summaryrefslogtreecommitdiff
path: root/installer-profiles/nfsroot.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-10-22 19:33:45 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2022-10-22 19:33:45 +0200
commitddcc8c65e30a9ca3b56e25466e749cb100b28510 (patch)
tree869c782c4e5874d4d353d3cd82af5b0e2dfe9a45 /installer-profiles/nfsroot.nix
parent0b7bd91465487426041c777a40de3be9f7407058 (diff)
downloadnixos-ddcc8c65e30a9ca3b56e25466e749cb100b28510.tar
nixos-ddcc8c65e30a9ca3b56e25466e749cb100b28510.tar.gz
nixos-ddcc8c65e30a9ca3b56e25466e749cb100b28510.tar.bz2
nixos-ddcc8c65e30a9ca3b56e25466e749cb100b28510.tar.xz
nixos-ddcc8c65e30a9ca3b56e25466e749cb100b28510.zip
...
Diffstat (limited to 'installer-profiles/nfsroot.nix')
-rw-r--r--installer-profiles/nfsroot.nix28
1 files changed, 27 insertions, 1 deletions
diff --git a/installer-profiles/nfsroot.nix b/installer-profiles/nfsroot.nix
index 9db415a8..2688a8d0 100644
--- a/installer-profiles/nfsroot.nix
+++ b/installer-profiles/nfsroot.nix
@@ -16,7 +16,17 @@ in {
16 nfsroot = { 16 nfsroot = {
17 storeDevice = mkOption { 17 storeDevice = mkOption {
18 type = types.str; 18 type = types.str;
19 default = "nfsroot:nix-store";
19 }; 20 };
21
22 registrationUrl = mkOption {
23 type = types.str;
24 default = "http://nfsroot/nix-registration";
25 };
26 };
27
28 system.build = {
29 storeContents = mkOption {};
20 }; 30 };
21 }; 31 };
22 32
@@ -67,14 +77,26 @@ in {
67 ]; 77 ];
68 }; 78 };
69 79
80 nix.extraOptions = ''
81 use-sqlite-wal = false
82 '';
83
70 boot.initrd.availableKernelModules = [ "nfs" "nfsv4" "overlay" ]; 84 boot.initrd.availableKernelModules = [ "nfs" "nfsv4" "overlay" ];
71 boot.initrd.supportedFilesystems = [ "nfs" "nfsv4" "overlay" ]; 85 boot.initrd.supportedFilesystems = [ "nfs" "nfsv4" "overlay" ];
86 services.rpcbind.enable = mkImageMediaOverride false;
72 87
73 boot.initrd.network.enable = true; 88 boot.initrd.network.enable = true;
74 boot.initrd.network.flushBeforeStage2 = false; # otherwise nfs dosen't work 89 boot.initrd.network.flushBeforeStage2 = false; # otherwise nfs doesn't work
90 boot.initrd.postMountCommands = ''
91 mkdir -p /mnt-root/etc/
92 cp /etc/resolv.conf /mnt-root/etc/resolv.conf
93 '';
75 networking.useDHCP = true; 94 networking.useDHCP = true;
95 networking.resolvconf.enable = false;
76 96
77 97
98 system.build.storeContents = [config.system.build.toplevel];
99
78 system.build.netbootIpxeScript = pkgs.writeTextDir "netboot.ipxe" '' 100 system.build.netbootIpxeScript = pkgs.writeTextDir "netboot.ipxe" ''
79 #!ipxe 101 #!ipxe
80 # Use the cmdline variable to allow the user to specify custom kernel params 102 # Use the cmdline variable to allow the user to specify custom kernel params
@@ -86,6 +108,10 @@ in {
86 108
87 boot.postBootCommands = 109 boot.postBootCommands =
88 '' 110 ''
111 # After booting, register the contents of the Nix store on NFS
112 # in the Nix database in the tmpfs.
113 ${pkgs.curl}/bin/curl ${escapeShellArg cfg.registrationUrl} | ${config.nix.package.out}/bin/nix-store --load-db
114
89 # nixos-rebuild also requires a "system" profile and an 115 # nixos-rebuild also requires a "system" profile and an
90 # /etc/NIXOS tag. 116 # /etc/NIXOS tag.
91 touch /etc/NIXOS 117 touch /etc/NIXOS