mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-02 20:03:16 +00:00
536a78ecc9
Renaming the variable from `initScript` to `bashAndZshInitScript` makes it clearer, what it is actually used for. Moving the fish init script right below the other call to `thefuck --alias` makes it more obvious, when one of them is different in some important way.
41 lines
989 B
Nix
41 lines
989 B
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
prg = config.programs;
|
|
cfg = prg.thefuck;
|
|
|
|
bashAndZshInitScript = ''
|
|
eval $(${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias})
|
|
'';
|
|
fishInitScript = ''
|
|
${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias} | source
|
|
'';
|
|
in
|
|
{
|
|
options = {
|
|
programs.thefuck = {
|
|
enable = mkEnableOption "thefuck";
|
|
|
|
alias = mkOption {
|
|
default = "fuck";
|
|
type = types.str;
|
|
|
|
description = ''
|
|
`thefuck` needs an alias to be configured.
|
|
The default value is `fuck`, but you can use anything else as well.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
environment.systemPackages = with pkgs; [ thefuck ];
|
|
|
|
programs.bash.interactiveShellInit = bashAndZshInitScript;
|
|
programs.zsh.interactiveShellInit = mkIf prg.zsh.enable bashAndZshInitScript;
|
|
programs.fish.interactiveShellInit = mkIf prg.fish.enable fishInitScript;
|
|
};
|
|
}
|