about summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorene <ene@sils.li>2023-02-19 19:13:36 +0100
committerene <ene@sils.li>2023-02-19 19:13:36 +0100
commit0499e3ab958d132dfa0a75487dbef97febfd1158 (patch)
tree6b13936df3a6101b179c4683b1cfbab820ac124b /lib
parentFix(bootstrap): Remove false btrfs subvolume (diff)
downloadnixos-config-0499e3ab958d132dfa0a75487dbef97febfd1158.tar.gz
nixos-config-0499e3ab958d132dfa0a75487dbef97febfd1158.zip
Feat(bootstrap): Separate the builder to a library
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix20
1 files changed, 20 insertions, 0 deletions
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}
+    '';
+}