Files
nixpkgs/pkgs/by-name/ni/nix-init/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

102 lines
2.1 KiB
Nix

{
lib,
writeText,
rustPlatform,
fetchFromGitHub,
curl,
installShellFiles,
pkg-config,
bzip2,
libgit2,
openssl,
zlib,
zstd,
spdx-license-list-data,
nix,
nurl,
versionCheckHook,
nix-update-script,
}:
let
get-nix-license = import ./get_nix_license.nix {
inherit lib writeText;
};
in
rustPlatform.buildRustPackage (finalAttrs: {
pname = "nix-init";
version = "0.3.2";
src = fetchFromGitHub {
owner = "nix-community";
repo = "nix-init";
tag = "v${finalAttrs.version}";
hash = "sha256-0RLEPVtYnwYH+pMnpO0/Evbp7x9d0RMobOVAqwgMJz4=";
};
cargoHash = "sha256-kk/SaP/ZtSorSSewAdf0Bq7tiMhB5dZb8v9MlsaUa0M=";
nativeBuildInputs = [
curl
installShellFiles
pkg-config
];
buildInputs = [
bzip2
curl
libgit2
openssl
zlib
zstd
];
buildNoDefaultFeatures = true;
checkFlags = [
# requires internet access
"--skip=lang::rust::tests"
];
postPatch = ''
mkdir -p data
ln -s ${get-nix-license} data/get_nix_license.rs
'';
preBuild = ''
cargo run -p license-store-cache \
-j $NIX_BUILD_CORES --frozen \
data/license-store-cache.zstd ${spdx-license-list-data.json}/json/details
'';
postInstall = ''
installManPage artifacts/nix-init.1
installShellCompletion artifacts/nix-init.{bash,fish} --zsh artifacts/_nix-init
'';
env = {
GEN_ARTIFACTS = "artifacts";
# FIXME: our libgit2 is currently too new
# LIBGIT2_NO_VENDOR = 1;
NIX = lib.getExe nix;
NURL = lib.getExe nurl;
ZSTD_SYS_USE_PKG_CONFIG = true;
};
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
doInstallCheck = true;
passthru.updateScript = nix-update-script { };
meta = {
description = "Command line tool to generate Nix packages from URLs";
mainProgram = "nix-init";
homepage = "https://github.com/nix-community/nix-init";
changelog = "https://github.com/nix-community/nix-init/blob/${finalAttrs.src.tag}/CHANGELOG.md";
license = lib.licenses.mpl20;
maintainers = with lib.maintainers; [ figsoda ];
};
})