notiz:nixos-tarball
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
Nächste Überarbeitung | Vorherige Überarbeitung | ||
notiz:nixos-tarball [2021/01/14 18:02] – angelegt clerie | notiz:nixos-tarball [2021/01/14 19:51] (aktuell) – clerie | ||
---|---|---|---|
Zeile 10: | Zeile 10: | ||
imports = [ | imports = [ | ||
(modulesPath + "/ | (modulesPath + "/ | ||
- | (modulesPath + "/ | ||
# (modulesPath + "/ | # (modulesPath + "/ | ||
]; | ]; | ||
Zeile 35: | Zeile 34: | ||
}; | }; | ||
} | } | ||
+ | </ | ||
+ | <code bash> | ||
+ | nix-build "< | ||
+ | </ | ||
+ | |||
+ | |||
+ | < | ||
+ | { hostName }: | ||
+ | |||
+ | let | ||
+ | # format target device with `mkfs.ext4 -L NIXOS_ROOT` | ||
+ | rootfsLabel = " | ||
+ | |||
+ | configuration = | ||
+ | { config, pkgs, lib, modulesPath, | ||
+ | |||
+ | { | ||
+ | imports = [ | ||
+ | (modulesPath + "/ | ||
+ | (./ | ||
+ | ]; | ||
+ | | ||
+ | tarball.contents = [ | ||
+ | { | ||
+ | source = pkgs.writeText " | ||
+ | insmod gfxterm | ||
+ | insmod png | ||
+ | set gfxpayload=keep | ||
+ | menuentry " | ||
+ | search --set=drive1 --label ${rootfsLabel} | ||
+ | linux ($drive1)${config.boot.kernelPackages.kernel}/ | ||
+ | initrd ($drive1)${config.system.build.initialRamdisk}/ | ||
+ | } | ||
+ | ''; | ||
+ | target = "/ | ||
+ | } | ||
+ | ]; | ||
+ | |||
+ | fileSystems."/" | ||
+ | device = "/ | ||
+ | fsType = " | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | evaluatedHost = import < | ||
+ | inherit configuration; | ||
+ | }; | ||
+ | in | ||
+ | evaluatedHost.config.system.build.tarball | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | nix-build tarball.nix --argstr hostName myhost | ||
</ | </ |
notiz/nixos-tarball.txt · Zuletzt geändert: 2021/01/14 19:51 von clerie