diff --git a/hosts/servers/alexandria.nix b/hosts/alexandria.nix similarity index 77% rename from hosts/servers/alexandria.nix rename to hosts/alexandria.nix index 4154097..50920e6 100644 --- a/hosts/servers/alexandria.nix +++ b/hosts/alexandria.nix @@ -2,11 +2,7 @@ { imports = [ - # Host-common imports - ../common - # Server-common imports - ./common - # Host-specific imports + ./modules ./alexandria ]; diff --git a/hosts/servers/alexandria/changedetection.nix b/hosts/alexandria/changedetection.nix similarity index 100% rename from hosts/servers/alexandria/changedetection.nix rename to hosts/alexandria/changedetection.nix diff --git a/hosts/servers/alexandria/cinny.nix b/hosts/alexandria/cinny.nix similarity index 100% rename from hosts/servers/alexandria/cinny.nix rename to hosts/alexandria/cinny.nix diff --git a/hosts/servers/alexandria/default.nix b/hosts/alexandria/default.nix similarity index 100% rename from hosts/servers/alexandria/default.nix rename to hosts/alexandria/default.nix diff --git a/hosts/servers/alexandria/forgejo.nix b/hosts/alexandria/forgejo.nix similarity index 100% rename from hosts/servers/alexandria/forgejo.nix rename to hosts/alexandria/forgejo.nix diff --git a/hosts/servers/alexandria/hardware-configuration.nix b/hosts/alexandria/hardware-configuration.nix similarity index 97% rename from hosts/servers/alexandria/hardware-configuration.nix rename to hosts/alexandria/hardware-configuration.nix index a5f9767..05eac80 100644 --- a/hosts/servers/alexandria/hardware-configuration.nix +++ b/hosts/alexandria/hardware-configuration.nix @@ -33,8 +33,6 @@ fsType = "vfat"; }; - swapDevices = [ ]; - networking.useDHCP = lib.mkDefault true; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; diff --git a/hosts/servers/alexandria/jellyfin.nix b/hosts/alexandria/jellyfin.nix similarity index 100% rename from hosts/servers/alexandria/jellyfin.nix rename to hosts/alexandria/jellyfin.nix diff --git a/hosts/servers/alexandria/librespeed.nix b/hosts/alexandria/librespeed.nix similarity index 100% rename from hosts/servers/alexandria/librespeed.nix rename to hosts/alexandria/librespeed.nix diff --git a/hosts/servers/alexandria/memos.nix b/hosts/alexandria/memos.nix similarity index 100% rename from hosts/servers/alexandria/memos.nix rename to hosts/alexandria/memos.nix diff --git a/hosts/servers/alexandria/minecraft.nix b/hosts/alexandria/minecraft.nix similarity index 100% rename from hosts/servers/alexandria/minecraft.nix rename to hosts/alexandria/minecraft.nix diff --git a/hosts/servers/alexandria/nextcloud.nix b/hosts/alexandria/nextcloud.nix similarity index 100% rename from hosts/servers/alexandria/nextcloud.nix rename to hosts/alexandria/nextcloud.nix diff --git a/hosts/servers/alexandria/nginx.nix b/hosts/alexandria/nginx.nix similarity index 100% rename from hosts/servers/alexandria/nginx.nix rename to hosts/alexandria/nginx.nix diff --git a/hosts/servers/alexandria/paperless.nix b/hosts/alexandria/paperless.nix similarity index 100% rename from hosts/servers/alexandria/paperless.nix rename to hosts/alexandria/paperless.nix diff --git a/hosts/servers/alexandria/searx.nix b/hosts/alexandria/searx.nix similarity index 100% rename from hosts/servers/alexandria/searx.nix rename to hosts/alexandria/searx.nix diff --git a/hosts/servers/alexandria/services.nix b/hosts/alexandria/services.nix similarity index 100% rename from hosts/servers/alexandria/services.nix rename to hosts/alexandria/services.nix diff --git a/hosts/servers/alexandria/users.nix b/hosts/alexandria/users.nix similarity index 100% rename from hosts/servers/alexandria/users.nix rename to hosts/alexandria/users.nix diff --git a/hosts/servers/alexandria/vaultwarden.nix b/hosts/alexandria/vaultwarden.nix similarity index 100% rename from hosts/servers/alexandria/vaultwarden.nix rename to hosts/alexandria/vaultwarden.nix diff --git a/hosts/desktops/io.nix b/hosts/desktops/io.nix deleted file mode 100644 index fccc7f2..0000000 --- a/hosts/desktops/io.nix +++ /dev/null @@ -1,110 +0,0 @@ -{ pkgs, ... }: - -let - cml-ucm-conf = pkgs.alsa-ucm-conf.overrideAttrs { - wttsrc = pkgs.fetchFromGitHub { - owner = "WeirdTreeThing"; - repo = "chromebook-ucm-conf"; - rev = "b6ce2a7"; - hash = "sha256-QRUKHd3RQmg1tnZU8KCW0AmDtfw/daOJ/H3XU5qWTCc="; - }; - postInstall = '' - echo "v0.4.1" > $out/chromebook.patched - cp -R $wttsrc/{common,codecs,platforms} $out/share/alsa/ucm2 - cp -R $wttsrc/{cml,sof-rt5682} $out/share/alsa/ucm2/conf.d - ''; - }; -in -{ - imports = [ - ../modules - # Host-specific imports - ./io - ]; - - networking.hostName = "io"; - - nix.nixPath = [ "nixos-config=${./io.nix}" ]; - - zramSwap = { - enable = true; - memoryPercent = 100; - }; - - boot = { - # TODO check if future kernel versions fix boot issue with systemd initrd with tpm - initrd.systemd.tpm2.enable = false; - kernelParams = [ - "nosgx" - "i915.fastboot=1" - "mem_sleep_default=deep" - ]; - extraModprobeConfig = '' - options snd-intel-dspcfg dsp_driver=3 - ''; - }; - - environment = { - systemPackages = with pkgs; [ - maliit-keyboard - sof-firmware - ]; - sessionVariables.ALSA_CONFIG_UCM2 = "${cml-ucm-conf}/share/alsa/ucm2"; - }; - - # TODO: remove once gmodena/nix-flatpak/issues/45 fixed - systemd.services."flatpak-managed-install" = { - serviceConfig = { - ExecStartPre = "${pkgs.coreutils}/bin/sleep 5"; - }; - }; - - services = { - keyd = { - enable = true; - keyboards.main = { - ids = [ "0001:0001" ]; - settings = { - main = { - meta = "overload(meta, esc)"; - f1 = "back"; - f2 = "forward"; - f3 = "refresh"; - f4 = "M-f11"; - f5 = "M-w"; - f6 = "brightnessdown"; - f7 = "brightnessup"; - f8 = "timeout(mute, 200, micmute)"; - f9 = "play"; - f10 = "timeout(nextsong, 200, previoussong)"; - f13 = "delete"; - "102nd" = "layer(function)"; - }; - shift = { - leftshift = "capslock"; - rightshift = "capslock"; - }; - function = { - escape = "f1"; - f1 = "f2"; - f2 = "f3"; - f3 = "f4"; - f4 = "f5"; - f5 = "f6"; - f6 = "f7"; - f7 = "f8"; - f8 = "f9"; - f9 = "f10"; - f10 = "f11"; - f13 = "f12"; - y = "sysrq"; - k = "home"; - l = "pageup"; - "," = "end"; - "." = "pagedown"; - }; - }; - }; - }; - }; -} diff --git a/hosts/desktops/rotterdam.nix b/hosts/desktops/rotterdam.nix deleted file mode 100644 index 8004665..0000000 --- a/hosts/desktops/rotterdam.nix +++ /dev/null @@ -1,92 +0,0 @@ -{ pkgs, ... }: - -let - qubesnsh = pkgs.writeTextFile { - name = "qubes.nsh"; - text = "HD1f65535a1:EFI\\qubes\\grubx64.efi"; - }; - - reboot-into-qubes = pkgs.makeDesktopItem { - name = "reboot-into-qubes"; - icon = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/vinceliuice/Qogir-icon-theme/31f267e1f5fd4e9596bfd78dfb41a03d3a9f33ee/src/scalable/apps/distributor-logo-qubes.svg"; - sha256 = "sha256-QbHr7s5Wcs7uFtfqZctMyS0iDbMfiiZOKy2nHhDOfn0="; - }; - desktopName = "Qubes OS"; - genericName = "Reboot into Qubes OS"; - categories = [ "System" ]; - startupNotify = true; - exec = pkgs.writeShellScript "reboot-into-qubes" '' - ${pkgs.yad}/bin/yad --form \ - --title="Qubes OS" \ - --image distributor-logo-qubes \ - --text "Are you sure you want to reboot into Qubes OS?" \ - --button="Yes:0" --button="Cancel:1" - if [ $? -eq 0 ]; then - systemctl reboot --boot-loader-entry=qubes.conf - fi - ''; - }; -in -{ - imports = [ - ./rotterdam - ../modules - ]; - - networking.hostName = "rotterdam"; - - services = { - flatpak.packages = [ "net.retrodeck.retrodeck" ]; - keyd = { - enable = true; - keyboards.main = { - ids = [ "5653:0001" ]; - settings.main = { - esc = "overload(meta, esc)"; - }; - }; - }; - }; - - environment.systemPackages = with pkgs; [ reboot-into-qubes ]; - - hardware = { - amdgpu = { - opencl.enable = true; - amdvlk.enable = true; - }; - graphics.extraPackages = with pkgs; [ rocmPackages.clr.icd ]; - }; - - systemd.targets.hibernate.enable = false; # disable non-functional hibernate - - nix.nixPath = [ "nixos-config=${./rotterdam.nix}" ]; - - boot = { - kernelParams = [ - "processor.max_cstate=1" # Fixes bug where ryzen cpus freeze when in highest C state - "clearcpuid=514" - # Fixes amdgpu freezing - "amdgpu.noretry=0" - "amdgpu.ppfeaturemask=0xfffd3fff" - "amdgpu.gpu_recovery=1" - "amdgpu.lockup_timeout=1000" - ]; - # QubesOS boot entry - loader.systemd-boot = { - extraFiles = { - "efi/edk2-shell/shell.efi" = "${pkgs.edk2-uefi-shell}/shell.efi"; - "qubes.nsh" = qubesnsh; - }; - extraEntries."qubes.conf" = '' - title Qubes OS - efi /efi/edk2-shell/shell.efi - options -nointerrupt qubes.nsh - sort-key ab - ''; - }; - }; - - programs.steam.dedicatedServer.openFirewall = true; -} diff --git a/hosts/io.nix b/hosts/io.nix new file mode 100644 index 0000000..0eba1ed --- /dev/null +++ b/hosts/io.nix @@ -0,0 +1,12 @@ +{ ... }: + +{ + networking.hostName = "io"; + + imports = [ + ./modules + ./io + ]; + + nix.nixPath = [ "nixos-config=${./io.nix}" ]; +} diff --git a/hosts/io/boot.nix b/hosts/io/boot.nix new file mode 100644 index 0000000..1580753 --- /dev/null +++ b/hosts/io/boot.nix @@ -0,0 +1,16 @@ +{ ... }: + +{ + boot = { + # TODO check if future kernel versions fix boot issue with systemd initrd with tpm + initrd.systemd.tpm2.enable = false; + kernelParams = [ + "nosgx" + "i915.fastboot=1" + "mem_sleep_default=deep" + ]; + extraModprobeConfig = '' + options snd-intel-dspcfg dsp_driver=3 + ''; + }; +} diff --git a/hosts/desktops/io/default.nix b/hosts/io/default.nix similarity index 63% rename from hosts/desktops/io/default.nix rename to hosts/io/default.nix index a480ae0..53179f8 100644 --- a/hosts/desktops/io/default.nix +++ b/hosts/io/default.nix @@ -2,7 +2,10 @@ { imports = [ + ./boot ./ephermal.nix ./hardware-configuration.nix + ./programs.nix + ./services.nix ]; } diff --git a/hosts/desktops/io/ephermal.nix b/hosts/io/ephermal.nix similarity index 100% rename from hosts/desktops/io/ephermal.nix rename to hosts/io/ephermal.nix diff --git a/hosts/desktops/io/hardware-configuration.nix b/hosts/io/hardware-configuration.nix similarity index 100% rename from hosts/desktops/io/hardware-configuration.nix rename to hosts/io/hardware-configuration.nix diff --git a/hosts/io/programs.nix b/hosts/io/programs.nix new file mode 100644 index 0000000..0b156f6 --- /dev/null +++ b/hosts/io/programs.nix @@ -0,0 +1,34 @@ +{ pkgs, ... }: + +let + cml-ucm-conf = pkgs.alsa-ucm-conf.overrideAttrs { + wttsrc = pkgs.fetchFromGitHub { + owner = "WeirdTreeThing"; + repo = "chromebook-ucm-conf"; + rev = "b6ce2a7"; + hash = "sha256-QRUKHd3RQmg1tnZU8KCW0AmDtfw/daOJ/H3XU5qWTCc="; + }; + postInstall = '' + echo "v0.4.1" > $out/chromebook.patched + cp -R $wttsrc/{common,codecs,platforms} $out/share/alsa/ucm2 + cp -R $wttsrc/{cml,sof-rt5682} $out/share/alsa/ucm2/conf.d + ''; + }; +in + +{ + environment = { + systemPackages = with pkgs; [ + maliit-keyboard + sof-firmware + ]; + sessionVariables.ALSA_CONFIG_UCM2 = "${cml-ucm-conf}/share/alsa/ucm2"; + }; + + # TODO: remove once gmodena/nix-flatpak/issues/45 fixed + systemd.services."flatpak-managed-install" = { + serviceConfig = { + ExecStartPre = "${pkgs.coreutils}/bin/sleep 5"; + }; + }; +} diff --git a/hosts/io/services.nix b/hosts/io/services.nix new file mode 100644 index 0000000..5291695 --- /dev/null +++ b/hosts/io/services.nix @@ -0,0 +1,52 @@ +{ ... }: + +{ + services = { + keyd = { + enable = true; + keyboards.main = { + ids = [ "0001:0001" ]; + settings = { + main = { + meta = "overload(meta, esc)"; + f1 = "back"; + f2 = "forward"; + f3 = "refresh"; + f4 = "M-f11"; + f5 = "M-w"; + f6 = "brightnessdown"; + f7 = "brightnessup"; + f8 = "timeout(mute, 200, micmute)"; + f9 = "play"; + f10 = "timeout(nextsong, 200, previoussong)"; + f13 = "delete"; + "102nd" = "layer(function)"; + }; + shift = { + leftshift = "capslock"; + rightshift = "capslock"; + }; + function = { + escape = "f1"; + f1 = "f2"; + f2 = "f3"; + f3 = "f4"; + f4 = "f5"; + f5 = "f6"; + f6 = "f7"; + f7 = "f8"; + f8 = "f9"; + f9 = "f10"; + f10 = "f11"; + f13 = "f12"; + y = "sysrq"; + k = "home"; + l = "pageup"; + "," = "end"; + "." = "pagedown"; + }; + }; + }; + }; + }; +} diff --git a/hosts/modules/desktop.nix b/hosts/modules/desktop.nix index f0c03c8..e90ab4d 100644 --- a/hosts/modules/desktop.nix +++ b/hosts/modules/desktop.nix @@ -25,13 +25,6 @@ compositor = "kwin"; }; }; - keyd = { - enable = true; - keyboards.all = { - ids = [ "*" ]; - settings.main.capslock = "overload(meta, esc)"; - }; - }; desktopManager.plasma6.enable = true; pipewire = { enable = true; diff --git a/hosts/modules/services.nix b/hosts/modules/services.nix index d35bfff..b957a97 100644 --- a/hosts/modules/services.nix +++ b/hosts/modules/services.nix @@ -24,6 +24,13 @@ services = { printing.enable = true; udev.packages = with pkgs; [ yubikey-personalization ]; + keyd = { + enable = true; + keyboards.all = { + ids = [ "*" ]; + settings.main.capslock = "overload(meta, esc)"; + }; + }; }; }) ]; diff --git a/hosts/rotterdam.nix b/hosts/rotterdam.nix new file mode 100644 index 0000000..8e41f04 --- /dev/null +++ b/hosts/rotterdam.nix @@ -0,0 +1,12 @@ +{ ... }: + +{ + networking.hostName = "rotterdam"; + + imports = [ + ./rotterdam + ./modules + ]; + + nix.nixPath = [ "nixos-config=${./rotterdam.nix}" ]; +} diff --git a/hosts/rotterdam/boot.nix b/hosts/rotterdam/boot.nix new file mode 100644 index 0000000..44dd48f --- /dev/null +++ b/hosts/rotterdam/boot.nix @@ -0,0 +1,35 @@ +{ pkgs, ... }: + +let + qubesnsh = pkgs.writeTextFile { + name = "qubes.nsh"; + text = "HD1f65535a1:EFI\\qubes\\grubx64.efi"; + }; +in + +{ + boot = { + kernelParams = [ + "processor.max_cstate=1" # Fixes bug where ryzen cpus freeze when in highest C state + "clearcpuid=514" + # Fixes amdgpu freezing + "amdgpu.noretry=0" + "amdgpu.ppfeaturemask=0xfffd3fff" + "amdgpu.gpu_recovery=1" + "amdgpu.lockup_timeout=1000" + ]; + # QubesOS boot entry + loader.systemd-boot = { + extraFiles = { + "efi/edk2-shell/shell.efi" = "${pkgs.edk2-uefi-shell}/shell.efi"; + "qubes.nsh" = qubesnsh; + }; + extraEntries."qubes.conf" = '' + title Qubes OS + efi /efi/edk2-shell/shell.efi + options -nointerrupt qubes.nsh + sort-key ab + ''; + }; + }; +} diff --git a/hosts/desktops/rotterdam/default.nix b/hosts/rotterdam/default.nix similarity index 54% rename from hosts/desktops/rotterdam/default.nix rename to hosts/rotterdam/default.nix index eedd2b4..6671420 100644 --- a/hosts/desktops/rotterdam/default.nix +++ b/hosts/rotterdam/default.nix @@ -2,7 +2,11 @@ { imports = [ - ./hardware-configuration.nix + ./boot.nix ./ephermal.nix + ./hardware-configuration.nix + ./hardware.nix + ./programs.nix + ./services.nix ]; } diff --git a/hosts/desktops/rotterdam/ephermal.nix b/hosts/rotterdam/ephermal.nix similarity index 100% rename from hosts/desktops/rotterdam/ephermal.nix rename to hosts/rotterdam/ephermal.nix diff --git a/hosts/desktops/rotterdam/hardware-configuration.nix b/hosts/rotterdam/hardware-configuration.nix similarity index 88% rename from hosts/desktops/rotterdam/hardware-configuration.nix rename to hosts/rotterdam/hardware-configuration.nix index 524d0ab..169c53f 100644 --- a/hosts/desktops/rotterdam/hardware-configuration.nix +++ b/hosts/rotterdam/hardware-configuration.nix @@ -72,18 +72,8 @@ "compress=zstd" ]; }; - "/swap" = { - device = "/dev/disk/by-uuid/3287dbc3-c0fa-4096-a0b3-59b017cfecc8"; - fsType = "btrfs"; - options = [ - "subvol=@swap" - "noatime" - ]; - }; }; - swapDevices = [ { device = "/swap/swapfile"; } ]; - networking.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; diff --git a/hosts/rotterdam/hardware.nix b/hosts/rotterdam/hardware.nix new file mode 100644 index 0000000..495a78b --- /dev/null +++ b/hosts/rotterdam/hardware.nix @@ -0,0 +1,13 @@ +{ pkgs, ... }: + +{ + hardware = { + amdgpu = { + opencl.enable = true; + amdvlk.enable = true; + }; + graphics.extraPackages = with pkgs; [ rocmPackages.clr.icd ]; + }; + + systemd.targets.hibernate.enable = false; # disable non-functional hibernate +} diff --git a/hosts/rotterdam/programs.nix b/hosts/rotterdam/programs.nix new file mode 100644 index 0000000..9f624a1 --- /dev/null +++ b/hosts/rotterdam/programs.nix @@ -0,0 +1,33 @@ +{ pkgs, ... }: + +let + reboot-into-qubes = pkgs.makeDesktopItem { + name = "reboot-into-qubes"; + icon = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/vinceliuice/Qogir-icon-theme/31f267e1f5fd4e9596bfd78dfb41a03d3a9f33ee/src/scalable/apps/distributor-logo-qubes.svg"; + sha256 = "sha256-QbHr7s5Wcs7uFtfqZctMyS0iDbMfiiZOKy2nHhDOfn0="; + }; + desktopName = "Qubes OS"; + genericName = "Reboot into Qubes OS"; + categories = [ "System" ]; + startupNotify = true; + exec = pkgs.writeShellScript "reboot-into-qubes" '' + ${pkgs.yad}/bin/yad --form \ + --title="Qubes OS" \ + --image distributor-logo-qubes \ + --text "Are you sure you want to reboot into Qubes OS?" \ + --button="Yes:0" --button="Cancel:1" + if [ $? -eq 0 ]; then + systemctl reboot --boot-loader-entry=qubes.conf + fi + ''; + }; +in + +{ + environment.systemPackages = [ reboot-into-qubes ]; + + services.flatpak.packages = [ "net.retrodeck.retrodeck" ]; + + programs.steam.dedicatedServer.openFirewall = true; +} diff --git a/hosts/rotterdam/services.nix b/hosts/rotterdam/services.nix new file mode 100644 index 0000000..5483b5d --- /dev/null +++ b/hosts/rotterdam/services.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + services.keyd = { + enable = true; + keyboards.main = { + ids = [ "5653:0001" ]; + settings.main = { + esc = "overload(meta, esc)"; + }; + }; + }; +}