mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
lib/shell: add library of convenience functions
This library holds a few convenience functions for generating shell code.
This commit is contained in:
parent
df6590abfc
commit
58a629b02e
2 changed files with 13 additions and 0 deletions
|
@ -15,4 +15,6 @@
|
||||||
entryAfter = d.dagEntryAfter;
|
entryAfter = d.dagEntryAfter;
|
||||||
entryBefore = d.dagEntryBefore;
|
entryBefore = d.dagEntryBefore;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
shell = import ./shell.nix { inherit lib; };
|
||||||
}
|
}
|
||||||
|
|
11
modules/lib/shell.nix
Normal file
11
modules/lib/shell.nix
Normal file
|
@ -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);
|
||||||
|
}
|
Loading…
Reference in a new issue