mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
starship: add extraPackages options
This commit is contained in:
committed by
Robert Helgesson
parent
b0569dc6ec
commit
e0ca734ffc
@@ -5,7 +5,12 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkIf mkOption types;
|
||||
inherit (lib)
|
||||
literalExpression
|
||||
mkIf
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
cfg = config.programs.starship;
|
||||
|
||||
@@ -22,6 +27,13 @@ in
|
||||
|
||||
package = lib.mkPackageOption pkgs "starship" { };
|
||||
|
||||
extraPackages = mkOption {
|
||||
type = with types; listOf package;
|
||||
default = [ ];
|
||||
example = literalExpression "[ pkgs.jj-starship ]";
|
||||
description = "Extra packages available to starship.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
inherit (tomlFormat) type;
|
||||
default = { };
|
||||
@@ -107,7 +119,22 @@ in
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home = {
|
||||
packages = [ cfg.package ];
|
||||
packages =
|
||||
if cfg.extraPackages != [ ] then
|
||||
[
|
||||
(pkgs.symlinkJoin {
|
||||
name = "${lib.getName cfg.package}-wrapped-${lib.getVersion cfg.package}";
|
||||
paths = [ cfg.package ];
|
||||
preferLocalBuild = true;
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/starship \
|
||||
--suffix PATH : ${lib.makeBinPath cfg.extraPackages}
|
||||
'';
|
||||
})
|
||||
]
|
||||
else
|
||||
[ cfg.package ];
|
||||
|
||||
sessionVariables.STARSHIP_CONFIG = cfg.configPath;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user