From 70497a93d013a593ed75ec400dd231a71800f569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20Schr=C3=B6ter?= Date: Fri, 20 Mar 2026 23:00:30 +0100 Subject: [PATCH] adapt desktop adapt config so that it works on desktop too --- configuration.nix | 66 ++++++++++--------- flake.nix | 25 ++++++++ home/programs/eww/src/power.yuck | 30 +++------ home/programs/eww/src/scripts/powermenu.sh | 23 ++++--- home/programs/river/src/startEww.sh | 11 ++-- home/services/kanshi.nix | 70 ++++++++++++++------- home/themes/catppuccin/default.nix | 4 +- machines/configuration-desktop.nix | 13 ++-- machines/configuration-laptop.nix | 4 +- machines/hardware-configuration-desktop.nix | 40 ++++++++---- 10 files changed, 179 insertions(+), 107 deletions(-) diff --git a/configuration.nix b/configuration.nix index 2560c41..638eb53 100644 --- a/configuration.nix +++ b/configuration.nix @@ -4,13 +4,13 @@ let images = pkgs.callPackage ./home/themes/images.nix { }; in { - # Importing necessary setup for Steam & Printing & Flutter. + # ── Steam & Printer ─────────────────────────────────────────────────── imports = [ ./builds/steam/default.nix ./home/extras/printer.nix ]; - # Use the systemd-boot EFI boot loader. + # ── Use the systemd-boot EFI boot loader. ───────────────────────────── boot.loader = { systemd-boot = { enable = true; @@ -19,18 +19,21 @@ in efi.canTouchEfiVariables = true; }; - # Chose NetworkManager, timezone, internationalisation properties and console settings. - networking.networkmanager.enable = true; - networking.networkmanager.plugins = with pkgs; [ - networkmanager-vpnc - ]; + # ── NetworkManager, timezone, internationalisation properties and ───── + networking.networkmanager = { + enable = true; + plugins = with pkgs; [ + networkmanager-vpnc + ]; + }; time.timeZone = "Europe/Berlin"; i18n.defaultLocale = "en_US.UTF-8"; console = { font = "Lat2-Terminus16"; useXkbConfig = true; }; - # Enable Asterisks for Password prompt. + + # ── Enable Asterisks for Password prompt. ───────────────────────────── security.sudo = { enable = true; extraConfig = '' @@ -38,17 +41,19 @@ in ''; }; - # Activate Flakes. - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; + nix = { + # ── Flakes ──────────────────────────────────────────────────────────── + settings.experimental-features = [ + "nix-command" + "flakes" + ]; - # Configuration of the Garbage collect. - nix.gc = { - automatic = true; # Enable the automatic garbage collector - dates = "10:00"; # When to run the garbage collector - options = "--delete-older-than 7d"; + # ── Garbage collect ─────────────────────────────────────────────────── + gc = { + automatic = true; + dates = "12:00"; + options = "--delete-older-than 7d"; + }; }; services = { @@ -78,7 +83,7 @@ in }; }; - # Define a user account. + # ── User account ────────────────────────────────────────────────────── users = { mutableUsers = false; users.elias = { @@ -97,7 +102,6 @@ in }; }; - # Setting the Basic Packages. environment.systemPackages = with pkgs; [ (catppuccin-sddm.override { flavor = "mocha"; @@ -146,17 +150,21 @@ in XDG_STATE_HOME = "$HOME/.local/state"; }; - # Enabling the Keyring. - security.pam.services.login.enableGnomeKeyring = true; - security.pam.services.sddm.enableGnomeKeyring = true; + # ── Keyring ─────────────────────────────────────────────────────────── + security.pam.services = { + login.enableGnomeKeyring = true; + sddm.enableGnomeKeyring = true; + }; + services = { - gnome.gnome-keyring.enable = true; - gnome.gcr-ssh-agent.enable = false; - # Disable powerbutton => for use with eww - logind.settings.Login = { - HandlePowerKey = "ignore"; + gnome = { + gnome-keyring.enable = true; + gcr-ssh-agent.enable = false; }; - # Setting the permissions for acpilight. + + # Disable powerbutton => for use with eww + logind.settings.Login.HandlePowerKey = "ignore"; + # ── Permissions for acpilight ───────────────────────────────────────── udev = { enable = true; extraRules = '' diff --git a/flake.nix b/flake.nix index 8dcac0c..6bc89fb 100644 --- a/flake.nix +++ b/flake.nix @@ -96,6 +96,31 @@ } ]; }; + nixos = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./machines/configuration-desktop.nix + ./home/services/pipewire.nix + nur.modules.nixos.default + catppuccin.nixosModules.catppuccin + home-manager.nixosModules.home-manager + # impermanence.nixosModules.impermanence + { + home-manager = { + useUserPackages = true; + extraSpecialArgs = { inherit inputs; }; + users.elias.imports = [ + ./home/default-desktop.nix + catppuccin.homeModules.catppuccin + ]; + }; + nixpkgs.overlays = [ + inputs.nur.overlays.default + inputs.nix-vscode-extensions.overlays.default + ]; + } + ]; + }; }; }; } diff --git a/home/programs/eww/src/power.yuck b/home/programs/eww/src/power.yuck index e016f4a..b0864d8 100644 --- a/home/programs/eww/src/power.yuck +++ b/home/programs/eww/src/power.yuck @@ -1,3 +1,13 @@ +(defwindow power [] + :class "powermenuWindow" + :geometry (geometry + :width "200px" + :height "50px" + :anchor "center center" + :x "0%" + :y "0%") + (powerpopup)) + (defwidget powerpopup [] (box :class "powermenu" @@ -27,23 +37,3 @@ :class "powermenu-button" (label :text "")))) -(defwidget powermenu [shutdown shutdown_icon reboot - reboot_icon logout logout_icon] - (box :class "powermenu" :spacing 5 - :vexpand true :hexpand true - :valign "end" :halign "end" - :space-evenly false - (button :onclick shutdown shutdown_icon) - (button :onclick reboot reboot_icon) - (button :onclick logout logout_icon))) - -(defwindow power [] - :class "powermenuWindow" - :geometry (geometry - :width "200px" - :height "50px" - :anchor "center center" - :x "0%" - :y "0%") - (powerpopup) -) diff --git a/home/programs/eww/src/scripts/powermenu.sh b/home/programs/eww/src/scripts/powermenu.sh index acb157b..a3394a5 100755 --- a/home/programs/eww/src/scripts/powermenu.sh +++ b/home/programs/eww/src/scripts/powermenu.sh @@ -1,10 +1,19 @@ -WINDOW_NAME="power" - -echo "Power button pressed" >>/tmp/acpi_log.txt +WINDOW="power" +DISPLAY="" # Check if the window is already open -if eww active-windows | grep -q "$WINDOW_NAME"; then - eww close "$WINDOW_NAME" -else - eww open "$WINDOW_NAME" --screen "$(wlr-randr | grep -oP '^\S+' | head -n 1)" +if eww active-windows | grep -q "$WINDOW"; then + eww close "$WINDOW" + exit 0 fi + +# Determin screen +if [[ "$(hostname)" == "eliasLaptop" ]]; then + DISPLAY="eDP-1" +elif [[ "$(hostname)" == "eliasDesktop" ]]; then + DISPLAY="DVI-D-1" +fi + +echo "$DISPLAY" + +eww open "$WINDOW" --screen "$DISPLAY" diff --git a/home/programs/river/src/startEww.sh b/home/programs/river/src/startEww.sh index f845950..49c6884 100755 --- a/home/programs/river/src/startEww.sh +++ b/home/programs/river/src/startEww.sh @@ -1,10 +1,9 @@ -hostname=$(hostname) +HOST_NAME=$(hostname) -if [[ "$hostname" == "eliasLaptop" ]]; then +if [[ "$HOST_NAME" == "eliasLaptop" ]]; then eww open bar --screen eDP-1 /home/elias/.config/eww/scripts/ristate.sh -elif [[ "$hostname" == "eliasDesktop" ]]; then - echo "This is another PC!" -else - echo "This is an unknown PC." +elif [[ "$HOST_NAME" == "eliasDesktop" ]]; then + eww open bar --screen DVI-D-1 + /home/elias/.config/eww/scripts/ristate.sh fi diff --git a/home/services/kanshi.nix b/home/services/kanshi.nix index 96b94f5..c41541b 100644 --- a/home/services/kanshi.nix +++ b/home/services/kanshi.nix @@ -11,7 +11,6 @@ profile.outputs = [ { criteria = "eDP-1"; } ]; profile.exec = [ "systemctl --user start hypridle.service" - "eww reload" ]; } { @@ -21,36 +20,59 @@ "eww reload" ]; profile.outputs = [ - { - criteria = "eDP-1"; - mode = "1920x1080@60Hz"; - position = "1920,0"; - } { criteria = "HDMI-A-1"; mode = "1920x1080@60Hz"; position = "0,0"; } + { + criteria = "eDP-1"; + mode = "1920x1080@60Hz"; + position = "1920,0"; + } + ]; + } + { + profile.name = "desktop"; + profile.exec = [ + "systemctl --user stop hypridle.service" + ]; + profile.outputs = [ + { + criteria = "HDMI-A-2"; + mode = "1920x1080@60Hz"; + position = "0,0"; + } + { + criteria = "DVI-D-1"; + mode = "1920x1080@60Hz"; + position = "1920,0"; + } + { + criteria = "DP-2"; + mode = "1920x1080@60Hz"; + position = "3840,0"; + } + ]; + } + { + profile.name = "desktop-reduced"; + profile.exec = [ + "systemctl --user stop hypridle.service" + ]; + profile.outputs = [ + { + criteria = "DVI-D-1"; + mode = "1920x1080@60Hz"; + position = "0,0"; + } + { + criteria = "DP-2"; + mode = "1920x1080@60Hz"; + position = "1920,0"; + } ]; } - # { - # profile.name = "desktop"; - # profile.exec = [ - # "systemctl --user start hypridle.service" - # ]; - # profile.outputs = [ - # { - # criteria = "eDP-1"; - # mode = "1920x1080@60Hz"; - # position = "1920,0"; - # } - # { - # criteria = "HDMI-A-1"; - # mode = "1920x1080@60Hz"; - # position = "0,0"; - # } - # ]; - # } ]; }; } diff --git a/home/themes/catppuccin/default.nix b/home/themes/catppuccin/default.nix index 28bffab..e96e2ed 100644 --- a/home/themes/catppuccin/default.nix +++ b/home/themes/catppuccin/default.nix @@ -10,11 +10,11 @@ in imports = [ ./cursor.nix ./fnott.nix - # ./gtk.nix TODO: check why so weird + ./gtk.nix ./hyprlock.nix ./nvim.nix ./taskwarrior.nix - # ./qt.nix TODO: check why so weird + ./qt.nix ]; catppuccin = { diff --git a/machines/configuration-desktop.nix b/machines/configuration-desktop.nix index a3a3cf4..302bdbc 100644 --- a/machines/configuration-desktop.nix +++ b/machines/configuration-desktop.nix @@ -7,13 +7,18 @@ ]; networking.hostName = "eliasDesktop"; - services.blueman.enable = true; - hardware.bluetooth.enable = true; - hardware.bluetooth.powerOnBoot = true; - # Hyprlock + # ── Hyprlock ────────────────────────────────────────────────────────── security.pam.services.hyprlock = { }; + # ── Bluetooth ───────────────────────────────────────────────────────── + services.blueman.enable = true; + hardware.bluetooth = { + enable = true; + powerOnBoot = false; + }; + + # ── Network ─────────────────────────────────────────────────────────── environment.systemPackages = with pkgs; [ networkmanager-vpnc networkmanagerapplet diff --git a/machines/configuration-laptop.nix b/machines/configuration-laptop.nix index 84fbc64..34dc8a7 100644 --- a/machines/configuration-laptop.nix +++ b/machines/configuration-laptop.nix @@ -17,7 +17,7 @@ }; }; - # Hyprlock + # ── Hyprlock ────────────────────────────────────────────────────────── security.pam.services = { hyprlock = { text = '' @@ -33,7 +33,7 @@ services.blueman.enable = true; hardware.bluetooth = { enable = true; - powerOnBoot = true; + powerOnBoot = false; }; # ── Network ─────────────────────────────────────────────────────────── diff --git a/machines/hardware-configuration-desktop.nix b/machines/hardware-configuration-desktop.nix index 73a30cd..56523bd 100644 --- a/machines/hardware-configuration-desktop.nix +++ b/machines/hardware-configuration-desktop.nix @@ -14,27 +14,41 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-label/NIXROOT"; - fsType = "ext4"; + { device = "/dev/disk/by-uuid/aded1c84-f4d0-4841-ab2f-68266532737f"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + fileSystems."/.swapvol" = + { device = "/dev/disk/by-uuid/aded1c84-f4d0-4841-ab2f-68266532737f"; + fsType = "btrfs"; + options = [ "subvol=swap" ]; }; fileSystems."/boot" = - { device = "/dev/disk/by-label/NIXBOOT"; + { device = "/dev/disk/by-uuid/A38E-500D"; fsType = "vfat"; options = [ "fmask=0022" "dmask=0022" ]; }; - swapDevices = [{ - device = "/.swapfile"; - size = 2048; - }]; + fileSystems."/home" = + { device = "/dev/disk/by-uuid/aded1c84-f4d0-4841-ab2f-68266532737f"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; - # 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 - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.eno1.useDHCP = lib.mkDefault true; + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/aded1c84-f4d0-4841-ab2f-68266532737f"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + fileSystems."/partition-root" = + { device = "/dev/disk/by-uuid/aded1c84-f4d0-4841-ab2f-68266532737f"; + fsType = "btrfs"; + }; + + swapDevices = [ ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;