aboutsummaryrefslogtreecommitdiff
path: root/strip-store-paths/default.nix
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2021-12-20 14:38:24 +1100
committerJustin Bedo <cu@cua0.org>2021-12-20 14:38:24 +1100
commiteebc44e609cc2f901c7ea694d62e36f63cbeae24 (patch)
tree4c7c07991a64c2480dd02490110ae62885c7bc2d /strip-store-paths/default.nix
parent6979eda7260b804099a39b27e417d942feb722b9 (diff)
rewrite strip store paths
Old version used sed, which is not inplace and causes issues when garbage collection triggers during a build. This patch adds a small rewriter that works in place.
Diffstat (limited to 'strip-store-paths/default.nix')
-rw-r--r--strip-store-paths/default.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/strip-store-paths/default.nix b/strip-store-paths/default.nix
new file mode 100644
index 0000000..40fb546
--- /dev/null
+++ b/strip-store-paths/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, zig }:
+
+stdenv.mkDerivation {
+ name = "strip-store-paths";
+ nativeBuildInputs = [ zig ];
+ src = ./strip-store-paths.zig;
+
+ unpackPhase = ''
+ cp $src strip-store-paths.zig
+ '';
+
+ buildPhase = ''
+ export HOME=$TMPDIR
+ zig build-exe -OReleaseFast strip-store-paths.zig
+ '';
+
+ installPhase = ''
+ install -Dm 755 ./strip-store-paths $out/bin/strip-store-paths
+ '';
+}