devenv: fix locale warnings, install shell completions, and more (#367567)

This commit is contained in:
Domen Kožar
2024-12-23 22:49:46 +00:00
committed by GitHub

View File

@@ -1,16 +1,16 @@
{
lib,
stdenv,
fetchFromGitHub,
makeWrapper,
makeBinaryWrapper,
installShellFiles,
rustPlatform,
testers,
cachix,
darwin,
sqlx-cli,
nixVersions,
openssl,
pkg-config,
glibcLocalesUtf8,
devenv, # required to run version test
}:
@@ -55,19 +55,40 @@ rustPlatform.buildRustPackage {
'';
nativeBuildInputs = [
makeWrapper
installShellFiles
makeBinaryWrapper
pkg-config
sqlx-cli
];
buildInputs =
[ openssl ]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.SystemConfiguration
];
buildInputs = [ openssl ];
postInstall = ''
wrapProgram $out/bin/devenv --set DEVENV_NIX ${devenv_nix} --prefix PATH ":" "$out/bin:${cachix}/bin"
postInstall =
let
setDefaultLocaleArchive = lib.optionalString (glibcLocalesUtf8 != null) ''
--set-default LOCALE_ARCHIVE ${glibcLocalesUtf8}/lib/locale/locale-archive
'';
in
''
wrapProgram $out/bin/devenv \
--prefix PATH ":" "$out/bin:${cachix}/bin" \
--set DEVENV_NIX ${devenv_nix} \
${setDefaultLocaleArchive}
# Generate manpages
cargo xtask generate-manpages --out-dir man
installManPage man/*
# 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
'';
passthru.tests = {