programs.thefuck: support shells that don't use `/etc/profile`

Changed files
+11 -3
nixos
modules
programs
+11 -3
nixos/modules/programs/thefuck.nix
···
with lib;
let
-
cfg = config.programs.thefuck;
in
{
options = {
···
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ thefuck ];
-
environment.shellInit = ''
-
eval $(${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias})
'';
};
}
···
with lib;
let
+
prg = config.programs;
+
cfg = prg.thefuck;
+
+
initScript = ''
+
eval $(${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias})
+
'';
in
{
options = {
···
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ thefuck ];
+
environment.shellInit = initScript;
+
+
programs.zsh.shellInit = mkIf prg.zsh.enable initScript;
+
programs.fish.shellInit = mkIf prg.fish.enable ''
+
${pkgs.thefuck}/bin/thefuck --alias | source
'';
};
}