use some unstable pkgs, reorganize hw

This commit is contained in:
Vinzenz Schroeter 2023-10-02 17:14:20 +02:00
parent 996ed9e026
commit 61419b3559
17 changed files with 133 additions and 69 deletions

View file

@ -1,11 +1,13 @@
# nixos-configuration # nixos-configuration
When adding a new host: /
1. install NixOS via the graphical installer ├── modules
2. `mv /etc/hardware-configuration ./devicename-hardware-configuration.nix` │ ├── desktop
3. copy an existing devicename.nix │ ├── hardware (includes hostname.nix)
5. change import to `new-devicename-hardware-configuration.nix` │ └── users
6. set the hostname and optional imports in `new-devicename.nix` └── hostname.nix (imports modules)
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` When adding a new host: `ln -s ./new-devicename.nix /etc/nixos/configuration.nix`
9. apply
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.

View file

@ -1,4 +1,4 @@
{pkgs, ...}: { {...}: {
imports = [ imports = [
(import ./modules { (import ./modules {
hostName = "hetzner-vpn1"; hostName = "hetzner-vpn1";

View file

@ -42,6 +42,10 @@ in {
programs = { programs = {
kdeconnect.enable = true; kdeconnect.enable = true;
firefox = {
enable = true;
languagePacks = ["en-US" "de"];
};
}; };
# unblock kde connect / gsconnect # unblock kde connect / gsconnect

View file

@ -10,6 +10,7 @@ in {
config = lib.mkIf isEnabled { config = lib.mkIf isEnabled {
hardware.opengl = { hardware.opengl = {
driSupport = true;
driSupport32Bit = true; driSupport32Bit = true;
extraPackages = with pkgs; [mangohud]; extraPackages = with pkgs; [mangohud];
extraPackages32 = with pkgs; [mangohud]; extraPackages32 = with pkgs; [mangohud];

47
modules/hardware/amd.nix Normal file
View file

@ -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
];
})
];
}

View file

@ -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;
};
}

View file

@ -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
];
};
}

View file

@ -9,9 +9,8 @@ in {
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
(builtins.toString ./. + "/${hostName}.nix") (builtins.toString ./. + "/${hostName}.nix")
./common-desktop.nix ./common-desktop.nix
./amdcpu.nix ./amd.nix
./amdgpu.nix ./intel.nix
./intelcpu.nix
]; ];
options.my.modulesCfg.hostName = lib.mkOption { options.my.modulesCfg.hostName = lib.mkOption {

View file

@ -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
];
})
];
}

View file

@ -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;
};
}

View file

@ -2,8 +2,11 @@
config = { config = {
my.hardware = { my.hardware = {
enableCommonDesktopSettings = true; enableCommonDesktopSettings = true;
isIntelCpu = true; amd.radeon = true;
isAmdGpu = true; intel = {
cpu = true;
iGpu = true;
};
}; };
boot = { boot = {

View file

@ -2,8 +2,10 @@
config = { config = {
my.hardware = { my.hardware = {
enableCommonDesktopSettings = true; enableCommonDesktopSettings = true;
isAmdCpu = true; amd = {
isAmdGpu = true; cpu = true;
gpu = true;
};
}; };
boot = { boot = {

View file

@ -1,6 +1,17 @@
{...}: { {config, ...}: let
unstable-commit-sha = "f5892ddac112a1e9b3612c39af1b72987ee5783a";
in {
config = { 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 = { system = {
stateVersion = "22.11"; stateVersion = "22.11";

View file

@ -12,8 +12,6 @@
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;
firefox.enable = true;
zsh = { zsh = {
history = { history = {
size = 10000; size = 10000;

View file

@ -30,7 +30,6 @@
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;
firefox.enable = true;
fzf.enable = true; fzf.enable = true;
mangohud.enable = true; mangohud.enable = true;

View file

@ -17,5 +17,10 @@
# flatpak xdg-portal-kde crashes, otherwise this would be global # flatpak xdg-portal-kde crashes, otherwise this would be global
services.flatpak.enable = true; services.flatpak.enable = true;
# force rendering on dedicated graphics
environment.sessionVariables = rec {
DRI_PRIME = "1";
};
}; };
} }

View file

@ -1,4 +1,4 @@
{pkgs, ...}: { {...}: {
imports = [ imports = [
(import ./modules { (import ./modules {
hostName = "vinzenz-pc2"; hostName = "vinzenz-pc2";