Netboot: Difference between revisions
imported>Erikarvstedt Improve example: Move script definition to system build. Fix old `nix build` syntax. Add firewall commands. |
imported>Erikarvstedt Example: Allow differing boot and host systems |
||
| Line 12: | Line 12: | ||
sys = nixpkgs.lib.nixosSystem { | sys = nixpkgs.lib.nixosSystem { | ||
system = "x86_64-linux"; | system = "x86_64-linux"; | ||
modules = [ | modules = [ | ||
({ config, pkgs, lib, modulesPath, ... }: { | |||
({ config, pkgs, lib, ... }: | imports = [ | ||
(modulesPath + "/installer/netboot/netboot-minimal.nix") | |||
]; | |||
config = { | config = { | ||
## Some useful options for setting up a new system | ## Some useful options for setting up a new system | ||
# services.getty.autologinUser = mkForce "root"; | # services.getty.autologinUser = lib.mkForce "root"; | ||
# users.users.root.openssh.authorizedKeys.keys = [ ... ]; | # users.users.root.openssh.authorizedKeys.keys = [ ... ]; | ||
# console.keyMap = "de"; | # console.keyMap = "de"; | ||
| Line 29: | Line 30: | ||
}; | }; | ||
run-pixiecore = let | |||
hostPkgs = nixpkgs.legacyPackages.${builtins.currentSystem}; | |||
build = sys.config.system.build; | |||
in hostPkgs.writers.writeBash "run-pixiecore" '' | |||
exec ${hostPkgs.pixiecore}/bin/pixiecore \ | |||
boot ${build.kernel}/bzImage ${build.netbootRamdisk}/initrd \ | |||
--cmdline "init=${build.toplevel}/init loglevel=4" \ | |||
--debug --dhcp-no-bind \ | |||
--port 64172 --status-port 64172 "$@" | |||
''; | |||
in | |||
run-pixiecore | |||
</syntaxHighlight> | </syntaxHighlight> | ||