1
1
mirror of https://github.com/divnix/digga.git synced 2024-12-29 19:34:29 +03:00
digga/hosts/default.nix
2021-01-17 01:26:38 -07:00

99 lines
2.2 KiB
Nix

{ home
, lib
, nixos
, master
, pkgset
, self
, system
, utils
, externModules
, ...
}:
let
inherit (utils) recImport;
inherit (builtins) attrValues removeAttrs;
inherit (pkgset) osPkgs unstablePkgs;
unstableModules = [ ];
addToDisabledModules = [ ];
config = hostName:
lib.nixosSystem {
inherit system;
specialArgs =
{
unstableModulesPath = "${master}/nixos/modules";
};
modules =
let
core = self.nixosModules.profiles.core;
modOverrides = { config, unstableModulesPath, ... }: {
disabledModules = unstableModules ++ addToDisabledModules;
imports = map
(path: "${unstableModulesPath}/${path}")
unstableModules;
};
global = {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
hardware.enableRedistributableFirmware = lib.mkDefault true;
networking.hostName = hostName;
nix.nixPath = let path = toString ../.; in
[
"nixos-unstable=${master}"
"nixpkgs=${nixos}"
"nixos-config=${path}/configuration.nix"
"nixpkgs-overlays=${path}/overlays"
"home-manager=${home}"
];
nixpkgs.pkgs = osPkgs;
nix.registry = {
master.flake = master;
nixflk.flake = self;
nixpkgs.flake = nixos;
home-manager.flake = home;
};
system.configurationRevision = lib.mkIf (self ? rev) self.rev;
};
overrides = {
nixpkgs.overlays =
let
override = import ../pkgs/override.nix unstablePkgs;
in
[ override ];
};
local = import "${toString ./.}/${hostName}.nix";
# Everything in `./modules/list.nix`.
flakeModules =
attrValues (removeAttrs self.nixosModules [ "profiles" ]);
in
flakeModules ++ [
core
global
local
overrides
modOverrides
] ++ externModules;
};
hosts = recImport {
dir = ./.;
_import = config;
};
in
hosts