Add manifest to each package

This commit is contained in:
Emery Hemingway 2020-01-15 19:06:25 +01:00
父節點 4e85cc4dd2
當前提交 e0c8dfed3e
共有 2 個文件被更改,包括 52 次插入3 次删除

查看文件

@ -1,5 +1,24 @@
{
"inputs": {
"dhall-haskell": {
"inputs": {
"nixpkgs": {
"inputs": {},
"narHash": "sha256-wJg4DA700SoQbEz61448sR6BgxRa1R92K3vvCV1g+HY=",
"originalUrl": "git+https://github.com/nixos/nixpkgs.git?ref=18.09-beta&rev=1d4de0d552ae9aa66a5b8dee5fb0650a4372d148",
"url": "git+https://github.com/nixos/nixpkgs.git?ref=18.09-beta&rev=1d4de0d552ae9aa66a5b8dee5fb0650a4372d148"
},
"nixpkgsStaticLinux": {
"inputs": {},
"narHash": "sha256-famU3pJZ4vkElV9qc71HmyRVSvcrAhfMZ0UJKpmmKP8=",
"originalUrl": "git+https://github.com/nh2/nixpkgs.git?ref=static-haskell-nix-stack-dhall-working",
"url": "git+https://github.com/nh2/nixpkgs.git?ref=static-haskell-nix-stack-dhall-working&rev=925aac04f4ca58aceb83beef18cb7dae0715421b"
}
},
"narHash": "sha256-KJl9ZLcMcEsLSPcwcWoc0Ac74/6HKC9LkVMeLwhyhlg=",
"originalUrl": "git+https://github.com/dhall-lang/dhall-haskell?ref=flake",
"url": "git+https://github.com/dhall-lang/dhall-haskell?ref=flake&rev=aea28adf3d10ff1982aa4ddd176d1476251b932f"
},
"nixpkgs": {
"inputs": {},
"narHash": "sha256-NB+H7zK3BB//zM127FqgbG4iAfY+nS/IOyO+uGWA5Ho=",

查看文件

@ -3,21 +3,29 @@
edition = 201909;
outputs = { self, nixpkgs }:
inputs.dhall-haskell.uri =
"git+https://github.com/dhall-lang/dhall-haskell?ref=flake";
outputs = { self, nixpkgs, dhall-haskell }:
let
localSystem = "x86_64-linux";
localPackages = nixpkgs.legacyPackages.${localSystem};
unpack = baseUrl:
{ name, value }: {
inherit name;
value = nixpkgs.legacyPackages.x86_64-linux.stdenvNoCC.mkDerivation {
value = localPackages.stdenvNoCC.mkDerivation {
pname = name;
inherit (value) version;
outputs = [ "out" "manifest" ];
preferLocalBuild = true;
src = nixpkgs.legacyPackages.x86_64-linux.fetchurl {
src = localPackages.fetchurl {
url = "${baseUrl}${name}/${value.version}.tar.xz";
inherit (value) sha256;
};
dontConfigure = true;
dontBuild = true;
buildInputs = [ dhall-haskell.packages.${localSystem}.dhall ];
installPhase = ''
find . -type f | while read FILE; do
case $FILE in
@ -27,6 +35,28 @@
*) install -Dm555 -t $out/bin $FILE;;
esac
done
local drv=$out
echo '{' >> manifest.tmp
if [ -d $drv/bin ]; then
echo ', bin = {' >> manifest.tmp
find $drv/bin/ -type f -printf ', %f = { mapKey = "%f", mapValue = "%p" }\n' >> manifest.tmp
echo '}' >> manifest.tmp
fi
if [ -d $drv/lib ]; then
echo ', lib = {' >> manifest.tmp
find $drv/lib/ -type f -name '*.lib.so' -printf '%f "%p"\n' \
| awk '{print ", "gensub(/.lib.so/, "", 1, $1)" = { mapKey = \""$1"\", mapValue = "$2" }" }'>> manifest.tmp
echo '}' >> manifest.tmp
fi
if [ -d $drv/tar ]; then
echo ', tar = {' >> manifest.tmp
find $drv/tar/ -type f -name '*.tar' -printf '%f "%p"\n' \
| awk '{print ""gensub(/.tar/, "", 1, $1)" = { mapKey = \""$1"\", mapValue = "$2" }" }'>> manifest.tmp
echo '}' >> manifest.tmp
fi
echo '}' >> manifest.tmp
dhall < manifest.tmp > $manifest
'';
meta = {
license = [ "LicenseRef-Genode" ];