From 9c03712908d181ce450c729095eed2927b4a5726 Mon Sep 17 00:00:00 2001 From: Jimbo Date: Sun, 24 Nov 2024 16:53:49 -0500 Subject: [PATCH] Move variables to more convenient folder --- hosts/extern/boot/default.nix | 33 +++++- hosts/extern/default.nix | 4 +- hosts/extern/disko/default.nix | 96 ++++++++++++++++++ hosts/extern/filesystems/default.nix | 11 ++ hosts/extern/hardware/default.nix | 29 +----- hosts/extern/nixmodules/default.nix | 7 -- modules/extras/default.nix | 7 ++ .../extras/overlays}/default.nix | 0 .../extras/overlays}/packages/default.nix | 0 .../overlays}/packages/hlsdk/default.nix | 0 .../packages/xash3d/change-zip-date.patch | 0 .../overlays}/packages/xash3d/default.nix | 0 .../extras/overlays}/unstable/default.nix | 0 .../extras/variables}/default.nix | 0 .../extras/variables}/displays/default.nix | 0 .../extras/variables}/domains/default.nix | 0 .../extras/variables}/ips/default.nix | 0 .../extras/variables}/look/border/default.nix | 0 .../extras/variables}/look/colors/default.nix | 0 .../extras/variables}/look/default.nix | 0 .../extras/variables}/look/fonts/default.nix | 0 .../extras/variables}/workspaces/default.nix | 0 modules/home/default.nix | 3 +- .../programs/terminal/carapace/default.nix | 4 + modules/home/programs/terminal/default.nix | 1 + .../home/programs/terminal/zsh/default.nix | 3 +- modules/system/default.nix | 3 +- .../system/settings/documentation/default.nix | 2 - modules/system/settings/minimal/default.nix | 1 + variables/secrets/default.nix | Bin 1986 -> 0 bytes 30 files changed, 159 insertions(+), 45 deletions(-) create mode 100644 hosts/extern/disko/default.nix create mode 100644 hosts/extern/filesystems/default.nix delete mode 100644 hosts/extern/nixmodules/default.nix create mode 100644 modules/extras/default.nix rename {overlays => modules/extras/overlays}/default.nix (100%) rename {overlays => modules/extras/overlays}/packages/default.nix (100%) rename {overlays => modules/extras/overlays}/packages/hlsdk/default.nix (100%) rename {overlays => modules/extras/overlays}/packages/xash3d/change-zip-date.patch (100%) rename {overlays => modules/extras/overlays}/packages/xash3d/default.nix (100%) rename {overlays => modules/extras/overlays}/unstable/default.nix (100%) rename {variables => modules/extras/variables}/default.nix (100%) rename {variables => modules/extras/variables}/displays/default.nix (100%) rename {variables => modules/extras/variables}/domains/default.nix (100%) rename {variables => modules/extras/variables}/ips/default.nix (100%) rename {variables => modules/extras/variables}/look/border/default.nix (100%) rename {variables => modules/extras/variables}/look/colors/default.nix (100%) rename {variables => modules/extras/variables}/look/default.nix (100%) rename {variables => modules/extras/variables}/look/fonts/default.nix (100%) rename {variables => modules/extras/variables}/workspaces/default.nix (100%) create mode 100644 modules/home/programs/terminal/carapace/default.nix delete mode 100644 variables/secrets/default.nix diff --git a/hosts/extern/boot/default.nix b/hosts/extern/boot/default.nix index ece0152c..972bff67 100644 --- a/hosts/extern/boot/default.nix +++ b/hosts/extern/boot/default.nix @@ -1,7 +1,36 @@ { config, pkgs, ... }: -{ +let + commonKernelParams = [ + # VM/GPU passthrough + "amd_iommu=on" + "iommu=pt" + "nested=1" + + # Virtualization nonsense + "transparent_hugepage=never" + + # Isolate devices into IOMMU groups + "pcie_acs_override=downstream,multifunction" + "pci=routeirq" + ]; +in { boot = { - kernelPackages = pkgs.linuxPackages_latest; + # Must be Zen for IOMMU isolation + kernelPackages = pkgs.unstable.linuxPackages_zen; kernel.sysctl."vm.max_map_count" = 2147483642; + kernelParams = commonKernelParams ++ [ "vfio-pci.ids=10de:1f82,10de:10fa" ]; + blacklistedKernelModules = [ "pcspkr" ]; + + # Needed for GPU passthrough + initrd.kernelModules = [ + "vfio" + "vfio_pci" + "vfio_iommu_type1" + ]; + }; + + # Use second GPU on boot + specialisation.gputwo.configuration = { + boot.kernelParams = commonKernelParams ++ [ "vfio-pci.ids=10de:2504,10de:228e" ]; }; } diff --git a/hosts/extern/default.nix b/hosts/extern/default.nix index c4a1b519..c1ddb3ad 100644 --- a/hosts/extern/default.nix +++ b/hosts/extern/default.nix @@ -2,13 +2,13 @@ { imports = [ ./boot + ./disko + ./filesystems ./hardware - ./nixmodules ./wireguard ../../modules/system ]; - boot.loader.systemd-boot.enable = lib.mkForce false; services.btrfs.autoScrub.enable = lib.mkForce false; system.video.nvidia.enable = true; diff --git a/hosts/extern/disko/default.nix b/hosts/extern/disko/default.nix new file mode 100644 index 00000000..e8471a37 --- /dev/null +++ b/hosts/extern/disko/default.nix @@ -0,0 +1,96 @@ +{ disko, config, ... }: +{ + imports = [ disko.nixosModules.disko ]; + + disko.devices = { + disk = { + "${config.networking.hostName}" = { + type = "disk"; + device = "/dev/sdg"; + content = { + type = "gpt"; + partitions = { + ESP = { + priority = 1; + size = "2G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "${config.networking.hostName}-disk"; + settings.allowDiscards = true; + passwordFile = "/tmp/secret.key"; + content = { + type = "lvm_pv"; + vg = "${config.networking.hostName}"; + }; + }; + }; + }; + }; + }; + }; + + nodev = { + "/" = { + fsType = "tmpfs"; + mountOptions = [ "size=4G" ]; + }; + }; + + lvm_vg = { + "${config.networking.hostName}" = { + type = "lvm_vg"; + lvs = { + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; + }; + + # Impermanence + "/persist" = { + mountpoint = "/persist"; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; + }; + "/persist/.snapshots" = { }; + + "/jimbo" = { + mountpoint = "/persist/home/jimbo"; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; + }; + "/jimbo/.snapshots" = { }; + }; + }; + }; + swap = { + size = "8G"; + content = { + type = "swap"; + discardPolicy = "both"; + }; + }; + }; + }; + }; + }; + + # Needed for impermanence + fileSystems = { + "/persist".neededForBoot = true; + "/persist/home/jimbo".neededForBoot = true; + }; +} diff --git a/hosts/extern/filesystems/default.nix b/hosts/extern/filesystems/default.nix new file mode 100644 index 00000000..60aeaf32 --- /dev/null +++ b/hosts/extern/filesystems/default.nix @@ -0,0 +1,11 @@ +{ config, ... }: +{ + fileSystems = { + # Remote + "/home/jimbo/JimboNFS" = { + device = "10.100.0.1:/export/JimboNFS"; + fsType = "nfs4"; + options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ]; + }; + }; +} diff --git a/hosts/extern/hardware/default.nix b/hosts/extern/hardware/default.nix index eb19a423..807c3d41 100644 --- a/hosts/extern/hardware/default.nix +++ b/hosts/extern/hardware/default.nix @@ -1,32 +1,7 @@ { config, lib, modulesPath, ... }: { - imports = [ (modulesPath + "/profiles/all-hardware.nix") ]; - - boot = { - initrd = { - availableKernelModules = [ - "nvme" - "xhci_pci" - "ahci" - "usbhid" - "uas" - "usb_storage" - "sd_mod" - ]; - kernelModules = [ - "dm-snapshot" - ]; - }; - }; - - fileSystems = { - # Remote - "/home/jimbo/JimboNFS" = { - device = "10.100.0.1:/export/JimboNFS"; - fsType = "nfs4"; - options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ]; - }; - }; + boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" "sd_mod" ]; + boot.kernelModules = [ "dm-snapshot" ]; networking.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; diff --git a/hosts/extern/nixmodules/default.nix b/hosts/extern/nixmodules/default.nix deleted file mode 100644 index c1b57a5d..00000000 --- a/hosts/extern/nixmodules/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ modulesPath, ... }: -{ - imports = [ - "${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix" - "${modulesPath}/installer/cd-dvd/channel.nix" - ]; -} diff --git a/modules/extras/default.nix b/modules/extras/default.nix new file mode 100644 index 00000000..82d00152 --- /dev/null +++ b/modules/extras/default.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + imports = [ + ./overlays + ./variables + ]; +} diff --git a/overlays/default.nix b/modules/extras/overlays/default.nix similarity index 100% rename from overlays/default.nix rename to modules/extras/overlays/default.nix diff --git a/overlays/packages/default.nix b/modules/extras/overlays/packages/default.nix similarity index 100% rename from overlays/packages/default.nix rename to modules/extras/overlays/packages/default.nix diff --git a/overlays/packages/hlsdk/default.nix b/modules/extras/overlays/packages/hlsdk/default.nix similarity index 100% rename from overlays/packages/hlsdk/default.nix rename to modules/extras/overlays/packages/hlsdk/default.nix diff --git a/overlays/packages/xash3d/change-zip-date.patch b/modules/extras/overlays/packages/xash3d/change-zip-date.patch similarity index 100% rename from overlays/packages/xash3d/change-zip-date.patch rename to modules/extras/overlays/packages/xash3d/change-zip-date.patch diff --git a/overlays/packages/xash3d/default.nix b/modules/extras/overlays/packages/xash3d/default.nix similarity index 100% rename from overlays/packages/xash3d/default.nix rename to modules/extras/overlays/packages/xash3d/default.nix diff --git a/overlays/unstable/default.nix b/modules/extras/overlays/unstable/default.nix similarity index 100% rename from overlays/unstable/default.nix rename to modules/extras/overlays/unstable/default.nix diff --git a/variables/default.nix b/modules/extras/variables/default.nix similarity index 100% rename from variables/default.nix rename to modules/extras/variables/default.nix diff --git a/variables/displays/default.nix b/modules/extras/variables/displays/default.nix similarity index 100% rename from variables/displays/default.nix rename to modules/extras/variables/displays/default.nix diff --git a/variables/domains/default.nix b/modules/extras/variables/domains/default.nix similarity index 100% rename from variables/domains/default.nix rename to modules/extras/variables/domains/default.nix diff --git a/variables/ips/default.nix b/modules/extras/variables/ips/default.nix similarity index 100% rename from variables/ips/default.nix rename to modules/extras/variables/ips/default.nix diff --git a/variables/look/border/default.nix b/modules/extras/variables/look/border/default.nix similarity index 100% rename from variables/look/border/default.nix rename to modules/extras/variables/look/border/default.nix diff --git a/variables/look/colors/default.nix b/modules/extras/variables/look/colors/default.nix similarity index 100% rename from variables/look/colors/default.nix rename to modules/extras/variables/look/colors/default.nix diff --git a/variables/look/default.nix b/modules/extras/variables/look/default.nix similarity index 100% rename from variables/look/default.nix rename to modules/extras/variables/look/default.nix diff --git a/variables/look/fonts/default.nix b/modules/extras/variables/look/fonts/default.nix similarity index 100% rename from variables/look/fonts/default.nix rename to modules/extras/variables/look/fonts/default.nix diff --git a/variables/workspaces/default.nix b/modules/extras/variables/workspaces/default.nix similarity index 100% rename from variables/workspaces/default.nix rename to modules/extras/variables/workspaces/default.nix diff --git a/modules/home/default.nix b/modules/home/default.nix index c1f6d018..d0600064 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -7,8 +7,7 @@ ./settings ./wms ./users - ../../overlays - ../../variables + ../extras # Imports nur.nixosModules.nur diff --git a/modules/home/programs/terminal/carapace/default.nix b/modules/home/programs/terminal/carapace/default.nix new file mode 100644 index 00000000..625d54bf --- /dev/null +++ b/modules/home/programs/terminal/carapace/default.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + programs.carapace.enable = true; +} diff --git a/modules/home/programs/terminal/default.nix b/modules/home/programs/terminal/default.nix index 680d658d..6cc9c7c7 100644 --- a/modules/home/programs/terminal/default.nix +++ b/modules/home/programs/terminal/default.nix @@ -1,6 +1,7 @@ { ... }: { imports = [ + ./carapace ./fastfetch ./git ./ncmpcpp diff --git a/modules/home/programs/terminal/zsh/default.nix b/modules/home/programs/terminal/zsh/default.nix index 42890673..2acc44f9 100644 --- a/modules/home/programs/terminal/zsh/default.nix +++ b/modules/home/programs/terminal/zsh/default.nix @@ -2,6 +2,7 @@ { programs.zsh = { enable = true; + enableCompletion = false; autosuggestion.enable = true; syntaxHighlighting.enable = true; oh-my-zsh = { @@ -34,9 +35,9 @@ seneca = "ssh jhampton1@matrix.senecapolytechnic.ca"; }; initExtra = '' + ${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin; pfetch source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh source ${pkgs.zsh-you-should-use}/share/zsh/plugins/you-should-use/you-should-use.plugin.zsh - ${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin; pfetch setopt HIST_IGNORE_SPACE setopt RM_STAR_WAIT ''; diff --git a/modules/system/default.nix b/modules/system/default.nix index 831a9c30..893b2d3e 100644 --- a/modules/system/default.nix +++ b/modules/system/default.nix @@ -7,8 +7,7 @@ ./programs ./services ./settings - ../../overlays - ../../variables + ../extras ]; time.timeZone = "America/Toronto"; diff --git a/modules/system/settings/documentation/default.nix b/modules/system/settings/documentation/default.nix index 13fb7e14..84dc6969 100644 --- a/modules/system/settings/documentation/default.nix +++ b/modules/system/settings/documentation/default.nix @@ -5,6 +5,4 @@ info.enable = false; nixos.enable = false; }; - - programs.command-not-found.enable = true; } diff --git a/modules/system/settings/minimal/default.nix b/modules/system/settings/minimal/default.nix index 0b9712ef..00eade75 100644 --- a/modules/system/settings/minimal/default.nix +++ b/modules/system/settings/minimal/default.nix @@ -6,5 +6,6 @@ }; programs.less.lessopen = null; + services.logrotate.enable = false; } diff --git a/variables/secrets/default.nix b/variables/secrets/default.nix deleted file mode 100644 index 1cbcd891b21536d4e0ab6093f52a8b702ce32d52..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1986 zcmZQ@_Y83kiVO&0*jwG2tiE}o+PsvkaE1J0e^aZ1-d-E7D}pQKc{bIp{`hR=2HSw1 zH}~IYdst8XklWVf!fI#8wBEq)%je~v?5s8h-wP~>zy8`m_WepGom-~QrnjFAc~I;3 z^5ltRS=JqgPn@mI>)EjXWOC}u6}Ofxi`(0};@6R7O1B@mYRYqjFL+jRQ9Zo)^6TBl zb*9x!ux5ShWHPNtaN5*sx^FGRO(%s1p1-_is_*ir|8BP_lx|kLTs8mwvqf@MOP^J2 z|994D)uu-hclOWn`P|rYbaR52)^F|Yy^rMoPhIl)k3!Qi&eT(49chv}f~^6sj{fRN z-K@Y9bbb1*yFHP`e%1`Le+EUxJYA!0QMXWR?Pe3j!*W%T?{iwR?ggDZmMVOs^z!a> z#R>OH*YB9H{pWG1w~tou%bBYh6_cFzRPgw}Pr0@;9$b3wf9sdak>i5?DW2D7FS)<{ zc*pdj+!Pe#Lp@ z-M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