mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 12:53:59 +03:00
Add builtin idris packages to idrisPackages
This commit is contained in:
parent
5898c20604
commit
efbee054fd
12
pkgs/development/idris-modules/build-builtin-package.nix
Normal file
12
pkgs/development/idris-modules/build-builtin-package.nix
Normal file
@ -0,0 +1,12 @@
|
||||
{ idris, buildIdrisPackage }: name: deps: buildIdrisPackage (args: {
|
||||
inherit name;
|
||||
|
||||
propagatedBuildInputs = deps;
|
||||
|
||||
inherit (idris) src;
|
||||
|
||||
postUnpack = ''
|
||||
mv $sourceRoot/libs/${name} $IDRIS_LIBRARY_PATH
|
||||
sourceRoot=$IDRIS_LIBRARY_PATH/${name}
|
||||
'';
|
||||
})
|
34
pkgs/development/idris-modules/build-idris-package.nix
Normal file
34
pkgs/development/idris-modules/build-idris-package.nix
Normal file
@ -0,0 +1,34 @@
|
||||
{ stdenv, idris }: argf: let args = {
|
||||
preHook = ''
|
||||
mkdir idris-libs
|
||||
export IDRIS_LIBRARY_PATH=$PWD/idris-libs
|
||||
|
||||
addIdrisLibs () {
|
||||
if [ -d $1/lib/${idris.name} ]; then
|
||||
ln -sv $1/lib/${idris.name}/* $IDRIS_LIBRARY_PATH
|
||||
fi
|
||||
}
|
||||
|
||||
envHooks+=(addIdrisLibs)
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
export TARGET=$out/lib/${idris.name}
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
${idris}/bin/idris --build *.ipkg
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
|
||||
checkPhase = ''
|
||||
if grep -q test *.ipkg; then
|
||||
${idris}/bin/idris --testpkg *.ipkg
|
||||
fi
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
${idris}/bin/idris --install *.ipkg
|
||||
'';
|
||||
}; in stdenv.mkDerivation (args // (argf args))
|
@ -12,7 +12,27 @@
|
||||
defaultScope = mkScope self;
|
||||
|
||||
callPackage = callPackageWithScope defaultScope;
|
||||
in {
|
||||
withPackages = packages: callPackage ./with-packages-wrapper.nix { inherit packages idris; };
|
||||
|
||||
buildBuiltinPackage = callPackage ./build-builtin-package.nix {};
|
||||
|
||||
builtins = pkgs.lib.mapAttrs buildBuiltinPackage {
|
||||
prelude = [];
|
||||
|
||||
base = [ self.prelude ];
|
||||
|
||||
contrib = [ self.prelude self.base ];
|
||||
|
||||
effects = [ self.prelude self.base ];
|
||||
|
||||
pruviloj = [ self.prelude self.base ];
|
||||
};
|
||||
in {
|
||||
inherit idris;
|
||||
|
||||
withPackages = callPackage ./with-packages-wrapper.nix {};
|
||||
|
||||
buildIdrisPackage = callPackage ./build-idris-package.nix {};
|
||||
|
||||
builtins = pkgs.lib.mapAttrsToList (name: value: value) builtins;
|
||||
} // builtins;
|
||||
in fix' (extends overrides idrisPackages)
|
||||
|
@ -1,7 +1,19 @@
|
||||
{ stdenv, idris, packages }: stdenv.mkDerivation {
|
||||
{ stdenv, idris }: buildInputs: stdenv.mkDerivation {
|
||||
inherit (idris) name;
|
||||
|
||||
inherit packages;
|
||||
inherit buildInputs;
|
||||
|
||||
preHook = ''
|
||||
mkdir -p $out/lib/${idris.name}
|
||||
|
||||
installIdrisLib () {
|
||||
if [ -d $1/lib/${idris.name} ]; then
|
||||
ln -sv $1/lib/${idris.name}/* $out/lib/${idris.name}
|
||||
fi
|
||||
}
|
||||
|
||||
envHooks+=(installIdrisLib)
|
||||
'';
|
||||
|
||||
unpackPhase = ''
|
||||
cat >idris.c <<EOF
|
||||
@ -24,12 +36,6 @@
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib/${idris.name}
|
||||
for package in $packages
|
||||
do
|
||||
ln -sv $package/lib/${idris.name}/* $out/lib/${idris.name}
|
||||
done
|
||||
|
||||
mkdir -p $out/bin
|
||||
mv idris $out/bin
|
||||
'';
|
||||
|
Loading…
Reference in New Issue
Block a user