From 6bc9ae25153a292b5e34ec0b891d83c98b1d5e8a Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 8 Aug 2023 21:48:11 +0200 Subject: ... --- installer/default.nix | 19 ++++++++++- installer/shell.nix | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 installer/shell.nix (limited to 'installer') diff --git a/installer/default.nix b/installer/default.nix index a0c84182..9043d59b 100644 --- a/installer/default.nix +++ b/installer/default.nix @@ -26,11 +26,28 @@ }; environment.systemPackages = with pkgs; [ - nvme-cli iotop mosh + nvme-cli iotop pciutils bottom + + cudatoolkit ]; zramSwap.enable = true; + users.defaultUserShell = pkgs.zsh; + programs = { + mosh.enable = true; + tmux.enable = true; + zsh.enable = true; + }; + + # nvidia + services.xserver.videoDrivers = [ "nvidia" ]; + systemd.services.nvidia-control-devices = { + wantedBy = [ "multi-user.target" ]; + serviceConfig.ExecStart = "${pkgs.linuxPackages.nvidia_x11.bin}/bin/nvidia-smi"; + }; + nixpkgs.config.allowUnfree = true; + system.stateVersion = config.system.nixos.release; # No state in installer }; } diff --git a/installer/shell.nix b/installer/shell.nix new file mode 100644 index 00000000..043f0ddc --- /dev/null +++ b/installer/shell.nix @@ -0,0 +1,92 @@ +{ system, installerName, config +, runCommand, makeWrapper, pixiecore, writeShellApplication, coreutils, busybox, nftables, mkShell +}: + +let + pxeBuild = config.config.system.build; + pixiecore-wrapped = runCommand "pixiecore-${system}-${installerName}" { + nativeBuildInputs = [ makeWrapper ]; + } '' + mkdir -p $out/bin + makeWrapper ${pixiecore}/bin/pixiecore $out/bin/pixiecore-${installerName} \ + --add-flags boot \ + --add-flags "${pxeBuild.kernel}/bzImage" --add-flags "${pxeBuild.netbootRamdisk}/initrd" \ + --add-flags "--cmdline \"init=${pxeBuild.toplevel}/init loglevel=4\"" \ + --add-flags "-dt" --add-flags "--status-port 64172" --add-flags "--port 64172" --add-flags "--dhcp-no-bind" + ''; + udhcpd = writeShellApplication { + name = "udhcpd"; + + runtimeInputs = [ coreutils ]; + + text = '' + [[ -n "''${INTERFACE-}" ]] || exit 2 + + _LEASES_FILE=$(mktemp --tmpdir udhcpd.XXXXXXXXXX.leases) + exec ${busybox}/bin/udhcpd -f <(cat <