nim_lk: init at 20231031

https://git.sr.ht/~ehmry/nim_lk
This commit is contained in:
Emery Hemingway 2023-10-11 11:15:37 +01:00
parent 09e42015ad
commit 85c506b7ce
2 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1 @@
{"depends":[{"method":"fetchzip","packages":["npeg"],"path":"/nix/store/ffkxmjmigfs7zhhiiqm0iw2c34smyciy-source","ref":"1.2.1","rev":"26d62fdc40feb84c6533956dc11d5ee9ea9b6c09","sha256":"0xpzifjkfp49w76qmaylan8q181bs45anmp46l4bwr3lkrr7bpwh","srcDir":"src","url":"https://github.com/zevv/npeg/archive/26d62fdc40feb84c6533956dc11d5ee9ea9b6c09.tar.gz"},{"method":"fetchzip","packages":["preserves"],"path":"/nix/store/nrcpzf9hx70kry3gwhrdzcs3qicjncjh-source","ref":"20231021","rev":"edece399be70818208bf2263c30cb2bcf435bbff","sha256":"0xmw35wmw3a4lja9q4qvlvpxv3xk0hnkjg4fwfw6f3inh6zfiqki","srcDir":"src","url":"https://git.syndicate-lang.org/ehmry/preserves-nim/archive/edece399be70818208bf2263c30cb2bcf435bbff.tar.gz"}]}

View file

@ -0,0 +1,52 @@
{ lib, buildPackages, nim2Packages, fetchFromSourcehut, openssl }:
nim2Packages.buildNimPackage (finalAttrs: {
pname = "nim_lk";
version = "20231031";
nimBinOnly = true;
src = fetchFromSourcehut {
owner = "~ehmry";
repo = "nim_lk";
rev = finalAttrs.version;
hash = "sha256-dXm3dfXAxgucek19f1KdRShOsJyELPTB32qgGSKId6A=";
};
buildInputs = [ openssl ];
nimFlags = finalAttrs.passthru.nimFlagsFromLockFile ./lock.json;
meta = finalAttrs.src.meta // {
description = "Generate Nix specific lock files for Nim packages";
homepage = "https://git.sr.ht/~ehmry/nim_lk";
mainProgram = "nim_lk";
license = lib.licenses.bsd3;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ ehmry ];
};
passthru.nimFlagsFromLockFile = let
fetchDependency = let
methods = {
fetchzip = { url, sha256, ... }:
buildPackages.fetchzip {
name = "source";
inherit url sha256;
};
git = { fetchSubmodules, leaveDotGit, rev, sha256, url, ... }:
buildPackages.fetchgit {
inherit fetchSubmodules leaveDotGit rev sha256 url;
};
};
in attrs@{ method, ... }: methods.${method} attrs // attrs;
in lockFile:
with builtins;
lib.pipe lockFile [
readFile
fromJSON
(getAttr "depends")
(map fetchDependency)
(map ({ outPath, srcDir, ... }: ''--path:"${outPath}/${srcDir}"''))
];
})