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