diff --git a/README.md b/README.md index 3195c03..4d254da 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ # nixos-configuration -When adding a new host: -1. install NixOS via the graphical installer -2. `mv /etc/hardware-configuration ./devicename-hardware-configuration.nix` -3. copy an existing devicename.nix -5. change import to `new-devicename-hardware-configuration.nix` -6. set the hostname and optional imports in `new-devicename.nix` -7. `ln -s ./new-devicename.nix /etc/nixos/configuration.nix` -8. `sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz home-manager` -9. apply +/ +├── modules +│ ├── desktop +│ ├── hardware (includes hostname.nix) +│ └── users +└── hostname.nix (imports modules) + +When adding a new host: `ln -s ./new-devicename.nix /etc/nixos/configuration.nix` + +Use `sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz home-manager` to add home manager support. + diff --git a/hetzner-vpn1.nix b/hetzner-vpn1.nix index 9e42020..d2c2fba 100644 --- a/hetzner-vpn1.nix +++ b/hetzner-vpn1.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{...}: { imports = [ (import ./modules { hostName = "hetzner-vpn1"; diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 7e5f08a..ab3aa05 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -42,6 +42,10 @@ in { programs = { kdeconnect.enable = true; + firefox = { + enable = true; + languagePacks = ["en-US" "de"]; + }; }; # unblock kde connect / gsconnect diff --git a/modules/desktop/gaming.nix b/modules/desktop/gaming.nix index 2c9b6ab..e0ae169 100644 --- a/modules/desktop/gaming.nix +++ b/modules/desktop/gaming.nix @@ -10,6 +10,7 @@ in { config = lib.mkIf isEnabled { hardware.opengl = { + driSupport = true; driSupport32Bit = true; extraPackages = with pkgs; [mangohud]; extraPackages32 = with pkgs; [mangohud]; diff --git a/modules/hardware/amd.nix b/modules/hardware/amd.nix new file mode 100644 index 0000000..d00b99c --- /dev/null +++ b/modules/hardware/amd.nix @@ -0,0 +1,47 @@ +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.my.hardware.amd; +in { + options.my.hardware.amd = { + cpu = lib.mkEnableOption "amd cpu"; + gpu = lib.mkEnableOption "amd gpu"; + radeon = lib.mkEnableOption "amd legacy gpu"; # old hardware, dont judge + }; + + config = lib.mkMerge [ + (lib.mkIf cfg.cpu { + boot.kernelModules = ["kvm-amd"]; + hardware.cpu.amd.updateMicrocode = true; + }) + + (lib.mkIf cfg.gpu { + boot.kernelModules = ["amdgpu"]; + services.xserver.videoDrivers = ["amdgpu"]; + + hardware.opengl = { + extraPackages = with pkgs; [ + amdvlk + ]; + extraPackages32 = with pkgs; [ + driversi686Linux.amdvlk + ]; + }; + + environment.systemPackages = with pkgs; [ + unstable.nvtop-amd + ]; + }) + + (lib.mkIf cfg.radeon { + boot.kernelModules = ["radeon"]; + services.xserver.videoDrivers = ["radeon"]; + environment.systemPackages = with pkgs; [ + radeontop + ]; + }) + ]; +} diff --git a/modules/hardware/amdcpu.nix b/modules/hardware/amdcpu.nix deleted file mode 100644 index 6eedbb1..0000000 --- a/modules/hardware/amdcpu.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: let - isEnabled = config.my.hardware.isAmdCpu; -in { - options.my.hardware.isAmdCpu = lib.mkEnableOption "amd cpu"; - - config = lib.mkIf isEnabled { - boot.kernelModules = ["kvm-amd"]; - hardware.cpu.amd.updateMicrocode = true; - }; -} diff --git a/modules/hardware/amdgpu.nix b/modules/hardware/amdgpu.nix deleted file mode 100644 index 2e4486b..0000000 --- a/modules/hardware/amdgpu.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: let - isEnabled = config.my.hardware.isAmdGpu; -in { - options.my.hardware.isAmdGpu = lib.mkEnableOption "amd gpu"; - - config = lib.mkIf isEnabled { - environment.systemPackages = with pkgs; [ - radeontop - amdvlk - ]; - }; -} diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix index a6dfabc..a9a4a84 100644 --- a/modules/hardware/default.nix +++ b/modules/hardware/default.nix @@ -9,9 +9,8 @@ in { (modulesPath + "/installer/scan/not-detected.nix") (builtins.toString ./. + "/${hostName}.nix") ./common-desktop.nix - ./amdcpu.nix - ./amdgpu.nix - ./intelcpu.nix + ./amd.nix + ./intel.nix ]; options.my.modulesCfg.hostName = lib.mkOption { diff --git a/modules/hardware/intel.nix b/modules/hardware/intel.nix new file mode 100644 index 0000000..a2795c2 --- /dev/null +++ b/modules/hardware/intel.nix @@ -0,0 +1,39 @@ +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.my.hardware.intel; +in { + options.my.hardware.intel = { + cpu = lib.mkEnableOption "intel cpu"; + iGpu = lib.mkEnableOption "intel integrated gpu"; + }; + + config = lib.mkMerge [ + (lib.mkIf cfg.cpu { + boot.kernelModules = ["kvm-intel"]; + hardware.cpu.intel.updateMicrocode = true; + }) + (lib.mkIf cfg.iGpu { + hardware.opengl = { + extraPackages = with pkgs; [ + intel-media-driver + vaapiIntel + vaapiVdpau + libvdpau-va-gl + ]; + extraPackages32 = with pkgs.pkgsi686Linux; [ + intel-media-driver + vaapiIntel + vaapiVdpau + libvdpau-va-gl + ]; + }; + environment.systemPackages = with pkgs; [ + unstable.nvtop-intel + ]; + }) + ]; +} diff --git a/modules/hardware/intelcpu.nix b/modules/hardware/intelcpu.nix deleted file mode 100644 index e9d5ba8..0000000 --- a/modules/hardware/intelcpu.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - lib, - config, - ... -}: let - isEnabled = config.my.hardware.isIntelCpu; -in { - options.my.hardware.isIntelCpu = lib.mkEnableOption "intel cpu"; - - config = lib.mkIf isEnabled { - boot.kernelModules = ["kvm-intel"]; - hardware.cpu.intel.updateMicrocode = true; - }; -} diff --git a/modules/hardware/vinzenz-lpt.nix b/modules/hardware/vinzenz-lpt.nix index bec7a08..5f028ef 100644 --- a/modules/hardware/vinzenz-lpt.nix +++ b/modules/hardware/vinzenz-lpt.nix @@ -2,8 +2,11 @@ config = { my.hardware = { enableCommonDesktopSettings = true; - isIntelCpu = true; - isAmdGpu = true; + amd.radeon = true; + intel = { + cpu = true; + iGpu = true; + }; }; boot = { diff --git a/modules/hardware/vinzenz-pc2.nix b/modules/hardware/vinzenz-pc2.nix index 9fdaca7..3f6ce4a 100644 --- a/modules/hardware/vinzenz-pc2.nix +++ b/modules/hardware/vinzenz-pc2.nix @@ -2,8 +2,10 @@ config = { my.hardware = { enableCommonDesktopSettings = true; - isAmdCpu = true; - isAmdGpu = true; + amd = { + cpu = true; + gpu = true; + }; }; boot = { diff --git a/modules/nixpkgs.nix b/modules/nixpkgs.nix index b8299d3..3bb6d9a 100644 --- a/modules/nixpkgs.nix +++ b/modules/nixpkgs.nix @@ -1,6 +1,17 @@ -{...}: { +{config, ...}: let + unstable-commit-sha = "f5892ddac112a1e9b3612c39af1b72987ee5783a"; +in { config = { - nixpkgs.config.allowUnfree = true; + nixpkgs.config = { + allowUnfree = true; + + # make nixos-unstable availiable as 'pkgs.unstable' + packageOverrides = pkgs: { + unstable = import (fetchTarball "https://github.com/nixos/nixpkgs/tarball/${unstable-commit-sha}") { + config = config.nixpkgs.config; + }; + }; + }; system = { stateVersion = "22.11"; diff --git a/modules/users/ronja-home.nix b/modules/users/ronja-home.nix index 3e1982d..aed4e1e 100644 --- a/modules/users/ronja-home.nix +++ b/modules/users/ronja-home.nix @@ -12,8 +12,6 @@ programs = { home-manager.enable = true; - firefox.enable = true; - zsh = { history = { size = 10000; diff --git a/modules/users/vinzenz-home.nix b/modules/users/vinzenz-home.nix index 3ee1b64..04a1f81 100644 --- a/modules/users/vinzenz-home.nix +++ b/modules/users/vinzenz-home.nix @@ -30,7 +30,6 @@ programs = { home-manager.enable = true; - firefox.enable = true; fzf.enable = true; mangohud.enable = true; diff --git a/vinzenz-lpt.nix b/vinzenz-lpt.nix index e184e77..5c5d847 100644 --- a/vinzenz-lpt.nix +++ b/vinzenz-lpt.nix @@ -17,5 +17,10 @@ # flatpak xdg-portal-kde crashes, otherwise this would be global services.flatpak.enable = true; + + # force rendering on dedicated graphics + environment.sessionVariables = rec { + DRI_PRIME = "1"; + }; }; } diff --git a/vinzenz-pc2.nix b/vinzenz-pc2.nix index a67ce96..775be57 100644 --- a/vinzenz-pc2.nix +++ b/vinzenz-pc2.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{...}: { imports = [ (import ./modules { hostName = "vinzenz-pc2";