This commit is contained in:
zonsopkomst 2023-10-01 21:35:48 -05:00
parent 7f06a468e7
commit 8aa135e90b
5 changed files with 36 additions and 46 deletions

View File

@ -18,20 +18,29 @@ This is my NixOS setup to manage multiple computers with a home-manager config s
*Source: South Park*
1. NixOS Installation
1. Install NixOS on a computer. I use the default Gnome installer from https://nixos.org/download.html.
2. Create a `hosts` directory on git for the new machine and either use an existing `users` or create a new one.
1. Copy the `configuration.nix` and `hardware-configuration.nix` files from the `/etc/nixos` directory and move them to `hosts/PLACE(local OR remote)/NEW_PC_NAME`.
1. I have been renaming `configuration.nix` to `default.nix` and, under `flake.nix` located in the top directory, linking the appropriate modules I want to use on that computer.
2. home-manager
1. See https://github.com/nix-community/home-manager for manual and configuration options
1. Remember to add unstable channel (in this case) in the terminal:
2. sudo nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
3. sudo nix-channel --update
3. Declare desktop, kernals & RAM, modules, host & user specific items, and home-manager in `flake.nix` and check that the imports are correct
4. Declare packages either globally under `/hosts/<location>/hostname/packages.nix` or `/users/<username>/home-manager.nix`
5. Maintenance
1. Install NixOS on a computer using the default Gnome installer from https://nixos.org/download.html.
1. Clone this repository [zonsopkomst](https://git.disroot.org/zonsopkomst) in the `/home/<username>/ directory.
1. Update the subdirectories in `hosts` and `users`.
1. Copy the `configuration.nix` and `hardware-configuration.nix` files from the `/etc/nixos` directory and move them to `hosts/PLACE(local OR remote)/NEW_PC_NAME`.
1. Rename `configuration.nix` to `default.nix` and, update `flake.nix` located in the top directory, link the appropriate modules to be used.
1. Make sure the correct version of NixOS is listed in the appropriate files.
1. `flake.nix` is where `.nix` files are imported with further instructions on declared packages and modules.
1. Declare packages either globally under `/hosts/<location>/hostname/packages.nix` or `/users/<username>/home-manager.nix`.
1. Rebuild NixOS *(<hostname> must be include the first time rebuilding, after the first rebuild, .# can be used and the system will know which hostname is to be used)*
1. nix-channel --update
1. nixos-rebuild switch --flake .#<hostname>
1. Push the updated git files to the repository so that they can be pulled and the system rebuilt during the next update.
### Maintenance
1. See `/config/.bashrc` for `alias` using `nixos-rebuild --flake .#<hostname>` commands and other useful items
### Sources
[nix flakes]()
[home-manager](https://github.com/nix-community/home-manager)
1. Added as unstable channel
1. sudo nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
1. sudo nix-channel --update
## Structure
Directory | What is it for?
-----------------------|-------------------------------------------------------------
@ -54,4 +63,4 @@ tii | Dell Lattitude 5511 | Laptop | 16GB | Intel i5 Quad (i5-10400H) | Re
tuisto | AMD Ryzen 5 | Desktop | 16GB | AMD Ryzen 5 (Renoir) | Remote
sintanne | Intel i5 | Desktop | 16GB | Intel i5-11320H | Remote
TODO | AMD Ryzen 5 | Server | ??GB | AMD 2200G | Test Server
TODO | AMD Ryzen 5 | Server | ??GB | AMD 2200G | Main Server
TODO | AMD Ryzen 5 | Server | ??GB | AMD 2200G | Main Server

View File

@ -1,9 +1,6 @@
{ config, pkgs, ... }:
{
imports = [
];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
@ -17,21 +14,16 @@
# Enable grub cryptodisk
boot.loader.grub.enableCryptodisk=true;
boot.initrd.luks.devices."luks-1b17d35e-4c1d-4007-b3bd-461e2e3c45b8".keyFile = "/crypto_keyfile.bin";
boot.initrd.luks.devices."luks-fd9d48bb-c085-40a7-bbea-d2e099d67cd8".keyFile = "/crypto_keyfile.bin";
# Enable swap on luks
boot.initrd.luks.devices."luks-841a0a72-70fc-4ac9-9b04-2d97d536af9c".device = "/dev/disk/by-uuid/841a0a72-70fc-4ac9-9b04-2d97d536af9c";
boot.initrd.luks.devices."luks-841a0a72-70fc-4ac9-9b04-2d97d536af9c".keyFile = "/crypto_keyfile.bin";
# boot.initrd.luks.devices."luks-ff9e6bac-c23b-45eb-8429-c15271559dfa".keyFile = "/crypto_keyfile.bin";
# # Enable swap on luks
# boot.initrd.luks.devices."luks-bfce34cb-65e4-4ba0-939d-e3f0ff903338".device = "/dev/disk/by-uuid/bfce34cb-65e4-4ba0-939d-e3f0ff903338";
# boot.initrd.luks.devices."luks-bfce34cb-65e4-4ba0-939d-e3f0ff903338".keyFile = "/crypto_keyfile.bin";
networking.hostName = "frija";
boot.initrd.luks.devices."luks-8954ac79-16e8-4d4e-ae1c-3be9af26f4d0".device = "/dev/disk/by-uuid/8954ac79-16e8-4d4e-ae1c-3be9af26f4d0";
boot.initrd.luks.devices."luks-8954ac79-16e8-4d4e-ae1c-3be9af26f4d0".keyFile = "/crypto_keyfile.bin";
networking.hostName = "frija"; # Define your hostname.
users.users.aspire = {
isNormalUser = true;
description = "Aspire";
description = "aspire";
extraGroups = [ "docker" "networkmanager" "wheel" ];
packages = with pkgs; [
];
@ -45,6 +37,6 @@
systemd.services."getty@tty1".enable = false;
systemd.services."autovt@tty1".enable = false;
# DO NOT EDIT
system.stateVersion = "22.11";
system.stateVersion = "23.05"; # DO NOT EDIT
}

View File

@ -14,27 +14,16 @@
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/789a8d5e-909a-493b-a312-ac84adefbbfc";
{ device = "/dev/disk/by-uuid/a6edb4ae-e752-46ad-80b5-1b2d541cd6c0";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-1b17d35e-4c1d-4007-b3bd-461e2e3c45b8".device = "/dev/disk/by-uuid/1b17d35e-4c1d-4007-b3bd-461e2e3c45b8";
boot.initrd.luks.devices."luks-fd9d48bb-c085-40a7-bbea-d2e099d67cd8".device = "/dev/disk/by-uuid/fd9d48bb-c085-40a7-bbea-d2e099d67cd8";
swapDevices =
[ { device = "/dev/disk/by-uuid/81417e23-6b1b-4cb8-9b17-123bcc012b26"; }
[ { device = "/dev/disk/by-uuid/2fa829e9-c75f-4217-a42f-36ce134e9034"; }
];
# fileSystems."/" =
# { device = "/dev/disk/by-uuid/4a526b94-4676-44d0-b545-2c1a96d08450";
# fsType = "ext4";
# };
# boot.initrd.luks.devices."luks-ff9e6bac-c23b-45eb-8429-c15271559dfa".device = "/dev/disk/by-uuid/ff9e6bac-c23b-45eb-8429-c15271559dfa";
# swapDevices =
# [ { device = "/dev/disk/by-uuid/b0b3c4a1-5d5c-44e6-8eee-9e3693f25c90"; }
# ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction

View File

@ -14,7 +14,7 @@
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "22.11";
home.stateVersion = "23.05";
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;

View File

@ -17,6 +17,6 @@
../../common/vscodium.nix
];
home.stateVersion = "22.11";
home.stateVersion = "23.05";
};
}
}