2021-04-24 17:56:51 +02:00
|
|
|
{ lib }:
|
|
|
|
{
|
2021-04-26 01:22:33 +02:00
|
|
|
hmDefaults = { suites, modules }: {
|
2021-04-24 17:56:51 +02:00
|
|
|
home-manager = {
|
|
|
|
useGlobalPkgs = true;
|
|
|
|
useUserPackages = true;
|
|
|
|
|
2021-04-26 01:22:33 +02:00
|
|
|
extraSpecialArgs = { inherit suites; };
|
|
|
|
sharedModules = modules;
|
2021-04-24 17:56:51 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-04-26 01:22:33 +02:00
|
|
|
globalDefaults = { self, inputs }:
|
2021-04-24 17:56:51 +02:00
|
|
|
let
|
|
|
|
experimentalFeatures = [
|
|
|
|
"flakes"
|
|
|
|
"nix-command"
|
|
|
|
"ca-references"
|
|
|
|
"ca-derivations"
|
|
|
|
];
|
|
|
|
in
|
2021-04-26 01:22:33 +02:00
|
|
|
{ channel, config, pkgs, ... }: {
|
2021-04-24 17:56:51 +02:00
|
|
|
users.mutableUsers = lib.mkDefault false;
|
|
|
|
|
|
|
|
hardware.enableRedistributableFirmware = lib.mkDefault true;
|
|
|
|
|
|
|
|
nix.nixPath = [
|
2021-04-26 01:22:33 +02:00
|
|
|
"nixpkgs=${channel.input}"
|
2021-04-24 17:56:51 +02:00
|
|
|
"nixos-config=${self}/lib/compat/nixos"
|
|
|
|
"home-manager=${inputs.home}"
|
|
|
|
];
|
|
|
|
|
|
|
|
nix.registry = {
|
|
|
|
devos.flake = self;
|
2021-04-26 01:22:33 +02:00
|
|
|
nixos.flake = channel.input;
|
2021-04-24 17:56:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
nix.extraOptions = ''
|
|
|
|
experimental-features = ${lib.concatStringsSep " "
|
|
|
|
experimentalFeatures
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2021-04-27 04:33:31 +02:00
|
|
|
_module.args = {
|
|
|
|
inherit self;
|
2021-04-28 20:30:04 +02:00
|
|
|
devlib = lib;
|
2021-04-27 04:33:31 +02:00
|
|
|
hosts = builtins.mapAttrs (_: host: host.config)
|
|
|
|
(removeAttrs self.nixosConfigurations [ config.networking.hostName ]);
|
|
|
|
};
|
|
|
|
|
2021-04-24 17:56:51 +02:00
|
|
|
system.configurationRevision = lib.mkIf (self ? rev) self.rev;
|
|
|
|
};
|
|
|
|
|
2021-04-26 01:22:33 +02:00
|
|
|
isoConfig = { self, inputs, fullHostConfig }:
|
|
|
|
{ config, modulesPath, suites, ... }: {
|
2021-04-24 17:56:51 +02:00
|
|
|
|
2021-04-26 01:22:33 +02:00
|
|
|
imports = [ "${modulesPath}/installer/cd-dvd/installation-cd-minimal-new-kernel.nix" ];
|
2021-04-24 18:10:10 +02:00
|
|
|
# avoid unwanted systemd service startups
|
|
|
|
# all strings in disabledModules get appended to modulesPath
|
|
|
|
# so convert each to list which can be coerced to string
|
|
|
|
disabledModules = map lib.singleton suites.allProfiles;
|
|
|
|
|
|
|
|
nix.registry = lib.mapAttrs (n: v: { flake = v; }) inputs;
|
|
|
|
|
|
|
|
isoImage.isoBaseName = "nixos-" + config.networking.hostName;
|
|
|
|
isoImage.contents = [{
|
|
|
|
source = self;
|
|
|
|
target = "/devos/";
|
|
|
|
}];
|
|
|
|
isoImage.storeContents = [
|
|
|
|
self.devShell.${config.nixpkgs.system}
|
|
|
|
# include also closures that are "switched off" by the
|
|
|
|
# above profile filter on the local config attribute
|
|
|
|
fullHostConfig.system.build.toplevel
|
|
|
|
];
|
|
|
|
# still pull in tools of deactivated profiles
|
|
|
|
environment.systemPackages = fullHostConfig.environment.systemPackages;
|
|
|
|
|
|
|
|
# confilcts with networking.wireless which might be slightly
|
|
|
|
# more useful on a stick
|
|
|
|
networking.networkmanager.enable = lib.mkForce false;
|
|
|
|
# confilcts with networking.wireless
|
|
|
|
networking.wireless.iwd.enable = lib.mkForce false;
|
|
|
|
|
|
|
|
# Set up a link-local boostrap network
|
|
|
|
# See also: https://github.com/NixOS/nixpkgs/issues/75515#issuecomment-571661659
|
|
|
|
networking.usePredictableInterfaceNames = lib.mkForce true; # so prefix matching works
|
|
|
|
networking.useNetworkd = lib.mkForce true;
|
|
|
|
networking.useDHCP = lib.mkForce false;
|
|
|
|
networking.dhcpcd.enable = lib.mkForce false;
|
|
|
|
systemd.network = {
|
|
|
|
# https://www.freedesktop.org/software/systemd/man/systemd.network.html
|
|
|
|
networks."boostrap-link-local" = {
|
|
|
|
matchConfig = {
|
|
|
|
Name = "en* wl* ww*";
|
|
|
|
};
|
|
|
|
networkConfig = {
|
|
|
|
Description = "Link-local host bootstrap network";
|
|
|
|
MulticastDNS = true;
|
|
|
|
LinkLocalAddressing = "ipv6";
|
|
|
|
DHCP = "yes";
|
|
|
|
};
|
|
|
|
address = [
|
|
|
|
# fall back well-known link-local for situations where MulticastDNS is not available
|
|
|
|
"fe80::47" # 47: n=14 i=9 x=24; n+i+x
|
|
|
|
];
|
|
|
|
extraConfig = ''
|
|
|
|
# Unique, yet stable. Based off the MAC address.
|
|
|
|
IPv6LinkLocalAddressGenerationMode = "eui64"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-04-24 17:56:51 +02:00
|
|
|
}
|
|
|
|
|