diff --git a/home.nix b/home.nix index f45f4ed..4dd7180 100644 --- a/home.nix +++ b/home.nix @@ -4,7 +4,6 @@ imports = [ ./home/modules ./home/modules/git.nix - ./home/modules/fish.nix ]; # Home Manager needs a bit of information about you and the paths it should diff --git a/home/modules/default.nix b/home/modules/default.nix index ed4a717..3ea12a0 100644 --- a/home/modules/default.nix +++ b/home/modules/default.nix @@ -1,7 +1,10 @@ -{ ... }: +{ lib, ... }: { imports = [ ./neovim.nix ./alacritty.nix + ./fish.nix ]; + + snowhawk.fish.enable = lib.mkDefault true; } diff --git a/home/modules/fish.nix b/home/modules/fish.nix index 6d12f37..e259060 100644 --- a/home/modules/fish.nix +++ b/home/modules/fish.nix @@ -1,21 +1,29 @@ -{ pkgs, inputs, ... }: +{ pkgs, inputs, config, lib, ... }: +let + cfg = config.snowhawk.fish; +in { - programs.bash = { - enable = true; - initExtra = '' - if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] - then - shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" - exec ${pkgs.fish}/bin/fish $LOGIN_OPTION - fi - ''; + options.snowhawk.fish = { + enable = lib.mkEnableOption "fish"; }; + config = lib.mkIf cfg.enable { + programs.bash = { + enable = true; + initExtra = '' + if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] + then + shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" + exec ${pkgs.fish}/bin/fish $LOGIN_OPTION + fi + ''; + }; - programs.fish = { - enable = true; - interactiveShellInit = - builtins.readFile "${inputs.fish_theme}/fish_prompt.fish" + "\n" + - builtins.readFile ../fish/config.fish - ; + programs.fish = { + enable = true; + interactiveShellInit = + builtins.readFile "${inputs.fish_theme}/fish_prompt.fish" + "\n" + + builtins.readFile ../fish/config.fish + ; + }; }; }