Organize configuration better

This commit is contained in:
thiloho
2025-01-29 00:51:37 +01:00
parent bbc956ff51
commit 642d3f55f1
11 changed files with 355 additions and 322 deletions

42
modules/core.nix Normal file
View File

@@ -0,0 +1,42 @@
{ pkgs, ... }:
{
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
kernelPackages = pkgs.linuxPackages_latest;
};
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs.config.allowUnfree = true;
networking = {
networkmanager.enable = true;
firewall = {
allowedTCPPorts = [ 53317 ];
allowedUDPPorts = [ 53317 ];
};
};
time.timeZone = "Europe/Berlin";
users = {
mutableUsers = false;
users = {
root.hashedPassword = "$y$j9T$gdQiD91dRc1rEURkntnkh1$9VvI8xhvCMqhSSOeOkiSnjHsQVUOOH/4Sbou.w6P5TC";
thiloho = {
isNormalUser = true;
extraGroups = [
"wheel"
"networkmanager"
"docker"
];
hashedPassword = "$y$j9T$0wgXXBJMy5lzuwmdvx5Lb.$G5JmfDXeXzH7sq66R.clvmlovuh1ZsZMf1SfDsWpNcB";
};
};
};
}

46
modules/desktop.nix Normal file
View File

@@ -0,0 +1,46 @@
{ pkgs, ... }:
{
environment.sessionVariables.NIXOS_OZONE_WL = "1";
fonts.packages = with pkgs; [
jetbrains-mono
];
services.xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
excludePackages = [ pkgs.xterm ];
};
environment.gnome.excludePackages = with pkgs; [
gnome-tour
gnome-connections
geary
evince
gnome-contacts
gnome-maps
gnome-music
snapshot
simple-scan
];
environment.systemPackages = with pkgs; [
gnome-tweaks
gnome-themes-extra
];
programs.dconf.enable = true;
programs.steam.enable = true;
home-manager.users.thiloho.dconf.settings = {
"org/gnome/mutter" = {
experimental-features = [
"scale-monitor-framebuffer"
"variable-refresh-rate"
"xwayland-native-scaling"
];
};
};
}

28
modules/development.nix Normal file
View File

@@ -0,0 +1,28 @@
{ pkgs, ... }:
{
virtualisation.docker.enable = true;
virtualisation.libvirtd = {
enable = true;
qemu.swtpm.enable = true;
};
programs.virt-manager.enable = true;
programs.adb.enable = true;
users.users.thiloho.extraGroups = [ "adbusers" ];
programs.nix-ld = {
enable = true;
libraries = with pkgs; [
nodejs
nodePackages.pnpm
];
};
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
programs.java.enable = true;
}

112
modules/home.nix Normal file
View File

@@ -0,0 +1,112 @@
{ pkgs, ... }:
{
home-manager.users.thiloho = {
programs.bash = {
enable = true;
shellAliases = {
rbs = "sudo nixos-rebuild switch --flake .";
cleanup = "nix store optimise && nix-collect-garbage -d && sudo nix store optimise && sudo nix-collect-garbage -d";
};
};
programs.helix = {
enable = true;
settings.theme = "ayu_dark";
};
programs = {
git = {
enable = true;
userName = "thiloho";
userEmail = "123883702+thiloho@users.noreply.github.com";
signing = {
signByDefault = true;
};
};
vscode = {
enable = true;
package = pkgs.vscodium;
mutableExtensionsDir = false;
extensions =
with pkgs.vscode-extensions;
[
jnoortheen.nix-ide
ritwickdey.liveserver
esbenp.prettier-vscode
]
++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "svelte-vscode";
publisher = "svelte";
version = "108.5.4";
sha256 = "0sjq5ifnz08pkxslzz2qnrc76gvl6lkygcr3042safbvfral4xm1";
}
{
name = "playwright";
publisher = "ms-playwright";
version = "1.1.10";
sha256 = "0y0jlrxpjzd7drdmcr9kfy5g12zax9q4d8cblzzb6ia4c98ipfq0";
}
];
userSettings = {
"editor.wordWrap" = "on";
"editor.fontFamily" = "JetBrains Mono";
"editor.fontLigatures" = true;
"editor.indentSize" = 2;
"editor.tabSize" = 2;
"typescript.preferences.importModuleSpecifier" = "relative";
"[svelte]" = {
"editor.defaultFormatter" = "svelte.svelte-vscode";
};
"svelte.enable-ts-plugin" = true;
"svelte.plugin.svelte.defaultScriptLanguage" = "ts";
"svelte.plugin.svelte.format.config.svelteStrictMode" = true;
};
};
firefox = {
enable = true;
package = pkgs.firefox-devedition.override {
cfg = {
speechSynthesisSupport = true;
};
};
};
chromium = {
enable = true;
package = pkgs.ungoogled-chromium;
};
direnv = {
enable = true;
enableBashIntegration = true;
nix-direnv.enable = true;
};
yt-dlp.enable = true;
obs-studio.enable = true;
};
home.packages = with pkgs; [
tldr
ventoy-full
qbittorrent
neofetch
backblaze-b2
localsend
postman
melonDS
prismlauncher
papers
endeavour
gapless
mullvad-browser
picocrypt-cli
tutanota-desktop
inkscape
];
};
}

