summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2016-06-12 20:03:14 +0100
committerzimbatm <zimbatm@zimbatm.com>2016-06-12 20:35:34 +0100
commit2974b6f4c8224ab1097e9386d6b3a0d570f95531 (patch)
tree5e096917408ec3b8099685c0db35fa372914d01e /nixos/lib
parente2413ad5a8b6a80e5552306518fdf16e68b6c6d7 (diff)
downloadnixpkgs-2974b6f4c8224ab1097e9386d6b3a0d570f95531.tar
nixpkgs-2974b6f4c8224ab1097e9386d6b3a0d570f95531.tar.gz
nixpkgs-2974b6f4c8224ab1097e9386d6b3a0d570f95531.tar.bz2
nixpkgs-2974b6f4c8224ab1097e9386d6b3a0d570f95531.tar.lz
nixpkgs-2974b6f4c8224ab1097e9386d6b3a0d570f95531.tar.xz
nixpkgs-2974b6f4c8224ab1097e9386d6b3a0d570f95531.tar.zst
nixpkgs-2974b6f4c8224ab1097e9386d6b3a0d570f95531.zip
Use shell packages to select the user's shell
The string type is still available for backward-compatiblity.
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/utils.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/nixos/lib/utils.nix b/nixos/lib/utils.nix
index 7b8be2050c1..871fbb121d0 100644
--- a/nixos/lib/utils.nix
+++ b/nixos/lib/utils.nix
@@ -8,4 +8,10 @@ rec {
    replaceChars ["/" "-" " "] ["-" "\\x2d" "\\x20"]
     (if hasPrefix "/" s then substring 1 (stringLength s) s else s);
 
+  # Returns a system path for a given shell package
+  toShellPath = shell:
+    if types.shellPackage.check shell then
+      "/run/current-system/sw${shell.shellPath}"
+    else
+      shell;
 }