aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/home-manager/modules/lib/shell.nix
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/home-manager/modules/lib/shell.nix')
-rw-r--r--infra/libkookie/home-manager/modules/lib/shell.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/infra/libkookie/home-manager/modules/lib/shell.nix b/infra/libkookie/home-manager/modules/lib/shell.nix
new file mode 100644
index 000000000000..5e5743f51ea6
--- /dev/null
+++ b/infra/libkookie/home-manager/modules/lib/shell.nix
@@ -0,0 +1,11 @@
+{ lib }:
+
+rec {
+ # Produces a Bourne shell like variable export statement.
+ export = n: v: ''export ${n}="${toString v}"'';
+
+ # Given an attribute set containing shell variable names and their
+ # assignment, this function produces a string containing an export
+ # statement for each set entry.
+ exportAll = vars: lib.concatStringsSep "\n" (lib.mapAttrsToList export vars);
+}