From 0499e3ab958d132dfa0a75487dbef97febfd1158 Mon Sep 17 00:00:00 2001 From: ene Date: Sun, 19 Feb 2023 19:13:36 +0100 Subject: Feat(bootstrap): Separate the builder to a library --- lib/default.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/default.nix (limited to 'lib/default.nix') diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 00000000..0e2caf1b --- /dev/null +++ b/lib/default.nix @@ -0,0 +1,20 @@ +{ + pkgs, + shell-library, + ... +}: { + makeShellScriptWithLibrary = { + dependencies, + name, + script, + ... + }: + pkgs.runCommandLocal name { + nativeBuildInputs = [pkgs.makeWrapper] ++ dependencies; + } '' + install -m755 ${script} -D "$out/bin/${name}" + sed -i 's|%SHELL_LIBRARY_PATH|${shell-library}/lib|' "$out/bin/${name}" + patchShebangs "$out/bin/${name}" + wrapProgram "$out/bin/${name}" --prefix PATH : ${pkgs.lib.makeBinPath dependencies} + ''; +} -- cgit 1.4.1