implementing home.file instead of xdg.config

This commit is contained in:
2026-03-01 18:30:28 +01:00
parent eb18a3628a
commit 15607aca9b
7 changed files with 568 additions and 555 deletions
+405 -403
View File
File diff suppressed because it is too large Load Diff
+82 -77
View File
@@ -1970,7 +1970,6 @@ in
}; };
programs.waybar.style = ""; programs.waybar.style = "";
} }
#+end_src #+end_src
** Lock Screen ** Lock Screen
@@ -1978,20 +1977,25 @@ The lock screen configured using [[https://wiki.hyprland.org/Hypr-Ecosystem/hypr
I use [[https://wiki.hyprland.org/Hypr-Ecosystem/hypridle/][hypridle]] to detect idle time and use wlogout to show a logout menu. I use [[https://wiki.hyprland.org/Hypr-Ecosystem/hypridle/][hypridle]] to detect idle time and use wlogout to show a logout menu.
They are configured below. They are configured below.
#+begin_src nix :tangle home/desktop/hyprlock.nix :noweb tangle :mkdirp yes #+begin_src nix :tangle home/desktop/hyprlock.nix :noweb tangle :mkdirp yes
{config, lib, pkgs, flakeRoot, ... }: { config, lib, pkgs, flakeRoot, ... }:
let let
lockPngSrc = flakeRoot.outPath + "/assets/lock.png"; lockPngSrc = flakeRoot.outPath + "/assets/lock.png";
hyprlockConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprlock.conf"; hyprlockConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprlock.conf";
in in
{ {
home.packages = [ pkgs.hyprlock ]; home.packages = [ pkgs.hyprlock ];
xdg.configFile."hypr/lock.png".source = lib.mkForce lockPngSrc; # Gebruik home.file voor echte bestanden (geen symlinks)
xdg.configFile."hypr/hyprlock.conf".source = lib.mkForce hyprlockConf; home.file.".config/hypr/lock.png" = {
source = lockPngSrc;
};
home.file.".config/hypr/hyprlock.conf" = {
source = hyprlockConf;
};
} }
#+end_src #+end_src
** Idle Screen ** Idle Screen
<henro: needs instruction>
#+begin_src nix :tangle home/desktop/hypridle.nix :noweb tangle :mkdirp yes #+begin_src nix :tangle home/desktop/hypridle.nix :noweb tangle :mkdirp yes
{ config, lib, pkgs, flakeRoot, ... }: { config, lib, pkgs, flakeRoot, ... }:
let let
@@ -1999,59 +2003,54 @@ let
in in
{ {
home.packages = [ pkgs.hypridle ]; home.packages = [ pkgs.hypridle ];
xdg.configFile."hypr/hypridle.conf".source = lib.mkForce hypridleConf; home.file.".config/hypr/hypridle.conf" = {
source = hypridleConf;
};
} }
#+end_src #+end_src
** hyprscrolling ** hyprscrolling
This Nix module integrates the hyprscrolling plugin into a Home-Manager managed Hyprland setup in a declarative and reproducible way. It ensures the plugin is installed, optionally switches Hyprland to the scrolling layout, and renders user-defined plugin settings directly into the Hyprland configuration. The goal is to manage the scrolling workspace behavior entirely from Nix instead of maintaining manual edits inside hyprland.conf. This Nix module integrates the hyprscrolling plugin into a Home-Manager managed Hyprland setup in a declarative and reproducible way. It ensures the plugin is installed, optionally switches Hyprland to the scrolling layout, and renders user-defined plugin settings directly into the Hyprland configuration. The goal is to manage the scrolling workspace behavior entirely from Nix instead of maintaining manual edits inside hyprland.conf.
#+begin_src nix :tangle home/desktop/hyprscrolling.nix :noweb tangle :mkdirp yes #+begin_src nix :tangle home/desktop/hyprscrolling.nix :noweb tangle :mkdirp yes
{ config, lib, pkgs, flakeRoot,...}: { config, lib, pkgs, flakeRoot, ... }:
let let
# Hyprscrolling drop-in config (repo -> ~/.config) # Hyprscrolling drop-in config (repo -> ~/.config)
repoConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprscrolling.conf"; repoConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprscrolling.conf";
targetRel = "hypr/conf.d/90-hyprscrolling.conf"; targetRel = "hypr/conf.d/90-hyprscrolling.conf";
# Overflow indicator script (repo -> ~/.config) # Overflow indicator script
repoOverflowScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscroll-overflow.sh"; repoOverflowScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscroll-overflow.sh";
targetOverflowRel = "hypr/scripts/hyprscroll-overflow.sh"; targetOverflowRel = "hypr/scripts/hyprscroll-overflow.sh";
# Adapt columnsize to monitor # Adapt columnsize to monitor
repoPerMonitorScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscrolling-per-monitor.sh"; repoPerMonitorScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscrolling-per-monitor.sh";
targetPerMonitor = "hypr/scripts/hyprscrolling-per-monitor.sh"; targetPerMonitor = "hypr/scripts/hyprscrolling-per-monitor.sh";
# Facilitate switching between scrolling and dwindle # Switch between scrolling/dwindle
repoSwitchScript = repoSwitchScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh";
flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh";
targetSwitchScript = "hypr/scripts/toggle-layout-scrolling-dwindle.sh"; targetSwitchScript = "hypr/scripts/toggle-layout-scrolling-dwindle.sh";
in in
{ {
# Ensure deps for the script exist at runtime home.packages = with pkgs; [ jq ];
# (hyprctl comes with Hyprland; jq is often not installed by default)
home.packages = with pkgs; [
jq
];
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
plugins = [ plugins = [ pkgs.hyprlandPlugins.hyprscrolling ];
pkgs.hyprlandPlugins.hyprscrolling extraConfig = ''
]; source = ${config.xdg.configHome}/${targetRel}
extraConfig = '' '';
source = ~/.config/${targetRel}
'';
}; };
# Copy repo configs/scripts into ~/.config # Copy repo configs/scripts into ~/.config (als echte bestanden)
xdg.configFile."${targetRel}" = { home.file."${targetRel}" = {
source = lib.mkForce repoConf; source = repoConf;
}; };
xdg.configFile."${targetOverflowRel}" = { home.file."${targetOverflowRel}" = {
source = lib.mkForce repoOverflowScript; source = repoOverflowScript;
executable = true; # makes it chmod +x executable = true;
}; };
xdg.configFile."${targetPerMonitor}" = { home.file."${targetPerMonitor}" = {
source = lib.mkForce repoPerMonitorScript; source = repoPerMonitorScript;
executable = true; # makes it chmod +x executable = true;
}; };
xdg.configFile."${targetSwitchScript}" = { home.file."${targetSwitchScript}" = {
source = lib.mkForce repoSwitchScript; source = repoSwitchScript;
executable = true; # makes it chmod +x executable = true;
}; };
} }
#+end_src #+end_src
@@ -2069,24 +2068,28 @@ in
{ {
xdg.enable = true; xdg.enable = true;
home.packages = [ pkgs.hyprshell ]; home.packages = [ pkgs.hyprshell ];
# Link repo -> ~/.config/hyprshell/... # Gebruik home.file voor echte bestanden (geen symlinks)
xdg.configFile."hyprshell/config.ron".source = lib.mkForce cfgRon; home.file.".config/hyprshell/config.ron" = {
xdg.configFile."hyprshell/styles.css".source = lib.mkForce cssFile; source = cfgRon;
};
home.file.".config/hyprshell/styles.css" = {
source = cssFile;
};
# Autostart (systemd user service) # Autostart (systemd user service)
systemd.user.services.hyprshell = { systemd.user.services.hyprshell = {
Unit = { Unit = {
Description = "Hyprshell (window switcher / launcher)"; Description = "Hyprshell (window switcher / launcher)";
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ]; After = [ "graphical-session.target" ];
}; };
Service = { Service = {
ExecStart = "${pkgs.hyprshell}/bin/hyprshell"; ExecStart = "${pkgs.hyprshell}/bin/hyprshell";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 1; RestartSec = 1;
}; };
Install = { Install = {
WantedBy = [ "graphical-session.target" ]; WantedBy = [ "graphical-session.target" ];
}; };
}; };
} }
#+end_src #+end_src
@@ -2097,40 +2100,42 @@ This configures the desktop environment along with the peripherals. The comments
#+begin_src nix :tangle home/desktop/hyprland.nix :noweb tangle :mkdirp yes. #+begin_src nix :tangle home/desktop/hyprland.nix :noweb tangle :mkdirp yes.
{ config, lib, pkgs, flakeRoot, ... }: { config, lib, pkgs, flakeRoot, ... }:
let let
hyprConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprland.conf"; hyprConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprland.conf";
bindingsConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/bindings.conf"; bindingsConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/bindings.conf";
lidLockScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/lid-lock.sh";
in in
{ {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
# Load base config + bindings from repo files # Load base config + bindings from repo files
extraConfig = extraConfig = ''
(builtins.readFile hyprConf) ${builtins.readFile hyprConf}
+ "\n\n# --- Repo keybindings ---\n" # --- Repo keybindings ---
+ (builtins.readFile bindingsConf) ${builtins.readFile bindingsConf}
+ "\n"; '';
settings = { settings = {
windowrule = [ windowrule = [
"match:class nm-connection-editor, float 1, center 1, size 900 700" "match:class nm-connection-editor, float 1, center 1, size 900 700"
]; ];
};
}; };
}; # Gebruik home.file voor echte bestanden (geen symlinks)
xdg.configFile."hypr/scripts/lid-lock.sh" = { home.file.".config/hypr/scripts/lid-lock.sh" = {
source = lib.mkForce (flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/lid-lock.sh"); source = lidLockScript;
executable = true; executable = true;
}; };
xdg.portal = { xdg.portal = {
enable = true; enable = true;
extraPortals = with pkgs; [ extraPortals = with pkgs; [
xdg-desktop-portal-gtk xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland xdg-desktop-portal-hyprland
]; ];
# GTK als algemene backend (OpenURI is daar betrouwbaar) # GTK als algemene backend (OpenURI is daar betrouwbaar)
config.common.default = [ "gtk" ]; config.common.default = [ "gtk" ];
# Hyprland alleen voor screensharing / remote desktop # Hyprland alleen voor screensharing / remote desktop
config.hyprland = { config.hyprland = {
"org.freedesktop.impl.portal.Screencast" = [ "hyprland" ]; "org.freedesktop.impl.portal.Screencast" = [ "hyprland" ];
"org.freedesktop.impl.portal.RemoteDesktop" = [ "hyprland" ]; "org.freedesktop.impl.portal.RemoteDesktop" = [ "hyprland" ];
}; };
}; };
} }
+3 -1
View File
@@ -4,5 +4,7 @@ let
in in
{ {
home.packages = [ pkgs.hypridle ]; home.packages = [ pkgs.hypridle ];
xdg.configFile."hypr/hypridle.conf".source = lib.mkForce hypridleConf; home.file.".config/hypr/hypridle.conf" = {
source = hypridleConf;
};
} }
+28 -26
View File
@@ -1,39 +1,41 @@
{ config, lib, pkgs, flakeRoot, ... }: { config, lib, pkgs, flakeRoot, ... }:
let let
hyprConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprland.conf"; hyprConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprland.conf";
bindingsConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/bindings.conf"; bindingsConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/bindings.conf";
lidLockScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/lid-lock.sh";
in in
{ {
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
# Load base config + bindings from repo files # Load base config + bindings from repo files
extraConfig = extraConfig = ''
(builtins.readFile hyprConf) ${builtins.readFile hyprConf}
+ "\n\n# --- Repo keybindings ---\n" # --- Repo keybindings ---
+ (builtins.readFile bindingsConf) ${builtins.readFile bindingsConf}
+ "\n"; '';
settings = { settings = {
windowrule = [ windowrule = [
"match:class nm-connection-editor, float 1, center 1, size 900 700" "match:class nm-connection-editor, float 1, center 1, size 900 700"
]; ];
};
}; };
}; # Gebruik home.file voor echte bestanden (geen symlinks)
xdg.configFile."hypr/scripts/lid-lock.sh" = { home.file.".config/hypr/scripts/lid-lock.sh" = {
source = lib.mkForce (flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/lid-lock.sh"); source = lidLockScript;
executable = true; executable = true;
}; };
xdg.portal = { xdg.portal = {
enable = true; enable = true;
extraPortals = with pkgs; [ extraPortals = with pkgs; [
xdg-desktop-portal-gtk xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland xdg-desktop-portal-hyprland
]; ];
# GTK als algemene backend (OpenURI is daar betrouwbaar) # GTK als algemene backend (OpenURI is daar betrouwbaar)
config.common.default = [ "gtk" ]; config.common.default = [ "gtk" ];
# Hyprland alleen voor screensharing / remote desktop # Hyprland alleen voor screensharing / remote desktop
config.hyprland = { config.hyprland = {
"org.freedesktop.impl.portal.Screencast" = [ "hyprland" ]; "org.freedesktop.impl.portal.Screencast" = [ "hyprland" ];
"org.freedesktop.impl.portal.RemoteDesktop" = [ "hyprland" ]; "org.freedesktop.impl.portal.RemoteDesktop" = [ "hyprland" ];
}; };
}; };
} }
+8 -3
View File
@@ -1,10 +1,15 @@
{config, lib, pkgs, flakeRoot, ... }: { config, lib, pkgs, flakeRoot, ... }:
let let
lockPngSrc = flakeRoot.outPath + "/assets/lock.png"; lockPngSrc = flakeRoot.outPath + "/assets/lock.png";
hyprlockConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprlock.conf"; hyprlockConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprlock.conf";
in in
{ {
home.packages = [ pkgs.hyprlock ]; home.packages = [ pkgs.hyprlock ];
xdg.configFile."hypr/lock.png".source = lib.mkForce lockPngSrc; # Gebruik home.file voor echte bestanden (geen symlinks)
xdg.configFile."hypr/hyprlock.conf".source = lib.mkForce hyprlockConf; home.file.".config/hypr/lock.png" = {
source = lockPngSrc;
};
home.file.".config/hypr/hyprlock.conf" = {
source = hyprlockConf;
};
} }
+22 -29
View File
@@ -1,48 +1,41 @@
{ config, lib, pkgs, flakeRoot,...}: { config, lib, pkgs, flakeRoot, ... }:
let let
# Hyprscrolling drop-in config (repo -> ~/.config) # Hyprscrolling drop-in config (repo -> ~/.config)
repoConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprscrolling.conf"; repoConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprscrolling.conf";
targetRel = "hypr/conf.d/90-hyprscrolling.conf"; targetRel = "hypr/conf.d/90-hyprscrolling.conf";
# Overflow indicator script (repo -> ~/.config) # Overflow indicator script
repoOverflowScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscroll-overflow.sh"; repoOverflowScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscroll-overflow.sh";
targetOverflowRel = "hypr/scripts/hyprscroll-overflow.sh"; targetOverflowRel = "hypr/scripts/hyprscroll-overflow.sh";
# Adapt columnsize to monitor # Adapt columnsize to monitor
repoPerMonitorScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscrolling-per-monitor.sh"; repoPerMonitorScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscrolling-per-monitor.sh";
targetPerMonitor = "hypr/scripts/hyprscrolling-per-monitor.sh"; targetPerMonitor = "hypr/scripts/hyprscrolling-per-monitor.sh";
# Facilitate switching between scrolling and dwindle # Switch between scrolling/dwindle
repoSwitchScript = repoSwitchScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh";
flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh";
targetSwitchScript = "hypr/scripts/toggle-layout-scrolling-dwindle.sh"; targetSwitchScript = "hypr/scripts/toggle-layout-scrolling-dwindle.sh";
in in
{ {
# Ensure deps for the script exist at runtime home.packages = with pkgs; [ jq ];
# (hyprctl comes with Hyprland; jq is often not installed by default)
home.packages = with pkgs; [
jq
];
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
plugins = [ plugins = [ pkgs.hyprlandPlugins.hyprscrolling ];
pkgs.hyprlandPlugins.hyprscrolling extraConfig = ''
]; source = ${config.xdg.configHome}/${targetRel}
extraConfig = '' '';
source = ~/.config/${targetRel}
'';
}; };
# Copy repo configs/scripts into ~/.config # Copy repo configs/scripts into ~/.config (als echte bestanden)
xdg.configFile."${targetRel}" = { home.file."${targetRel}" = {
source = lib.mkForce repoConf; source = repoConf;
}; };
xdg.configFile."${targetOverflowRel}" = { home.file."${targetOverflowRel}" = {
source = lib.mkForce repoOverflowScript; source = repoOverflowScript;
executable = true; # makes it chmod +x executable = true;
}; };
xdg.configFile."${targetPerMonitor}" = { home.file."${targetPerMonitor}" = {
source = lib.mkForce repoPerMonitorScript; source = repoPerMonitorScript;
executable = true; # makes it chmod +x executable = true;
}; };
xdg.configFile."${targetSwitchScript}" = { home.file."${targetSwitchScript}" = {
source = lib.mkForce repoSwitchScript; source = repoSwitchScript;
executable = true; # makes it chmod +x executable = true;
}; };
} }
+20 -16
View File
@@ -8,23 +8,27 @@ in
{ {
xdg.enable = true; xdg.enable = true;
home.packages = [ pkgs.hyprshell ]; home.packages = [ pkgs.hyprshell ];
# Link repo -> ~/.config/hyprshell/... # Gebruik home.file voor echte bestanden (geen symlinks)
xdg.configFile."hyprshell/config.ron".source = lib.mkForce cfgRon; home.file.".config/hyprshell/config.ron" = {
xdg.configFile."hyprshell/styles.css".source = lib.mkForce cssFile; source = cfgRon;
};
home.file.".config/hyprshell/styles.css" = {
source = cssFile;
};
# Autostart (systemd user service) # Autostart (systemd user service)
systemd.user.services.hyprshell = { systemd.user.services.hyprshell = {
Unit = { Unit = {
Description = "Hyprshell (window switcher / launcher)"; Description = "Hyprshell (window switcher / launcher)";
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ]; After = [ "graphical-session.target" ];
}; };
Service = { Service = {
ExecStart = "${pkgs.hyprshell}/bin/hyprshell"; ExecStart = "${pkgs.hyprshell}/bin/hyprshell";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 1; RestartSec = 1;
}; };
Install = { Install = {
WantedBy = [ "graphical-session.target" ]; WantedBy = [ "graphical-session.target" ];
}; };
}; };
} }