diff options
author | lethalman <lucabru@src.gnome.org> | 2015-02-11 15:05:03 +0100 |
---|---|---|
committer | lethalman <lucabru@src.gnome.org> | 2015-02-11 15:05:03 +0100 |
commit | 157d199b33bee85aeeb256e84abf55523539eaa0 (patch) | |
tree | fab66ac110d17d2baedd53e7f565c9d014061e9e /nixos | |
parent | 4c7adddcb7ae435cdecceeb627dca22ae581ca09 (diff) | |
parent | 5e6068d9136d98b48180c064efb9e779202de68e (diff) | |
download | nixlib-157d199b33bee85aeeb256e84abf55523539eaa0.tar nixlib-157d199b33bee85aeeb256e84abf55523539eaa0.tar.gz nixlib-157d199b33bee85aeeb256e84abf55523539eaa0.tar.bz2 nixlib-157d199b33bee85aeeb256e84abf55523539eaa0.tar.lz nixlib-157d199b33bee85aeeb256e84abf55523539eaa0.tar.xz nixlib-157d199b33bee85aeeb256e84abf55523539eaa0.tar.zst nixlib-157d199b33bee85aeeb256e84abf55523539eaa0.zip |
Merge pull request #5626 from matthiasbeyer/add-fish_shell_module
Add basic nixos module for fish shell
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/programs/fish/fish.nix | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/nixos/modules/programs/fish/fish.nix b/nixos/modules/programs/fish/fish.nix new file mode 100644 index 000000000000..7bbdd280a3bd --- /dev/null +++ b/nixos/modules/programs/fish/fish.nix @@ -0,0 +1,115 @@ +# This module defines global configuration for the fish. + +{ config, lib, pkgs, ... }: + +with lib; + +let + +cfge = config.environment; + +cfg = config.programs.fish; + +fishAliases = concatStringsSep "\n" ( + mapAttrsFlatten (k: v: "alias ${k}='${v}'") cfg.shellAliases +); + +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} + + ${fishAliases} + ''; + + }; + + 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" + ]; + + }; + +} + |