mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-07 12:44:20 +00:00
Merge pull request #214998 from figsoda/nix-init
nix-init: 0.1.0 -> 0.1.1
This commit is contained in:
commit
5bb9beb752
@ -15,16 +15,16 @@
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "nix-init";
|
||||
version = "0.1.0";
|
||||
version = "0.1.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nix-community";
|
||||
repo = "nix-init";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-97aAlH03H8xTVhp45FwecNb7i/ZUtJG9OOYBx8Sf+YI=";
|
||||
hash = "sha256-x9UrBCnEGz6nI1XGBLjIeiF3qi3EvynAfafiuhQdt9Q=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-uvn1cP6aIxfPKG/QLtHBd6fHjl7JNRtkZ4gIG2tpHVg=";
|
||||
cargoHash = "sha256-RUfprANAbj8w8LPRwQEF9SD9fhWb1CEcwbvOa6DX9Xk=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
installShellFiles
|
||||
|
@ -3,12 +3,66 @@
|
||||
{ lib, writeText }:
|
||||
|
||||
let
|
||||
inherit (builtins) concatLists concatStringsSep length;
|
||||
inherit (lib) flip licenses mapAttrsToList optional;
|
||||
inherit (lib)
|
||||
concatMapAttrs
|
||||
filterAttrs
|
||||
flip
|
||||
id
|
||||
intersectLists
|
||||
licenses
|
||||
mapAttrsToList
|
||||
optionalAttrs
|
||||
pipe
|
||||
warn
|
||||
attrNames
|
||||
concatStringsSep
|
||||
length
|
||||
;
|
||||
|
||||
inserts = concatLists
|
||||
(flip mapAttrsToList licenses
|
||||
(k: v: optional (v ? spdxId) '' xs.insert("${v.spdxId}", "${k}");''));
|
||||
licenseMap = flip concatMapAttrs licenses
|
||||
(k: v: optionalAttrs (v ? spdxId && !v.deprecated) { ${v.spdxId} = k; });
|
||||
|
||||
deprecatedAliases = {
|
||||
"AGPL-3.0" = "agpl3Only";
|
||||
"BSD-2-Clause-FreeBSD" = "bsd2WithViews";
|
||||
"BSD-2-Clause-NetBSD" = "bsd2";
|
||||
"GFDL-1.1" = "fdl11Only";
|
||||
"GFDL-1.2" = "fdl12Only";
|
||||
"GFDL-1.3" = "fdl13Only";
|
||||
"GPL-1.0" = "gpl1Only";
|
||||
"GPL-1.0+" = "gpl1Plus";
|
||||
"GPL-2.0" = "gpl2Only";
|
||||
"GPL-2.0+" = "gpl2Plus";
|
||||
"GPL-3.0" = "gpl3Only";
|
||||
"GPL-3.0+" = "gpl3Plus";
|
||||
"LGPL-2.0" = "lgpl2Only";
|
||||
"LGPL-2.0+" = "lgpl2Plus";
|
||||
"LGPL-2.1" = "lgpl21Only";
|
||||
"LGPL-2.1+" = "lgpl21Plus";
|
||||
"LGPL-3.0" = "lgpl3Only";
|
||||
"LGPL-3.0+" = "lgpl3Plus";
|
||||
};
|
||||
|
||||
lints = {
|
||||
"deprecated licenses" = intersectLists
|
||||
(attrNames licenseMap)
|
||||
(attrNames deprecatedAliases);
|
||||
|
||||
"invalid aliases" = attrNames (filterAttrs
|
||||
(k: v: licenses.${v}.deprecated or true)
|
||||
deprecatedAliases);
|
||||
};
|
||||
|
||||
lint = flip pipe
|
||||
(flip mapAttrsToList lints (k: v:
|
||||
if v == [ ] then
|
||||
id
|
||||
else
|
||||
warn "${k}: ${concatStringsSep ", " v}"));
|
||||
|
||||
inserts = lint (mapAttrsToList
|
||||
(k: v: '' xs.insert("${k}", "${v}");'')
|
||||
(deprecatedAliases // licenseMap));
|
||||
in
|
||||
|
||||
writeText "license.rs" ''
|
||||
|
Loading…
Reference in New Issue
Block a user