22
modules/media.nix Normal file
View File

@@ -0,0 +1,22 @@
{ pkgs, ... }:
{
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
services.pulseaudio.enable = false;
hardware.bluetooth.enable = true;
services.printing.enable = true;
services.mullvad-vpn = {
enable = true;
package = pkgs.mullvad-vpn;
};
services.resolved.enable = true;
}

View File

@@ -1,30 +1,26 @@
{ inputs, pkgs, ... }: { inputs, pkgs, ... }:
{ {
imports = [ imports = [
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t480s inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t480s
./hardware-configuration.nix ./hardware-configuration.nix
../shared-desktop.nix
../shared.nix ../../modules/core.nix
../../modules/desktop.nix
../../modules/development.nix
../../modules/home.nix
../../modules/media.nix
]; ];
networking.hostName = "laptop"; networking.hostName = "laptop";
boot.initrd = { boot.initrd.luks.devices.cryptroot = {
luks.devices = { device = "/dev/disk/by-uuid/f1b5a08f-e515-4fba-b3f4-2a1091063cdc";
cryptroot = { };
device = "/dev/disk/by-uuid/f1b5a08f-e515-4fba-b3f4-2a1091063cdc";
}; home-manager.users.thiloho = {
}; programs.git.signing.key = "3B62137A89493F7D";
home.stateVersion = "24.11";
}; };
home-manager.users.thiloho =
{ pkgs, ... }:
{
programs.git.signing.key = "3B62137A89493F7D";
home = {
stateVersion = "24.11";
};
};
system.stateVersion = "24.11"; system.stateVersion = "24.11";
} }

View File

