mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 06:45:16 +01:00
bccd0faee4
The init script slightly differs depending on which shell is in use. So for bash it should be in the interactiveShellInit as well. In this case we don't need a mkIf as `bash` is enabled by default on NixOS.
39 lines
922 B
Nix
39 lines
922 B
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
prg = config.programs;
|
|
cfg = prg.thefuck;
|
|
|
|
initScript = ''
|
|
eval $(${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias})
|
|
'';
|
|
in
|
|
{
|
|
options = {
|
|
programs.thefuck = {
|
|
enable = mkEnableOption "thefuck";
|
|
|
|
alias = mkOption {
|
|
default = "fuck";
|
|
type = types.string;
|
|
|
|
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 = initScript;
|
|
programs.zsh.interactiveShellInit = mkIf prg.zsh.enable initScript;
|
|
programs.fish.interactiveShellInit = mkIf prg.fish.enable ''
|
|
${pkgs.thefuck}/bin/thefuck --alias | source
|
|
'';
|
|
};
|
|
}
|