mirror of
https://github.com/nix-community/home-manager
synced 2024-12-25 19:29:47 +01:00
helix: add extraPackages option
Closes #2923 based on how arnarg solves this in his personal config. With review suggestions from musjj. Co-authored-by: Arnar Gauti Ingason <arnarg@fastmail.com> Co-authored-by: musjj <72612857+musjj@users.noreply.github.com>
This commit is contained in:
parent
c0cfd32bf0
commit
3b72c311ac
1 changed files with 23 additions and 1 deletions
|
@ -18,6 +18,13 @@ in {
|
||||||
description = "The package to use for helix.";
|
description = "The package to use for helix.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraPackages = mkOption {
|
||||||
|
type = with types; listOf package;
|
||||||
|
default = [ ];
|
||||||
|
example = literalExpression "[ pkgs.marksman ]";
|
||||||
|
description = "Extra packages available to hx.";
|
||||||
|
};
|
||||||
|
|
||||||
defaultEditor = mkOption {
|
defaultEditor = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -161,7 +168,22 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [ cfg.package ];
|
home.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/hx \
|
||||||
|
--prefix PATH : ${lib.makeBinPath cfg.extraPackages}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
]
|
||||||
|
else
|
||||||
|
[ cfg.package ];
|
||||||
|
|
||||||
home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "hx"; };
|
home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "hx"; };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue