nix-init: 0.1.1 -> 0.2.0
Diff: https://github.com/nix-community/nix-init/compare/v0.1.1...v0.2.0 Changelog: https://github.com/nix-community/nix-init/blob/v0.2.0/CHANGELOG.md
This commit is contained in:
parent
55dea1bc7a
commit
f129d39c77
@ -1,43 +1,81 @@
|
|||||||
{ lib
|
{ lib
|
||||||
|
, writeText
|
||||||
, rustPlatform
|
, rustPlatform
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
|
, curl
|
||||||
, installShellFiles
|
, installShellFiles
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
, pkg-config
|
, pkg-config
|
||||||
|
, bzip2
|
||||||
|
, libgit2_1_5
|
||||||
|
, openssl
|
||||||
|
, zlib
|
||||||
, zstd
|
, zstd
|
||||||
, stdenv
|
, stdenv
|
||||||
, darwin
|
, darwin
|
||||||
|
, spdx-license-list-data
|
||||||
, nix
|
, nix
|
||||||
, nurl
|
, nurl
|
||||||
, callPackage
|
|
||||||
, spdx-license-list-data
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
get-nix-license = import ./get-nix-license.nix {
|
||||||
|
inherit lib writeText;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
rustPlatform.buildRustPackage rec {
|
rustPlatform.buildRustPackage rec {
|
||||||
pname = "nix-init";
|
pname = "nix-init";
|
||||||
version = "0.1.1";
|
version = "0.2.0";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "nix-community";
|
owner = "nix-community";
|
||||||
repo = "nix-init";
|
repo = "nix-init";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
hash = "sha256-x9UrBCnEGz6nI1XGBLjIeiF3qi3EvynAfafiuhQdt9Q=";
|
hash = "sha256-/lH8zO6ah7/HVZ7jOxTgs2iKND1UlGP5EQLtx6JsFxo=";
|
||||||
};
|
};
|
||||||
|
|
||||||
cargoHash = "sha256-RUfprANAbj8w8LPRwQEF9SD9fhWb1CEcwbvOa6DX9Xk=";
|
cargoHash = "sha256-jI/hysUq3JGe0hdZTQQw49BfcTWMx6jg+QAkd1QeBv4=";
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
|
curl
|
||||||
installShellFiles
|
installShellFiles
|
||||||
makeWrapper
|
makeWrapper
|
||||||
pkg-config
|
pkg-config
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
bzip2
|
||||||
|
curl
|
||||||
|
libgit2_1_5
|
||||||
|
openssl
|
||||||
|
zlib
|
||||||
zstd
|
zstd
|
||||||
] ++ lib.optionals stdenv.isDarwin [
|
] ++ lib.optionals stdenv.isDarwin [
|
||||||
darwin.apple_sdk.frameworks.Security
|
darwin.apple_sdk.frameworks.Security
|
||||||
|
] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
|
||||||
|
darwin.apple_sdk.frameworks.CoreFoundation
|
||||||
];
|
];
|
||||||
|
|
||||||
|
buildNoDefaultFeatures = true;
|
||||||
|
buildFeatures = [ "reqwest/rustls-tls" ];
|
||||||
|
|
||||||
|
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 = ''
|
postInstall = ''
|
||||||
wrapProgram $out/bin/nix-init \
|
wrapProgram $out/bin/nix-init \
|
||||||
--prefix PATH : ${lib.makeBinPath [ nix nurl ]}
|
--prefix PATH : ${lib.makeBinPath [ nix nurl ]}
|
||||||
@ -46,8 +84,6 @@ rustPlatform.buildRustPackage rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
GEN_ARTIFACTS = "artifacts";
|
GEN_ARTIFACTS = "artifacts";
|
||||||
NIX_LICENSES = callPackage ./license.nix { };
|
|
||||||
SPDX_LICENSE_LIST_DATA = "${spdx-license-list-data.json}/json/details";
|
|
||||||
ZSTD_SYS_USE_PKG_CONFIG = true;
|
ZSTD_SYS_USE_PKG_CONFIG = true;
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
# vendored from src/licenses.nix
|
# vendored from src/get-nix-license.nix
|
||||||
|
|
||||||
{ lib, writeText }:
|
{ lib, writeText }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
|
attrNames
|
||||||
concatMapAttrs
|
concatMapAttrs
|
||||||
|
concatStringsSep
|
||||||
filterAttrs
|
filterAttrs
|
||||||
flip
|
flip
|
||||||
id
|
id
|
||||||
@ -14,9 +16,6 @@ let
|
|||||||
optionalAttrs
|
optionalAttrs
|
||||||
pipe
|
pipe
|
||||||
warn
|
warn
|
||||||
attrNames
|
|
||||||
concatStringsSep
|
|
||||||
length
|
|
||||||
;
|
;
|
||||||
|
|
||||||
licenseMap = flip concatMapAttrs licenses
|
licenseMap = flip concatMapAttrs licenses
|
||||||
@ -60,18 +59,17 @@ let
|
|||||||
else
|
else
|
||||||
warn "${k}: ${concatStringsSep ", " v}"));
|
warn "${k}: ${concatStringsSep ", " v}"));
|
||||||
|
|
||||||
inserts = lint (mapAttrsToList
|
arms = lint (concatStringsSep "\n "
|
||||||
(k: v: '' xs.insert("${k}", "${v}");'')
|
(mapAttrsToList
|
||||||
(deprecatedAliases // licenseMap));
|
(k: v: ''"${k}" => Some("${v}"),'')
|
||||||
|
(deprecatedAliases // licenseMap)));
|
||||||
in
|
in
|
||||||
|
|
||||||
writeText "license.rs" ''
|
writeText "get-nix-license.rs" ''
|
||||||
fn get_nix_licenses() -> rustc_hash::FxHashMap<&'static str, &'static str> {
|
pub fn get_nix_license(license: &str) -> Option<&'static str> {
|
||||||
let mut xs = std::collections::HashMap::with_capacity_and_hasher(
|
match license {
|
||||||
${toString (length inserts)},
|
${arms}
|
||||||
Default::default(),
|
_ => None,
|
||||||
);
|
}
|
||||||
${concatStringsSep "\n " inserts}
|
|
||||||
xs
|
|
||||||
}
|
}
|
||||||
''
|
''
|
Loading…
Reference in New Issue
Block a user