From 7f26288284429e2f186d7dc61de716dbd36ef8c4 Mon Sep 17 00:00:00 2001 From: ene Date: Mon, 20 Feb 2023 01:01:13 +0100 Subject: Feat(flake): Reorder hosts --- hosts/apzu/configuration.nix | 19 +++++++++++++++++++ hosts/apzu/hardware/cpu.nix | 4 ++++ hosts/apzu/hardware/default.nix | 28 ++++++++++++++++++++++++++++ hosts/apzu/hardware/gpu.nix | 15 +++++++++++++++ hosts/apzu/networking.nix | 14 ++++++++++++++ hosts/desktop/configuration.nix | 21 --------------------- hosts/desktop/hardware/cpu.nix | 4 ---- hosts/desktop/hardware/default.nix | 28 ---------------------------- hosts/desktop/hardware/gpu.nix | 19 ------------------- hosts/desktop/networking.nix | 14 -------------- hosts/hostinfo.toml | 11 +++++++++++ hosts/laptop/configuration.nix | 19 ------------------- hosts/laptop/hardware/cpu.nix | 4 ---- hosts/laptop/hardware/default.nix | 28 ---------------------------- hosts/laptop/hardware/gpu.nix | 15 --------------- hosts/laptop/networking.nix | 14 -------------- hosts/tiamat/configuration.nix | 21 +++++++++++++++++++++ hosts/tiamat/hardware/cpu.nix | 4 ++++ hosts/tiamat/hardware/default.nix | 28 ++++++++++++++++++++++++++++ hosts/tiamat/hardware/gpu.nix | 19 +++++++++++++++++++ hosts/tiamat/networking.nix | 14 ++++++++++++++ 21 files changed, 177 insertions(+), 166 deletions(-) create mode 100644 hosts/apzu/configuration.nix create mode 100644 hosts/apzu/hardware/cpu.nix create mode 100644 hosts/apzu/hardware/default.nix create mode 100644 hosts/apzu/hardware/gpu.nix create mode 100644 hosts/apzu/networking.nix delete mode 100644 hosts/desktop/configuration.nix delete mode 100644 hosts/desktop/hardware/cpu.nix delete mode 100644 hosts/desktop/hardware/default.nix delete mode 100644 hosts/desktop/hardware/gpu.nix delete mode 100644 hosts/desktop/networking.nix create mode 100644 hosts/hostinfo.toml delete mode 100644 hosts/laptop/configuration.nix delete mode 100644 hosts/laptop/hardware/cpu.nix delete mode 100644 hosts/laptop/hardware/default.nix delete mode 100644 hosts/laptop/hardware/gpu.nix delete mode 100644 hosts/laptop/networking.nix create mode 100644 hosts/tiamat/configuration.nix create mode 100644 hosts/tiamat/hardware/cpu.nix create mode 100644 hosts/tiamat/hardware/default.nix create mode 100644 hosts/tiamat/hardware/gpu.nix create mode 100644 hosts/tiamat/networking.nix (limited to 'hosts') diff --git a/hosts/apzu/configuration.nix b/hosts/apzu/configuration.nix new file mode 100644 index 00000000..8e78949b --- /dev/null +++ b/hosts/apzu/configuration.nix @@ -0,0 +1,19 @@ +# vim: ts=2 +{ + config, + lib, + nixpkgs, + home-manager, + ... +}: { + imports = [ + ./hardware + ./networking.nix + + ../../system + + ../../services + ]; + + system.stateVersion = "23.05"; +} diff --git a/hosts/apzu/hardware/cpu.nix b/hosts/apzu/hardware/cpu.nix new file mode 100644 index 00000000..2d7232cd --- /dev/null +++ b/hosts/apzu/hardware/cpu.nix @@ -0,0 +1,4 @@ +{config, ...}: { + powerManagement.cpuFreqGovernor = "powersave"; + hardware.cpu.amd.updateMicrocode = true; # Why not? +} diff --git a/hosts/apzu/hardware/default.nix b/hosts/apzu/hardware/default.nix new file mode 100644 index 00000000..bd7241b3 --- /dev/null +++ b/hosts/apzu/hardware/default.nix @@ -0,0 +1,28 @@ +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") # TODO is this necessary? + ./cpu.nix + ./gpu.nix + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + system.fileSystemLayouts = { + enable = true; + mainDisk = "/dev/disk/by-uuid/"; + efiDisk = "/dev/disk/by-uuid/"; + }; + + boot = { + kernelModules = ["kvm-amd"]; + + # TODO check this: + initrd.availableKernelModules = ["xhci_pci" "nvme" "rtsx_pci_sdmmc"]; + }; +} diff --git a/hosts/apzu/hardware/gpu.nix b/hosts/apzu/hardware/gpu.nix new file mode 100644 index 00000000..c3df51ae --- /dev/null +++ b/hosts/apzu/hardware/gpu.nix @@ -0,0 +1,15 @@ +{ + config, + pkgs, + lib, + ... +}: { + hardware.opengl.extraPackages = with pkgs; [ + rocm-opencl-icd # open-cl + amdvlk # or directly through mesa + amd-media-driver # libva + ]; + + # Force radv, TODO is this logical? + environment.variables.AMD_VULKAN_ICD = "RADV"; +} diff --git a/hosts/apzu/networking.nix b/hosts/apzu/networking.nix new file mode 100644 index 00000000..d50b3af1 --- /dev/null +++ b/hosts/apzu/networking.nix @@ -0,0 +1,14 @@ +{ + config, + lib, + ... +}: { + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + networking.hostName = "Tiamat"; +} diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix deleted file mode 100644 index 7f68621c..00000000 --- a/hosts/desktop/configuration.nix +++ /dev/null @@ -1,21 +0,0 @@ -# vim: ts=2 -{ - config, - lib, - nixpkgs, - home-manager, - ... -}: { - imports = [ - ./hardware - ./networking.nix - - ../../secrets - - ../../system - - ../../services - ]; - - system.stateVersion = "23.05"; -} diff --git a/hosts/desktop/hardware/cpu.nix b/hosts/desktop/hardware/cpu.nix deleted file mode 100644 index 6859f72a..00000000 --- a/hosts/desktop/hardware/cpu.nix +++ /dev/null @@ -1,4 +0,0 @@ -{config, ...}: { - powerManagement.cpuFreqGovernor = "powersave"; - hardware.cpu.intel.updateMicrocode = true; # Why not? -} diff --git a/hosts/desktop/hardware/default.nix b/hosts/desktop/hardware/default.nix deleted file mode 100644 index bd7241b3..00000000 --- a/hosts/desktop/hardware/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - pkgs, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") # TODO is this necessary? - ./cpu.nix - ./gpu.nix - ]; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - - system.fileSystemLayouts = { - enable = true; - mainDisk = "/dev/disk/by-uuid/"; - efiDisk = "/dev/disk/by-uuid/"; - }; - - boot = { - kernelModules = ["kvm-amd"]; - - # TODO check this: - initrd.availableKernelModules = ["xhci_pci" "nvme" "rtsx_pci_sdmmc"]; - }; -} diff --git a/hosts/desktop/hardware/gpu.nix b/hosts/desktop/hardware/gpu.nix deleted file mode 100644 index 741e8882..00000000 --- a/hosts/desktop/hardware/gpu.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: { - nixpkgs.config.packageOverrides = pkgs: { - vaapiIntel = pkgs.vaapiIntel.override {enableHybridCodec = true;}; - }; - hardware.opengl = { - enable = true; - extraPackages = with pkgs; [ - intel-media-driver # LIBVA_DRIVER_NAME=iHD - vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) - vaapiVdpau - libvdpau-va-gl - ]; - }; -} diff --git a/hosts/desktop/networking.nix b/hosts/desktop/networking.nix deleted file mode 100644 index 17f7c356..00000000 --- a/hosts/desktop/networking.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - config, - lib, - ... -}: { - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; - networking.hostName = "Apzu"; -} diff --git a/hosts/hostinfo.toml b/hosts/hostinfo.toml new file mode 100644 index 00000000..dd8723b9 --- /dev/null +++ b/hosts/hostinfo.toml @@ -0,0 +1,11 @@ +[Tiamat] +description = "This is my main desktop" + +[Apzu] +description = "This is my light laptop, with modern hardware" + +[Mummu] +description = "This is my older and heavier laptop" + +[Spawn] +description = "This is a small compilation target, to get sshkeys for secret unlocking" diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix deleted file mode 100644 index 8e78949b..00000000 --- a/hosts/laptop/configuration.nix +++ /dev/null @@ -1,19 +0,0 @@ -# vim: ts=2 -{ - config, - lib, - nixpkgs, - home-manager, - ... -}: { - imports = [ - ./hardware - ./networking.nix - - ../../system - - ../../services - ]; - - system.stateVersion = "23.05"; -} diff --git a/hosts/laptop/hardware/cpu.nix b/hosts/laptop/hardware/cpu.nix deleted file mode 100644 index 2d7232cd..00000000 --- a/hosts/laptop/hardware/cpu.nix +++ /dev/null @@ -1,4 +0,0 @@ -{config, ...}: { - powerManagement.cpuFreqGovernor = "powersave"; - hardware.cpu.amd.updateMicrocode = true; # Why not? -} diff --git a/hosts/laptop/hardware/default.nix b/hosts/laptop/hardware/default.nix deleted file mode 100644 index bd7241b3..00000000 --- a/hosts/laptop/hardware/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - pkgs, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") # TODO is this necessary? - ./cpu.nix - ./gpu.nix - ]; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - - system.fileSystemLayouts = { - enable = true; - mainDisk = "/dev/disk/by-uuid/"; - efiDisk = "/dev/disk/by-uuid/"; - }; - - boot = { - kernelModules = ["kvm-amd"]; - - # TODO check this: - initrd.availableKernelModules = ["xhci_pci" "nvme" "rtsx_pci_sdmmc"]; - }; -} diff --git a/hosts/laptop/hardware/gpu.nix b/hosts/laptop/hardware/gpu.nix deleted file mode 100644 index c3df51ae..00000000 --- a/hosts/laptop/hardware/gpu.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: { - hardware.opengl.extraPackages = with pkgs; [ - rocm-opencl-icd # open-cl - amdvlk # or directly through mesa - amd-media-driver # libva - ]; - - # Force radv, TODO is this logical? - environment.variables.AMD_VULKAN_ICD = "RADV"; -} diff --git a/hosts/laptop/networking.nix b/hosts/laptop/networking.nix deleted file mode 100644 index d50b3af1..00000000 --- a/hosts/laptop/networking.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - config, - lib, - ... -}: { - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; - networking.hostName = "Tiamat"; -} diff --git a/hosts/tiamat/configuration.nix b/hosts/tiamat/configuration.nix new file mode 100644 index 00000000..7f68621c --- /dev/null +++ b/hosts/tiamat/configuration.nix @@ -0,0 +1,21 @@ +# vim: ts=2 +{ + config, + lib, + nixpkgs, + home-manager, + ... +}: { + imports = [ + ./hardware + ./networking.nix + + ../../secrets + + ../../system + + ../../services + ]; + + system.stateVersion = "23.05"; +} diff --git a/hosts/tiamat/hardware/cpu.nix b/hosts/tiamat/hardware/cpu.nix new file mode 100644 index 00000000..6859f72a --- /dev/null +++ b/hosts/tiamat/hardware/cpu.nix @@ -0,0 +1,4 @@ +{config, ...}: { + powerManagement.cpuFreqGovernor = "powersave"; + hardware.cpu.intel.updateMicrocode = true; # Why not? +} diff --git a/hosts/tiamat/hardware/default.nix b/hosts/tiamat/hardware/default.nix new file mode 100644 index 00000000..bd7241b3 --- /dev/null +++ b/hosts/tiamat/hardware/default.nix @@ -0,0 +1,28 @@ +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") # TODO is this necessary? + ./cpu.nix + ./gpu.nix + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + system.fileSystemLayouts = { + enable = true; + mainDisk = "/dev/disk/by-uuid/"; + efiDisk = "/dev/disk/by-uuid/"; + }; + + boot = { + kernelModules = ["kvm-amd"]; + + # TODO check this: + initrd.availableKernelModules = ["xhci_pci" "nvme" "rtsx_pci_sdmmc"]; + }; +} diff --git a/hosts/tiamat/hardware/gpu.nix b/hosts/tiamat/hardware/gpu.nix new file mode 100644 index 00000000..741e8882 --- /dev/null +++ b/hosts/tiamat/hardware/gpu.nix @@ -0,0 +1,19 @@ +{ + config, + pkgs, + lib, + ... +}: { + nixpkgs.config.packageOverrides = pkgs: { + vaapiIntel = pkgs.vaapiIntel.override {enableHybridCodec = true;}; + }; + hardware.opengl = { + enable = true; + extraPackages = with pkgs; [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + vaapiVdpau + libvdpau-va-gl + ]; + }; +} diff --git a/hosts/tiamat/networking.nix b/hosts/tiamat/networking.nix new file mode 100644 index 00000000..17f7c356 --- /dev/null +++ b/hosts/tiamat/networking.nix @@ -0,0 +1,14 @@ +{ + config, + lib, + ... +}: { + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + networking.hostName = "Apzu"; +} -- cgit 1.4.1