Add a wrapper around buildCrystalPackage to allow for nonstandard shard configurations.
This commit is contained in:
parent
4d6ccab45f
commit
8fc680055f
25
custom-crystal/default.nix
Normal file
25
custom-crystal/default.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{ stdenv, lib, linkFarm, fetchgit, fetchFromGitHub }:
|
||||||
|
|
||||||
|
{ crystal,
|
||||||
|
gitShardsFile ? null,
|
||||||
|
lockFile ? null,
|
||||||
|
shardsFile ? null, ...}@args:
|
||||||
|
|
||||||
|
let
|
||||||
|
buildArgs = builtins.removeAttrs args [ "crystal" ];
|
||||||
|
githubLinks = lib.mapAttrsToList (name: value: {
|
||||||
|
inherit name;
|
||||||
|
path = fetchFromGitHub value;
|
||||||
|
}) (import shardsFile);
|
||||||
|
gitLinks = lib.mapAttrsToList (name: value: {
|
||||||
|
inherit name;
|
||||||
|
path = fetchgit { inherit (value) url rev sha256; };
|
||||||
|
}) (import gitShardsFile);
|
||||||
|
crystalLib = linkFarm "crystal-lib" (githubLinks ++ gitLinks);
|
||||||
|
configurePhase = args.configurePhase or lib.concatStringsSep "\n" ([
|
||||||
|
"runHook preConfigure"
|
||||||
|
] ++ lib.optional (lockFile != null) "ln -s ${lockFile} ./shard.lock"
|
||||||
|
++ lib.optional (shardsFile != null) "ln -s ${crystalLib} lib"
|
||||||
|
++ [ "runHook postConfigure "]);
|
||||||
|
in
|
||||||
|
crystal.buildCrystalPackage (buildArgs // { inherit configurePhase; })
|
Loading…
Reference in New Issue
Block a user