at 24.11-pre 1.1 kB view raw
1{ config, pkgs, lib, ... }: 2 3let 4 prg = config.programs; 5 cfg = prg.thefuck; 6 7 bashAndZshInitScript = '' 8 eval $(${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias}) 9 ''; 10 fishInitScript = '' 11 ${pkgs.thefuck}/bin/thefuck --alias ${cfg.alias} | source 12 ''; 13in 14 { 15 options = { 16 programs.thefuck = { 17 enable = lib.mkEnableOption "thefuck, an app which corrects your previous console command"; 18 19 alias = lib.mkOption { 20 default = "fuck"; 21 type = lib.types.str; 22 23 description = '' 24 `thefuck` needs an alias to be configured. 25 The default value is `fuck`, but you can use anything else as well. 26 ''; 27 }; 28 }; 29 }; 30 31 config = lib.mkIf cfg.enable { 32 environment.systemPackages = with pkgs; [ thefuck ]; 33 34 programs.bash.interactiveShellInit = bashAndZshInitScript; 35 programs.zsh.interactiveShellInit = lib.mkIf prg.zsh.enable bashAndZshInitScript; 36 programs.fish.interactiveShellInit = lib.mkIf prg.fish.enable fishInitScript; 37 }; 38 }