summaryrefslogtreecommitdiff
path: root/modules/system/patches.nix
diff options
context:
space:
mode:
authorMike Vink <59492084+ivi-vink@users.noreply.github.com>2025-01-16 22:22:34 +0100
committerGitHub <noreply@github.com>2025-01-16 22:22:34 +0100
commit8e7bd91f353caacc0bc4105f573eb3e17f09e03a (patch)
treec5059edcbebd9644290cad7c653c49a36d593021 /modules/system/patches.nix
parent6bd39d420578aacf7c0bab7de3e7027b952115ae (diff)
parentbd921223ba7cdac346477d7ea5204d6f4736fcc6 (diff)
Merge branch 'LnL7:master' into masterHEADmaster
Diffstat (limited to 'modules/system/patches.nix')
-rw-r--r--modules/system/patches.nix17
1 files changed, 10 insertions, 7 deletions
diff --git a/modules/system/patches.nix b/modules/system/patches.nix
index 9ac15ec..7b19255 100644
--- a/modules/system/patches.nix
+++ b/modules/system/patches.nix
@@ -26,13 +26,13 @@ in
'''')
]
'';
- description = lib.mdDoc ''
+ description = ''
Set of patches to apply to {file}`/`.
::: {.warning}
-
+
This can modify everything so use with caution.
-
+
:::
Useful for safely changing system files. Unlike the etc module this
@@ -56,10 +56,13 @@ in
# Applying patches to /.
echo "applying patches..." >&2
- for f in $(ls /run/current-system/patches 2> /dev/null); do
- if test ! -e "${config.system.build.patches}/patches/$f"; then
- patch --force --reverse --backup -d / -p1 < "/run/current-system/patches/$f" || true
- fi
+ for f in /run/current-system/patches/*; do
+ [[ -e "$f" ]] || break # handle when directory is empty
+ f=''${f#/run/current-system/patches/}
+
+ if [[ ! -e "${config.system.build.patches}/patches/$f" ]]; then
+ patch --force --reverse --backup -d / -p1 < "/run/current-system/patches/$f" || true
+ fi
done
${concatMapStringsSep "\n" (f: ''