2023-01-28 23:19:25 +03:00
|
|
|
{ lib
|
2023-03-20 02:19:23 +03:00
|
|
|
, writeText
|
2023-01-28 23:19:25 +03:00
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
2023-03-20 02:19:23 +03:00
|
|
|
, curl
|
2023-01-28 23:19:25 +03:00
|
|
|
, installShellFiles
|
|
|
|
, pkg-config
|
2023-03-20 02:19:23 +03:00
|
|
|
, bzip2
|
2024-02-12 00:27:06 +03:00
|
|
|
, libgit2
|
2023-03-20 02:19:23 +03:00
|
|
|
, openssl
|
|
|
|
, zlib
|
2023-01-28 23:19:25 +03:00
|
|
|
, zstd
|
|
|
|
, stdenv
|
|
|
|
, darwin
|
2023-03-20 02:19:23 +03:00
|
|
|
, spdx-license-list-data
|
2023-01-28 23:19:25 +03:00
|
|
|
, nix
|
|
|
|
, nurl
|
|
|
|
}:
|
|
|
|
|
2023-03-20 02:19:23 +03:00
|
|
|
let
|
2023-09-17 00:24:38 +03:00
|
|
|
get-nix-license = import ./get_nix_license.nix {
|
2023-03-20 02:19:23 +03:00
|
|
|
inherit lib writeText;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
2023-01-28 23:19:25 +03:00
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "nix-init";
|
2023-09-17 00:24:38 +03:00
|
|
|
version = "0.3.0";
|
2023-01-28 23:19:25 +03:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "nix-community";
|
|
|
|
repo = "nix-init";
|
|
|
|
rev = "v${version}";
|
2023-09-17 00:24:38 +03:00
|
|
|
hash = "sha256-YUstBO+iznr0eJYVJdNQ2BjDhvviRQuojhT9IlTuR0k=";
|
2023-01-28 23:19:25 +03:00
|
|
|
};
|
|
|
|
|
2023-09-17 00:24:38 +03:00
|
|
|
cargoHash = "sha256-OAgEzf+EyrwjNa40BwPwSNZ4lhEH93YxCbPJJ3r7oSQ=";
|
2023-01-28 23:19:25 +03:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2023-03-20 02:19:23 +03:00
|
|
|
curl
|
2023-01-28 23:19:25 +03:00
|
|
|
installShellFiles
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2023-03-20 02:19:23 +03:00
|
|
|
bzip2
|
|
|
|
curl
|
2024-02-12 00:27:06 +03:00
|
|
|
libgit2
|
2023-03-20 02:19:23 +03:00
|
|
|
openssl
|
|
|
|
zlib
|
2023-01-28 23:19:25 +03:00
|
|
|
zstd
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
darwin.apple_sdk.frameworks.Security
|
2023-03-20 02:19:23 +03:00
|
|
|
] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
|
|
|
|
darwin.apple_sdk.frameworks.CoreFoundation
|
2023-01-28 23:19:25 +03:00
|
|
|
];
|
|
|
|
|
2023-03-20 02:19:23 +03:00
|
|
|
buildNoDefaultFeatures = true;
|
|
|
|
|
|
|
|
checkFlags = [
|
|
|
|
# requires internet access
|
|
|
|
"--skip=lang::rust::tests"
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
mkdir -p data
|
2023-09-17 00:24:38 +03:00
|
|
|
ln -s ${get-nix-license} data/get_nix_license.rs
|
2023-03-20 02:19:23 +03: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-01-28 23:19:25 +03:00
|
|
|
postInstall = ''
|
|
|
|
installManPage artifacts/nix-init.1
|
|
|
|
installShellCompletion artifacts/nix-init.{bash,fish} --zsh artifacts/_nix-init
|
|
|
|
'';
|
|
|
|
|
2023-04-23 17:49:07 +03:00
|
|
|
env = {
|
|
|
|
GEN_ARTIFACTS = "artifacts";
|
2024-02-12 00:27:06 +03:00
|
|
|
LIBGIT2_NO_VENDOR = 1;
|
2023-07-07 01:32:23 +03:00
|
|
|
NIX = lib.getExe nix;
|
|
|
|
NURL = lib.getExe nurl;
|
2023-04-23 17:49:07 +03:00
|
|
|
ZSTD_SYS_USE_PKG_CONFIG = true;
|
|
|
|
};
|
2023-01-28 23:19:25 +03:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Command line tool to generate Nix packages from URLs";
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|