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, ... }:
let
repoScript =
flakeRoot + "/assets/conf/desktop/hypr/scripts/powermenu.sh";
targetRel = "hypr/scripts/powermenu.sh";
flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/powermenu.sh";
targetRel = ".config/hypr/scripts/powermenu.sh";
in
{
# Ensure script exists in ~/.config/hypr/scripts/
xdg.configFile."${targetRel}" = {
source = lib.mkForce repoScript;
home.file."${targetRel}" = {
source = repoScript;
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
{ config, pkgs, lib, flakeRoot, ... }:
let
repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper";
userRelRoot = "nixos_conf/wallpaperstuff";
repoWallpaperDir = flakeRoot.outPath + "/assets/conf/desktop/wallpaper";
userRelRoot = ".config/nixos_conf/wallpaperstuff";
userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}";
# The video file you want as wallpaper (must exist under the synced dir)
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
{
home.packages = [
pkgs.mpvpaper
pkgs.mpv
pkgs.mpvpaper
pkgs.mpv
];
# Sync repo wallpapers (including videos/) into ~/nixos_conf/wallpaperstuff
home.file."${userRelRoot}" = {
source = repoWallpapersOnly;
recursive = true;
source = repoWallpaperDir;
recursive = true;
};
systemd.user.services.mpvpaper-wallpaper = {
Unit = {
Description = "Video wallpaper (mpvpaper)";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "simple";
# -p auto-pause saves resources when the wallpaper surface is hidden.
# '*' applies to all outputs.
# Stretch-to-fill (cover) behavior:
# --panscan=1.0 fills the entire output by cropping (no letterboxing).
# If you literally want distortion-stretch (ignore aspect ratio), use --keepaspect=no instead.
ExecStart = ''
${pkgs.mpvpaper}/bin/mpvpaper \
-p \
-o "no-audio --loop-file=inf --no-terminal --really-quiet --panscan=1.0 --keepaspect=yes" \
'*' "${userVideoPath}"
'';
Restart = "on-failure";
RestartSec = 1;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Unit = {
Description = "Video wallpaper (mpvpaper)";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "simple";
ExecStart = ''
${pkgs.mpvpaper}/bin/mpvpaper \
-p \
-o "no-audio --loop-file=inf --no-terminal --really-quiet --panscan=1.0 --keepaspect=yes" \
'*' "${userVideoPath}"
'';
Restart = "on-failure";
RestartSec = 1;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
}
#+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
{ config, lib, pkgs, flakeRoot, ... }:
let
repoWaybarDir = flakeRoot + "/assets/conf/desktop/waybar";
repoWaybarDir = flakeRoot.outPath + "/assets/conf/desktop/waybar";
in
{
programs.waybar.enable = true;
# Ensure config matches repo (HM-managed symlink, not user-editable)
xdg.configFile."waybar/config" = {
source = lib.mkForce (repoWaybarDir + "/config.jsonc");
force = true;
home.file.".config/waybar/config" = {
source = repoWaybarDir + "/config.jsonc";
};
# Override HM's internally-generated waybar-style.css derivation
# and use your repo file instead.
xdg.configFile."waybar/style.css" = {
source = lib.mkForce (repoWaybarDir + "/style.css");
force = true;
home.file.".config/waybar/style.css" = {
source = repoWaybarDir + "/style.css";
};
# 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 = "";
}
#+end_src
** Lock Screen
@@ -1,50 +1,39 @@
{ config, pkgs, lib, flakeRoot, ... }:
let
repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper";
userRelRoot = "nixos_conf/wallpaperstuff";
repoWallpaperDir = flakeRoot.outPath + "/assets/conf/desktop/wallpaper";
userRelRoot = ".config/nixos_conf/wallpaperstuff";
userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}";
# The video file you want as wallpaper (must exist under the synced dir)
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
{
home.packages = [
pkgs.mpvpaper
pkgs.mpv
pkgs.mpvpaper
pkgs.mpv
];
# Sync repo wallpapers (including videos/) into ~/nixos_conf/wallpaperstuff
home.file."${userRelRoot}" = {
source = repoWallpapersOnly;
recursive = true;
source = repoWallpaperDir;
recursive = true;
};
systemd.user.services.mpvpaper-wallpaper = {
Unit = {
Description = "Video wallpaper (mpvpaper)";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "simple";
# -p auto-pause saves resources when the wallpaper surface is hidden.
# '*' applies to all outputs.
# Stretch-to-fill (cover) behavior:
# --panscan=1.0 fills the entire output by cropping (no letterboxing).
# If you literally want distortion-stretch (ignore aspect ratio), use --keepaspect=no instead.
ExecStart = ''
${pkgs.mpvpaper}/bin/mpvpaper \
-p \
-o "no-audio --loop-file=inf --no-terminal --really-quiet --panscan=1.0 --keepaspect=yes" \
'*' "${userVideoPath}"
'';
Restart = "on-failure";
RestartSec = 1;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Unit = {
Description = "Video wallpaper (mpvpaper)";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "simple";
ExecStart = ''
${pkgs.mpvpaper}/bin/mpvpaper \
-p \
-o "no-audio --loop-file=inf --no-terminal --really-quiet --panscan=1.0 --keepaspect=yes" \
'*' "${userVideoPath}"
'';
Restart = "on-failure";
RestartSec = 1;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
}
+4 -4
View File
@@ -1,13 +1,13 @@
{ config, lib, pkgs, flakeRoot, ... }:
let
repoScript =
flakeRoot + "/assets/conf/desktop/hypr/scripts/powermenu.sh";
targetRel = "hypr/scripts/powermenu.sh";
flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/powermenu.sh";
targetRel = ".config/hypr/scripts/powermenu.sh";
in
{
# Ensure script exists in ~/.config/hypr/scripts/
xdg.configFile."${targetRel}" = {
source = lib.mkForce repoScript;
home.file."${targetRel}" = {
source = repoScript;
executable = true;
};
}
+5 -12
View File
@@ -1,21 +1,14 @@
{ config, lib, pkgs, flakeRoot, ... }:
let
repoWaybarDir = flakeRoot + "/assets/conf/desktop/waybar";
repoWaybarDir = flakeRoot.outPath + "/assets/conf/desktop/waybar";
in
{
programs.waybar.enable = true;
# Ensure config matches repo (HM-managed symlink, not user-editable)
xdg.configFile."waybar/config" = {
source = lib.mkForce (repoWaybarDir + "/config.jsonc");
force = true;
home.file.".config/waybar/config" = {
source = repoWaybarDir + "/config.jsonc";
};
# Override HM's internally-generated waybar-style.css derivation
# and use your repo file instead.
xdg.configFile."waybar/style.css" = {
source = lib.mkForce (repoWaybarDir + "/style.css");
force = true;
home.file.".config/waybar/style.css" = {
source = repoWaybarDir + "/style.css";
};
# 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 = "";
}