From 2fdf57226a90416083ec16186341cf2189efbcba Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Sat, 3 Dec 2022 17:54:05 -0500 Subject: [PATCH] Make modules list explit in one place --- flake.nix | 25 ++++++++++++++++--------- nix-darwin/default.nix | 6 ++---- nixos/default.nix | 6 ++---- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/flake.nix b/flake.nix index 9382d88..68b70e3 100644 --- a/flake.nix +++ b/flake.nix @@ -53,24 +53,31 @@ }; }; }; + flake = { # Configurations for Linux (NixOS) systems nixosConfigurations = { # My Linux development computer (on Hetzner) - pinch = self.lib.mkLinuxSystem [ - ./systems/hetzner/ax41.nix - ./nixos/server/harden.nix - # I share my Hetzner server with other people who need it. - self.nixosModules.guests - ]; + pinch = self.lib.mkLinuxSystem { + imports = [ + self.nixosModules.default # Defined in nixos/default.nix + ./systems/hetzner/ax41.nix + ./nixos/server/harden.nix + # I share my Hetzner server with other people who need it. + self.nixosModules.guests + ]; + }; }; # Configurations for my only[^1] macOS machine (using nix-darwin) # # [^1]: This is why attr key is 'default'. darwinConfigurations = { - default = self.lib-darwin.mkMacosSystem [ - ./systems/darwin.nix - ]; + default = self.lib-darwin.mkMacosSystem { + imports = [ + self.darwinModules.default # Defined in nix-darwin/default.nix + ./systems/darwin.nix + ]; + }; }; }; diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix index 9077145..df7be80 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -18,16 +18,14 @@ ../nixos/caches ]; }; - lib-darwin.mkMacosSystem = extraModules: inputs.darwin.lib.darwinSystem rec { + lib-darwin.mkMacosSystem = mod: inputs.darwin.lib.darwinSystem rec { system = "aarch64-darwin"; specialArgs = { inherit inputs system; flake = { inherit config; }; rosettaPkgs = import inputs.nixpkgs { system = "x86_64-darwin"; }; }; - modules = [ - self.darwinModules.default - ] ++ extraModules; + modules = [ mod ]; }; }; } diff --git a/nixos/default.nix b/nixos/default.nix index 8343b72..c4d1325 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -31,16 +31,14 @@ in ]; }; - lib.mkLinuxSystem = extraModules: inputs.nixpkgs.lib.nixosSystem rec { + lib.mkLinuxSystem = mod: inputs.nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; # Arguments to pass to all modules. specialArgs = { inherit system inputs; flake = { inherit config; }; }; - modules = [ - self.nixosModules.default - ] ++ extraModules; + modules = [ mod ]; }; }; }