From 03c57d73d33e1cece9163c81efa865837ed0163d Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sat, 17 Feb 2024 14:58:53 +0800 Subject: [PATCH] hosts/{bootstrap,graphical-installer}: refactor for nixos-generators --- configs/nixos/bootstrap/default.nix | 38 ++++++----- configs/nixos/graphical-installer/default.nix | 64 ++++++++++--------- 2 files changed, 57 insertions(+), 45 deletions(-) diff --git a/configs/nixos/bootstrap/default.nix b/configs/nixos/bootstrap/default.nix index dc695af5..d434c5d5 100644 --- a/configs/nixos/bootstrap/default.nix +++ b/configs/nixos/bootstrap/default.nix @@ -6,25 +6,31 @@ # # This means, there will be a "nixos" user among other things. { - isoImage = { - isoBaseName = config.networking.hostName; + config = lib.mkMerge [ + { + boot.kernelPackages = pkgs.linuxPackages_6_6; - # Store the source code in a easy-to-locate path. - contents = [{ - source = ../../..; - target = "/etc/nixos/"; - }]; + # Assume that this will be used for remote installations. + services.openssh = { + enable = true; + allowSFTP = true; + }; - squashfsCompression = "zstd -Xcompression-level 11"; - }; + system.stateVersion = "23.11"; + } - boot.kernelPackages = pkgs.linuxPackages_6_6; + (lib.mkIf config.formatAttr == "install-iso" { + isoImage = { + isoBaseName = config.networking.hostName; - # Assume that this will be used for remote installations. - services.openssh = { - enable = true; - allowSFTP = true; - }; + # Store the source code in a easy-to-locate path. + contents = [{ + source = ../../..; + target = "/etc/nixos/"; + }]; - system.stateVersion = "23.11"; + squashfsCompression = "zstd -Xcompression-level 11"; + }; + }) + ]; } diff --git a/configs/nixos/graphical-installer/default.nix b/configs/nixos/graphical-installer/default.nix index a1b49901..76088166 100644 --- a/configs/nixos/graphical-installer/default.nix +++ b/configs/nixos/graphical-installer/default.nix @@ -8,40 +8,46 @@ "${modulesPath}/installer/cd-dvd/installation-cd-graphical-base.nix" ]; - isoImage = { - isoBaseName = config.networking.hostName; + config = lib.mkMerge [ + { + boot.kernelPackages = pkgs.linuxPackages_6_6; - # Put the source code somewhere easy to see. - contents = [{ - source = ../../..; - target = "/etc/nixos"; - }]; + # Use my desktop environment configuration without the apps just to make the + # closure size smaller. + workflows.workflows.a-happy-gnome = { + enable = true; + extraApps = [ ]; + }; - squashfsCompression = "zstd -Xcompression-level 12"; - }; + # Some niceties. + suites.desktop.enable = true; - boot.kernelPackages = pkgs.linuxPackages_6_6; + services.xserver.displayManager = { + gdm = { + enable = true; + autoSuspend = false; + }; + autoLogin = { + enable = true; + user = "nixos"; + }; + }; - # Use my desktop environment configuration without the apps just to make the - # closure size smaller. - workflows.workflows.a-happy-gnome = { - enable = true; - extraApps = [ ]; - }; + system.stateVersion = "23.11"; + } - # Some niceties. - suites.desktop.enable = true; + (lib.mkIf (config.formatAttr == "install-iso") { + isoImage = { + isoBaseName = config.networking.hostName; - services.xserver.displayManager = { - gdm = { - enable = true; - autoSuspend = false; - }; - autoLogin = { - enable = true; - user = "nixos"; - }; - }; + # Put the source code somewhere easy to see. + contents = [{ + source = ../../..; + target = "/etc/nixos"; + }]; - system.stateVersion = "23.11"; + squashfsCompression = "zstd -Xcompression-level 12"; + }; + }) + ]; }