Testing lib.mkForce

This commit is contained in:
2026-03-01 18:14:35 +01:00
parent a503e0ec4d
commit db2b9e4a06
5 changed files with 407 additions and 459 deletions
+338 -355
View File
File diff suppressed because it is too large Load Diff
+35 -52
View File
@@ -1661,13 +1661,13 @@ Creates a script for a powermenu
{ config, lib, pkgs, flakeRoot, ... }: { config, lib, pkgs, flakeRoot, ... }:
let let
repoScript = repoScript =
flakeRoot + "/assets/conf/desktop/hypr/scripts/powermenu.sh"; flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/powermenu.sh";
targetRel = "hypr/scripts/powermenu.sh"; targetRel = ".config/hypr/scripts/powermenu.sh";
in in
{ {
# Ensure script exists in ~/.config/hypr/scripts/ # Ensure script exists in ~/.config/hypr/scripts/
xdg.configFile."${targetRel}" = { home.file."${targetRel}" = {
source = lib.mkForce repoScript; source = repoScript;
executable = true; executable = true;
}; };
} }
@@ -1679,52 +1679,41 @@ animated_wallpaper.nix installs mpvpaper and deploys your wallpaper files from t
#+begin_src nix :tangle home/desktop/animated_wallpaper.nix :noweb tangle :mkdirp yes #+begin_src nix :tangle home/desktop/animated_wallpaper.nix :noweb tangle :mkdirp yes
{ config, pkgs, lib, flakeRoot, ... }: { config, pkgs, lib, flakeRoot, ... }:
let let
repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper"; repoWallpaperDir = flakeRoot.outPath + "/assets/conf/desktop/wallpaper";
userRelRoot = "nixos_conf/wallpaperstuff"; userRelRoot = ".config/nixos_conf/wallpaperstuff";
userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}"; userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}";
# The video file you want as wallpaper (must exist under the synced dir)
userVideoPath = "${userAbsRoot}/videos/myWallpaper.mp4"; userVideoPath = "${userAbsRoot}/videos/myWallpaper.mp4";
# (keep your existing approach: sync the repo wallpaper dir to the user dir)
repoWallpapersOnly = lib.cleanSourceWith {
src = repoWallpaperDir;
filter = path: type: true;
};
in in
{ {
home.packages = [ home.packages = [
pkgs.mpvpaper pkgs.mpvpaper
pkgs.mpv pkgs.mpv
]; ];
# Sync repo wallpapers (including videos/) into ~/nixos_conf/wallpaperstuff # Sync repo wallpapers (including videos/) into ~/nixos_conf/wallpaperstuff
home.file."${userRelRoot}" = { home.file."${userRelRoot}" = {
source = repoWallpapersOnly; source = repoWallpaperDir;
recursive = true; recursive = true;
}; };
systemd.user.services.mpvpaper-wallpaper = { systemd.user.services.mpvpaper-wallpaper = {
Unit = { Unit = {
Description = "Video wallpaper (mpvpaper)"; Description = "Video wallpaper (mpvpaper)";
After = [ "graphical-session.target" ]; After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; };
Service = { Service = {
Type = "simple"; Type = "simple";
# -p auto-pause saves resources when the wallpaper surface is hidden. ExecStart = ''
# '*' applies to all outputs. ${pkgs.mpvpaper}/bin/mpvpaper \
# Stretch-to-fill (cover) behavior: -p \
# --panscan=1.0 fills the entire output by cropping (no letterboxing). -o "no-audio --loop-file=inf --no-terminal --really-quiet --panscan=1.0 --keepaspect=yes" \
# If you literally want distortion-stretch (ignore aspect ratio), use --keepaspect=no instead. '*' "${userVideoPath}"
ExecStart = '' '';
${pkgs.mpvpaper}/bin/mpvpaper \ Restart = "on-failure";
-p \ RestartSec = 1;
-o "no-audio --loop-file=inf --no-terminal --really-quiet --panscan=1.0 --keepaspect=yes" \ };
'*' "${userVideoPath}" Install = {
''; WantedBy = [ "graphical-session.target" ];
Restart = "on-failure"; };
RestartSec = 1;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
}; };
} }
#+end_src #+end_src
@@ -1992,25 +1981,19 @@ Mostly styling and enabling modules in the [[https://github.com/Alexays/Waybar][
#+begin_src nix :tangle home/desktop/waybar.nix :noweb tangle :mkdirp yes #+begin_src nix :tangle home/desktop/waybar.nix :noweb tangle :mkdirp yes
{ config, lib, pkgs, flakeRoot, ... }: { config, lib, pkgs, flakeRoot, ... }:
let let
repoWaybarDir = flakeRoot + "/assets/conf/desktop/waybar"; repoWaybarDir = flakeRoot.outPath + "/assets/conf/desktop/waybar";
in in
{ {
programs.waybar.enable = true; programs.waybar.enable = true;
# Ensure config matches repo (HM-managed symlink, not user-editable) home.file.".config/waybar/config" = {
xdg.configFile."waybar/config" = { source = repoWaybarDir + "/config.jsonc";
source = lib.mkForce (repoWaybarDir + "/config.jsonc");
force = true;
}; };
# Override HM's internally-generated waybar-style.css derivation home.file.".config/waybar/style.css" = {
# and use your repo file instead. source = repoWaybarDir + "/style.css";
xdg.configFile."waybar/style.css" = {
source = lib.mkForce (repoWaybarDir + "/style.css");
force = true;
}; };
# Prevent HM from also trying to generate style content via programs.waybar.style
# (not strictly required once mkForce is in place, but keeps intent clear)
programs.waybar.style = ""; programs.waybar.style = "";
} }
#+end_src #+end_src
** Lock Screen ** Lock Screen
@@ -1,50 +1,39 @@
{ config, pkgs, lib, flakeRoot, ... }: { config, pkgs, lib, flakeRoot, ... }:
let let
repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper"; repoWallpaperDir = flakeRoot.outPath + "/assets/conf/desktop/wallpaper";
userRelRoot = "nixos_conf/wallpaperstuff"; userRelRoot = ".config/nixos_conf/wallpaperstuff";
userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}"; userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}";
# The video file you want as wallpaper (must exist under the synced dir)
userVideoPath = "${userAbsRoot}/videos/myWallpaper.mp4"; userVideoPath = "${userAbsRoot}/videos/myWallpaper.mp4";
# (keep your existing approach: sync the repo wallpaper dir to the user dir)
repoWallpapersOnly = lib.cleanSourceWith {
src = repoWallpaperDir;
filter = path: type: true;
};
in in
{ {
home.packages = [ home.packages = [
pkgs.mpvpaper pkgs.mpvpaper
pkgs.mpv pkgs.mpv
]; ];
# Sync repo wallpapers (including videos/) into ~/nixos_conf/wallpaperstuff # Sync repo wallpapers (including videos/) into ~/nixos_conf/wallpaperstuff
home.file."${userRelRoot}" = { home.file."${userRelRoot}" = {
source = repoWallpapersOnly; source = repoWallpaperDir;
recursive = true; recursive = true;
}; };
systemd.user.services.mpvpaper-wallpaper = { systemd.user.services.mpvpaper-wallpaper = {
Unit = { Unit = {
Description = "Video wallpaper (mpvpaper)"; Description = "Video wallpaper (mpvpaper)";
After = [ "graphical-session.target" ]; After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; };
Service = { Service = {
Type = "simple"; Type = "simple";
# -p auto-pause saves resources when the wallpaper surface is hidden. ExecStart = ''
# '*' applies to all outputs. ${pkgs.mpvpaper}/bin/mpvpaper \
# Stretch-to-fill (cover) behavior: -p \
# --panscan=1.0 fills the entire output by cropping (no letterboxing). -o "no-audio --loop-file=inf --no-terminal --really-quiet --panscan=1.0 --keepaspect=yes" \
# If you literally want distortion-stretch (ignore aspect ratio), use --keepaspect=no instead. '*' "${userVideoPath}"
ExecStart = '' '';
${pkgs.mpvpaper}/bin/mpvpaper \ Restart = "on-failure";
-p \ RestartSec = 1;
-o "no-audio --loop-file=inf --no-terminal --really-quiet --panscan=1.0 --keepaspect=yes" \ };
'*' "${userVideoPath}" Install = {
''; WantedBy = [ "graphical-session.target" ];
Restart = "on-failure"; };
RestartSec = 1;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
}; };
} }
+4 -4
View File
@@ -1,13 +1,13 @@
{ config, lib, pkgs, flakeRoot, ... }: { config, lib, pkgs, flakeRoot, ... }:
let let
repoScript = repoScript =
flakeRoot + "/assets/conf/desktop/hypr/scripts/powermenu.sh"; flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/powermenu.sh";
targetRel = "hypr/scripts/powermenu.sh"; targetRel = ".config/hypr/scripts/powermenu.sh";
in in
{ {
# Ensure script exists in ~/.config/hypr/scripts/ # Ensure script exists in ~/.config/hypr/scripts/
xdg.configFile."${targetRel}" = { home.file."${targetRel}" = {
source = lib.mkForce repoScript; source = repoScript;
executable = true; executable = true;
}; };
} }
+5 -12
View File
@@ -1,21 +1,14 @@
{ config, lib, pkgs, flakeRoot, ... }: { config, lib, pkgs, flakeRoot, ... }:
let let
repoWaybarDir = flakeRoot + "/assets/conf/desktop/waybar"; repoWaybarDir = flakeRoot.outPath + "/assets/conf/desktop/waybar";
in in
{ {
programs.waybar.enable = true; programs.waybar.enable = true;
# Ensure config matches repo (HM-managed symlink, not user-editable) home.file.".config/waybar/config" = {
xdg.configFile."waybar/config" = { source = repoWaybarDir + "/config.jsonc";
source = lib.mkForce (repoWaybarDir + "/config.jsonc");
force = true;
}; };
# Override HM's internally-generated waybar-style.css derivation home.file.".config/waybar/style.css" = {
# and use your repo file instead. source = repoWaybarDir + "/style.css";
xdg.configFile."waybar/style.css" = {
source = lib.mkForce (repoWaybarDir + "/style.css");
force = true;
}; };
# Prevent HM from also trying to generate style content via programs.waybar.style
# (not strictly required once mkForce is in place, but keeps intent clear)
programs.waybar.style = ""; programs.waybar.style = "";
} }