@@ -1,32 +1,47 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = imports = [
[ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [
"xhci_pci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ ]; boot.kernelModules = [ ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/8c24d51b-f02d-4c0c-9894-50b4209cf8c0"; device = "/dev/disk/by-uuid/8c24d51b-f02d-4c0c-9894-50b4209cf8c0";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/222F-191E"; device = "/dev/disk/by-uuid/222F-191E";
fsType = "vfat"; fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ]; options = [
}; "fmask=0077"
"dmask=0077"
swapDevices =
[ { device = "/dev/disk/by-uuid/c6a47a90-a892-43c0-82e2-74b489aabc17"; }
]; ];
};
swapDevices = [
{ device = "/dev/disk/by-uuid/c6a47a90-a892-43c0-82e2-74b489aabc17"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View File

@@ -1,12 +1,15 @@
{ inputs, pkgs, ... }: { inputs, pkgs, ... }:
{ {
imports = [ imports = [
inputs.nixos-hardware.nixosModules.common-gpu-amd inputs.nixos-hardware.nixosModules.common-gpu-amd
inputs.nixos-hardware.nixosModules.common-cpu-amd inputs.nixos-hardware.nixosModules.common-cpu-amd
./hardware-configuration.nix ./hardware-configuration.nix
../shared-desktop.nix
../shared.nix ../../modules/core.nix
../../modules/desktop.nix
../../modules/development.nix
../../modules/home.nix
../../modules/media.nix
]; ];
networking = { networking = {
@@ -23,28 +26,22 @@
}; };
}; };
boot.initrd = { boot = {
luks.devices = { initrd.luks.devices.cryptroot = {
cryptroot = { device = "/dev/disk/by-uuid/1202158c-cf4a-49f5-83f6-d54af16bca65";
device = "/dev/disk/by-uuid/1202158c-cf4a-49f5-83f6-d54af16bca65";
};
}; };
kernelParams = [ "amd_iommu=on" ];
kernelModules = [ "v4l2loopback" ];
extraModulePackages = [ pkgs.linuxPackages_latest.v4l2loopback ];
extraModprobeConfig = ''
options v4l2loopback exclusive_caps=1 card_label="Virtual Webcam"
'';
}; };
environment.sessionVariables = { environment.sessionVariables = {
MUTTER_DEBUG_FORCE_KMS_MODE = "simple"; MUTTER_DEBUG_DISABLE_HW_CURSORS = "1";
}; };
boot.kernelParams = [ "amd_iommu=on" ];
virtualisation.libvirtd.enable = true;
virtualisation.libvirtd.qemu.swtpm.enable = true;
programs.virt-manager.enable = true;
programs.adb.enable = true;
users.users.thiloho.extraGroups = [ "adbusers" ];
# Use same monitor settings for GDM as for GNOME user
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"L+ /run/gdm/.config/monitors.xml - - - - ${pkgs.writeText "gdm-monitors.xml" '' "L+ /run/gdm/.config/monitors.xml - - - - ${pkgs.writeText "gdm-monitors.xml" ''
<monitors version="2"> <monitors version="2">
@@ -73,16 +70,17 @@
''}" ''}"
]; ];
home-manager.users.thiloho = home-manager.users.thiloho = {
{ pkgs, lib, ... }: programs.git.signing.key = "273D6150B9741CCF";
{ xdg.desktopEntries.andcam = {
programs.git.signing.key = "273D6150B9741CCF"; name = "Android Virtual Camera";
home = { exec = "${pkgs.writeScript "andcam" ''
packages = with pkgs; [ ${pkgs.android-tools}/bin/adb start-server
inkscape ${pkgs.scrcpy}/bin/scrcpy --camera-id=0 --video-source=camera --no-audio --v4l2-sink=/dev/video0 -m1024
]; ''}";
stateVersion = "24.11";
};
}; };
home.stateVersion = "24.11";
};
system.stateVersion = "24.11"; system.stateVersion = "24.11";
} }

View File

