fish: use mkTarget

This commit is contained in:
awwpotato 2025-05-21 14:01:23 -07:00
parent af11435723
commit 18211a9f41
No known key found for this signature in database
3 changed files with 23 additions and 22 deletions

View file

@ -1,10 +1,13 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "fish";
humanName = "Fish";
{
options.stylix.targets.fish.enable =
config.lib.stylix.mkEnableTarget "Fish" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fish.enable) {
programs.fish.interactiveShellInit = import ./prompt.nix config;
};
configElements =
{ colors, inputs }:
{
programs.fish.interactiveShellInit = import ./prompt.nix {
inherit colors inputs;
};
};
}

View file

@ -1,10 +1,11 @@
{ config, lib, ... }:
{ mkTarget, ... }:
mkTarget {
name = "fish";
humanName = "Fish";
{
options.stylix.targets.fish.enable =
config.lib.stylix.mkEnableTarget "Fish" true;
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fish.enable) {
programs.fish.promptInit = import ./prompt.nix config;
};
configElements =
{ colors, inputs }:
{
programs.fish.promptInit = import ./prompt.nix { inherit colors inputs; };
};
}

View file

@ -1,15 +1,12 @@
config:
{ colors, inputs }:
let
theme = config.lib.stylix.colors {
templateRepo = config.stylix.inputs.base16-fish;
};
theme = colors { templateRepo = inputs.base16-fish; };
in
''
source ${theme}
# See https://github.com/tomyun/base16-fish/issues/7 for why this condition exists
if status --is-interactive && test -z "$TMUX"
base16-${config.lib.stylix.colors.slug}
base16-${colors.slug}
end
''