mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-26 23:54:01 +00:00
478e7184f8
And replace them with a more appropriate type Also fix up some minor module problems along the way
40 lines
919 B
Nix
40 lines
919 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.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 = initScript;
|
|
programs.zsh.interactiveShellInit = mkIf prg.zsh.enable initScript;
|
|
programs.fish.interactiveShellInit = mkIf prg.fish.enable ''
|
|
${pkgs.thefuck}/bin/thefuck --alias | source
|
|
'';
|
|
};
|
|
}
|