|
| 1 | +{ |
| 2 | + inputs, |
| 3 | + cell, |
| 4 | +}: let |
| 5 | + inherit (inputs) nixpkgs nixos-generators; |
| 6 | + lib = nixpkgs.lib // builtins; |
| 7 | +in { |
| 8 | + bootstrap = { |
| 9 | + config, |
| 10 | + options, |
| 11 | + pkgs, |
| 12 | + ... |
| 13 | + }: { |
| 14 | + imports = [ |
| 15 | + nixos-generators.nixosModules.install-iso |
| 16 | + ]; |
| 17 | + |
| 18 | + nix = { |
| 19 | + # only part of ./modules/profiles/channels.nix since 22.11 |
| 20 | + registry.nixpkgs.flake.outPath = builtins.path { |
| 21 | + name = "source"; |
| 22 | + path = pkgs.path; |
| 23 | + }; |
| 24 | + package = nixpkgs.nix; |
| 25 | + extraOptions = '' |
| 26 | + experimental-features = nix-command flakes recursive-nix |
| 27 | + ''; |
| 28 | + }; |
| 29 | + |
| 30 | + networking.domain = "local"; |
| 31 | + |
| 32 | + # Provide networkmanager for easy wireless configuration. |
| 33 | + networking.networkmanager.enable = true; |
| 34 | + networking.networkmanager.wifi.backend = "iwd"; |
| 35 | + networking.wireless.enable = lib.mkForce false; |
| 36 | + networking.wireless.iwd.enable = true; |
| 37 | + services.getty.helpLine = |
| 38 | + '' |
| 39 | + The "nixos" and "root" accounts have empty passwords. |
| 40 | +
|
| 41 | + An ssh daemon is running. You then must set a password |
| 42 | + for either "root" or "nixos" with `passwd` or add an ssh key |
| 43 | + to /home/nixos/.ssh/authorized_keys be able to login. |
| 44 | + '' |
| 45 | + + lib.optionalString config.services.xserver.enable '' |
| 46 | +
|
| 47 | + Type `sudo systemctl start display-manager' to |
| 48 | + start the graphical user interface. |
| 49 | + ''; |
| 50 | + |
| 51 | + isoImage = { |
| 52 | + isoBaseName = "bootstrap-hive-from-queen"; |
| 53 | + contents = [ |
| 54 | + { |
| 55 | + source = inputs.self; |
| 56 | + target = "/hive/"; |
| 57 | + } |
| 58 | + ]; |
| 59 | + }; |
| 60 | + |
| 61 | + systemd.network = { |
| 62 | + # https://www.freedesktop.org/software/systemd/man/systemd.network.html |
| 63 | + networks."boostrap-link-local" = { |
| 64 | + matchConfig = { |
| 65 | + Name = "en* wl* ww*"; |
| 66 | + }; |
| 67 | + networkConfig = { |
| 68 | + Description = "Link-local host bootstrap network"; |
| 69 | + MulticastDNS = true; |
| 70 | + LinkLocalAddressing = "ipv6"; |
| 71 | + DHCP = "yes"; |
| 72 | + }; |
| 73 | + address = [ |
| 74 | + # fall back well-known link-local for situations where MulticastDNS is not available |
| 75 | + "fe80::47" # 47: n=14 i=9 x=24; n+i+x |
| 76 | + ]; |
| 77 | + extraConfig = '' |
| 78 | + # Unique, yet stable. Based off the MAC address. |
| 79 | + IPv6LinkLocalAddressGenerationMode = "eui64" |
| 80 | + ''; |
| 81 | + }; |
| 82 | + }; |
| 83 | + }; |
| 84 | +} |
0 commit comments