@@ -1,32 +1,48 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = imports = [
[ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usb_storage"
"usbhid"
"sd_mod"
];
boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/69528c2b-4fe1-4ff8-a77b-2fc000669629"; device = "/dev/disk/by-uuid/69528c2b-4fe1-4ff8-a77b-2fc000669629";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/139D-6775"; device = "/dev/disk/by-uuid/139D-6775";
fsType = "vfat"; fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ]; options = [
}; "fmask=0077"
"dmask=0077"
swapDevices =
[ { device = "/dev/disk/by-uuid/aafdb506-7d0b-40ef-b87a-c14c39688b76"; }
]; ];
};
swapDevices = [
{ device = "/dev/disk/by-uuid/aafdb506-7d0b-40ef-b87a-c14c39688b76"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View File

@@ -1,199 +0,0 @@
{ pkgs, lib, ... }:
{
environment.sessionVariables.NIXOS_OZONE_WL = "1";
fonts.packages = with pkgs; [
jetbrains-mono
];
services = {
xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome = {
enable = true;
};
excludePackages = [ pkgs.xterm ];
};
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
printing.enable = true;
resolved.enable = true;
mullvad-vpn = {
enable = true;
package = pkgs.mullvad-vpn;
};
};
environment.gnome.excludePackages = with pkgs; [
gnome-tour
gnome-connections
geary
evince
gnome-contacts
gnome-maps
gnome-music
snapshot
simple-scan
];
users = {
mutableUsers = false;
users = {
root.hashedPassword = "$y$j9T$gdQiD91dRc1rEURkntnkh1$9VvI8xhvCMqhSSOeOkiSnjHsQVUOOH/4Sbou.w6P5TC";
thiloho = {
isNormalUser = true;
extraGroups = [
"wheel"
"networkmanager"
"docker"
];
hashedPassword = "$y$j9T$0wgXXBJMy5lzuwmdvx5Lb.$G5JmfDXeXzH7sq66R.clvmlovuh1ZsZMf1SfDsWpNcB";
};
};
};
networking.firewall = {
allowedTCPPorts = [ 53317 ];
allowedUDPPorts = [ 53317 ];
};
programs = {
dconf.enable = true;
steam.enable = true;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
java.enable = true;
nix-ld = {
enable = true;
libraries = with pkgs; [
nodejs
nodePackages.pnpm
];
};
};
services.pulseaudio.enable = false;
hardware.bluetooth.enable = true;
home-manager.users.thiloho =
{
pkgs,
lib,
config,
...
}:
{
dconf.settings = {
"org/gnome/mutter" = {
experimental-features = [
"scale-monitor-framebuffer"
"variable-refresh-rate"
"xwayland-native-scaling"
];
};
};
programs = {
yt-dlp = {
enable = true;
};
firefox = {
enable = true;
package = pkgs.firefox-devedition.override {
cfg = {
speechSynthesisSupport = true;
};
};
};
chromium = {
enable = true;
package = pkgs.ungoogled-chromium;
};
vscode = {
enable = true;
package = pkgs.vscodium;
mutableExtensionsDir = false;
extensions =
with pkgs.vscode-extensions;
[
# svelte.svelte-vscode
jnoortheen.nix-ide
ritwickdey.liveserver
esbenp.prettier-vscode
]
++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "svelte-vscode";
publisher = "svelte";
version = "108.5.4";
sha256 = "0sjq5ifnz08pkxslzz2qnrc76gvl6lkygcr3042safbvfral4xm1";
}
{
name = "playwright";
publisher = "ms-playwright";
version = "1.1.10";
sha256 = "0y0jlrxpjzd7drdmcr9kfy5g12zax9q4d8cblzzb6ia4c98ipfq0";
}
];
userSettings = {
"editor.wordWrap" = "on";
"editor.fontFamily" = "JetBrains Mono";
"editor.fontLigatures" = true;
"editor.indentSize" = 2;
"editor.tabSize" = 2;
"typescript.preferences.importModuleSpecifier" = "relative";
"[svelte]" = {
"editor.defaultFormatter" = "svelte.svelte-vscode";
};
"svelte.enable-ts-plugin" = true;
"svelte.plugin.svelte.defaultScriptLanguage" = "ts";
"svelte.plugin.svelte.format.config.svelteStrictMode" = true;
};
};
git = {
enable = true;
userName = "thiloho";
userEmail = "123883702+thiloho@users.noreply.github.com";
signing = {
signByDefault = true;
};
};
direnv = {
enable = true;
enableBashIntegration = true;
nix-direnv.enable = true;
};
obs-studio.enable = true;
};
home = {
packages = with pkgs; [
tldr
ventoy-full
qbittorrent
neofetch
backblaze-b2
localsend
postman
gnome-tweaks
gnome-themes-extra
melonDS
prismlauncher
papers
endeavour
gapless
mullvad-browser
picocrypt-cli
tutanota-desktop
];
};
};
}

View File

@@ -1,43 +0,0 @@
{ pkgs, ... }:
{
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
kernelPackages = pkgs.linuxPackages_latest;
};
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
time.timeZone = "Europe/Berlin";
nixpkgs.config.allowUnfree = true;
networking.networkmanager.enable = true;
virtualisation.docker.enable = true;
home-manager.users.thiloho =
{ ... }:
{
programs = {
bash = {
enable = true;
shellAliases = {
rbs = "sudo nixos-rebuild switch --flake .";
cleanup = "nix store optimise && nix-collect-garbage -d && sudo nix store optimise && sudo nix-collect-garbage -d";
};
};
helix = {
enable = true;
defaultEditor = true;
settings.theme = "ayu_dark";
};
};
};
}