48 lines
1.3 KiB
Nix
48 lines
1.3 KiB
Nix
{ lib, stdenv, buildNimPackage, fetchFromGitea, fetchFromGitHub, runCommand
|
|
, nim-unwrapped, preserves }:
|
|
|
|
let
|
|
compiler = runCommand "compiler.nimble" { inherit (nim-unwrapped) src; } ''
|
|
mkdir -p $out
|
|
tar xf $src --strip-components=1 -C $out
|
|
'';
|
|
|
|
npeg = fetchFromGitHub {
|
|
owner = "zevv";
|
|
repo = "npeg";
|
|
rev = "1.2.1";
|
|
hash = "sha256-kN91cp50ZL4INeRWqwrRK6CAkVXUq4rN4YlcN6WL/3Y=";
|
|
};
|
|
|
|
in buildNimPackage rec {
|
|
pname = "preserves";
|
|
version = "20230530";
|
|
src = fetchFromGitea {
|
|
domain = "git.syndicate-lang.org";
|
|
owner = "ehmry";
|
|
repo = "${pname}-nim";
|
|
rev = version;
|
|
sha256 = "sha256-IRIBGjv4po8VyL873v++ovqz8Vg6a9Qbh/M1fxpQXvY=";
|
|
};
|
|
|
|
propagatedBuildInputs = [ compiler npeg ];
|
|
propagatedNativeBuildInputs =
|
|
lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) preserves;
|
|
# propagate the utilities of this package for this build platform
|
|
preConfigure = "substituteInPlace preserves.nimble --replace '# bin ' 'bin '";
|
|
|
|
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;
|
|
|
|
meta = src.meta // {
|
|
maintainers = [ lib.maintainers.ehmry ];
|
|
license = lib.licenses.unlicense;
|
|
};
|
|
}
|