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
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.

View file

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

View file

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

View file

@ -10,6 +10,7 @@ in {
config = lib.mkIf isEnabled {
hardware.opengl = {
driSupport = true;
driSupport32Bit = true;
extraPackages = 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")
(builtins.toString ./. + "/${hostName}.nix")
./common-desktop.nix
./amdcpu.nix
./amdgpu.nix
./intelcpu.nix
./amd.nix
./intel.nix
];
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 = {
my.hardware = {
enableCommonDesktopSettings = true;
isIntelCpu = true;
isAmdGpu = true;
amd.radeon = true;
intel = {
cpu = true;
iGpu = true;
};
};
boot = {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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