2022-06-25 21:34:14 +00:00
|
|
|
{ lib, stdenv, buildNimPackage, fetchFromGitea, fetchFromGitHub, runCommand
|
|
|
|
, nim-unwrapped, preserves }:
|
2021-09-03 16:37:39 +00:00
|
|
|
|
|
|
|
let
|
2022-06-25 21:34:14 +00:00
|
|
|
compiler = runCommand "compiler.nimble" { inherit (nim-unwrapped) src; } ''
|
|
|
|
mkdir -p $out
|
|
|
|
tar xf $src --strip-components=1 -C $out
|
|
|
|
'';
|
2021-09-03 16:37:39 +00:00
|
|
|
|
2021-11-12 13:06:39 +00:00
|
|
|
npeg = fetchFromGitHub {
|
|
|
|
owner = "zevv";
|
|
|
|
repo = "npeg";
|
2023-05-07 08:10:48 +00:00
|
|
|
rev = "1.2.1";
|
|
|
|
hash = "sha256-kN91cp50ZL4INeRWqwrRK6CAkVXUq4rN4YlcN6WL/3Y=";
|
2021-09-03 16:37:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in buildNimPackage rec {
|
|
|
|
pname = "preserves";
|
2023-05-18 09:53:53 +00:00
|
|
|
version = "20230517";
|
2021-10-17 12:25:51 +00:00
|
|
|
src = fetchFromGitea {
|
|
|
|
domain = "git.syndicate-lang.org";
|
|
|
|
owner = "ehmry";
|
2022-03-14 19:45:33 +00:00
|
|
|
repo = "${pname}-nim";
|
2022-06-25 21:34:14 +00:00
|
|
|
rev = version;
|
2023-05-18 09:53:53 +00:00
|
|
|
sha256 = "sha256-9rHpiTrpyH6nJPm1mlxwpv2G8dJilfUf0YRB6P8vYEM=";
|
2021-09-03 16:37:39 +00:00
|
|
|
};
|
2022-03-14 19:45:33 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ compiler npeg ];
|
2022-05-18 19:27:22 +00:00
|
|
|
propagatedNativeBuildInputs =
|
|
|
|
lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) preserves;
|
|
|
|
# propagate the utilities of this package for this build platform
|
2022-03-14 19:45:33 +00:00
|
|
|
preConfigure = "substituteInPlace preserves.nimble --replace '# bin ' 'bin '";
|
|
|
|
|
2021-09-25 12:35:05 +00:00
|
|
|
postInstall = ''
|
|
|
|
pushd $out/bin
|
|
|
|
for link in preserves_decode preserves_from_json preserves_to_json;
|
|
|
|
do ln -s preserves_encode $link
|
|
|
|
done
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
doCheck = true;
|
2022-03-14 19:45:33 +00:00
|
|
|
|
|
|
|
meta = src.meta // {
|
|
|
|
maintainers = [ lib.maintainers.ehmry ];
|
|
|
|
license = lib.licenses.unlicense;
|
|
|
|
};
|
2021-09-03 16:37:39 +00:00
|
|
|
}
|