From 74545072ddd81c4a0309d7f47fc31163e4d98e47 Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Joshua Bell)" Date: Thu, 25 Apr 2024 00:48:10 -0500 Subject: [PATCH] wip new config structure and onboarding process --- hosts/_common/configuration.nix | 3 ++- readme.md | 46 ++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/hosts/_common/configuration.nix b/hosts/_common/configuration.nix index 0eee4f3..ae1365d 100644 --- a/hosts/_common/configuration.nix +++ b/hosts/_common/configuration.nix @@ -28,7 +28,8 @@ in enable = true; clean.enable = true; clean.extraArgs = "--keep 3"; - flake = "/etc/nixos"; + # TODO this may need to be defined higher up if it is ever different for a machine... + flake = "/home/${settings.user.username}/.config/nixos-config"; }; # Select internationalization properties. diff --git a/readme.md b/readme.md index 339b817..601c388 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,44 @@ +## TODO working on changes to this now + +# First Install on new Machine + +## NixOS +export HOSTNAME=desired_hostname_for_this_machine (___) +export USERNAME=desired_username_for_admin_on_this_machine (josh) +- Follow nixos installation guide: https://nixos.wiki/wiki/NixOS_Installation_Guide + - Follow until the config is generated +- in hardware-configuration change to use by-labels +```sh +# TODO command to do this in one line +``` +- in configuration.nix + - set networking.hostname to HOSTNAME + - enable networkmanager + - uncomment systemPackages and add: `git` `curl` + - add `nix.settings.experimental-features = [ "nix-command" "flakes" ];` + - add `users.users.USERNAME = { ... todo, just enough to get to git clone the real nixos config into its home .config folder } + - TODO add whatever is needed for default pubkeys for onboarding later +- Install nixos: `cd /mnt` `sudo nixos-install` + - `passwd` to change root password (if not already prompted to do so) +- `reboot` +- login to USERNAME and git clone nixos-config `git clone __ ~/.config/nixos-config` +- TODO ONBOARD NEW MACHINE CONFIGS, secrets, etc + - use hostname to make new folders in the repo, copy hardware config, and create config from template. Update flake.nix with top level info needed for this system with ARCH detected. + - Copy public keys into secrets.nix file + - push changes + - rekey system with another onboarded device... (make this offlinable?), push there, pull here +- `sudo nixos-rebuild switch --flake ~/.config/nixos-config` +- reboot? done + + + +## Darwin +- TODO + +### +### + + # First Install on new Machine - First follow nixos installation guide: https://nixos.wiki/wiki/NixOS_Installation_Guide @@ -15,9 +56,6 @@ -- TODO come up with a way to pregen keys so onboarding is less stupid with secrets? -- add home home-manager - - `sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager` - - `sudo nix-channel --update` - `cp -r /etc/nixos ~/nixos_bak` Backup configuration - Checkout this repo into /etc/nixos: `rm -rf /etc/nixos` `git clone https://github.com/ringofstorms/dotfiles /etc/nixos` - Copy the backup into the new /etc/nixos/hosts/HOSTNAME dir `mkdir /etc/nixos/hosts/HOSTNAME && cp -r ~/nixos_bak/* /etx/nixos/hosts/HOSTNAME` @@ -42,6 +80,8 @@ # Cleanup boot +> TODO remove, no longer needed `nh` handles this + I used the existing windows 100MB boot partition and it fills up constantly. Have to purge old stuff a lot this is how: - `find '/boot/loader/entries' -type f ! -name 'windows.conf' | head -n -4 | xargs -I {} rm {}; nix-collect-garbage -d; nixos-rebuild boot; echo; df`