Skip to content

Commit c81856f

Browse files
committed
convert bootstrap iso to a nixos-generator format
1 parent d60f27f commit c81856f

File tree

1 file changed

+47
-57
lines changed

1 file changed

+47
-57
lines changed

modules/bootstrap-iso.nix

+47-57
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{ config, lib, modulesPath, self, ... }:
12
let
23
getFqdn = config:
34
let
@@ -7,68 +8,57 @@ let
78
then "${net.hostName}.${net.domain}"
89
else net.hostName;
910
in
10-
fqdn;
11-
12-
protoModule = fullHostConfig: { config, lib, modulesPath, suites, self, inputs, ... }@args: {
11+
fqdn;
12+
in
13+
{
1314

14-
imports = [ "${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix" ];
15+
imports = [ "${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix" ];
1516

16-
isoImage.isoBaseName = "bootstrap-" + (getFqdn config);
17-
isoImage.contents = [{
18-
source = self;
19-
target = "/devos/";
20-
}];
21-
isoImage.storeContents = [
22-
self.devShell.${config.nixpkgs.system}
23-
# include also closures that are "switched off" by the
24-
# above profile filter on the local config attribute
25-
fullHostConfig.system.build.toplevel
26-
] ++ builtins.attrValues inputs;
27-
# still pull in tools of deactivated profiles
28-
environment.systemPackages = fullHostConfig.environment.systemPackages;
17+
isoImage.isoBaseName = "bootstrap-" + (getFqdn config);
18+
isoImage.contents = [{
19+
source = self;
20+
target = "/etc/nixos/";
21+
}];
22+
isoImage.storeContents = [
23+
self.devShell.${config.nixpkgs.system}
24+
# include also closures that are "switched off" by the
25+
# above profile filter on the local config attribute
26+
config.system.build.toplevel
27+
] ++ builtins.attrValues self.inputs;
28+
# still pull in tools of deactivated profiles
2929

30-
# confilcts with networking.wireless which might be slightly
31-
# more useful on a stick
32-
networking.networkmanager.enable = lib.mkForce false;
33-
# confilcts with networking.wireless
34-
networking.wireless.iwd.enable = lib.mkForce false;
30+
# confilcts with networking.wireless which might be slightly
31+
# more useful on a stick
32+
networking.networkmanager.enable = lib.mkForce false;
33+
# confilcts with networking.wireless
34+
networking.wireless.iwd.enable = lib.mkForce false;
3535

36-
# Set up a link-local boostrap network
37-
# See also: https://github.com/NixOS/nixpkgs/issues/75515#issuecomment-571661659
38-
networking.usePredictableInterfaceNames = lib.mkForce true; # so prefix matching works
39-
networking.useNetworkd = lib.mkForce true;
40-
networking.useDHCP = lib.mkForce false;
41-
networking.dhcpcd.enable = lib.mkForce false;
42-
systemd.network = {
43-
# https://www.freedesktop.org/software/systemd/man/systemd.network.html
44-
networks."boostrap-link-local" = {
45-
matchConfig = {
46-
Name = "en* wl* ww*";
47-
};
48-
networkConfig = {
49-
Description = "Link-local host bootstrap network";
50-
MulticastDNS = true;
51-
LinkLocalAddressing = "ipv6";
52-
DHCP = "yes";
53-
};
54-
address = [
55-
# fall back well-known link-local for situations where MulticastDNS is not available
56-
"fe80::47" # 47: n=14 i=9 x=24; n+i+x
57-
];
58-
extraConfig = ''
59-
# Unique, yet stable. Based off the MAC address.
60-
IPv6LinkLocalAddressGenerationMode = "eui64"
61-
'';
36+
# Set up a link-local boostrap network
37+
# See also: https://github.com/NixOS/nixpkgs/issues/75515#issuecomment-571661659
38+
networking.usePredictableInterfaceNames = lib.mkForce true; # so prefix matching works
39+
networking.useNetworkd = lib.mkForce true;
40+
networking.useDHCP = lib.mkForce false;
41+
networking.dhcpcd.enable = lib.mkForce false;
42+
systemd.network = {
43+
# https://www.freedesktop.org/software/systemd/man/systemd.network.html
44+
networks."boostrap-link-local" = {
45+
matchConfig = {
46+
Name = "en* wl* ww*";
47+
};
48+
networkConfig = {
49+
Description = "Link-local host bootstrap network";
50+
MulticastDNS = true;
51+
LinkLocalAddressing = "ipv6";
52+
DHCP = "yes";
6253
};
54+
address = [
55+
# fall back well-known link-local for situations where MulticastDNS is not available
56+
"fe80::47" # 47: n=14 i=9 x=24; n+i+x
57+
];
58+
extraConfig = ''
59+
# Unique, yet stable. Based off the MAC address.
60+
IPv6LinkLocalAddressGenerationMode = "eui64"
61+
'';
6362
};
6463
};
65-
in
66-
{ config, ... }:
67-
{
68-
system.build = {
69-
bootstrapIso = (config.lib.digga.mkBuild
70-
(protoModule config)
71-
).config.system.build.isoImage;
72-
};
7364
}
74-

0 commit comments

Comments
 (0)