about summary refs log tree commit diff
path: root/utils/default.nix
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-03-13T23·03+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-03-13T23·03+0000
commitaa9b81fe21438e7100c0a9019fc8883b2376dadb (patch)
tree4138f5e4edb82190d070ec3ace65b285e56e80a4 /utils/default.nix
parent02721a25a7676a8503f92c0bf32fd736c18dda58 (diff)
Move wrapNonNixProgram to utils module
Define the wrapNonNixProgram in my Nix utils module.
Diffstat (limited to 'utils/default.nix')
-rw-r--r--utils/default.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/utils/default.nix b/utils/default.nix
new file mode 100644
index 000000000000..df9673daec70
--- /dev/null
+++ b/utils/default.nix
@@ -0,0 +1,14 @@
+{ pkgs, ... }:
+
+# Using this as a library to define some common utility functions that I often
+# reach for.
+{
+  # A unary function that returns its argument.
+  identity = x: x;
+
+  # Create a derivation that creates an executable shell script named `as` that
+  # calls the program located at `path`, forwarding all of the arguments.
+  wrapNonNixProgram = { path, as }: pkgs.writeShellScriptBin as ''
+    exec ${path} "$@"
+  '';
+}