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, lib,
stdenv,
fetchFromGitHub, fetchFromGitHub,
makeWrapper, makeBinaryWrapper,
installShellFiles,
rustPlatform, rustPlatform,
testers, testers,
cachix, cachix,
darwin,
sqlx-cli, sqlx-cli,
nixVersions, nixVersions,
openssl, openssl,
pkg-config, pkg-config,
glibcLocalesUtf8,
devenv, # required to run version test devenv, # required to run version test
}: }:
@@ -55,19 +55,40 @@ rustPlatform.buildRustPackage {
''; '';
nativeBuildInputs = [ nativeBuildInputs = [
makeWrapper installShellFiles
makeBinaryWrapper
pkg-config pkg-config
sqlx-cli sqlx-cli
]; ];
buildInputs = buildInputs = [ openssl ];
[ openssl ]
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.SystemConfiguration
];
postInstall = '' postInstall =
wrapProgram $out/bin/devenv --set DEVENV_NIX ${devenv_nix} --prefix PATH ":" "$out/bin:${cachix}/bin" 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 = { passthru.tests = {