diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2017-01-24 20:45:40 +0100 |
|---|---|---|
| committer | Eric Bailey <eric@ericb.me> | 2017-02-02 19:40:08 -0600 |
| commit | 367a05488f7f454070d4fbdf1044e49866a1caa1 (patch) | |
| tree | 0859923e4eab24b9d7bdcf34124c31e7b0f1a858 /modules/programs/fish.nix | |
| parent | 75575107a677baf10ee54b114f1105873086364c (diff) | |
fish: use writeText for foreign-env
Diffstat (limited to 'modules/programs/fish.nix')
| -rw-r--r-- | modules/programs/fish.nix | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index a92aca4..698bc32 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -4,12 +4,21 @@ with lib; let + cfg = config.programs.fish; cfge = config.environment; - cfg = config.programs.fish; + foreignEnv = pkgs.writeText "fish-foreign-env" '' + # TODO: environment.shellInit + ${cfge.extraInit} + ''; - fishVariables = - mapAttrsToList (n: v: ''set -x ${n} "${v}"'') cfg.variables; + loginForeignEnv = pkgs.writeText "fish-login-foreign-env" '' + # TODO: environment.loginShellInit + ''; + + interactiveForeignEnv = pkgs.writeText "fish-interactive-foreign-env" '' + ${cfge.interactiveShellInit} + ''; shell = pkgs.runCommand pkgs.fish.name { buildInputs = [ pkgs.makeWrapper ]; } @@ -24,6 +33,9 @@ let mapAttrsFlatten (k: v: "alias ${k} '${v}'") cfg.shellAliases ); + fishVariables = + mapAttrsToList (n: v: ''set -x ${n} "${v}"'') cfg.variables; + in { @@ -99,10 +111,6 @@ in config = mkIf cfg.enable { - environment.etc."fish/foreign-env/shellInit".text = cfge.shellInit; - environment.etc."fish/foreign-env/loginShellInit".text = cfge.loginShellInit; - environment.etc."fish/foreign-env/interactiveShellInit".text = cfge.interactiveShellInit; - environment.etc."fish/config.fish".text = '' # /etc/fish/config.fish: DO NOT EDIT -- this file has been generated automatically. @@ -112,20 +120,22 @@ in ${config.system.build.setEnvironment} - fenv source /etc/fish/foreign-env/shellInit > /dev/null - + fenv source ${foreignEnv} ${cfg.shellInit} ${concatStringsSep "\n" fishVariables} if status --is-login - fenv source /etc/fish/foreign-env/loginShellInit > /dev/null + # TODO: environment.loginShellInit ${cfg.loginShellInit} end if status --is-interactive ${fishAliases} - fenv source /etc/fish/foreign-env/interactiveShellInit > /dev/null + ${optionalString (cfge.interactiveShellInit != "") '' + fenv source ${interactiveForeignEnv} + ''} + ${cfg.interactiveShellInit} ${cfg.promptInit} end |
