diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2020-05-29 22:54:25 +0200 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2020-05-29 22:54:25 +0200 |
| commit | f55568ea4e31900cc40d6fcd254c7eb11e927632 (patch) | |
| tree | 8dcae8f9ec769c5fd1608669cfb22e519602dc0a /modules/system | |
| parent | 77121650d42cbc11d5a62a9e466b0433324659fb (diff) | |
system: cleanup patches activation
Diffstat (limited to 'modules/system')
| -rw-r--r-- | modules/system/patches.nix | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/modules/system/patches.nix b/modules/system/patches.nix index 0820d01..855d23f 100644 --- a/modules/system/patches.nix +++ b/modules/system/patches.nix @@ -50,14 +50,18 @@ in # Applying patches to /. echo "applying patches..." >&2 - f=$(readlink /run/current-system/patches) - if ! test "$f" = ${config.system.build.patches}/patches; then - for f in $(find /run/current-system/patches/ -type l); do - patch --reverse --backup -d / -p1 < "$f" >/dev/null || true - done + for f in $(ls /run/current-system/patches 2> /dev/null); do + if test ! -e "${config.system.build.patches}/patches/$f"; then + patch --reverse --backup -d / -p1 < "/run/current-system/patches/$f" || true + fi + done - ${concatMapStringsSep "\n" (f: "patch --forward --backup -d / -p1 < '${f}' || true") cfg.patches} - fi + ${concatMapStringsSep "\n" (f: '' + f="$(basename ${f})" + if ! diff "${cfg.build.patches}/patches/$f" "/run/current-system/patches/$f" &> /dev/null; then + patch --forward --backup -d / -p1 < '${f}' || true + fi + '') cfg.patches} ''; }; |
