home-manager/modules/lib/shell.nix
Robert Helgesson 58a629b02e
lib/shell: add library of convenience functions
This library holds a few convenience functions for generating shell
code.
2018-01-07 16:59:22 +01:00

12 lines
381 B
Nix

{ 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);
}