From 45688ee74b5751d315da28f612f7c10c493915af Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Wed, 6 Sep 2023 00:14:34 -0500 Subject: [PATCH] Update --- nixos.nix | 2 +- nixos/rascal.nix | 1 - readme.md | 89 ++++++++++++++++++++++++++---------------------- 3 files changed, 50 insertions(+), 42 deletions(-) diff --git a/nixos.nix b/nixos.nix index c9d8a37..44daed6 100644 --- a/nixos.nix +++ b/nixos.nix @@ -35,5 +35,5 @@ in rascal = nixosSystem [ ./nixos/rascal.nix ]; musicbox = diskoNixosSystem self.diskoConfigurations.unencrypted [ "/dev/sda" ] [ ./nixos/musicbox.nix ]; thinker = diskoNixosSystem self.diskoConfigurations.standard [ "/dev/nvme0n1" ] [ ./nixos/thinker.nix ]; - dragon = diskoNixosSystem self.diskoConfigurations.standard [ "/dev/disk/by-uuid/asdf" ] [ ./machines/dragon.nix ]; + # dragon = diskoNixosSystem self.diskoConfigurations.standard [ "/dev/disk/by-uuid/asdf" ] [ ./nixos/dragon.nix ]; } diff --git a/nixos/rascal.nix b/nixos/rascal.nix index b373ca2..b6202ad 100644 --- a/nixos/rascal.nix +++ b/nixos/rascal.nix @@ -14,7 +14,6 @@ boot.loader.grub = { enable = true; - version = 2; device = "/dev/sda"; }; diff --git a/readme.md b/readme.md index 2810685..30f215e 100644 --- a/readme.md +++ b/readme.md @@ -1,46 +1,57 @@ -# zomg nixos +# Nix -TODO: overhaul this readme +The grand unification of configuration. + +## Not on NixOS? + +Install Nix using Determinate Systems's installer: ```bash -$ ssh -t beefcake 'cdd && pwd && g pl && cd os/linux/nix && sudo nixos-rebuild switch --flake .# && echo DONE' +curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install ``` -Or for pushing: +And [install Home Manager in standalone mode](https://nix-community.github.io/home-manager/index.html#sec-install-standalone): + +# NixOS ```bash -# do once to setup -$ ssh -t beefcake 'cdd && git config receive.denyCurrentBranch updateInstead' - -# probably regenerate and commit flake.lock from this directory -nix flake lock - -# push and rebuild+switch -$ git push beefcake:~/.config/lytedev-dotfiles -$ ssh -t beefcake 'cd ~/.config/lytedev-dotfiles/os/linux/nix && sudo nixos-rebuild switch --flake .# && echo DONE' +nixos-rebuild --flake git+https://git.lyte.dev/lytedev/nix switch ``` -# Install For Home Manager +## Remotely - +```bash +nixos-rebuild --flake git+https://git.lyte.dev/lytedev/nix#host \ + --target-host root@host --build-host root@host \ + switch +``` + +# Home Manager + +This can be used on non-NixOS hosts: ```bash home-manager switch --flake .#daniel ``` -# Install From NixOS Bootable Media +## Remotely + +```bash +ssh daniel@host 'home-manager switch --flake git+https://git.lyte.dev/lytedev/nix#daniel' +``` + +# Provisioning New NixOS Hosts Documented below is my process for standing up a new NixOS node configured and -managed by this flake. +managed by this flake from scratch. ## Network Access -Boot the ISO (via Ventoy USB drive) and establish network access: +Boot a NixOS ISO and establish network access: ```bash -# plug in ethernet or do the wpa_cli song and dance -# scan if needed -wpa_cli scan +# plug in ethernet or do the wpa_cli song and dance for wifi access +wpa_cli scan # if you need to wpa_cli scan_results wpa_cli add_network 0 @@ -50,38 +61,36 @@ wpa_cli enable_network 0 wpa_cli save_config ``` -Partition and mount disk(s) however you like. Preferably, though, use a disko -configuration from this flake like so: +Partition disk(s) and mount up however you like. Preferably, though, use a +[disko configuration](./disko.nix) from this flake like so: ```bash -sudo nix-shell --packages git --run " - nix run \ - --extra-experimental-features nix-command \ - --extra-experimental-features flakes \ - github:nix-community/disko -- \ - --flake 'git+https://git.lyte.dev/lytedev/nix#diskoConfigOfChoice' \ - --mode disko \ - --arg disks '[ \"/dev/your_disk\" ]' -" +# TODO: I'm relatively certain this can be simplified to a single `nix run` command +sudo nix-shell --packages git --run "nix run \ + --extra-experimental-features nix-command \ + --extra-experimental-features flakes \ + github:nix-community/disko -- \ + --flake 'git+https://git.lyte.dev/lytedev/nix#standard' \ + --mode disko \ + --arg disks '[ \"/dev/your_disk\" ]'" ``` And finally install NixOS as specified by this flake: ```bash nix-shell --packages git \ - --run " - sudo nixos-install \ - --flake 'git+https://git.lyte.dev/lytedev/nix#yourNixosConfig' - " + --run "sudo nixos-install \ + --flake 'git+https://git.lyte.dev/lytedev/nix#yourNixosConfig'" ``` **NOTE**: This takes a while, mostly due to building Helix myself on each box. I really need to figure out a good local caching setup. -# Ops stuff - -- **TODO**: Look into https://github.com/zhaofengli/colmena +**NOTE**: since the disko setup _should_ be included in the nixosConfiguration, +I would like to know how to do this all in one go -- maybe even building my own +live media? # Other To Dos -- **TODO**: check stuff during receive with a hook? +- Local Nix substitute/cache setup? +- Pre-commit checks with `nix flake check`?