summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2015-01-07 14:11:03 +0100
committerMatthias Beyer <mail@beyermatthias.de>2015-01-08 15:18:26 +0100
commitc5e855e060029697a8b13516b5bd55b87169cf7c (patch)
tree6e968a1f05b2ec33a8920ce7343248c16c31bc9d /nixos
parent9a5da8168d0bb1cf64fb56f74a173cd135eaa9d6 (diff)
downloadnixpkgs-c5e855e060029697a8b13516b5bd55b87169cf7c.tar
nixpkgs-c5e855e060029697a8b13516b5bd55b87169cf7c.tar.gz
nixpkgs-c5e855e060029697a8b13516b5bd55b87169cf7c.tar.bz2
nixpkgs-c5e855e060029697a8b13516b5bd55b87169cf7c.tar.lz
nixpkgs-c5e855e060029697a8b13516b5bd55b87169cf7c.tar.xz
nixpkgs-c5e855e060029697a8b13516b5bd55b87169cf7c.tar.zst
nixpkgs-c5e855e060029697a8b13516b5bd55b87169cf7c.zip
Add basic nixos module for fish shell
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/programs/fish/fish.nix109
1 files changed, 109 insertions, 0 deletions
diff --git a/nixos/modules/programs/fish/fish.nix b/nixos/modules/programs/fish/fish.nix
new file mode 100644
index 00000000000..1903b431aee
--- /dev/null
+++ b/nixos/modules/programs/fish/fish.nix
@@ -0,0 +1,109 @@
+# This module defines global configuration for the fish.
+
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+cfge = config.environment;
+
+cfg = config.programs.fish;
+
+in
+
+{
+
+  options = {
+
+    programs.fish = {
+
+      enable = mkOption {
+        default = false;
+        description = ''
+          Whenever to configure fish as an interactive shell.
+          '';
+        type = types.bool;
+      };
+
+      shellAliases = mkOption {
+        default = config.environment.shellAliases;
+        description = ''
+          Set of aliases for zsh shell. See <option>environment.shellAliases</option>
+          for an option format description.
+            '';
+        type = types.attrs; # types.attrsOf types.stringOrPath;
+      };
+
+      shellInit = mkOption {
+        default = "";
+        description = ''
+          Shell script code called during fish shell initialisation.
+        '';
+        type = types.lines;
+      };
+
+      loginShellInit = mkOption {
+        default = "";
+        description = ''
+          Shell script code called during fish login shell initialisation.
+        '';
+        type = types.lines;
+      };
+
+      interactiveShellInit = mkOption {
+        default = "";
+        description = ''
+          Shell script code called during interactive fish initialisation.
+        '';
+        type = types.lines;
+      };
+
+      promptInit = mkOption {
+        default = "";
+        description = ''
+          Shell script code used to initialise the fish prompt.
+        '';
+        type = types.lines;
+      };
+
+    };
+
+  };
+
+  config = mkIf cfg.enable {
+
+    programs.fish = {
+
+      shellInit = ''
+        . ${config.system.build.setEnvironment}
+
+        ${cfge.shellInit}
+      '';
+
+      loginShellInit = cfge.loginShellInit;
+
+      interactiveShellInit = ''
+        ${cfge.interactiveShellInit}
+
+        ${cfg.promptInit}
+      '';
+
+    };
+
+    environment.profileRelativeEnvVars = { };
+
+    environment.systemPackages = [ pkgs.fish ];
+
+    #users.defaultUserShell = mkDefault "/run/current-system/sw/bin/fish";
+
+    environment.shells =
+      [ "/run/current-system/sw/bin/fish"
+        "/var/run/current-system/sw/bin/fish"
+        "${pkgs.fish}/bin/fish"
+      ];
+
+  };
+
+}
+