add install guide

This commit is contained in:
zackartz 2024-04-27 22:59:12 -04:00
parent 2e9f75908c
commit 824b53086f
No known key found for this signature in database
GPG key ID: 5B53E53A9A514DBA
4 changed files with 171 additions and 2 deletions

132
README.md
View file

@ -30,3 +30,135 @@ With git installed, clone the repository with
```bash
git clone https://github.com/zackartz/nixos-dots.git && cd nixos-dots
```
### 2. Configuring the System
Generate your `hardware-configuration.nix` file.
```bash
sudo nixos-generate-config --root /mnt
```
You will now have two files in `/mnt/etc/nixos`. We will need `hardware-configuration.nix` and part of `configuration.nix`.
```bash
[nixos@live:~/nixos-dots]$ ls /mnt/etc/nixos/
configuration.nix hardware-configuration.nix
```
Go ahead and make a new folder for your pc inside of the `hosts` directory.
```bash
cd hosts && mkdir vm # change "vm" to your preferred hostname -- it MUST match the hostname you plan on using for scripts to work properly.
```
> [!TIP]
> You can use the "m" alias to create directories once you have booted into the installed system!
Now, copy the files over from `/mnt/etc/nixos/`.
```bash
cd vm && cp /mnt/etc/nixos/* . # remember to change "vm" to your hostname
mv configuration.nix config.old.nix # we will be writing our own configuration.nix
```
Now, make a new file: `configuration.nix`.
```bash
touch configuration.nix
```
Open up `configuration.nix` in your favorite editor and paste the following:
```nix
{
pkgs,
inputs,
...
}: {
imports = [
../common/default.nix
./hardware-configuration.nix
];
networking.hostName = "vm"; # Define your hostname.
programs.zsh.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.zack = {
isNormalUser = true;
description = "zack";
extraGroups = ["networkmanager" "wheel"];
shell = pkgs.zsh;
};
home-manager = {
extraSpecialArgs = {inherit inputs;};
users = {
"zack" = {
imports = [../../modules/home-manager/default.nix];
_module.args.theme = import ../../core/theme.nix;
home.username = "zack";
home.homeDirectory = "/home/zack";
};
};
};
}
```
Change the instances of `zack` to your desired username, and customize as you see fit!
We will need to copy some things over from `configuration.nix`, namely boot related options. I am doing this in a VM, so I see these boot related options. Find the `boot.loader` option, and copy it over from your old file into this new one.
```nix
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
# boot.loader.grub.efiSupport = true;
# boot.loader.grub.efiInstallAsRemovable = true;
# boot.loader.efi.efiSysMountPoint = "/boot/efi";
# Define on which hard drive you want to install Grub.
boot.loader.grub.device = "/dev/vda"; # the device to change
```
Make sure the device targets the correct drive for your EFI to be installed on.
Finally, add the following to `flake.nix` (somewhere around line 100).
```nix
nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;};
modules = [
./hosts/vm/configuration.nix
inputs.home-manager.nixosModules.default
];
};
```
### 3. Installing the system
Now that you have the config ready to go, run the following command.
```bash
rm -rf .git # remove the github repository
sudo nixos-install --flake ~/nixos-dots#vm # again, remember to change vm to be your hostname
```
### 4. Post-Install configuration.
Set a password for your user:
```bash
sudo passwd zack # replace with your username
```
Copy the flake to your home folder
```bash
cp -r ~/nixos-dots /mnt/home/zack/nixos # replace "zack" with your username
```
Reboot the system and you're done! Enjoy the system!
> [!TIP]
> Check ./modules/shell/zsh/aliases.nix for useful aliases, like "r" to rebuild your system!

View file

@ -123,8 +123,6 @@
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
programs.zsh.enable = true;
users.groups.plugdev = {};
# Allow unfree packages

View file

@ -131,6 +131,7 @@
# };
# };
programs.zsh.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.zack = {
isNormalUser = true;

View file

@ -0,0 +1,38 @@
{
pkgs,
inputs,
...
}: {
imports = [
../common/default.nix
];
programs.zsh.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.zack = {
isNormalUser = true;
description = "zack";
extraGroups = ["networkmanager" "wheel" "docker" "libvirtd" "plugdev"];
shell = pkgs.zsh;
packages = with pkgs; [
firefox
kate
rio
telegram-desktop
kitty
];
};
home-manager = {
extraSpecialArgs = {inherit inputs;};
users = {
"zack" = {
imports = [../../modules/home-manager/zack.nix];
_module.args.theme = import ../../core/theme.nix;
home.username = "zack";
home.homeDirectory = "/home/zack";
};
};
};
}