diff --git a/nix/default.nix b/nix/default.nix index 6edceb8..918fce2 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -24,9 +24,12 @@ buildFunction { nativeBuildInputs = [ installShellFiles ]; postInstall = let - # "$out/bin/${mainProgram}" generate-completions --shell "${shell}" --command "${command}" > "$TMP/muscl.${shell}" - commands = lib.mapCartesianProduct ({ shell, command }: '' - COMPLETE=${shell} "$out/bin/${command}" > "$TMP/${command}.${shell}" + installShellCompletions = lib.mapCartesianProduct ({ shell, command }: '' + ( + export PATH="$out/bin:$PATH" + export COMPLETE="${shell}" + "${command}" > "$TMP/${command}.${shell}" + ) installShellCompletion "--${shell}" --cmd "${command}" "$TMP/${command}.${shell}" '') { shell = [ "bash" "zsh" "fish" ]; @@ -35,7 +38,9 @@ buildFunction { in '' ln -sr "$out/bin/muscl" "$out/bin/mysql-dbadm" ln -sr "$out/bin/muscl" "$out/bin/mysql-useradm" - '' + lib.concatStringsSep "\n" commands + '' + + ${lib.concatStringsSep "\n" installShellCompletions} + install -Dm444 assets/systemd/muscl.socket -t "$out/lib/systemd/system" install -Dm644 assets/systemd/muscl.service -t "$out/lib/systemd/system" substituteInPlace "$out/lib/systemd/system/muscl.service" \