about summary refs log tree commit diff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-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} "$@"
+  '';
+}