mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-11-24 06:52:19 +03:00
nix flake: make it more idiomatic
so that one can pass attributes directly to buildIdris instead of the convoluted. buildIdris (...).build.overrideAttrs(oldAttrs: {})
This commit is contained in:
parent
b231ef0da5
commit
6780874d2e
@ -35,9 +35,7 @@
|
|||||||
inherit idris2-version chez;
|
inherit idris2-version chez;
|
||||||
srcRev = self.shortRev or "dirty";
|
srcRev = self.shortRev or "dirty";
|
||||||
};
|
};
|
||||||
buildIdris = { projectName, src, idrisLibraries }:
|
buildIdris = pkgs.callPackage ./nix/buildIdris.nix { inherit idris2-version; idris2 = idris2Pkg; };
|
||||||
pkgs.callPackage ./nix/buildIdris.nix
|
|
||||||
{ inherit src projectName idrisLibraries idris2-version; idris2 = idris2Pkg; };
|
|
||||||
in rec {
|
in rec {
|
||||||
checks = import ./nix/test.nix {
|
checks = import ./nix/test.nix {
|
||||||
inherit (pkgs) system stdenv runCommand lib;
|
inherit (pkgs) system stdenv runCommand lib;
|
||||||
|
@ -1,34 +1,44 @@
|
|||||||
{ stdenv
|
{ stdenv
|
||||||
, lib
|
, lib
|
||||||
, projectName
|
|
||||||
, src
|
|
||||||
, idris2
|
|
||||||
, idris2-version
|
, idris2-version
|
||||||
, idrisLibraries
|
, idris2
|
||||||
}:
|
}:
|
||||||
|
{
|
||||||
|
src
|
||||||
|
, projectName
|
||||||
|
, idrisLibraries
|
||||||
|
, ...
|
||||||
|
}@attrs:
|
||||||
|
|
||||||
let
|
let
|
||||||
ipkgName = projectName + ".ipkg";
|
ipkgName = projectName + ".ipkg";
|
||||||
idrName = "idris2-${idris2-version}";
|
idrName = "idris2-${idris2-version}";
|
||||||
libSuffix = "lib/${idrName}";
|
libSuffix = "lib/${idrName}";
|
||||||
lib-dirs = lib.strings.concatMapStringsSep ":" (p: "${p}/${libSuffix}") idrisLibraries;
|
lib-dirs = lib.strings.concatMapStringsSep ":" (p: "${p}/${libSuffix}") idrisLibraries;
|
||||||
|
drvAttrs = builtins.removeAttrs attrs [ "idrisLibraries" ];
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
build = stdenv.mkDerivation {
|
build = stdenv.mkDerivation (drvAttrs // {
|
||||||
name = projectName;
|
name = projectName;
|
||||||
src = src;
|
src = src;
|
||||||
nativeBuildInputs = [ idris2 ];
|
nativeBuildInputs = [ idris2 ];
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
|
runHook preConfigure
|
||||||
export IDRIS2_PACKAGE_PATH=${lib-dirs}
|
export IDRIS2_PACKAGE_PATH=${lib-dirs}
|
||||||
|
runHook postConfigure
|
||||||
'';
|
'';
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
idris2 --build ${ipkgName}
|
idris2 --build ${ipkgName}
|
||||||
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
mv build/exec/* $out/bin
|
mv build/exec/* $out/bin
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
};
|
});
|
||||||
installLibrary = build.overrideAttrs (_: {
|
installLibrary = build.overrideAttrs (_: {
|
||||||
buildPhase = "";
|
buildPhase = "";
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user