summaryrefslogtreecommitdiff
path: root/modules/system/patches.nix
diff options
context:
space:
mode:
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: ''