From 037bee53a4e719ba3ed4ccc48b3c6a2edc52b883 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 22 Sep 2026 14:43:25 +0200 Subject: skadhi: initial commit --- hosts/skadhi/default.nix | 87 ++++++++++++++++++++++++++++++++++++++++++++++++ hosts/skadhi/hw.nix | 72 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 hosts/skadhi/default.nix create mode 100644 hosts/skadhi/hw.nix (limited to 'hosts/skadhi') diff --git a/hosts/skadhi/default.nix b/hosts/skadhi/default.nix new file mode 100644 index 00000000..e9d5cc59 --- /dev/null +++ b/hosts/skadhi/default.nix @@ -0,0 +1,87 @@ +{ flake, flakeInputs, pkgs, config, lib, ... }: +{ + imports = with flake.nixosModules.systemProfiles; [ + ./hw.nix + tmpfs-root default-locale openssh niri-unstable networkmanager lanzaboote zswap + flakeInputs.nixVirt.nixosModules.default + ]; + + config = { + system.stateVersion = "26.05"; + + fileSystems."/persistent".neededForBoot = true; + environment.persistence."/persistent" = { + hideMounts = true; + directories = [ + "/nix" + "/root" + "/home" + "/var/log" + "/var/lib/nixos" + "/var/lib/sops-nix" + "/var/lib/systemd" + ]; + timezone = true; + }; + + boot = { + initrd.systemd = { + emergencyAccess = config.users.users.root.hashedPassword; + extraBin = { + "vim" = lib.getExe pkgs.vim; + "grep" = lib.getExe pkgs.gnugrep; + }; + }; + + lanzaboote.configurationLimit = 15; + loader = { + efi.canTouchEfiVariables = true; + timeout = null; + }; + + plymouth.enable = true; + + kernelPackages = pkgs.linuxPackages_7_2; + consoleLogLevel = 3; + kernelParams = [ + "quiet" + "boot.shell_on_fail" + "udev.log_priority=3" + "rd.systemd.show_status=auto" + "plymouth.use-simpledrm" + ]; + + tmp.useTmpfs = true; + }; + + services.timesyncd.enable = false; + services.chrony = { + enable = true; + enableNTS = true; + servers = []; + extraConfig = '' + pool time.cloudflare.com iburst nts + pool nts.netnod.se prefer iburst nts + server ptbtime1.ptb.de prefer iburst nts + server ptbtime2.ptb.de prefer iburst nts + server ptbtime3.ptb.de prefer iburst nts + server ptbtime4.ptb.de prefer iburst nts + pool ntppool1.time.nl prefer iburst nts + pool ntppool2.time.nl prefer iburst nts + + authselectmode require + minsources 3 + + nocerttimecheck 1 + + leapsectz right/UTC + + makestep 0.1 3 + + cmdport 0 + ''; + }; + + services.userborn.importLegacyState = false; + }; +} diff --git a/hosts/skadhi/hw.nix b/hosts/skadhi/hw.nix new file mode 100644 index 00000000..b95fc24c --- /dev/null +++ b/hosts/skadhi/hw.nix @@ -0,0 +1,72 @@ +{ flake, flakeInputs, pkgs, config, lib, ... }: +{ + imports = with flake.nixosModules.systemProfiles; [ + flakeInputs.nixos-hardware.nixosModules.framework-13-7040-amd + disko + ]; + + config = { + hardware.framework.laptop13.audioEnhancement.enable = true; + services.fstrim.enable = false; + + nixpkgs.system = "x86_64-linux"; + + disko.devices = { + disk.nvm = { + type = "disk"; + device = "/dev/nvm0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "fmask=0033" "dmask=0022" + ]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "nvm"; + extraFormatArgs = [ + "--cipher" "aegis128-random" + "--key-size" "128" + "--integrity" "aead" + ]; + content = { + type = "btrfs"; + extraArgs = let + subvols = ["/persistent"] ++ map (p: "/persistent/${p}") ["/nix" "/home" "/var/log"]; + restricted = map (p: "/persistent/${p}") ["/root"]; + in [ + "--csum" "blake2" + "--compress" "zstd:15" + "--rootdir" (pkgs.runCommand "rootdir" { + } '' + install -d ${lib.escapeShellArgs (map (p: "$out/${p}") subvols)} + install -m 0700 -d ${lib.escapeShellArgs (map (p: "$out/${p}") restricted)} + '') + ] ++ lib.concatMap (p: ["--subvol" p]) subvols; + subvolumes = { + "/persistent".mountpoint = "/persistent"; + "/swap" = { + mountpoint = "/.swap"; + swap.swapfile.size = "96G"; + }; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} -- cgit v1.2.3