summary refs log tree commit diff
path: root/host/uISO
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-02-14 11:33:24 +0100
committerRory& <root@rory.gay>2025-02-14 11:33:24 +0100
commit0b2a417d78df654e99b942617fa5fc20b256b1fc (patch)
tree738f98df7f1b0e372305f4bdcf134fc3b551b179 /host/uISO
parentLLDB needs a patch (diff)
downloadRory-Open-Architecture-0b2a417d78df654e99b942617fa5fc20b256b1fc.tar.xz
Some server replacement work
Diffstat (limited to 'host/uISO')
-rw-r--r--host/uISO/development.nix51
-rw-r--r--host/uISO/iso-root.nix128
-rw-r--r--host/uISO/overlays/grub-overlay.nix20
-rw-r--r--host/uISO/overlays/systemd-overlay.nix62
-rw-r--r--host/uISO/pkgs/resize.nix9
-rw-r--r--host/uISO/test.sh7
6 files changed, 277 insertions, 0 deletions
diff --git a/host/uISO/development.nix b/host/uISO/development.nix
new file mode 100644

index 0000000..90ffcfb --- /dev/null +++ b/host/uISO/development.nix
@@ -0,0 +1,51 @@ +{ + config, + lib, + pkgs, + + #params + #enableBios ? true, + #enableEfi ? true, + #enableUsb ? true, + + ... +}: + +#with lib; + +{ + users.users.root.initialPassword = "root"; + services.getty.autologinUser = "root"; + + isoImage = { + squashfsCompression = "gzip -Xcompression-level 1"; + compressImage = false; + includeSystemBuildDependencies = false; + efiSplashImage = null; + #splashImage = null; + grubTheme = null; + }; + + boot = { + initrd = { + #systemd.enable = true; + systemd.emergencyAccess = true; + }; + #consoleLogLevel = 1; + kernelParams = [ + "console=ttyS0,115200" + "systemd.gpt_auto=0" + #"console=tty1" + #"quiet" + ]; + }; + environment.systemPackages = with pkgs; [ + #xterm + + (callPackage ./pkgs/resize.nix { }) + #coreutils + htop + btop + neofetch + ]; +} \ No newline at end of file diff --git a/host/uISO/iso-root.nix b/host/uISO/iso-root.nix new file mode 100644
index 0000000..6f02772 --- /dev/null +++ b/host/uISO/iso-root.nix
@@ -0,0 +1,128 @@ +{ + config, + lib, + pkgs, + nixpkgs, + + #params + #enableBios ? true, + #enableEfi ? true, + #enableUsb ? true, + + ... +}: + +#with lib; + +{ + imports = [ + (nixpkgs + "/nixos/modules/installer/cd-dvd/iso-image.nix") + ]; + + fileSystems = lib.mkImageMediaOverride config.lib.isoFileSystems;# // { + # "/".device = lib.mkForce "/dev/disk/by-label/NIXOS_ISO"; + # "/nix/.ro-store".device = lib.mkForce "/sysroot/iso/nix-store.squashfs"; + #}; + + isoImage = { + isoName = "Spacebar-Selfhosting-Kit-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}.iso"; + + makeEfiBootable = false; + makeUsbBootable = false; + makeBiosBootable = true; + }; + + + boot.supportedFilesystems = lib.mkForce [ ]; + hardware.enableRedistributableFirmware = lib.mkForce false; + #environment.systemPackages = lib.mkForce [ ]; + documentation.enable = lib.mkForce false; + documentation.nixos.enable = lib.mkForce false; + networking.wireless.enable = lib.mkForce false; + + system.extraDependencies = lib.mkForce []; + + boot = { + loader = { + grub.memtest86.enable = false; + #systemd-boot.enable = true; + grub.enable = false; + timeout = lib.mkForce 1; + }; + + #kernelPackages = pkgs.linuxPackages_latest; + systemdExecutable = "${pkgs.systemd}/bin/init"; + + enableContainers = lib.mkForce false; + }; + + + #perlless profile + system.switch.enable = lib.mkForce false; + + # Remove perl from activation + #system.etc.overlay.enable = lib.mkForce true; + #systemd.sysusers.enable = lib.mkForce true; + + # Random perl remnants + programs.less.lessopen = lib.mkForce null; + programs.command-not-found.enable = lib.mkForce false; + environment.defaultPackages = lib.mkForce [ ]; + documentation.info.enable = lib.mkForce false; + documentation.man.enable = false; + + system = { + #activatable = false; + copySystemConfiguration = false; + includeBuildDependencies = false; + disableInstallerTools = lib.mkForce true; + build = { + separateActivationScript = true; + }; + }; + + nix.enable = false; + networking.firewall.enable = false; + networking.networkmanager.enable = false; + systemd.coredump.enable = false; + services.timesyncd.enable = false; + + services.nscd.enableNsncd = false; + networking.dhcpcd.enable = false; + services.udev.enable = false; + services.nscd.enable = false; + system.nssModules = lib.mkForce []; + + systemd.oomd.enable = false; + #services.getty = { + # autologinUser = "root"; + # loginProgram = "${pkgs.bash}/bin/bash"; + # loginOptions = "--login"; + #}; + + security = { + loginDefs = { + settings = { + ENCRYPT_METHOD = "MD5"; + }; + }; + sudo.enable = false; + }; + + nixpkgs.overlays = [ + (import ./overlays/systemd-overlay.nix) + (import ./overlays/grub-overlay.nix) + ]; + + services.lvm.enable = lib.mkForce false; + boot.initrd.services.lvm.enable = lib.mkForce false; + boot.initrd.systemd.suppressedUnits = [ + "systemd-hibernate-clear.service" + ]; + + systemd.suppressedSystemUnits = [ + "systemd-hibernate-clear.service" + "systemd-bootctl@.service" + "systemd-bootctl.socket" + ]; +} \ No newline at end of file diff --git a/host/uISO/overlays/grub-overlay.nix b/host/uISO/overlays/grub-overlay.nix new file mode 100644
index 0000000..abbed8e --- /dev/null +++ b/host/uISO/overlays/grub-overlay.nix
@@ -0,0 +1,20 @@ +final: prev: { + grub2 = (prev.grub2.override { + zfsSupport = false; + efiSupport = false; + xenSupport = false; + }).overrideAttrs (oldAttrs: { + doCheck = false; + doInstallCheck = false; + #remove --enable-grub-mount + configureFlags = oldAttrs.configureFlags ++ [ "--disable-year2038 --disable-nls --disable-rpath --disable-dependency-tracking --disable-grub-mount --disable-grub-themes --disable-grub-mkfont" ]; + # remove unnecessary commands + # postInstall = oldAttrs.postInstall + '' + # rm -rf $out/share/locale + # ''; + }); + + grub2_light = final.grub2; + grub2_efi = final.grub2; + grub2_xen = final.grub2; +} diff --git a/host/uISO/overlays/systemd-overlay.nix b/host/uISO/overlays/systemd-overlay.nix new file mode 100644
index 0000000..69a4d3f --- /dev/null +++ b/host/uISO/overlays/systemd-overlay.nix
@@ -0,0 +1,62 @@ +final: prev: { + systemd = prev.systemd.override { + #pname = "systemd-extra-minimal"; + withSelinux = false; + withKexectools = false; + withLibseccomp = false; + withAcl = false; + withAudit = false; + withAnalyze = false; + withApparmor = false; + withBootloader = false; + withCompression = false; + withCoredump = false; + withCryptsetup = false; + withRepart = false; + withDocumentation = false; + withEfi = false; + withFido2 = false; + withHomed = false; + withHostnamed = false; + withHwdb = true; # required by nixos + withImportd = false; + withIptables = false; + withKmod = true; # required by nixos + withLibBPF = false; + withLibidn2 = false; + withLocaled = false; + withLogind = true; # required by nixos + withMachined = false; + withNetworkd = false; + withNss = false; + withOomd = false; + withPam = true; # required by nixos + withPCRE2 = false; + withPolkit = false; + withPortabled = false; + withQrencode = false; + withRemote = false; + withResolved = false; + withShellCompletions = false; + withSysusers = false; + withSysupdate = false; + withTimedated = false; + withTimesyncd = false; + withTpm2Tss = false; + withUkify = false; + withUserDb = false; + withUtmp = false; + withVmspawn = false; + withKernelInstall = false; + withTests = false; + withLogTrace = false; + }; + + systemd-minimal = final.systemd; + + openssh = prev.openssh.overrideAttrs (oldAttrs: { + # Disable PAM support + doCheck = false; + doInstallCheck = false; + }); +} diff --git a/host/uISO/pkgs/resize.nix b/host/uISO/pkgs/resize.nix new file mode 100644
index 0000000..5dc3b77 --- /dev/null +++ b/host/uISO/pkgs/resize.nix
@@ -0,0 +1,9 @@ +{ lib, pkgs, ... }: + +derivation { + name = "resize"; + version = "1.0"; + builder = "${pkgs.bash}/bin/bash"; + args = [ "-c" "${pkgs.coreutils}/bin/mkdir -p $out/bin; ${pkgs.coreutils}/bin/cp ${pkgs.xterm}/bin/.resize-wrapped $out/bin/resize" ]; + system = builtins.currentSystem; +} \ No newline at end of file diff --git a/host/uISO/test.sh b/host/uISO/test.sh new file mode 100644
index 0000000..9033b8c --- /dev/null +++ b/host/uISO/test.sh
@@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +nom build .#nixosConfigurations.test-iso.config.system.build.isoImage --impure || exit 1 +clear +du -sh result/iso/*.iso || exit 1 +sleep 2 +qemu-system-x86_64 -enable-kvm -m 256 -cdrom result/iso/*.iso -nographic -serial mon:stdio \ No newline at end of file