From c3eab3b1ae758e9bb1d685f841cace4c8e8b20ff Mon Sep 17 00:00:00 2001 From: imterah Date: Mon, 5 May 2025 14:07:27 -0400 Subject: [PATCH] chore: Prepare for first install attempt --- SETUP.md | 38 ++++++++++++++++++++ flake.nix | 41 +++++++++------------- hosts/andromeda/configuration.nix | 3 -- hosts/andromeda/hardware-configuration.nix | 2 -- system/nix.nix | 6 +--- 5 files changed, 55 insertions(+), 35 deletions(-) create mode 100644 SETUP.md diff --git a/SETUP.md b/SETUP.md new file mode 100644 index 0000000..64c8ed6 --- /dev/null +++ b/SETUP.md @@ -0,0 +1,38 @@ +# Bootstrapping a New Device + +This guide assumes you have a somewhat sane sops setup. + +1. First, boot the NixOS live environment (minimal ISO is recommended). +2. Then, get the harddrive ID using `lsblk` or `fdisk -l`: + + ```bash + sudo fdisk -l + ls -lah /dev/disk/by-id | grep -i + ``` + +Example output: + + ```bash + [nix-shell:~]$ sudo fdisk -l + Disk /dev/loop0: 1.14 GiB, 1221455872 bytes, 2385656 sectors + Units: sectors of 1 * 512 = 512 bytes + Sector size (logical/physical): 512 bytes / 512 bytes + I/O size (minimum/optimal): 512 bytes / 512 bytes + + + Disk /dev/sda: 256 GiB, 274877906944 bytes, 536870912 sectors + Disk model: QEMU HARDDISK + Units: sectors of 1 * 512 = 512 bytes + Sector size (logical/physical): 512 bytes / 512 bytes + I/O size (minimum/optimal): 512 bytes / 512 bytes + + [nix-shell:~]$ ls -lah /dev/disk/by-id | grep -i sda + lrwxrwxrwx 1 root root 9 May 5 13:20 scsi-0QEMU_QEMU_HARDDISK_drive-scsi0 -> ../../sda + + [nix-shell:~]$ # disk path: /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0 + ``` + +3. Manually create a host configuration by modifying/duplicating `hosts/` to `hosts/`. Be sure to modify the hostname in `hosts//configuration.nix`. +4. Add the host to `flake.nix`. +5. Modify the disko configuration for our host to use the correct disk ID that we found earlier. +6. Make any other additional modifications if needed. diff --git a/flake.nix b/flake.nix index 8f5d282..c08d8ad 100755 --- a/flake.nix +++ b/flake.nix @@ -5,13 +5,11 @@ flake-utils.url = "github:gytis-ivaskevicius/flake-utils-plus"; disko = { url = "github:nix-community/disko"; - inputs.nixpkgs.follows = "nixpkgs-unstable"; }; sops-nix.url = "github:Mic92/sops-nix"; impermanence.url = "github:nix-community/impermanence"; nh = { url = "github:viperML/nh"; - inputs.nixpkgs.follows = "nixpkgs-unstable"; }; nix-secrets = { url = "git+https://git.terah.dev/imterah/sops?shallow=1&ref=main"; @@ -28,30 +26,23 @@ mkApp = flake-utils.lib.mkApp; mkFlake = flake-utils.lib.mkFlake; in mkFlake { - inherit self inputs nixpkgs; - overlays = import ./overlays.nix {inherit inputs;}; + inherit self inputs nixpkgs; - sharedOverlays = [ - self.overlays.additions - self.overlays.modifications - self.overlays.unstable-packages + hostDefaults.extraArgs = {inherit flake-utils;}; + hostDefaults.specialArgs = { + inherit inputs; + inherit (self) outputs; + }; + + # Main Docker-based host + hosts.andromeda = { + system = "x86_64-linux"; + modules = [ + inputs.disko.nixosModules.default + (import ./hosts/andromeda/disko.nix {device = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0";}) + inputs.impermanence.nixosModules.impermanence + ./hosts/andromeda/configuration.nix ]; - - hostDefaults.extraArgs = {inherit flake-utils;}; - hostDefaults.specialArgs = { - inherit inputs; - inherit (self) outputs; - }; - - # Main Docker-based host - hosts.andromeda = { - system = "x86_64-linux"; - modules = [ - inputs.disko.nixosModules.default - (import ./hosts/andromeda/disko.nix {device = "/dev/disk/by-id/nvme-Samsung_SSD_979_PRO_with_Heatsink_1TB_S6WSNJ0T900943T";}) - inputs.impermanence.nixosModules.impermanence - ./hosts/andromeda/configuration.nix - ]; - }; + }; }; } diff --git a/hosts/andromeda/configuration.nix b/hosts/andromeda/configuration.nix index 4dd31db..5114c4f 100755 --- a/hosts/andromeda/configuration.nix +++ b/hosts/andromeda/configuration.nix @@ -30,10 +30,7 @@ extraGroups = [ "wheel" "networkmanager" - "audio" "docker" - "input" - "plugdev" ]; openssh.authorizedKeys.keys = [ diff --git a/hosts/andromeda/hardware-configuration.nix b/hosts/andromeda/hardware-configuration.nix index e91f94a..6e470e7 100755 --- a/hosts/andromeda/hardware-configuration.nix +++ b/hosts/andromeda/hardware-configuration.nix @@ -21,8 +21,6 @@ # still possible to use this option, but it's recommended to use it in conjunction # with explicit per-interface declarations with `networking.interfaces..useDHCP`. networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp193s0f3u2u3.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; diff --git a/system/nix.nix b/system/nix.nix index 47f2999..fa21c26 100755 --- a/system/nix.nix +++ b/system/nix.nix @@ -10,11 +10,7 @@ allowUnfreePredicate = _: true; cudaSupport = true; }; - nixpkgs.overlays = [ - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.unstable-packages - ]; + nix = let flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; in {