From f89c97d3a1f38f0c2b4c6c4fde5d5eedd194300a Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 28 Jul 2024 23:11:38 +0200 Subject: [PATCH] pkgs/mkScriptOverride: init --- pkgs/by-name/mk/mkScriptOverride/package.nix | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 pkgs/by-name/mk/mkScriptOverride/package.nix diff --git a/pkgs/by-name/mk/mkScriptOverride/package.nix b/pkgs/by-name/mk/mkScriptOverride/package.nix new file mode 100644 index 0000000..6777a0c --- /dev/null +++ b/pkgs/by-name/mk/mkScriptOverride/package.nix @@ -0,0 +1,29 @@ +{ + lib, + stdenv, +}: + +{ + src, + script, + ... +} @ args: +lib.hiPrio (stdenv.mkDerivation ( + { + src = src; + name = "${src.name}-script-override"; + phases = [ "installPhase" "scriptOverridePhase" ]; + installPhase = '' + runHook preInstall + + cp -r $src $out + chmod u+w -R $out + + runHook postInstall + ''; + scriptOverridePhase = script; + } // lib.removeAttrs args [ + "pkg" + "commands" + ] +))