mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-12 03:56:17 +03:00
nix-init: init at 0.1.0
This commit is contained in:
parent
379dfe6a9f
commit
44187e2a04
60
pkgs/tools/nix/nix-init/default.nix
Normal file
60
pkgs/tools/nix/nix-init/default.nix
Normal file
@ -0,0 +1,60 @@
|
||||
{ lib
|
||||
, rustPlatform
|
||||
, fetchFromGitHub
|
||||
, installShellFiles
|
||||
, makeWrapper
|
||||
, pkg-config
|
||||
, zstd
|
||||
, stdenv
|
||||
, darwin
|
||||
, nix
|
||||
, nurl
|
||||
, callPackage
|
||||
, spdx-license-list-data
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "nix-init";
|
||||
version = "0.1.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nix-community";
|
||||
repo = "nix-init";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-97aAlH03H8xTVhp45FwecNb7i/ZUtJG9OOYBx8Sf+YI=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-uvn1cP6aIxfPKG/QLtHBd6fHjl7JNRtkZ4gIG2tpHVg=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
installShellFiles
|
||||
makeWrapper
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
zstd
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
darwin.apple_sdk.frameworks.Security
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/nix-init \
|
||||
--prefix PATH : ${lib.makeBinPath [ nix nurl ]}
|
||||
installManPage artifacts/nix-init.1
|
||||
installShellCompletion artifacts/nix-init.{bash,fish} --zsh artifacts/_nix-init
|
||||
'';
|
||||
|
||||
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;
|
||||
|
||||
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 ];
|
||||
};
|
||||
}
|
23
pkgs/tools/nix/nix-init/license.nix
Normal file
23
pkgs/tools/nix/nix-init/license.nix
Normal file
@ -0,0 +1,23 @@
|
||||
# vendored from src/licenses.nix
|
||||
|
||||
{ lib, writeText }:
|
||||
|
||||
let
|
||||
inherit (builtins) concatLists concatStringsSep length;
|
||||
inherit (lib) flip licenses mapAttrsToList optional;
|
||||
|
||||
inserts = concatLists
|
||||
(flip mapAttrsToList licenses
|
||||
(k: v: optional (v ? spdxId) '' xs.insert("${v.spdxId}", "${k}");''));
|
||||
in
|
||||
|
||||
writeText "license.rs" ''
|
||||
fn get_nix_licenses() -> rustc_hash::FxHashMap<&'static str, &'static str> {
|
||||
let mut xs = std::collections::HashMap::with_capacity_and_hasher(
|
||||
${toString (length inserts)},
|
||||
Default::default(),
|
||||
);
|
||||
${concatStringsSep "\n " inserts}
|
||||
xs
|
||||
}
|
||||
''
|
@ -37644,6 +37644,8 @@ with pkgs;
|
||||
nix-info = callPackage ../tools/nix/info { };
|
||||
nix-info-tested = nix-info.override { doCheck = true; };
|
||||
|
||||
nix-init = callPackage ../tools/nix/nix-init { };
|
||||
|
||||
nix-index-unwrapped = callPackage ../tools/package-management/nix-index {
|
||||
inherit (darwin.apple_sdk.frameworks) Security;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user