diff --git a/deploy.nix b/deploy.nix index bc4f712..171fa26 100644 --- a/deploy.nix +++ b/deploy.nix @@ -19,6 +19,10 @@ let url = https://github.com/NixOS/nixpkgs; shallow = true; }; + nixos-hardware.git = { + ref = sources.nixos-hardware.rev; + url = https://github.com/NixOS/nixos-hardware; + }; config.file = { path = toString ./.; filters = [ diff --git a/machines/nunotaba/configuration.nix b/machines/nunotaba/configuration.nix index 8269011..7d53761 100644 --- a/machines/nunotaba/configuration.nix +++ b/machines/nunotaba/configuration.nix @@ -8,14 +8,11 @@ ]; sbruder = { - cpu.intel.enable = true; docker.enable = true; games.enable = true; - gpu.intel.enable = true; gui.enable = true; media-proxy.enable = true; restic.enable = true; - ssd.enable = true; unfree.allowSoftware = true; wireguard.home = { enable = true; diff --git a/machines/nunotaba/hardware-configuration.nix b/machines/nunotaba/hardware-configuration.nix index 9c12924..b1910ef 100644 --- a/machines/nunotaba/hardware-configuration.nix +++ b/machines/nunotaba/hardware-configuration.nix @@ -3,6 +3,8 @@ { imports = [ (modulesPath + "/installer/scan/not-detected.nix") + + ]; boot = { @@ -27,6 +29,7 @@ "/" = { device = "/dev/disk/by-uuid/8937d1ac-23cb-456f-9c16-e348acc66bb7"; fsType = "ext4"; + options = [ "discard" "noatime" ]; }; "/boot" = { @@ -44,4 +47,8 @@ # Most of the time I want to use both screens at the same time and suspend it # regularily by closing the lid services.logind.lidSwitchDocked = config.services.logind.lidSwitch; + + hardware.opengl.extraPackages = with pkgs; [ + beignet # OpenCL for old intel GPU + ]; } diff --git a/machines/sayuri/configuration.nix b/machines/sayuri/configuration.nix index 92f7be4..2740c1c 100644 --- a/machines/sayuri/configuration.nix +++ b/machines/sayuri/configuration.nix @@ -8,10 +8,8 @@ ]; sbruder = { - cpu.intel.enable = true; docker.enable = true; games.enable = true; - gpu.amd.enable = true; gui.enable = true; media-proxy.enable = true; restic = { @@ -20,7 +18,6 @@ "/data" ]; }; - ssd.enable = true; unfree.allowSoftware = true; wireguard.home = { enable = true; diff --git a/machines/sayuri/hardware-configuration.nix b/machines/sayuri/hardware-configuration.nix index e76f56d..0b1d4f7 100644 --- a/machines/sayuri/hardware-configuration.nix +++ b/machines/sayuri/hardware-configuration.nix @@ -3,6 +3,8 @@ { imports = [ (modulesPath + "/installer/scan/not-detected.nix") + + ]; boot = { @@ -27,6 +29,7 @@ "/" = { device = "/dev/disk/by-uuid/024e31ab-aa98-4070-95be-7980043541ac"; fsType = "ext4"; + options = [ "discard" "noatime" ]; }; "/boot" = { @@ -50,4 +53,16 @@ ]; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + + # GPU + hardware.opengl.extraPackages = with pkgs; [ + amdvlk + rocm-opencl-icd + ]; + + environment.systemPackages = with pkgs; [ + clinfo + radeontop + rocm-smi + ]; } diff --git a/modules/cpu/default.nix b/modules/cpu/default.nix deleted file mode 100644 index 7934478..0000000 --- a/modules/cpu/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - imports = [ - ./intel.nix - ]; -} diff --git a/modules/cpu/intel.nix b/modules/cpu/intel.nix deleted file mode 100644 index ed1efd4..0000000 --- a/modules/cpu/intel.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.sbruder.cpu.intel; -in -{ - options.sbruder.cpu.intel.enable = lib.mkEnableOption "intel cpu configuration"; - - config = lib.mkIf cfg.enable { - hardware.cpu.intel.updateMicrocode = true; - }; -} diff --git a/modules/default.nix b/modules/default.nix index 9e6cb88..fe1c869 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -34,11 +34,9 @@ in # All modules are imported but non-essential modules are activated by # configuration options imports = [ - ./cpu ./cups.nix ./docker.nix ./fonts.nix - ./gpu ./grub.nix ./gui.nix ./initrd-ssh.nix @@ -52,7 +50,6 @@ in ./pulseaudio.nix ./restic.nix ./secrets.nix - ./ssd.nix ./ssh.nix ./tools.nix ./udev.nix diff --git a/modules/gpu/amd.nix b/modules/gpu/amd.nix deleted file mode 100644 index 8bfd356..0000000 --- a/modules/gpu/amd.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, lib, pkgs, ... }: -let - cfg = config.sbruder.gpu.amd; -in -{ - options.sbruder.gpu.amd.enable = lib.mkEnableOption "amd gpu configuration"; - - config = lib.mkIf cfg.enable { - hardware.opengl.extraPackages = with pkgs; [ - amdvlk - rocm-opencl-icd - ]; - - environment.systemPackages = with pkgs; [ - clinfo - radeontop - rocm-smi - ]; - - # force RGB otput for HDMI (otherwise the default is YCbCr) - # see https://gitlab.freedesktop.org/drm/amd/-/issues/476 - #boot.kernelPatches = [ - # { - # name = "force-rgb"; - # patch = pkgs.fetchpatch { - # url = "https://gitlab.freedesktop.org/drm/amd/uploads/99b3664a49ec759075bde5c454e1d7c2/0001-force-rgb.patch"; - # sha256 = "03dhnlxx9vlj1x8izh3c3j4r9s75q47nx8kf6mbdxqfy3cj96mjm"; - # }; - # } - #]; - }; -} diff --git a/modules/gpu/default.nix b/modules/gpu/default.nix deleted file mode 100644 index 68eb19d..0000000 --- a/modules/gpu/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ lib, ... }: -{ - imports = [ - ./amd.nix - ./intel.nix - ]; -} diff --git a/modules/gpu/intel.nix b/modules/gpu/intel.nix deleted file mode 100644 index 103a6ed..0000000 --- a/modules/gpu/intel.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ config, lib, pkgs, ... }: -let - cfg = config.sbruder.gpu.intel; -in -{ - options.sbruder.gpu.intel.enable = lib.mkEnableOption "intel gpu configuration"; - - config = lib.mkIf cfg.enable { - hardware.opengl.extraPackages = with pkgs; [ - beignet - vaapiIntel - ]; - }; -} diff --git a/modules/ssd.nix b/modules/ssd.nix deleted file mode 100644 index 3230b0c..0000000 --- a/modules/ssd.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.sbruder.ssd; -in -{ - options.sbruder.ssd = { - enable = lib.mkEnableOption "ssd optimisations"; - fileSystems = lib.mkOption { - type = lib.types.listOf lib.types.str; - default = [ "/" ]; - description = "List of file systems to apply optimisations to"; - }; - }; - - config = lib.mkIf cfg.enable { - fileSystems = builtins.listToAttrs - (builtins.map - (fs: { - name = fs; - value = { - options = [ - "discard" - "noatime" - "nodiratime" - ]; - }; - }) - cfg.fileSystems); - - services.fstrim.enable = true; - }; -} diff --git a/nix/sources.json b/nix/sources.json index 178e3cd..049dd91 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -23,6 +23,18 @@ "url": "https://github.com/krebs/krops/archive/c2fa48550f2bb46009b9cecdb9ac838dc402ce19.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, + "nixos-hardware": { + "branch": "master", + "description": "A collection of NixOS modules covering hardware quirks.", + "homepage": "", + "owner": "nixos", + "repo": "nixos-hardware", + "rev": "a0d8383c422f85f37fccee5af74b1cb4b52287d9", + "sha256": "08w3z19alqrnwpaxppcrlpyw7y5060xha81abhndaxryzvcld2hl", + "type": "tarball", + "url": "https://github.com/nixos/nixos-hardware/archive/a0d8383c422f85f37fccee5af74b1cb4b52287d9.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, "nixpkgs": { "branch": "nixos-20.09", "description": "Nix Packages collection",