2021-04-18 23:30:07 +00:00
|
|
|
{ lib, dev, nixpkgs, inputs, userSelf, ... }:
|
2019-12-05 05:36:36 +00:00
|
|
|
|
2021-03-20 16:37:03 +00:00
|
|
|
{ dir, extern, suites, overrides, multiPkgs, ... }:
|
|
|
|
let
|
|
|
|
defaultSystem = "x86_64-linux";
|
2021-02-02 03:26:47 +00:00
|
|
|
|
2021-03-17 04:11:56 +00:00
|
|
|
experimentalFeatures = [
|
|
|
|
"flakes"
|
|
|
|
"nix-command"
|
|
|
|
"ca-references"
|
|
|
|
"ca-derivations"
|
|
|
|
];
|
|
|
|
|
2021-03-17 22:41:54 +00:00
|
|
|
modules = {
|
|
|
|
modOverrides = { config, overrideModulesPath, ... }:
|
|
|
|
let
|
|
|
|
inherit (overrides) modules disabledModules;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
disabledModules = modules ++ disabledModules;
|
|
|
|
imports = map
|
|
|
|
(path: "${overrideModulesPath}/${path}")
|
|
|
|
modules;
|
|
|
|
};
|
2021-03-14 07:10:51 +00:00
|
|
|
|
2021-04-03 15:09:36 +00:00
|
|
|
global = { config, pkgs, ... }: {
|
2021-03-23 14:34:38 +00:00
|
|
|
home-manager = {
|
|
|
|
useGlobalPkgs = true;
|
|
|
|
useUserPackages = true;
|
|
|
|
|
2021-03-23 14:36:23 +00:00
|
|
|
extraSpecialArgs = extern.userSpecialArgs // { suites = suites.user; };
|
2021-04-18 23:30:07 +00:00
|
|
|
sharedModules = extern.userModules ++ (builtins.attrValues userSelf.homeModules);
|
2021-03-23 14:34:38 +00:00
|
|
|
};
|
2021-04-03 15:09:36 +00:00
|
|
|
users.mutableUsers = lib.mkDefault false;
|
2021-03-14 07:10:51 +00:00
|
|
|
|
2021-03-17 22:41:54 +00:00
|
|
|
hardware.enableRedistributableFirmware = lib.mkDefault true;
|
2021-03-14 07:10:51 +00:00
|
|
|
|
2021-03-17 22:41:54 +00:00
|
|
|
nix.nixPath = [
|
2021-04-02 02:10:24 +00:00
|
|
|
"nixpkgs=${nixpkgs}"
|
2021-04-18 23:30:07 +00:00
|
|
|
"nixos-config=${userSelf}/compat/nixos"
|
2021-03-20 16:37:03 +00:00
|
|
|
"home-manager=${inputs.home}"
|
2021-03-17 22:41:54 +00:00
|
|
|
];
|
2021-03-14 07:10:51 +00:00
|
|
|
|
2021-03-16 02:04:28 +00:00
|
|
|
nixpkgs.pkgs = lib.mkDefault multiPkgs.${config.nixpkgs.system};
|
2021-03-14 07:10:51 +00:00
|
|
|
|
2021-03-17 22:41:54 +00:00
|
|
|
nix.registry = {
|
2021-04-18 23:30:07 +00:00
|
|
|
devos.flake = userSelf;
|
2021-04-02 02:10:24 +00:00
|
|
|
nixos.flake = nixpkgs;
|
2021-03-20 16:37:03 +00:00
|
|
|
override.flake = inputs.override;
|
2021-03-14 07:10:51 +00:00
|
|
|
};
|
|
|
|
|
2021-04-03 15:09:36 +00:00
|
|
|
nix.package = pkgs.nixFlakes;
|
|
|
|
|
2021-03-17 04:11:56 +00:00
|
|
|
nix.extraOptions = ''
|
|
|
|
experimental-features = ${lib.concatStringsSep " "
|
|
|
|
experimentalFeatures
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2021-04-18 23:30:07 +00:00
|
|
|
system.configurationRevision = lib.mkIf (userSelf ? rev) userSelf.rev;
|
2021-03-17 22:41:54 +00:00
|
|
|
};
|
2021-03-14 07:10:51 +00:00
|
|
|
|
2021-03-17 22:41:54 +00:00
|
|
|
# Everything in `./modules/list.nix`.
|
2021-04-18 23:30:07 +00:00
|
|
|
flakeModules = { imports = builtins.attrValues userSelf.nixosModules ++ extern.modules; };
|
2021-03-23 17:25:42 +00:00
|
|
|
|
2021-03-20 16:37:03 +00:00
|
|
|
cachix = ../../cachix.nix;
|
2021-03-17 22:41:54 +00:00
|
|
|
};
|
2021-03-14 07:10:51 +00:00
|
|
|
|
2021-03-23 14:36:23 +00:00
|
|
|
specialArgs = extern.specialArgs // { suites = suites.system; };
|
2021-03-14 07:10:51 +00:00
|
|
|
|
|
|
|
mkHostConfig = hostName:
|
|
|
|
let
|
|
|
|
local = {
|
|
|
|
require = [
|
2021-03-20 16:37:03 +00:00
|
|
|
"${dir}/${hostName}.nix"
|
2021-03-14 07:10:51 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
networking = { inherit hostName; };
|
2021-03-16 19:50:38 +00:00
|
|
|
|
|
|
|
_module.args = {
|
2021-04-18 23:30:07 +00:00
|
|
|
self = userSelf;
|
2021-03-16 21:22:38 +00:00
|
|
|
hosts = builtins.mapAttrs (_: host: host.config)
|
|
|
|
(removeAttrs hosts [ hostName ]);
|
2021-03-16 19:50:38 +00:00
|
|
|
};
|
2021-03-14 07:10:51 +00:00
|
|
|
};
|
2021-03-17 22:41:54 +00:00
|
|
|
lib = {
|
|
|
|
lib = { inherit specialArgs; };
|
|
|
|
lib.testModule = {
|
|
|
|
imports = builtins.attrValues modules;
|
|
|
|
};
|
|
|
|
};
|
2021-03-14 07:10:51 +00:00
|
|
|
in
|
|
|
|
dev.os.devosSystem {
|
2021-03-16 02:04:28 +00:00
|
|
|
inherit specialArgs;
|
|
|
|
system = defaultSystem;
|
2021-03-17 22:41:54 +00:00
|
|
|
modules = modules // { inherit local lib; };
|
2019-12-14 04:30:43 +00:00
|
|
|
};
|
2019-12-17 23:03:44 +00:00
|
|
|
|
2021-03-14 07:10:51 +00:00
|
|
|
hosts = dev.os.recImport
|
|
|
|
{
|
2021-03-20 16:37:03 +00:00
|
|
|
inherit dir;
|
2021-03-14 07:10:51 +00:00
|
|
|
_import = mkHostConfig;
|
|
|
|
};
|
2020-07-31 04:17:28 +00:00
|
|
|
in
|
|
|
|
hosts
|