2023-02-02 18:25:31 +00:00
|
|
|
{ lib
|
2023-03-24 00:07:29 +00:00
|
|
|
, writeText
|
2023-02-02 18:25:31 +00:00
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
2023-03-24 00:07:29 +00:00
|
|
|
, curl
|
2023-02-02 18:25:31 +00:00
|
|
|
, installShellFiles
|
|
|
|
, pkg-config
|
2023-03-24 00:07:29 +00:00
|
|
|
, bzip2
|
2024-02-29 20:09:43 +00:00
|
|
|
, libgit2
|
2023-03-24 00:07:29 +00:00
|
|
|
, openssl
|
|
|
|
, zlib
|
2023-02-02 18:25:31 +00:00
|
|
|
, zstd
|
|
|
|
, stdenv
|
|
|
|
, darwin
|
2023-03-24 00:07:29 +00:00
|
|
|
, spdx-license-list-data
|
2023-02-02 18:25:31 +00:00
|
|
|
, nix
|
|
|
|
, nurl
|
|
|
|
}:
|
|
|
|
|
2023-03-24 00:07:29 +00:00
|
|
|
let
|
2023-10-09 19:29:22 +00:00
|
|
|
get-nix-license = import ./get_nix_license.nix {
|
2023-03-24 00:07:29 +00:00
|
|
|
inherit lib writeText;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "nix-init";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "0.3.2";
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "nix-community";
|
|
|
|
repo = "nix-init";
|
|
|
|
rev = "v${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-0RLEPVtYnwYH+pMnpO0/Evbp7x9d0RMobOVAqwgMJz4=";
|
2023-02-02 18:25:31 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes."cargo-0.82.0" = "sha256-1G14vLW3FhLxOWGxuHXcWgb+XXS1vOOyQYKVbrJWlmI=";
|
|
|
|
};
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2023-03-24 00:07:29 +00:00
|
|
|
curl
|
2023-02-02 18:25:31 +00:00
|
|
|
installShellFiles
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2023-03-24 00:07:29 +00:00
|
|
|
bzip2
|
|
|
|
curl
|
2024-02-29 20:09:43 +00:00
|
|
|
libgit2
|
2023-03-24 00:07:29 +00:00
|
|
|
openssl
|
|
|
|
zlib
|
2023-02-02 18:25:31 +00:00
|
|
|
zstd
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2023-02-02 18:25:31 +00:00
|
|
|
darwin.apple_sdk.frameworks.Security
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
|
2023-03-24 00:07:29 +00:00
|
|
|
darwin.apple_sdk.frameworks.CoreFoundation
|
2023-02-02 18:25:31 +00:00
|
|
|
];
|
|
|
|
|
2023-03-24 00:07:29 +00:00
|
|
|
buildNoDefaultFeatures = true;
|
|
|
|
|
|
|
|
checkFlags = [
|
|
|
|
# requires internet access
|
|
|
|
"--skip=lang::rust::tests"
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
mkdir -p data
|
2023-10-09 19:29:22 +00:00
|
|
|
ln -s ${get-nix-license} data/get_nix_license.rs
|
2023-03-24 00:07:29 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
cargo run -p license-store-cache \
|
|
|
|
-j $NIX_BUILD_CORES --frozen \
|
|
|
|
data/license-store-cache.zstd ${spdx-license-list-data.json}/json/details
|
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
postInstall = ''
|
|
|
|
installManPage artifacts/nix-init.1
|
|
|
|
installShellCompletion artifacts/nix-init.{bash,fish} --zsh artifacts/_nix-init
|
|
|
|
'';
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
env = {
|
|
|
|
GEN_ARTIFACTS = "artifacts";
|
2024-02-29 20:09:43 +00:00
|
|
|
LIBGIT2_NO_VENDOR = 1;
|
2023-07-15 17:15:38 +00:00
|
|
|
NIX = lib.getExe nix;
|
|
|
|
NURL = lib.getExe nurl;
|
2023-04-29 16:46:19 +00:00
|
|
|
ZSTD_SYS_USE_PKG_CONFIG = true;
|
|
|
|
};
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Command line tool to generate Nix packages from URLs";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "nix-init";
|
2023-02-02 18:25:31 +00:00
|
|
|
homepage = "https://github.com/nix-community/nix-init";
|
|
|
|
changelog = "https://github.com/nix-community/nix-init/blob/${src.rev}/CHANGELOG.md";
|
|
|
|
license = licenses.mpl20;
|
|
|
|
maintainers = with maintainers; [ figsoda ];
|
|
|
|
};
|
|
|
|
}
|