aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/unflake.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/unflake.sh')
-rwxr-xr-xscripts/unflake.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/unflake.sh b/scripts/unflake.sh
new file mode 100755
index 00000000..2404260a
--- /dev/null
+++ b/scripts/unflake.sh
@@ -0,0 +1,21 @@
+#! /usr/bin/env sh
+
+set -e
+
+# HACK(@bpeetz): unflake doesn't support npins version 8 yet, so we pretend to still use
+# version 7.
+# Essentially, we are abusing the fact that `npins` will look at `NPINS_DIRECTORY` while
+# unflake doesn't.
+# <2026-06-13>
+NPINS_DIRECTORY="$(mktemp -t "npins_fake_dir_for_unflake_XXXXX" -d)"
+export NPINS_DIRECTORY
+
+mv npins/sources.json "$NPINS_DIRECTORY/"
+jq '.version = 7' <"$NPINS_DIRECTORY/sources.json" >npins/sources.json
+
+NIX_CONFIG="pure-eval = false" nix run -f https://codeberg.org/goldstein/unflake/archive/main.tar.gz unflake -- "$@"
+
+mv "$NPINS_DIRECTORY/sources.json" npins/sources.json
+rmdir "$NPINS_DIRECTORY"
+
+# vim: ft=sh