nixos/kubeswitch: use 'runCommand' instead of 'phases'

This commit is contained in:
Felix Buehler 2024-04-30 23:01:23 +02:00
parent 7e151ba980
commit f498f8ef4a

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 ];