From dd494facc314f331e842177f4e8a327e5dcebf1d Mon Sep 17 00:00:00 2001 From: Pacman99 Date: Wed, 17 Mar 2021 15:41:54 -0700 Subject: [PATCH] hosts/devosSystem: pass modules as attrset --- hosts/default.nix | 99 +++++++++++++++++---------------------- lib/devos/devosSystem.nix | 5 +- 2 files changed, 47 insertions(+), 57 deletions(-) diff --git a/hosts/default.nix b/hosts/default.nix index 1f4f6d4..0a4884e 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -13,54 +13,46 @@ let suites = import ../suites { inherit lib; }; - modules = - let - core = ../profiles/core; - modOverrides = { config, overrideModulesPath, ... }: - let - overrides = import ../overrides; - inherit (overrides) modules disabledModules; - in - { - disabledModules = modules ++ disabledModules; - imports = map - (path: "${overrideModulesPath}/${path}") - modules; - }; - - global = { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - - hardware.enableRedistributableFirmware = lib.mkDefault true; - - nix.nixPath = [ - "nixpkgs=${nixos}" - "nixos-config=${self}/compat/nixos" - "home-manager=${home}" - ]; - - nixpkgs = { inherit pkgs; }; - - nix.registry = { - devos.flake = self; - nixos.flake = nixos; - override.flake = override; - }; - - system.configurationRevision = lib.mkIf (self ? rev) self.rev; + modules = { + core = ../profiles/core; + modOverrides = { config, overrideModulesPath, ... }: + let + overrides = import ../overrides; + inherit (overrides) modules disabledModules; + in + { + disabledModules = modules ++ disabledModules; + imports = map + (path: "${overrideModulesPath}/${path}") + modules; }; - # Everything in `./modules/list.nix`. - flakeModules = - builtins.attrValues self.nixosModules; + global = { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; - in - flakeModules ++ [ - core - global - modOverrides - ] ++ extern.modules; + hardware.enableRedistributableFirmware = lib.mkDefault true; + + nix.nixPath = [ + "nixpkgs=${nixos}" + "nixos-config=${self}/compat/nixos" + "home-manager=${home}" + ]; + + nixpkgs = { inherit pkgs; }; + + nix.registry = { + devos.flake = self; + nixos.flake = nixos; + override.flake = override; + }; + + system.configurationRevision = lib.mkIf (self ? rev) self.rev; + }; + + # Everything in `./modules/list.nix`. + flakeModules = { imports = builtins.attrValues self.nixosModules ++ extern.modules; }; + }; specialArgs = extern.specialArgs // { inherit suites; }; @@ -79,19 +71,16 @@ let (removeAttrs hosts [ hostName ]); }; }; + lib = { + lib = { inherit specialArgs; }; + lib.testModule = { + imports = builtins.attrValues modules; + }; + }; in dev.os.devosSystem { inherit system specialArgs; - - modules = modules ++ [ - local - { - lib = { inherit specialArgs; }; - lib.testModule = { - imports = modules; - }; - } - ]; + modules = modules // { inherit local lib; }; }; hosts = dev.os.recImport diff --git a/lib/devos/devosSystem.nix b/lib/devos/devosSystem.nix index cece333..05a6dcf 100644 --- a/lib/devos/devosSystem.nix +++ b/lib/devos/devosSystem.nix @@ -4,12 +4,13 @@ lib.nixosSystem (args // { modules = let + moduleList = builtins.attrValues modules; modpath = "nixos/modules"; cd = "installer/cd-dvd/installation-cd-minimal-new-kernel.nix"; isoConfig = (lib.nixosSystem (args // { - modules = modules ++ [ + modules = moduleList ++ [ "${nixos}/${modpath}/${cd}" ({ config, ... }: { isoImage.isoBaseName = "nixos-" + config.networking.hostName; @@ -58,7 +59,7 @@ lib.nixosSystem (args // { ]; })).config; in - modules ++ [{ + moduleList ++ [{ system.build = { iso = isoConfig.system.build.isoImage; };