mirror of
https://github.com/kaesaecracker/nixos-configuration.git
synced 2025-01-18 18:40:14 +01:00
commit
be60d90339
20
README.md
20
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.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{pkgs, ...}: {
|
||||
{...}: {
|
||||
imports = [
|
||||
(import ./modules {
|
||||
hostName = "hetzner-vpn1";
|
||||
|
|
|
@ -38,10 +38,15 @@ in {
|
|||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
#jack.enable = true;
|
||||
};
|
||||
|
||||
programs = {
|
||||
kdeconnect.enable = true;
|
||||
firefox = {
|
||||
enable = true;
|
||||
languagePacks = ["en-US" "de"];
|
||||
};
|
||||
};
|
||||
|
||||
# unblock kde connect / gsconnect
|
||||
|
@ -86,6 +91,14 @@ in {
|
|||
"electron-12.2.3"
|
||||
];
|
||||
|
||||
my.allowUnfreePackages = [
|
||||
"insync"
|
||||
"insync-pkg"
|
||||
|
||||
"rider"
|
||||
"pycharm-professional"
|
||||
];
|
||||
|
||||
fonts = {
|
||||
fontconfig.defaultFonts.monospace = ["FiraCode Nerd Font"];
|
||||
fonts = with pkgs; [
|
||||
|
|
|
@ -10,6 +10,7 @@ in {
|
|||
|
||||
config = lib.mkIf isEnabled {
|
||||
hardware.opengl = {
|
||||
driSupport = true;
|
||||
driSupport32Bit = true;
|
||||
extraPackages = with pkgs; [mangohud];
|
||||
extraPackages32 = with pkgs; [mangohud];
|
||||
|
@ -41,5 +42,11 @@ in {
|
|||
dedicatedServer.openFirewall = true;
|
||||
};
|
||||
};
|
||||
|
||||
my.allowUnfreePackages = [
|
||||
"steam"
|
||||
"steam-original"
|
||||
"steam-run"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
47
modules/hardware/amd.nix
Normal file
47
modules/hardware/amd.nix
Normal 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
|
||||
];
|
||||
})
|
||||
];
|
||||
}
|
|
@ -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;
|
||||
};
|
||||
}
|
|
@ -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
|
||||
];
|
||||
};
|
||||
}
|
|
@ -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 {
|
||||
|
|
39
modules/hardware/intel.nix
Normal file
39
modules/hardware/intel.nix
Normal 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
|
||||
];
|
||||
})
|
||||
];
|
||||
}
|
|
@ -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;
|
||||
};
|
||||
}
|
|
@ -2,8 +2,11 @@
|
|||
config = {
|
||||
my.hardware = {
|
||||
enableCommonDesktopSettings = true;
|
||||
isIntelCpu = true;
|
||||
isAmdGpu = true;
|
||||
amd.radeon = true;
|
||||
intel = {
|
||||
cpu = true;
|
||||
iGpu = true;
|
||||
};
|
||||
};
|
||||
|
||||
boot = {
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
config = {
|
||||
my.hardware = {
|
||||
enableCommonDesktopSettings = true;
|
||||
isAmdCpu = true;
|
||||
isAmdGpu = true;
|
||||
amd = {
|
||||
cpu = true;
|
||||
gpu = true;
|
||||
};
|
||||
};
|
||||
|
||||
boot = {
|
||||
|
|
|
@ -1,6 +1,28 @@
|
|||
{...}: {
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
unstable-commit-sha = "f5892ddac112a1e9b3612c39af1b72987ee5783a";
|
||||
in {
|
||||
options.my.allowUnfreePackages = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [];
|
||||
example = ["steam"];
|
||||
};
|
||||
|
||||
config = {
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
nixpkgs.config = {
|
||||
# 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;
|
||||
};
|
||||
};
|
||||
|
||||
# https://github.com/NixOS/nixpkgs/issues/197325#issuecomment-1579420085
|
||||
allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.my.allowUnfreePackages;
|
||||
};
|
||||
|
||||
system = {
|
||||
stateVersion = "22.11";
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
programs = {
|
||||
home-manager.enable = true;
|
||||
|
||||
firefox.enable = true;
|
||||
|
||||
zsh = {
|
||||
history = {
|
||||
size = 10000;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
programs = {
|
||||
home-manager.enable = true;
|
||||
|
||||
firefox.enable = true;
|
||||
fzf.enable = true;
|
||||
mangohud.enable = true;
|
||||
|
||||
|
|
|
@ -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";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{pkgs, ...}: {
|
||||
{...}: {
|
||||
imports = [
|
||||
(import ./modules {
|
||||
hostName = "vinzenz-pc2";
|
||||
|
|
Loading…
Reference in a new issue