Files
nixpkgs/pkgs/by-name/de/devenv/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

107 lines
2.5 KiB
Nix

{
lib,
fetchFromGitHub,
makeBinaryWrapper,
installShellFiles,
rustPlatform,
testers,
cachix,
nixVersions,
openssl,
dbus,
pkg-config,
glibcLocalesUtf8,
devenv, # required to run version test
}:
let
version = "1.9.1";
devenvNixVersion = "2.30.4";
devenv_nix =
(nixVersions.git.overrideSource (fetchFromGitHub {
owner = "cachix";
repo = "nix";
rev = "devenv-${devenvNixVersion}";
hash = "sha256-3+GHIYGg4U9XKUN4rg473frIVNn8YD06bjwxKS1IPrU=";
})).overrideAttrs
(old: {
pname = "devenv-nix";
version = devenvNixVersion;
doCheck = false;
doInstallCheck = false;
# do override src, but the Nix way so the warning is unaware of it
__intentionallyOverridingVersion = true;
});
in
rustPlatform.buildRustPackage {
pname = "devenv";
inherit version;
src = fetchFromGitHub {
owner = "cachix";
repo = "devenv";
tag = "v${version}";
hash = "sha256-v86pQGIWHJPkRryglJSXOp0aEoU6ZtURuURsXLqfqSE=";
};
cargoHash = "sha256-41VmzZvoRd2pL5/o6apHztpS2XrL4HGPIJPBkUbPL1I=";
buildAndTestSubdir = "devenv";
nativeBuildInputs = [
installShellFiles
makeBinaryWrapper
pkg-config
];
buildInputs = [
openssl
dbus
];
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 = {
version = testers.testVersion {
package = devenv;
command = "export XDG_DATA_HOME=$PWD; devenv version";
};
};
meta = {
changelog = "https://github.com/cachix/devenv/releases/tag/v${version}";
description = "Fast, Declarative, Reproducible, and Composable Developer Environments";
homepage = "https://github.com/cachix/devenv";
license = lib.licenses.asl20;
mainProgram = "devenv";
teams = [ lib.teams.cachix ];
};
}