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
+316 -333
View File
File diff suppressed because it is too large Load Diff
+13 -30
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,16 +1679,10 @@ 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 = [
@@ -1697,7 +1691,7 @@ in
]; ];
# 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 = {
@@ -1708,11 +1702,6 @@ in
}; };
Service = { Service = {
Type = "simple"; 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 = '' ExecStart = ''
${pkgs.mpvpaper}/bin/mpvpaper \ ${pkgs.mpvpaper}/bin/mpvpaper \
-p \ -p \
@@ -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,15 +1,9 @@
{ 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 = [
@@ -18,7 +12,7 @@ in
]; ];
# 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 = {
@@ -29,11 +23,6 @@ in
}; };
Service = { Service = {
Type = "simple"; 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 = '' ExecStart = ''
${pkgs.mpvpaper}/bin/mpvpaper \ ${pkgs.mpvpaper}/bin/mpvpaper \
-p \ -p \
+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 = "";
} }