Skip to content

Commit

Permalink
package: fixup post-install hook
Browse files Browse the repository at this point in the history
  • Loading branch information
sandydoo committed Nov 18, 2024
1 parent 0e2457f commit 69236e0
Showing 1 changed file with 33 additions and 27 deletions.
60 changes: 33 additions & 27 deletions package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,35 +47,41 @@ pkgs.rustPlatform.buildRustPackage {
cargo sqlx prepare --workspace
'';

postInstall = pkgs.lib.optionalString (!build_tasks) ''
wrapProgram $out/bin/devenv \
--set DEVENV_NIX ${inputs.nix.packages.${pkgs.stdenv.system}.nix} \
${pkgs.lib.optionalString (pkgs.stdenv.isLinux && (pkgs.glibcLocalesUtf8 != null)) ''
--set-default LOCALE_ARCHIVE ${pkgs.glibcLocalesUtf8}/lib/locale/locale-archive \
''}
--prefix PATH ":" "$out/bin:${inputs.cachix.packages.${pkgs.stdenv.system}.cachix}/bin"
postInstall =
let
inherit (inputs.nix.packages.${pkgs.stdenv.system}) nix;
inherit (inputs.cachix.packages.${pkgs.stdenv.system}) cachix;

# TODO: problematic for our library...
wrapProgram $out/bin/devenv-run-tests \
--set DEVENV_NIX ${inputs.nix.packages.${pkgs.stdenv.system}.nix} \
${pkgs.lib.optionalString (pkgs.stdenv.isLinux && (pkgs.glibcLocalesUtf8 != null)) ''
--set-default LOCALE_ARCHIVE ${pkgs.glibcLocalesUtf8}/lib/locale/locale-archive \
''}
--prefix PATH ":" "$out/bin:${inputs.cachix.packages.${pkgs.stdenv.system}.cachix}/bin"
localeArchiveFix =
pkgs.lib.optionalString (pkgs.stdenv.isLinux && (pkgs.glibcLocalesUtf8 != null)) ''
--set-default LOCALE_ARCHIVE ${pkgs.glibcLocalesUtf8}/lib/locale/locale-archive
'';
in
pkgs.lib.optionalString (!build_tasks) ''
wrapProgram $out/bin/devenv \
--prefix PATH ":" "$out/bin:${cachix}/bin" \
--set DEVENV_NIX ${nix} \
${localeArchiveFix} \
# Generate manpages
cargo xtask generate-manpages --out-dir man
installManPage man/*
# TODO: problematic for our library...
wrapProgram $out/bin/devenv-run-tests \
--prefix PATH ":" "$out/bin:${cachix}/bin" \
--set DEVENV_NIX ${nix} \
${localeArchiveFix} \
# Generate shell completions
compdir=./completions
for shell in bash fish zsh; do
cargo xtask generate-shell-completion $shell --out-dir $compdir
done
# Generate manpages
cargo xtask generate-manpages --out-dir man
installManPage man/*
installShellCompletion --cmd devenv \
--bash $compdir/devenv.bash \
--fish $compdir/devenv.fish \
--zsh $compdir/_devenv
'';
# Generate shell completions
compdir=./completions
for shell in bash fish zsh; do
cargo xtask generate-shell-completion $shell --out-dir $compdir
done
installShellCompletion --cmd devenv \
--bash $compdir/devenv.bash \
--fish $compdir/devenv.fish \
--zsh $compdir/_devenv
'';
}

0 comments on commit 69236e0

Please sign in to comment.