From 83b8a9d7656cadadf138ef13bf376186d9613f85 Mon Sep 17 00:00:00 2001 From: cy Date: Thu, 23 Jan 2025 16:39:20 -0500 Subject: [PATCH 1/7] pancake: init --- .../workflows/build-machines-and-homes.yml | 1 + flake.lock | 16 +++++ flake.nix | 30 +++++--- hosts/pancake/default.nix | 69 +++++++++++++++++++ hosts/pancake/disk-config.nix | 33 +++++++++ 5 files changed, 141 insertions(+), 8 deletions(-) create mode 100644 hosts/pancake/default.nix create mode 100644 hosts/pancake/disk-config.nix diff --git a/.github/workflows/build-machines-and-homes.yml b/.github/workflows/build-machines-and-homes.yml index e276cbf..f34d785 100644 --- a/.github/workflows/build-machines-and-homes.yml +++ b/.github/workflows/build-machines-and-homes.yml @@ -11,6 +11,7 @@ jobs: - chunk - ytnix - titan + - pancake os: - ubuntu-latest runs-on: ${{ matrix.os }} diff --git a/flake.lock b/flake.lock index 0c81455..e71572c 100644 --- a/flake.lock +++ b/flake.lock @@ -899,6 +899,21 @@ "type": "github" } }, + "nixos-hardware": { + "locked": { + "lastModified": 1737590910, + "narHash": "sha256-qM/y6Dtpu9Wmf5HqeZajQdn+cS0aljdYQQQnrvx+LJE=", + "owner": "nixos", + "repo": "nixos-hardware", + "rev": "9368027715d8dde4b84c79c374948b5306fdd2db", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixos-hardware", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1726042813, @@ -1207,6 +1222,7 @@ "lix": "lix", "lix-module": "lix-module", "niri": "niri", + "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_5", "nixpkgs-garage": "nixpkgs-garage", "nixvim": "nixvim", diff --git a/flake.nix b/flake.nix index 77099f8..e76442f 100644 --- a/flake.nix +++ b/flake.nix @@ -68,6 +68,7 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-compat.follows = "flake-compat"; }; + nixos-hardware.url = "github:nixos/nixos-hardware"; nixpkgs-garage.url = "github:cything/nixpkgs/garage-module"; # unmerged PR @@ -145,9 +146,9 @@ flake = let - pkgs = import nixpkgs { + pkgsFor = system: import nixpkgs { config.allowUnfree = true; - system = "x86_64-linux"; + system = system; overlays = [ inputs.niri.overlays.niri inputs.rust-overlay.overlays.default @@ -164,7 +165,7 @@ specialArgs = { inherit inputs; }; modules = [ { - nixpkgs = { inherit pkgs; }; + nixpkgs.pkgs = pkgsFor "x86_64-linux"; } ./hosts/ytnix inputs.sops-nix.nixosModules.sops @@ -178,7 +179,7 @@ specialArgs = { inherit inputs; }; modules = [ { - nixpkgs = { inherit pkgs; }; + nixpkgs.pkgs = pkgsFor "x86_64-linux"; disabledModules = [ "services/web-servers/garage.nix" ]; @@ -194,7 +195,7 @@ specialArgs = { inherit inputs; }; modules = [ { - nixpkgs = { inherit pkgs; }; + nixpkgs.pkgs = pkgsFor "x86_64-linux"; } ./hosts/titan disko.nixosModules.disko @@ -202,6 +203,19 @@ ./modules ]; }; + + pancake = lib.nixosSystem { + specialArgs = { inherit inputs; }; + modules = [ + { + nixpkgs.pkgs = pkgsFor "aarch64-linux"; + } + disko.nixosModules.disko + inputs.nixos-hardware.nixosModules.raspberry-pi-3 + ./hosts/pancake + ./modules + ]; + }; }; homeConfigurations = let @@ -209,7 +223,7 @@ in { "yt@ytnix" = lib.homeManagerConfiguration { - inherit pkgs; + pkgs = pkgsFor "x86_64-linux"; extraSpecialArgs = { inherit inputs; }; modules = [ ./home/yt/ytnix.nix @@ -219,7 +233,7 @@ }; "yt@chunk" = lib.homeManagerConfiguration { - inherit pkgs; + pkgs = pkgsFor "x86_64-linux"; extraSpecialArgs = { inherit inputs; }; modules = [ ./home/yt/chunk.nix @@ -228,7 +242,7 @@ }; "codespace@codespace" = lib.homeManagerConfiguration { - inherit pkgs; + pkgs = pkgsFor "x86_64-linux"; extraSpecialArgs = { inherit inputs; }; modules = [ ./home/yt/codespace.nix diff --git a/hosts/pancake/default.nix b/hosts/pancake/default.nix new file mode 100644 index 0000000..9fd7f4f --- /dev/null +++ b/hosts/pancake/default.nix @@ -0,0 +1,69 @@ +{ + modulesPath, + pkgs, + ... +}: +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + (modulesPath + "/profiles/qemu-guest.nix") + ../common.nix + ./disk-config.nix + ./hardware-configuration.nix + ]; + + services.openssh = { + enable = true; + settings.PasswordAuthentication = false; + }; + + users.users.root.openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPdhAQYy0+vS+QmyCd0MAbqbgzyMGcsuuFyf6kg2yKge yt@ytlinux" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINyn2+OoRN4nExti+vFQ1NHEZip0slAoCH9C5/FzvgZD yt@ytnix" + ]; + + system.stateVersion = "24.05"; + + environment.systemPackages = with pkgs; [ + curl + git + ]; + + # network stuff + networking.hostName = "pancake"; + networking.networkmanager.enable = true; + networking.firewall = { + enable = true; + allowedTCPPorts = [ + 22 + 80 + 443 + ]; + allowedUDPPorts = [ + 443 + ]; + }; + + networkings.wireless.enable = true; + networkings.wireless.networks = { + "36 Halsey" = { + psk = "Canada2022"; + }; + "cy" = { + psk = "12345678"; + }; + }; + + hardware.enableRedistributableFirmware = true; + + services.desktopManager.plasma6.enable = true; + services.displayManager = { + enable = true; + autoLogin.user = "yt"; + }; + users.users.yt.extraGroups = [ + "wheel" + ]; + security.sudo.enable = true; + security.sudo.wheelNeedsPassword = false; +} diff --git a/hosts/pancake/disk-config.nix b/hosts/pancake/disk-config.nix new file mode 100644 index 0000000..1d3855b --- /dev/null +++ b/hosts/pancake/disk-config.nix @@ -0,0 +1,33 @@ +{ + disko.devices = { + disk = { + main = { + device = "/dev/mmcblk0"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + type = "EF00"; + size = "500M"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; +} From d866d9c0e345a147fe55f661bcf72e9c6fd059f5 Mon Sep 17 00:00:00 2001 From: cy Date: Thu, 23 Jan 2025 17:27:12 -0500 Subject: [PATCH 2/7] add hardware-config for pancake --- hosts/pancake/hardware-configuration.nix | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 hosts/pancake/hardware-configuration.nix diff --git a/hosts/pancake/hardware-configuration.nix b/hosts/pancake/hardware-configuration.nix new file mode 100644 index 0000000..e4ee4f4 --- /dev/null +++ b/hosts/pancake/hardware-configuration.nix @@ -0,0 +1,38 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/cb6f0e18-5add-4177-ab98-e9f0235e06b3"; + fsType = "ext4"; + }; + + fileSystems."/boot/firmware" = + { device = "/dev/disk/by-uuid/D3E6-3F09"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [ ]; + + # 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 + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.eth0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; +} From f3b7da291897e2c8c90beb0d9ab9f40a7aaf6c25 Mon Sep 17 00:00:00 2001 From: cy Date: Thu, 23 Jan 2025 17:50:38 -0500 Subject: [PATCH 3/7] fix typo and bootloader path --- hosts/pancake/default.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hosts/pancake/default.nix b/hosts/pancake/default.nix index 9fd7f4f..ae3145e 100644 --- a/hosts/pancake/default.nix +++ b/hosts/pancake/default.nix @@ -44,8 +44,8 @@ ]; }; - networkings.wireless.enable = true; - networkings.wireless.networks = { + networking.wireless.enable = true; + networking.wireless.networks = { "36 Halsey" = { psk = "Canada2022"; }; @@ -66,4 +66,10 @@ ]; security.sudo.enable = true; security.sudo.wheelNeedsPassword = false; + users.users.root.initialHashedPassword = ""; + users.users.yt.initialHashedPassword = ""; + + boot.loader.generic-extlinux-compatible.mirroredBoots = [ + { path = "/boot/firmware"; } + ]; } From b5796b3c2383b55dae18786e319b5c53ce5e5e53 Mon Sep 17 00:00:00 2001 From: cy Date: Thu, 23 Jan 2025 18:06:38 -0500 Subject: [PATCH 4/7] try to fix everything --- flake.nix | 1 - hosts/common.nix | 2 -- hosts/pancake/default.nix | 3 +-- hosts/pancake/disk-config.nix | 33 --------------------------------- 4 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 hosts/pancake/disk-config.nix diff --git a/flake.nix b/flake.nix index e76442f..d36eb5c 100644 --- a/flake.nix +++ b/flake.nix @@ -210,7 +210,6 @@ { nixpkgs.pkgs = pkgsFor "aarch64-linux"; } - disko.nixosModules.disko inputs.nixos-hardware.nixosModules.raspberry-pi-3 ./hosts/pancake ./modules diff --git a/hosts/common.nix b/hosts/common.nix index 2e8b31a..5303739 100644 --- a/hosts/common.nix +++ b/hosts/common.nix @@ -9,8 +9,6 @@ "root" "@wheel" ]; - trusted-public-keys = [ "central:uWhjva6m6dhC2hqNisjn2hXGvdGBs19vPkA1dPEuwFg=" ]; - substituters = [ "https://cache.cything.io/central" ]; }; channel.enable = false; optimise = { diff --git a/hosts/pancake/default.nix b/hosts/pancake/default.nix index ae3145e..628d171 100644 --- a/hosts/pancake/default.nix +++ b/hosts/pancake/default.nix @@ -8,8 +8,8 @@ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/profiles/qemu-guest.nix") ../common.nix - ./disk-config.nix ./hardware-configuration.nix + ../zsh.nix ]; services.openssh = { @@ -31,7 +31,6 @@ # network stuff networking.hostName = "pancake"; - networking.networkmanager.enable = true; networking.firewall = { enable = true; allowedTCPPorts = [ diff --git a/hosts/pancake/disk-config.nix b/hosts/pancake/disk-config.nix deleted file mode 100644 index 1d3855b..0000000 --- a/hosts/pancake/disk-config.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - disko.devices = { - disk = { - main = { - device = "/dev/mmcblk0"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - ESP = { - type = "EF00"; - size = "500M"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; - }; - }; - root = { - size = "100%"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - }; - }; - }; - }; - }; - }; - }; -} From af950da1f59b227f045c7387064133ae15ca981f Mon Sep 17 00:00:00 2001 From: cy Date: Thu, 23 Jan 2025 18:07:38 -0500 Subject: [PATCH 5/7] also build machines on arm cuz we have pi now --- .github/workflows/build-machines-and-homes.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-machines-and-homes.yml b/.github/workflows/build-machines-and-homes.yml index f34d785..768a3c5 100644 --- a/.github/workflows/build-machines-and-homes.yml +++ b/.github/workflows/build-machines-and-homes.yml @@ -14,6 +14,7 @@ jobs: - pancake os: - ubuntu-latest + - ubuntu-24.04-arm runs-on: ${{ matrix.os }} continue-on-error: true steps: From 00e6f6267b7de4b1051d73e660145ac1db853264 Mon Sep 17 00:00:00 2001 From: cy Date: Thu, 23 Jan 2025 18:30:37 -0500 Subject: [PATCH 6/7] apply rpi config error fix --- flake.lock | 17 +++++++++++++++++ flake.nix | 1 + hosts/pancake/default.nix | 5 +++++ 3 files changed, 23 insertions(+) diff --git a/flake.lock b/flake.lock index e71572c..2acaba0 100644 --- a/flake.lock +++ b/flake.lock @@ -962,6 +962,22 @@ "type": "github" } }, + "nixpkgs-rpi": { + "locked": { + "lastModified": 1737645144, + "narHash": "sha256-QPTPf1ccrGTIgKA+/a3MIqrKiUbxhUSRUCQll86kUl8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d4e529a24b66b0341f2b866c5abe3ad8a96be2d7", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d4e529a24b66b0341f2b866c5abe3ad8a96be2d7", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1724316499, @@ -1225,6 +1241,7 @@ "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_5", "nixpkgs-garage": "nixpkgs-garage", + "nixpkgs-rpi": "nixpkgs-rpi", "nixvim": "nixvim", "nvim-github-theme": "nvim-github-theme", "rust-overlay": "rust-overlay", diff --git a/flake.nix b/flake.nix index d36eb5c..920750a 100644 --- a/flake.nix +++ b/flake.nix @@ -69,6 +69,7 @@ inputs.flake-compat.follows = "flake-compat"; }; nixos-hardware.url = "github:nixos/nixos-hardware"; + nixpkgs-rpi.url = "github:nixos/nixpkgs/d4e529a24b66b0341f2b866c5abe3ad8a96be2d7"; nixpkgs-garage.url = "github:cything/nixpkgs/garage-module"; # unmerged PR diff --git a/hosts/pancake/default.nix b/hosts/pancake/default.nix index 628d171..221b3dc 100644 --- a/hosts/pancake/default.nix +++ b/hosts/pancake/default.nix @@ -1,6 +1,8 @@ { modulesPath, pkgs, + lib, + inputs, ... }: { @@ -71,4 +73,7 @@ boot.loader.generic-extlinux-compatible.mirroredBoots = [ { path = "/boot/firmware"; } ]; + + # remove this after https://github.com/NixOS/nixpkgs/pull/375165 lands on unstable + boot.kernelPackages = lib.mkForce inputs.nixpkgs-rpi.legacyPackages.aarch64-linux.linuxKernel.packages.linux_rpi3; } From 389df0cb5cf77a3591ccdec029e5a23e3b599f34 Mon Sep 17 00:00:00 2001 From: cy Date: Fri, 24 Jan 2025 03:20:56 -0500 Subject: [PATCH 7/7] generate and upload sd image --- .../workflows/build-machines-and-homes.yml | 17 ++++-- flake.lock | 61 +++++++++++++++++-- flake.nix | 4 +- hosts/pancake/default.nix | 13 +--- 4 files changed, 73 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build-machines-and-homes.yml b/.github/workflows/build-machines-and-homes.yml index 768a3c5..89e36da 100644 --- a/.github/workflows/build-machines-and-homes.yml +++ b/.github/workflows/build-machines-and-homes.yml @@ -8,12 +8,12 @@ jobs: strategy: matrix: machine: - - chunk - - ytnix - - titan + # - chunk + # - ytnix + # - titan - pancake os: - - ubuntu-latest + # - ubuntu-latest - ubuntu-24.04-arm runs-on: ${{ matrix.os }} continue-on-error: true @@ -67,7 +67,14 @@ jobs: purge-primary-key: never # always save the cache save-always: true - - run: nix build -L .#nixosConfigurations.${{ matrix.machine }}.config.system.build.toplevel + # - run: nix build -L .#nixosConfigurations.${{ matrix.machine }}.config.system.build.toplevel + # - run: nix run -L github:nix-community/nixos-generators -- --flake .#pancake -f sd-aarch64 --system aarch64-linux + - run: nix build -L .#nixosConfigurations.pancake.config.formats.sd-aarch64 + - name: upload artifacts + uses: actions/upload-artifact@v4 + with: + name: image + path: result/ build-homes: strategy: matrix: diff --git a/flake.lock b/flake.lock index 2acaba0..bba3cfd 100644 --- a/flake.lock +++ b/flake.lock @@ -899,6 +899,40 @@ "type": "github" } }, + "nixlib": { + "locked": { + "lastModified": 1736643958, + "narHash": "sha256-tmpqTSWVRJVhpvfSN9KXBvKEXplrwKnSZNAoNPf/S/s=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "1418bc28a52126761c02dd3d89b2d8ca0f521181", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixos-generators": { + "inputs": { + "nixlib": "nixlib", + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1737057290, + "narHash": "sha256-3Pe0yKlCc7EOeq1X/aJVDH0CtNL+tIBm49vpepwL1MQ=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "d002ce9b6e7eb467cd1c6bb9aef9c35d191b5453", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1737590910, @@ -1076,16 +1110,32 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1737642748, - "narHash": "sha256-VsCzuoavNERLs46aw38nmORT4F5pLOZDDe2bzFo+jsE=", + "lastModified": 1736657626, + "narHash": "sha256-FWlPMUzp0lkQBdhKlPqtQdqmp+/C+1MBiEytaYfrCTY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2f9e2f85cb14a46410a1399aa9ea7ecf433e422e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1737569578, + "narHash": "sha256-6qY0pk2QmUtBT9Mywdvif0i/CLVgpCjMUn6g9vB+f3M=", "owner": "nixos", "repo": "nixpkgs", - "rev": "864f89f98b0b4e1bbcb762b025fd83da8bc1bae0", + "rev": "47addd76727f42d351590c905d9d1905ca895b82", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-unstable-small", + "ref": "nixos-24.11", "repo": "nixpkgs", "type": "github" } @@ -1238,8 +1288,9 @@ "lix": "lix", "lix-module": "lix-module", "niri": "niri", + "nixos-generators": "nixos-generators", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_6", "nixpkgs-garage": "nixpkgs-garage", "nixpkgs-rpi": "nixpkgs-rpi", "nixvim": "nixvim", diff --git a/flake.nix b/flake.nix index 920750a..920cc27 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "cy's flake"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -70,6 +70,7 @@ }; nixos-hardware.url = "github:nixos/nixos-hardware"; nixpkgs-rpi.url = "github:nixos/nixpkgs/d4e529a24b66b0341f2b866c5abe3ad8a96be2d7"; + nixos-generators.url = "github:nix-community/nixos-generators"; nixpkgs-garage.url = "github:cything/nixpkgs/garage-module"; # unmerged PR @@ -212,6 +213,7 @@ nixpkgs.pkgs = pkgsFor "aarch64-linux"; } inputs.nixos-hardware.nixosModules.raspberry-pi-3 + inputs.nixos-generators.nixosModules.all-formats ./hosts/pancake ./modules ]; diff --git a/hosts/pancake/default.nix b/hosts/pancake/default.nix index 221b3dc..561d7f0 100644 --- a/hosts/pancake/default.nix +++ b/hosts/pancake/default.nix @@ -10,7 +10,7 @@ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/profiles/qemu-guest.nix") ../common.nix - ./hardware-configuration.nix + # ./hardware-configuration.nix ../zsh.nix ]; @@ -57,11 +57,6 @@ hardware.enableRedistributableFirmware = true; - services.desktopManager.plasma6.enable = true; - services.displayManager = { - enable = true; - autoLogin.user = "yt"; - }; users.users.yt.extraGroups = [ "wheel" ]; @@ -70,10 +65,6 @@ users.users.root.initialHashedPassword = ""; users.users.yt.initialHashedPassword = ""; - boot.loader.generic-extlinux-compatible.mirroredBoots = [ - { path = "/boot/firmware"; } - ]; - # remove this after https://github.com/NixOS/nixpkgs/pull/375165 lands on unstable - boot.kernelPackages = lib.mkForce inputs.nixpkgs-rpi.legacyPackages.aarch64-linux.linuxKernel.packages.linux_rpi3; + # boot.kernelPackages = lib.mkForce inputs.nixpkgs-rpi.legacyPackages.aarch64-linux.linuxKernel.packages.linux_rpi3; }