1) Ich nutze Flake für nix-cachyos-kernel und DankMeterialShell
Spoiler: flake.nix
Bash:
# /etc/nixos/flake.nix
{
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nix-cachyos-kernel.url = "github:xddxdd/nix-cachyos-kernel/release";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
dms.url = "github:AvengeMedia/DankMaterialShell";
};
outputs = { self, nixpkgs, home-manager, nix-cachyos-kernel, dms, ... }: {
nixosConfigurations = {
pc = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
{
nixpkgs.overlays = [
nix-cachyos-kernel.overlays.pinned
];
}
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
home-manager.users.dsius = {
imports = [
./sway.nix
];
};
}
];
};
};
};
}
Das sind Aliases
Bash:
# Aliases für alle Shells
environment.shellAliases = {
nfu = "sudo sh -c 'cd /etc/nixos && nix flake update'";
nrs = "sudo nixos-rebuild switch --flake /etc/nixos#pc";
};
Ich werde noch testen, ob ich zen4(amd)-cachyOS-Kernel noch brauche, bzw mit zen Kernel vergleichen. Kompilieren und nvidia open-module einbauen dauert ca. 25 Min. mit AMD 7800X3D. Würde ich DMS(DankMaterialShell) nicht brauchen, dann könnte es auch ohne flake gehen. Aber mit flake ist man flexibel, wenn man z.B. Hyprland, MangoWC oder Niri testen möchte.
Ich werde noch symlink erstellen, die nix Dateien aus
/etc/nixos/ wieder nach home umziehen und mit Git Commit Signing(yubikey) absichern. Yubikey verwende ich schon für Passwordless sudo.
Grund: ich möchte VScodium loswerden, weil es eine Electron-basierte Anwendung ist. Mit Zed Editor kann man die Dateien, die in
/etc/nixos/ liegen, nicht bearbeiten. Es gibt noch keine polkit-integration oder anders gesagt, es kommt kein Pop-up für Passworteingabe wie bei Kate, gnome-editor oder VScodium. Deswegen ist der Umzug. Git Commit Signing ist nur offline, damit ich weiß, dass niemand, außer mir die nix Dateien in home bearbeitet hat. Dort ist kein sudo nötig und man kann die Dateien mit Zed Editor bearbeiten. Helix oder Neovim möchte ich nicht verwenden, weil ich kein Programmierer bin. Nachdem man alles fertig konfiguriert hat, lässt man die nix Dateien in Ruhe. Nur manchmal, wenn man neue App installieren und testen möchte, dann füge ich es in
configuration.nix unter
systemPackages ein und mache mit
nrs rebuild. Wenn man System aktualisieren möchte, dann
nfu && nrs(Alias) und yubikey berühren.
2) Home Manager verwende ich mit flake.
Es geht natürlich auch ohne flake oder home-manager, wenn man KDE-Plasma oder Gnome hat.
Meine
home.nix heißt
sway.nix, weil ich dort sway WM konfiguriert habe. Ist noch nicht perfekt, aber es funktioniert.
Spoiler: sway.nix
Bash:
{ config, pkgs, lib, ... }:
{
home.stateVersion = "26.05";
# Sway Konfiguration
wayland.windowManager.sway = {
enable = true;
systemd.enable = true;
systemd.xdgAutostart = true;
systemd.dbusImplementation = "dbus";
config = {
modifier = "Mod4";
# 1. Monitore
output = {
"DP-1" = { mode = "1920x1080@144Hz"; pos = "0 1080"; };
"DP-4" = { mode = "1920x1080@144Hz"; pos = "0 1080"; };
"HDMI-A-1" = { mode = "1920x1080@60Hz"; pos = "0 0"; };
"HDMI-A-2" = { mode = "1920x1080@60Hz"; pos = "0 0"; };
# "*" = { bg = "${./wallpaper.png} fill"; };
};
workspaceOutputAssign = [
{ workspace = "1"; output = "DP-1"; }
{ workspace = "3"; output = "DP-1"; }
{ workspace = "1"; output = "DP-4"; }
{ workspace = "3"; output = "DP-4"; }
{ workspace = "2"; output = "HDMI-A-1"; }
{ workspace = "2"; output = "HDMI-A-2"; }
];
# 2. Eingabe
input = {
"*" = {
xkb_layout = "de";
xkb_options = "caps:escape";
# repeat_delay = 600;
# repeat_rate = 30;
# Maus-Einstellungen
accel_profile = "flat"; # Deaktiviert die Beschleunigung (1:1 Bewegung)
pointer_accel = "0.5"; # Die Geschwindigkeit (-1.0 bis 1.0)
};
};
# 3. Alle Keybindings in EINEM Block zusammengefasst
keybindings = let
mod = "Mod4";
in lib.mkOptionDefault (
# 3.1 Standard-Binds
{
"${mod}+Return" = "exec ${pkgs.foot}/bin/foot";
"${mod}+d" = "exec ${pkgs.fuzzel}/bin/fuzzel";
"${mod}+q" = "kill";
"${mod}+f" = "fullscreen toggle";
"${mod}+w" = "layout tabbed";
"${mod}+Shift+r" = "reload";
"${mod}+Escape" = "exec ${pkgs.wleave}/bin/wleave";
"${mod}+b" = "exec ${pkgs.firefox}/bin/firefox";
"${mod}+t" = "exec ${pkgs.thunderbird}/bin/thunderbird";
"${mod}+KP_Enter" = "exec ${pkgs.vscodium}/bin/codium";
"${mod}+Shift+Escape" = "exec ${pkgs.mission-center}/bin/mission-center";
# "${mod}+v" = "exec cliphist list | fuzzel --dmenu | cliphist decode | wl-copy";
}
//
# 3.2 Binds für Workspaces (1-3)
(lib.attrsets.mergeAttrsList (map (num: let
ws = toString num;
in {
"${mod}+${ws}" = "workspace number ${ws}";
"${mod}+Alt+${ws}" = "move container to workspace ${ws}";
# Numpad Zahlen
"${mod}+KP_${ws}" = "workspace number ${ws}";
"${mod}+Alt+KP_${ws}" = "move container to workspace ${ws}";
}) [1 2 3 ]))
//
# Fokus-Steuerung (HJKL)
(lib.attrsets.concatMapAttrs (key: direction: {
"${mod}+${key}" = "focus ${direction}";
"${mod}+Shift+${key}" = "move ${direction}";
}) {
h = "left";
j = "down";
k = "up";
l = "right";
})
);
# ... andere Einstellungen ...
# Neue Workspaces als Tabs starten
workspaceLayout = "tabbed";
startup = [
# 1. Umgebungsvariablen für D-Bus und Systemd aktualisieren
{ command = "dbus-update-activation-environment --all"; }
{ command = "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway"; }
# 2. Portale neu starten, damit sie die neuen Variablen (von Punkt 1) mitbekommen
{ command = "systemctl --user stop xdg-desktop-portal xdg-desktop-portal-wlr xdg-desktop-portal-gtk && systemctl --user start xdg-desktop-portal xdg-desktop-portal-wlr xdg-desktop-portal-gtk"; }
{ command = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; }
{ command = "${pkgs.firefox}/bin/firefox";}
# { command = "${pkgs.brave}/bin/brave";}
{ command = "${pkgs.steam}/bin/steam -nochatui -nofriendsui -silent"; }
];
gaps = {
smartBorders = "no_gaps"; # "on", "off" oder "no_gaps"
smartGaps = true; # true oder false
};
# Swaybar entfernen oder durch waybar ersetzen
bars = []; # z.B.{command = "waybar";}
};
extraConfig = ''
# Schriftart (Native Sway Syntax)
font pango:Fira Code 12
# Farben (Native Sway Syntax)
# class border backgr. text indicator child_border
client.focused #282C34 #282C34 #F2610D #D2E3FD #F2610D
client.focused_inactive #282C34 #282C34 #ABB2BF #282C34 #282C34
client.unfocused #282C34 #282C34 #5c6370 #282C34 #282C34
# Firefox
for_window [app_id="firefox"] title_format " Firefox"
# VSCodium
for_window [app_id="codium"] title_format " VSCodium"
for_window [class="VSCodium"] title_format " VSCodium"
# Foot
for_window [app_id="foot"] title_format " Foot"
# Thunderbird
for_window [app_id="thunderbird"] title_format " Thunderbird"
# Schiebt das PiP-Fenster in Workspace 2
for_window [title="Bild-im-Bild"] move window to workspace 2
# Schiebt theLounge Chat in Workspace 2
for_window [title="http://localhost:9000"] move window to workspace 2, title_format "#chat"
# Spiele (Steam/Xwayland) auf Workspace 3 schieben
for_window [class="Steam"] move container to workspace 3
for_window [instance="steam_app_.*"] move container to workspace 3
# Battle.net Launcher (Steam/Proton) floating machen
for_window [title="Battle.net"] move window to workspace 3
for_window [class="steam_app_.*" title="Battle.net"] floating enable
for_window [instance="steam_app_.*" title="Battle.net Login"] floating enable, move position center
# Taschenrechner
for_window [title="Taschenrechner"] floating enable
# ----SCREENSHOTS----
# 1. Region (Super + Alt + A)
bindsym Mod4+Mod1+a exec grim -g "$(slurp)" "/home/dsius/Bilder/Bildschirmfotos/Screenshot_$(date +'%Y-%m-%d_%H-%M-%S').png" && notify-send "Screenshot" "Region gespeichert"
# 2. Aktueller Monitor (Super + Alt + S)
bindsym Mod4+Mod1+s exec swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name' | xargs -I {} grim -o {} "/home/dsius/Bilder/Bildschirmfotos/Monitor_$(date +'%Y-%m-%d_%H-%M-%S').png" && notify-send "Screenshot" "Monitor gespeichert"
# 3. Alle Monitore (Super + Alt + D)
bindsym Mod4+Mod1+d exec grim "/home/dsius/Bilder/Bildschirmfotos/Gesamt_$(date +'%Y-%m-%d_%H-%M-%S').png" && notify-send "Screenshot" "Kompletter Desktop gespeichert"
'';
};
# ====== Sway Config ENDE=======
xdg.mimeApps = {
enable = true;
defaultApplicationPackages = [
pkgs.loupe
];
defaultApplications = {
"text/html" = "firefox.desktop";
"x-scheme-handler/http" = "firefox.desktop";
"x-scheme-handler/https" = "firefox.desktop";
"inode/directory" = "org.gnome.Nautilus.desktop";
"image/jpeg" = "org.gnome.Loupe.desktop";
"image/png" = "org.gnome.Loupe.desktop";
"image/gif" = "org.gnome.Loupe.desktop";
"image/webp" = "org.gnome.Loupe.desktop";
"image/svg+xml" = "org.gnome.Loupe.desktop";
};
associations.added = {
"image/jpeg" = "org.gnome.Loupe.desktop";
"image/png" = "org.gnome.Loupe.desktop";
"inode/directory" = "org.gnome.Nautilus.desktop";
};
associations.removed = {
"image/jpeg" = "brave-browser.desktop";
"image/png" = "brave-browser.desktop";
"image/gif" = "brave-browser.desktop";
"image/webp" = "brave-browser.desktop";
"image/svg+xml" = "brave-browser.desktop";
};
};
# VSCodium - Save as root Erweiterung
programs.vscode.profiles.default.extensions = [
pkgs.vscode-extensions.yy0931.save-as-root-in-remote-ssh
];
# Fastfetch
programs.fastfetch = {
enable = true;
settings = {
modules = [
"title"
"separator"
"os"
# "host"
"kernel"
"monitor"
"uptime"
"packages"
"wm"
"shell"
"terminal"
"cpu"
"gpu"
"memory"
# "local_ip"
# "disk"
"break"
"colors"
];
};
};
# services.cliphist = {
# enable = true;
# allowImages = true;
# systemdTargets = [ "sway-session.target" ];
# extraOptions = [
# "-max-items"
# "10"
# ];
# };
# Foot
programs.foot = {
enable = true;
settings = {
main = {
term = "xterm-256color";
font = "Fira Code:size=11";
};
colors-dark = {
background = "282C34"; # Hintergrund
foreground = "D2E3FD"; # Text
};
};
};
# MPV media Player
programs.mpv = {
enable = true;
package = pkgs.mpv;
config = {
vo = "gpu";
hwdec = "no";
gpu-api = "vulkan";
video-sync = "audio";
interpolation = "no";
loop-file = "inf"; # Loop für Videos
};
# MPV Scripts
scripts = [
pkgs.mpvScripts.thumbfast # High-performance on-the-fly thumbnailer for mpv
pkgs.mpvScripts.uosc
];
};
programs.zed-editor = {
enable = true;
extensions = [ "nix" "toml" "rust" ];
userSettings = {
theme = {
mode = "system";
dark = "One Dark";
light = "One Light";
};
hour_format = "hour24";
vim_mode = false;
};
};
# GTK Cursors
home.pointerCursor = {
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Ice";
size = 14;
gtk.enable = true;
};
# GTK Icons + Theme
gtk = {
enable = true;
theme = {
name = "Orchis-Light";
package = pkgs.orchis-theme;
};
iconTheme = {
name = "Tela";
package = pkgs.tela-icon-theme;
};
# Ergänzung für GTK4, da stateVersion nun 26.05 ist:
gtk4.extraConfig = {
gtk-application-prefer-dark-theme = 0; # 0 für Light, 1 für Dark
};
};
# Desktop Ordner in Home ausblenden
xdg.userDirs = {
enable = true;
createDirectories = false;
desktop = "$HOME";
};
# Fuzzel (Application Launcher)
programs.fuzzel.enable = true;
# Wayland-Umgebungsvariablen
home.sessionVariables = {
screenshotDir = "/home/dsius/Bilder/Bildschirmfotos";
XDG_CONFIG_DIRS = "/home/dsius/.config:/etc/xdg";
XDG_DATA_DIRS = "/home/dsius/.nix-profile/share:/etc/profiles/per-user/rebellz/share:/run/current-system/sw/share:/nix/var/nix/profiles/default/share";
GIO_EXTRA_MODULES = "1";
STEAM_USE_XWAYLAND = "1";
GTK_USE_PORTAL = "1";
# Session / Desktop Info
XDG_CURRENT_DESKTOP = "sway"; # Helps some apps recognize the DE
XDG_SESSION_DESKTOP = "sway"; # Indicates Wayland session
XDG_SESSION_TYPE = "wayland"; # Indicates Wayland session
# Wayland Fixes
QT_QPA_PLATFORM = "wayland"; # For Qt apps
MOZ_ENABLE_WAYLAND = "1";
NIXOS_OZONE_WL = "1"; # Electron (Discord, VSCode, Slack …)
GDK_BACKEND = "wayland"; # For GTK apps
# Nvidia spezifisch
SWAY_UNSUPPORTED_GPU = "1";
WLR_NO_HARDWARE_CURSORS = "1";
LIBVA_DRIVER_NAME = "nvidia";
GBM_BACKEND = "nvidia-drm";
WLR_RENDERER = "vulkan";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
__GL_VRR_ALLOWED = "1";
};
# BattleNet
home.file."scripts/start-battlenet.sh" = {
executable = true;
text = ''
#!/bin/sh
# Proton Experimental Pfad
export PROTONPATH="/home/dsius/.local/share/Steam/steamapps/common/Proton - Experimental"
# Battle.net mit umu-run starten
umu-run "/home/dsius/Games/battlenet/drive_c/Program Files (x86)/Battle.net/Battle.net Launcher.exe"
'';
};
xdg.desktopEntries."battlenet" = {
name = "Battle.net";
exec = "/home/dsius/scripts/start-battlenet.sh";
icon = "/home/dsius/.icons/BattleNet32x32.png";
comment = "Launch Battle.net with Proton Experimental";
terminal = false;
categories = [ "Game" ];
};
home.file.".steam/root/compatibilitytools.d/proton-ge-bin".source = pkgs.proton-ge-bin;
}
Dort steht z.B. etwas für
# VSCodium - Save as root Erweiterung
# Fastfetch
# MPV media Player
# MPV Scripts
# Desktop Ordner in Home ausblenden
# Wayland-Umgebungsvariablen
# BattleNet (UMU-Launcher)
# GTK Icons + Theme
# Foot