Compare commits

...

2 commits

Author SHA1 Message Date
c538cb8211
Enable transience feature for starship. 2025-06-05 15:33:16 +08:00
a3edfa91e9 Add Makefile for cxx template 2025-06-05 15:33:16 +08:00
2 changed files with 45 additions and 16 deletions

View file

@ -4,27 +4,40 @@
...
}: let
cfg = config.youthlic.programs.starship;
fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash;
in {
options = {
youthlic.programs.starship = {
enable = lib.mkEnableOption "starship";
};
};
config = lib.mkIf cfg.enable {
programs.starship = lib.mkMerge [
{
enable = true;
settings = let
config-file = builtins.readFile ./config.toml;
in
builtins.fromTOML config-file;
config = lib.mkMerge [
(
lib.mkIf cfg.enable {
programs.starship = {
enable = true;
enableTransience = true;
settings = let
config-file = builtins.readFile ./config.toml;
in
builtins.fromTOML config-file;
};
}
(lib.mkIf config.youthlic.programs.fish.enable {
enableFishIntegration = true;
})
(lib.mkIf config.youthlic.programs.bash.enable {
enableBashIntegration = true;
})
];
};
)
(lib.mkIf (cfg.enable && fish-cfg.enable) {
programs.starship.enableFishIntegration = true;
programs.fish.functions = {
starship_transient_prompt_func = ''
starship module character
'';
starship_transient_rprompt_func = ''
starship module time
'';
};
})
(lib.mkIf (cfg.enable && bash-cfg.enable) {
programs.starship.enableBashIntegration = true;
})
];
}

16
templates/cxx/Makefile Normal file
View file

@ -0,0 +1,16 @@
main.out: main.o
$(CXX) -std=c++26 $^ -o $@
main.o: main.cxx
$(CXX) -std=c++26 -c $^
compile_commands.json: clean
bear -- make
.PHONY: run clean
run: main
@echo Run:
@./main
clean:
-rm main.out main.o