summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorSilvan Mosberger <infinisil@icloud.com>2018-10-13 17:46:11 +0200
committerGitHub <noreply@github.com>2018-10-13 17:46:11 +0200
commitd4f2f4c79d45c2599664e99345530f43ccfb6ef8 (patch)
treef2b2da622e5401d80b67f25f022462f64e553642 /nixos/modules/config
parent6e4d0c4a8aee7ccce78fc89baac35c616721d474 (diff)
parentc941577dcb68ad413853ae744a458555b3209c21 (diff)
downloadnixlib-d4f2f4c79d45c2599664e99345530f43ccfb6ef8.tar
nixlib-d4f2f4c79d45c2599664e99345530f43ccfb6ef8.tar.gz
nixlib-d4f2f4c79d45c2599664e99345530f43ccfb6ef8.tar.bz2
nixlib-d4f2f4c79d45c2599664e99345530f43ccfb6ef8.tar.lz
nixlib-d4f2f4c79d45c2599664e99345530f43ccfb6ef8.tar.xz
nixlib-d4f2f4c79d45c2599664e99345530f43ccfb6ef8.tar.zst
nixlib-d4f2f4c79d45c2599664e99345530f43ccfb6ef8.zip
Merge pull request #44441 from mnacamura/shell-aliases
environment.shellAliases: change default behavior
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/shells-environment.nix12
1 files changed, 9 insertions, 3 deletions
diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix
index 555db459f57a..6379b52870ea 100644
--- a/nixos/modules/config/shells-environment.nix
+++ b/nixos/modules/config/shells-environment.nix
@@ -108,14 +108,14 @@ in
     };
 
     environment.shellAliases = mkOption {
-      default = {};
-      example = { ll = "ls -l"; };
+      example = { l = null; ll = "ls -l"; };
       description = ''
         An attribute set that maps aliases (the top level attribute names in
         this option) to command strings or directly to build outputs. The
         aliases are added to all users' shells.
+        Aliases mapped to <code>null</code> are ignored.
       '';
-      type = types.attrs; # types.attrsOf types.stringOrPath;
+      type = with types; attrsOf (nullOr (either str path));
     };
 
     environment.binsh = mkOption {
@@ -157,6 +157,12 @@ in
     # terminal instead of logging out of X11).
     environment.variables = config.environment.sessionVariables;
 
+    environment.shellAliases = mapAttrs (name: mkDefault) {
+      ls = "ls --color=tty";
+      ll = "ls -l";
+      l  = "ls -alh";
+    };
+
     environment.etc."shells".text =
       ''
         ${concatStringsSep "\n" (map utils.toShellPath cfg.shells)}