-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c43023
commit 6b262d7
Showing
9 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -628,4 +628,10 @@ | |
github = "ALameLlama"; | ||
githubId = 55490546; | ||
}; | ||
folliehiyuki = { | ||
name = "Hoang Nguyen"; | ||
email = "[email protected]"; | ||
github = "folliehiyuki"; | ||
githubId = 67634026; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
cfg = config.programs.helm; | ||
|
||
enableXdgDir = !pkgs.stdenv.hostPlatform.isDarwin || config.xdg.enable; | ||
in { | ||
meta.maintainers = [ hm.maintainers.folliehiyuki ]; | ||
|
||
options.programs.helm = { | ||
enable = mkEnableOption "helm"; | ||
|
||
package = mkPackageOption pkgs "helm" { default = [ "kubernetes-helm" ]; }; | ||
|
||
plugins = mkOption { | ||
type = with types; attrsOf path; | ||
default = { }; | ||
description = '' | ||
Helm plugins to be installed. | ||
Values should be a path containing a top-level `plugin.yaml` file. | ||
Will be linked to {file}`$XDG_DATA_HOME/helm/plugins/<name>/`. | ||
''; | ||
example = literalExpression '' | ||
{ | ||
custom = ./custom; | ||
diff = ${pkgs.kubernetes-helmPlugins.helm-diff}/helm-diff; | ||
} | ||
''; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
home.packages = [ cfg.package ]; | ||
|
||
xdg.dataFile = mkIf enableXdgDir (mapAttrs' | ||
(name: value: nameValuePair "helm/plugins/${name}" { source = value; }) | ||
cfg.plugins); | ||
|
||
home.file = mkIf (!enableXdgDir) (mapAttrs' (name: value: | ||
nameValuePair "Library/helm/plugins/${name}" { source = value; }) | ||
cfg.plugins); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
helm-no-plugins = ./helm-no-plugins.nix; | ||
helm-with-plugins = ./helm-with-plugins.nix; | ||
helm-with-plugins-no-xdg = ./helm-with-plugins-no-xdg.nix; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ config, ... }: | ||
|
||
{ | ||
config = { | ||
programs.helm.enable = true; | ||
|
||
test.stubs.kubernetes-helm = { }; | ||
|
||
nmt.script = '' | ||
assertPathNotExists home-files/Library/helm | ||
assertPathNotExists ${config.xdg.dataHome}/helm | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ pkgs, lib, ... }: | ||
|
||
{ | ||
config = { | ||
xdg.enable = lib.mkForce false; | ||
|
||
programs.helm = { | ||
enable = true; | ||
|
||
plugins.unittest = "${pkgs.kubernetes-helmPlugins.helm-unittest}/helm-unittest"; | ||
}; | ||
|
||
test.stubs.kubernetes-helm = { }; | ||
|
||
nmt.script = let | ||
helmPluginsDir = if !pkgs.stdenv.isDarwin then | ||
".local/share/helm/plugins" | ||
else | ||
"Library/helm/plugins"; | ||
in '' | ||
assertFileExists home-files/${helmPluginsDir}/unittest/untt | ||
assertFileExists home-files/${helmPluginsDir}/unittest/plugin.yaml | ||
assertFileContains home-files/${helmPluginsDir}/unittest/plugin.yaml \ | ||
'command: "$HELM_PLUGIN_DIR/untt"' | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ pkgs, ... }: | ||
|
||
{ | ||
config = { | ||
xdg.enable = true; | ||
|
||
programs.helm = { | ||
enable = true; | ||
|
||
plugins.diff = "${pkgs.kubernetes-helmPlugins.helm-diff}/helm-diff"; | ||
}; | ||
|
||
test.stubs.kubernetes-helm = { }; | ||
|
||
nmt.script = '' | ||
assertFileExists home-files/.local/share/helm/plugins/diff/bin/diff | ||
assertFileExists home-files/.local/share/helm/plugins/diff/plugin.yaml | ||
assertFileContains home-files/.local/share/helm/plugins/diff/plugin.yaml \ | ||
'command: "$HELM_PLUGIN_DIR/bin/diff"' | ||
''; | ||
}; | ||
} |