move hosts implementation logic to lib as mkHosts

This commit is contained in:
Pacman99 2021-03-20 09:37:03 -07:00
parent 7ebd6b5730
commit ec7eff63eb
2 changed files with 12 additions and 20 deletions

View file

@ -11,6 +11,8 @@
mkNodes = dev.callLibs ./mkNodes.nix; mkNodes = dev.callLibs ./mkNodes.nix;
mkHosts = dev.callLibs ./mkHosts.nix;
mkSuites = dev.callLibs ./mkSuites.nix; mkSuites = dev.callLibs ./mkSuites.nix;
mkProfileAttrs = dev.callLibs ./mkProfileAttrs.nix; mkProfileAttrs = dev.callLibs ./mkProfileAttrs.nix;

View file

@ -1,17 +1,8 @@
{ extern { lib, dev, nixos, inputs, self, ... }:
, home
, lib
, nixos
, override
, multiPkgs
, self
, defaultSystem
, ...
}:
let
inherit (lib) dev;
suites = import ../suites { inherit lib; }; { dir, extern, suites, overrides, multiPkgs, ... }:
let
defaultSystem = "x86_64-linux";
experimentalFeatures = [ experimentalFeatures = [
"flakes" "flakes"
@ -21,10 +12,9 @@ let
]; ];
modules = { modules = {
core = ../profiles/core; core = "${self}/profiles/core";
modOverrides = { config, overrideModulesPath, ... }: modOverrides = { config, overrideModulesPath, ... }:
let let
overrides = import ../overrides;
inherit (overrides) modules disabledModules; inherit (overrides) modules disabledModules;
in in
{ {
@ -48,7 +38,7 @@ let
nix.nixPath = [ nix.nixPath = [
"nixpkgs=${nixos}" "nixpkgs=${nixos}"
"nixos-config=${self}/compat/nixos" "nixos-config=${self}/compat/nixos"
"home-manager=${home}" "home-manager=${inputs.home}"
]; ];
nixpkgs.pkgs = lib.mkDefault multiPkgs.${config.nixpkgs.system}; nixpkgs.pkgs = lib.mkDefault multiPkgs.${config.nixpkgs.system};
@ -56,7 +46,7 @@ let
nix.registry = { nix.registry = {
devos.flake = self; devos.flake = self;
nixos.flake = nixos; nixos.flake = nixos;
override.flake = override; override.flake = inputs.override;
}; };
nix.extraOptions = '' nix.extraOptions = ''
@ -71,7 +61,7 @@ let
# Everything in `./modules/list.nix`. # Everything in `./modules/list.nix`.
flakeModules = { imports = builtins.attrValues self.nixosModules ++ extern.modules; }; flakeModules = { imports = builtins.attrValues self.nixosModules ++ extern.modules; };
cachix = ../cachix.nix; cachix = ../../cachix.nix;
}; };
specialArgs = extern.specialArgs // { suites = suites.system; }; specialArgs = extern.specialArgs // { suites = suites.system; };
@ -80,7 +70,7 @@ let
let let
local = { local = {
require = [ require = [
"${toString ./.}/${hostName}.nix" "${dir}/${hostName}.nix"
]; ];
networking = { inherit hostName; }; networking = { inherit hostName; };
@ -106,7 +96,7 @@ let
hosts = dev.os.recImport hosts = dev.os.recImport
{ {
dir = ./.; inherit dir;
_import = mkHostConfig; _import = mkHostConfig;
}; };
in in