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