Merge pull request #308341 from Stunkymonkey/nixos-kubeswitch-use-runCommand

nixos/kubeswitch: use 'runCommand' instead of 'phases'
This commit is contained in:
superherointj 2024-06-17 19:59:36 -03:00 committed by GitHub
commit da118800a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,17 +29,13 @@ in
config =
let
shell_files = pkgs.stdenv.mkDerivation rec {
name = "kubeswitch-shell-files";
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/share
for shell in bash zsh; do
${cfg.package}/bin/switcher init $shell | sed 's/switch(/${cfg.commandName}(/' > $out/share/${cfg.commandName}_init.$shell
${cfg.package}/bin/switcher --cmd ${cfg.commandName} completion $shell > $out/share/${cfg.commandName}_completion.$shell
done
'';
};
shell_files = pkgs.runCommand "kubeswitch-shell-files" {} ''
mkdir -p $out/share
for shell in bash zsh; do
${cfg.package}/bin/switcher init $shell | sed 's/switch(/${cfg.commandName}(/' > $out/share/${cfg.commandName}_init.$shell
${cfg.package}/bin/switcher --cmd ${cfg.commandName} completion $shell > $out/share/${cfg.commandName}_completion.$shell
done
'';
in
lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];