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 = "";
}
#+end_src
** 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.
They are configured below.
#+begin_src nix :tangle home/desktop/hyprlock.nix :noweb tangle :mkdirp yes
{config, lib, pkgs, flakeRoot, ... }:
{ config, lib, pkgs, flakeRoot, ... }:
let
lockPngSrc = flakeRoot.outPath + "/assets/lock.png";
hyprlockConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprlock.conf";
in
{
home.packages = [ pkgs.hyprlock ];
xdg.configFile."hypr/lock.png".source = lib.mkForce lockPngSrc;
xdg.configFile."hypr/hyprlock.conf".source = lib.mkForce hyprlockConf;
# Gebruik home.file voor echte bestanden (geen symlinks)
home.file.".config/hypr/lock.png" = {
source = lockPngSrc;
};
home.file.".config/hypr/hyprlock.conf" = {
source = hyprlockConf;
};
}
#+end_src
** Idle Screen
<henro: needs instruction>
#+begin_src nix :tangle home/desktop/hypridle.nix :noweb tangle :mkdirp yes
{ config, lib, pkgs, flakeRoot, ... }:
let
@@ -1999,59 +2003,54 @@ let
in
{
home.packages = [ pkgs.hypridle ];
xdg.configFile."hypr/hypridle.conf".source = lib.mkForce hypridleConf;
home.file.".config/hypr/hypridle.conf" = {
source = hypridleConf;
};
}
#+end_src
** 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.
#+begin_src nix :tangle home/desktop/hyprscrolling.nix :noweb tangle :mkdirp yes
{ config, lib, pkgs, flakeRoot,...}:
{ config, lib, pkgs, flakeRoot, ... }:
let
# Hyprscrolling drop-in config (repo -> ~/.config)
repoConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/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";
targetOverflowRel = "hypr/scripts/hyprscroll-overflow.sh";
# Adapt columnsize to monitor
repoPerMonitorScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscrolling-per-monitor.sh";
targetPerMonitor = "hypr/scripts/hyprscrolling-per-monitor.sh";
# Facilitate switching between scrolling and dwindle
repoSwitchScript =
flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh";
# Switch between scrolling/dwindle
repoSwitchScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh";
targetSwitchScript = "hypr/scripts/toggle-layout-scrolling-dwindle.sh";
in
{
# Ensure deps for the script exist at runtime
# (hyprctl comes with Hyprland; jq is often not installed by default)
home.packages = with pkgs; [
jq
];
home.packages = with pkgs; [ jq ];
wayland.windowManager.hyprland = {
enable = true;
plugins = [
pkgs.hyprlandPlugins.hyprscrolling
];
extraConfig = ''
source = ~/.config/${targetRel}
'';
enable = true;
plugins = [ pkgs.hyprlandPlugins.hyprscrolling ];
extraConfig = ''
source = ${config.xdg.configHome}/${targetRel}
'';
};
# Copy repo configs/scripts into ~/.config
xdg.configFile."${targetRel}" = {
source = lib.mkForce repoConf;
# Copy repo configs/scripts into ~/.config (als echte bestanden)
home.file."${targetRel}" = {
source = repoConf;
};
xdg.configFile."${targetOverflowRel}" = {
source = lib.mkForce repoOverflowScript;
executable = true; # makes it chmod +x
home.file."${targetOverflowRel}" = {
source = repoOverflowScript;
executable = true;
};
xdg.configFile."${targetPerMonitor}" = {
source = lib.mkForce repoPerMonitorScript;
executable = true; # makes it chmod +x
home.file."${targetPerMonitor}" = {
source = repoPerMonitorScript;
executable = true;
};
xdg.configFile."${targetSwitchScript}" = {
source = lib.mkForce repoSwitchScript;
executable = true; # makes it chmod +x
home.file."${targetSwitchScript}" = {
source = repoSwitchScript;
executable = true;
};
}
#+end_src
@@ -2069,24 +2068,28 @@ in
{
xdg.enable = true;
home.packages = [ pkgs.hyprshell ];
# Link repo -> ~/.config/hyprshell/...
xdg.configFile."hyprshell/config.ron".source = lib.mkForce cfgRon;
xdg.configFile."hyprshell/styles.css".source = lib.mkForce cssFile;
# Gebruik home.file voor echte bestanden (geen symlinks)
home.file.".config/hyprshell/config.ron" = {
source = cfgRon;
};
home.file.".config/hyprshell/styles.css" = {
source = cssFile;
};
# Autostart (systemd user service)
systemd.user.services.hyprshell = {
Unit = {
Description = "Hyprshell (window switcher / launcher)";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.hyprshell}/bin/hyprshell";
Restart = "on-failure";
RestartSec = 1;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Unit = {
Description = "Hyprshell (window switcher / launcher)";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.hyprshell}/bin/hyprshell";
Restart = "on-failure";
RestartSec = 1;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
}
#+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.
{ config, lib, pkgs, flakeRoot, ... }:
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";
lidLockScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/lid-lock.sh";
in
{
wayland.windowManager.hyprland = {
enable = true;
# Load base config + bindings from repo files
extraConfig =
(builtins.readFile hyprConf)
+ "\n\n# --- Repo keybindings ---\n"
+ (builtins.readFile bindingsConf)
+ "\n";
settings = {
windowrule = [
"match:class nm-connection-editor, float 1, center 1, size 900 700"
];
enable = true;
# Load base config + bindings from repo files
extraConfig = ''
${builtins.readFile hyprConf}
# --- Repo keybindings ---
${builtins.readFile bindingsConf}
'';
settings = {
windowrule = [
"match:class nm-connection-editor, float 1, center 1, size 900 700"
];
};
};
};
xdg.configFile."hypr/scripts/lid-lock.sh" = {
source = lib.mkForce (flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/lid-lock.sh");
# Gebruik home.file voor echte bestanden (geen symlinks)
home.file.".config/hypr/scripts/lid-lock.sh" = {
source = lidLockScript;
executable = true;
};
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland
];
# GTK als algemene backend (OpenURI is daar betrouwbaar)
config.common.default = [ "gtk" ];
# Hyprland alleen voor screensharing / remote desktop
config.hyprland = {
"org.freedesktop.impl.portal.Screencast" = [ "hyprland" ];
"org.freedesktop.impl.portal.RemoteDesktop" = [ "hyprland" ];
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland
];
# GTK als algemene backend (OpenURI is daar betrouwbaar)
config.common.default = [ "gtk" ];
# Hyprland alleen voor screensharing / remote desktop
config.hyprland = {
"org.freedesktop.impl.portal.Screencast" = [ "hyprland" ];
"org.freedesktop.impl.portal.RemoteDesktop" = [ "hyprland" ];
};
};
}
+3 -1
View File
@@ -4,5 +4,7 @@ let
in
{
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, ... }:
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";
lidLockScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/lid-lock.sh";
in
{
wayland.windowManager.hyprland = {
enable = true;
# Load base config + bindings from repo files
extraConfig =
(builtins.readFile hyprConf)
+ "\n\n# --- Repo keybindings ---\n"
+ (builtins.readFile bindingsConf)
+ "\n";
settings = {
windowrule = [
"match:class nm-connection-editor, float 1, center 1, size 900 700"
];
enable = true;
# Load base config + bindings from repo files
extraConfig = ''
${builtins.readFile hyprConf}
# --- Repo keybindings ---
${builtins.readFile bindingsConf}
'';
settings = {
windowrule = [
"match:class nm-connection-editor, float 1, center 1, size 900 700"
];
};
};
};
xdg.configFile."hypr/scripts/lid-lock.sh" = {
source = lib.mkForce (flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/lid-lock.sh");
# Gebruik home.file voor echte bestanden (geen symlinks)
home.file.".config/hypr/scripts/lid-lock.sh" = {
source = lidLockScript;
executable = true;
};
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland
];
# GTK als algemene backend (OpenURI is daar betrouwbaar)
config.common.default = [ "gtk" ];
# Hyprland alleen voor screensharing / remote desktop
config.hyprland = {
"org.freedesktop.impl.portal.Screencast" = [ "hyprland" ];
"org.freedesktop.impl.portal.RemoteDesktop" = [ "hyprland" ];
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland
];
# GTK als algemene backend (OpenURI is daar betrouwbaar)
config.common.default = [ "gtk" ];
# Hyprland alleen voor screensharing / remote desktop
config.hyprland = {
"org.freedesktop.impl.portal.Screencast" = [ "hyprland" ];
"org.freedesktop.impl.portal.RemoteDesktop" = [ "hyprland" ];
};
};
}
+8 -3
View File
@@ -1,10 +1,15 @@
{config, lib, pkgs, flakeRoot, ... }:
{ config, lib, pkgs, flakeRoot, ... }:
let
lockPngSrc = flakeRoot.outPath + "/assets/lock.png";
hyprlockConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprlock.conf";
in
{
home.packages = [ pkgs.hyprlock ];
xdg.configFile."hypr/lock.png".source = lib.mkForce lockPngSrc;
xdg.configFile."hypr/hyprlock.conf".source = lib.mkForce hyprlockConf;
# Gebruik home.file voor echte bestanden (geen symlinks)
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
# Hyprscrolling drop-in config (repo -> ~/.config)
repoConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/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";
targetOverflowRel = "hypr/scripts/hyprscroll-overflow.sh";
# Adapt columnsize to monitor
repoPerMonitorScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscrolling-per-monitor.sh";
targetPerMonitor = "hypr/scripts/hyprscrolling-per-monitor.sh";
# Facilitate switching between scrolling and dwindle
repoSwitchScript =
flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh";
# Switch between scrolling/dwindle
repoSwitchScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh";
targetSwitchScript = "hypr/scripts/toggle-layout-scrolling-dwindle.sh";
in
{
# Ensure deps for the script exist at runtime
# (hyprctl comes with Hyprland; jq is often not installed by default)
home.packages = with pkgs; [
jq
];
home.packages = with pkgs; [ jq ];
wayland.windowManager.hyprland = {
enable = true;
plugins = [
pkgs.hyprlandPlugins.hyprscrolling
];
extraConfig = ''
source = ~/.config/${targetRel}
'';
enable = true;
plugins = [ pkgs.hyprlandPlugins.hyprscrolling ];
extraConfig = ''
source = ${config.xdg.configHome}/${targetRel}
'';
};
# Copy repo configs/scripts into ~/.config
xdg.configFile."${targetRel}" = {
source = lib.mkForce repoConf;
# Copy repo configs/scripts into ~/.config (als echte bestanden)
home.file."${targetRel}" = {
source = repoConf;
};
xdg.configFile."${targetOverflowRel}" = {
source = lib.mkForce repoOverflowScript;
executable = true; # makes it chmod +x
home.file."${targetOverflowRel}" = {
source = repoOverflowScript;
executable = true;
};
xdg.configFile."${targetPerMonitor}" = {
source = lib.mkForce repoPerMonitorScript;
executable = true; # makes it chmod +x
home.file."${targetPerMonitor}" = {
source = repoPerMonitorScript;
executable = true;
};
xdg.configFile."${targetSwitchScript}" = {
source = lib.mkForce repoSwitchScript;
executable = true; # makes it chmod +x
home.file."${targetSwitchScript}" = {
source = repoSwitchScript;
executable = true;
};
}
+20 -16
View File
@@ -8,23 +8,27 @@ in
{
xdg.enable = true;
home.packages = [ pkgs.hyprshell ];
# Link repo -> ~/.config/hyprshell/...
xdg.configFile."hyprshell/config.ron".source = lib.mkForce cfgRon;
xdg.configFile."hyprshell/styles.css".source = lib.mkForce cssFile;
# Gebruik home.file voor echte bestanden (geen symlinks)
home.file.".config/hyprshell/config.ron" = {
source = cfgRon;
};
home.file.".config/hyprshell/styles.css" = {
source = cssFile;
};
# Autostart (systemd user service)
systemd.user.services.hyprshell = {
Unit = {
Description = "Hyprshell (window switcher / launcher)";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.hyprshell}/bin/hyprshell";
Restart = "on-failure";
RestartSec = 1;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Unit = {
Description = "Hyprshell (window switcher / launcher)";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.hyprshell}/bin/hyprshell";
Restart = "on-failure";
RestartSec = 1;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
}