pub-solar-os/hosts/default.nix

104 lines
2.1 KiB
Nix
Raw Normal View History

{ extern
, home
, lib
, nixos
, override
, pkgs
, self
, system
, ...
}:
let
inherit (lib) dev;
2021-02-06 20:26:17 +00:00
suites = import ../suites { inherit lib; };
modules =
let
core = ../profiles/core;
modOverrides = { config, overrideModulesPath, ... }:
2020-07-31 04:17:28 +00:00
let
overrides = import ../overrides;
inherit (overrides) modules disabledModules;
2020-07-31 04:17:28 +00:00
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;
};
# Everything in `./modules/list.nix`.
flakeModules =
builtins.attrValues self.nixosModules;
in
flakeModules ++ [
core
global
modOverrides
] ++ extern.modules;
specialArgs = extern.specialArgs // { inherit suites; };
mkHostConfig = hostName:
let
local = {
require = [
"${toString ./.}/${hostName}.nix"
];
networking = { inherit hostName; };
_module.args = {
inherit self;
hosts = builtins.mapAttrs (_: host: host.config)
(removeAttrs hosts [ hostName ]);
};
};
in
dev.os.devosSystem {
inherit system specialArgs;
modules = modules ++ [
local
{
lib = { inherit specialArgs; };
lib.testModule = {
imports = modules;
};
}
];
};
hosts = dev.os.recImport
{
dir = ./.;
_import = mkHostConfig;
};
2020-07-31 04:17:28 +00:00
in
hosts