feature(starship): move to a module

This commit is contained in:
Serĉanto de Scio 2024-09-23 19:31:53 +10:00
parent 561fe2f602
commit e3d22e6206
Signed by: sercanto
GPG key ID: A4122FF3971B6865
8 changed files with 51 additions and 12 deletions

28
modules/default.nix Normal file
View file

@ -0,0 +1,28 @@
{
self,
inputs,
nixpkgs,
ragenix,
...
}: let
nixosSystem = nixpkgs.lib.makeOverridable nixpkgs.lib.nixosSystem;
customModules = import ./module-list.nix;
baseModules = [
{
imports = [
({pkgs, ...}: {
nix.nixPath = [
"nixpkgs=${pkgs.path}"
];
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
documentation.info.enable = false;
})
];
}
];
defaultModules = baseModules ++ customModules;
in {
imports = defaultModules;
}

3
modules/module-list.nix Normal file
View file

@ -0,0 +1,3 @@
[
./profiles/starship.nix
]

View file

@ -0,0 +1,17 @@
# A minimal, blazing fast, and extremely customizable prompt for any shell
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.profiles.starship;
in {
options.profiles.starship = {
enable = mkEnableOption "to enable the starship prompt.";
};
config = mkIf (cfg.enable) {
programs.starship.enable = true;
};
}

View file

@ -36,7 +36,10 @@ in {
}; };
}; };
defaults = { defaults = {
imports = [./modules];
# make flake inputs accessible in NixOS
_module.args.inputs = inputs; _module.args.inputs = inputs;
profiles.starship.enable = true;
}; };
# Comment out deployment line when building the SD Image. # Comment out deployment line when building the SD Image.
airgead = { airgead = {

View file

@ -6,9 +6,6 @@
export TERM="xterm-256color" export TERM="xterm-256color"
test -r ~/.dir_colors && eval $(dircolors ~/.dir_colors) test -r ~/.dir_colors && eval $(dircolors ~/.dir_colors)
''; '';
promptInit = ''
eval "$(starship init bash)"
'';
vteIntegration = true; vteIntegration = true;
}; };
} }

View file

@ -10,7 +10,6 @@
./chrony.nix ./chrony.nix
../profiles/neovim.nix ../profiles/neovim.nix
../profiles/logrotate.nix ../profiles/logrotate.nix
../profiles/starship.nix
./tmux.nix ./tmux.nix
./zsh.nix ./zsh.nix
]; ];

View file

@ -1,5 +0,0 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
starship # A minimal, blazing fast, and extremely customizable prompt for any shell
];
}

View file

@ -25,9 +25,6 @@
enable = true; enable = true;
plugins = ["fzf" "git"]; plugins = ["fzf" "git"];
}; };
promptInit = ''
eval "$(starship init zsh)"
'';
vteIntegration = true; vteIntegration = true;
}; };