From e9ceb852f99103f84ae8bf279b6ce58d09224119 Mon Sep 17 00:00:00 2001 From: uku Date: Mon, 13 Nov 2023 02:08:39 +0100 Subject: [PATCH] refactor flake, part 2 now using a homemade `mkSystem` function to make systems more identical thanks to leah for telling me about genAttrs note to future self: this is the commit where everything started going to shit. this is the moment in time where i decided nix was perfection. this is the precise timestamp in which i found out that there's no coming back from nix. i bid you farewell, old uku. --- flake.nix | 29 +++++++++++++++++------------ fuji/default.nix | 9 +-------- kilimandjaro/default.nix | 7 ------- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/flake.nix b/flake.nix index 005f9f8..5665fce 100644 --- a/flake.nix +++ b/flake.nix @@ -37,19 +37,24 @@ lanzaboote, ... } @ inputs: let - modules' = [ragenix.nixosModules.default lanzaboote.nixosModules.lanzaboote]; - in { - nixosConfigurations.fuji = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [./fuji] ++ modules'; - specialArgs = inputs; - }; + mkSystem = name: + nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./common.nix - nixosConfigurations.kilimandjaro = inputs.nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [./kilimandjaro] ++ modules'; - specialArgs = inputs; - }; + ./${name} + ./${name}/hardware-configuration.nix + + {networking.hostName = name;} + + ragenix.nixosModules.default + lanzaboote.nixosModules.lanzaboote + ]; + specialArgs = inputs; + }; + in { + nixosConfigurations = nixpkgs.lib.genAttrs ["fuji" "kilimandjaro"] mkSystem; formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; }; diff --git a/fuji/default.nix b/fuji/default.nix index 32f4e45..7288856 100644 --- a/fuji/default.nix +++ b/fuji/default.nix @@ -1,11 +1,4 @@ -{...}: { - imports = [ - ../common.nix - ./hardware-configuration.nix - ]; - - networking.hostName = "fuji"; - +_: { services.xserver.videoDrivers = ["amdgpu"]; # services.xserver.videoDrivers = ["nvidia"]; diff --git a/kilimandjaro/default.nix b/kilimandjaro/default.nix index 12b7e2d..57e8e5e 100644 --- a/kilimandjaro/default.nix +++ b/kilimandjaro/default.nix @@ -1,11 +1,4 @@ {pkgs, ...}: { - imports = [ - ../common.nix - ./hardware-configuration.nix - ]; - - networking.hostName = "kilimandjaro"; - hardware.bluetooth.enable = true; services.blueman.enable = true;