mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-09-17 16:27:52 +03:00
Added nix files (#855)
This commit is contained in:
parent
6d2dd935c4
commit
7a7504c956
23
.github/workflows/ci-nix.yml
vendored
Normal file
23
.github/workflows/ci-nix.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
name: Nix
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: cachix/install-nix-action@v12
|
||||||
|
with:
|
||||||
|
install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-3.0pre20200820_4d77513/install
|
||||||
|
extra_nix_config: |
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
- run: nix build
|
@ -120,3 +120,9 @@ If you are a [nix](https://nixos.org/features.html) user you can install Idris 2
|
|||||||
by running the following command:
|
by running the following command:
|
||||||
|
|
||||||
nix-env -i idris2
|
nix-env -i idris2
|
||||||
|
|
||||||
|
### Install from nix flakes
|
||||||
|
|
||||||
|
If you are a [nix flakes](https://nixos.wiki/wiki/Flakes) user you can install Idris 2 together with all the requirements by running the following command:
|
||||||
|
|
||||||
|
nix profile install github:idris-lang/Idris2
|
||||||
|
@ -7,6 +7,7 @@ Idris 2
|
|||||||
[![](https://github.com/idris-lang/Idris2/workflows/Ubuntu%20Racket/badge.svg)](https://github.com/idris-lang/Idris2/actions?query=workflow%3A"Ubuntu+Racket")
|
[![](https://github.com/idris-lang/Idris2/workflows/Ubuntu%20Racket/badge.svg)](https://github.com/idris-lang/Idris2/actions?query=workflow%3A"Ubuntu+Racket")
|
||||||
[![](https://github.com/idris-lang/Idris2/workflows/macOS/badge.svg)](https://github.com/idris-lang/Idris2/actions?query=workflow%3A"macOS")
|
[![](https://github.com/idris-lang/Idris2/workflows/macOS/badge.svg)](https://github.com/idris-lang/Idris2/actions?query=workflow%3A"macOS")
|
||||||
[![](https://github.com/idris-lang/Idris2/workflows/API/badge.svg)](https://github.com/idris-lang/Idris2/actions?query=workflow%3A"API")
|
[![](https://github.com/idris-lang/Idris2/workflows/API/badge.svg)](https://github.com/idris-lang/Idris2/actions?query=workflow%3A"API")
|
||||||
|
[![](https://github.com/idris-lang/Idris2/workflows/Nix/badge.svg)](https://github.com/idris-lang/Idris2/actions?query=workflow%3A"Nix")
|
||||||
|
|
||||||
[Idris 2](https://idris-lang.org/) is a purely functional programming language
|
[Idris 2](https://idris-lang.org/) is a purely functional programming language
|
||||||
with first class types.
|
with first class types.
|
||||||
|
3
default.nix
Normal file
3
default.nix
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{ nixpkgs ? import <nixos> {} }: with nixpkgs;
|
||||||
|
|
||||||
|
callPackage ./package.nix {}
|
25
flake.lock
Normal file
25
flake.lock
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1608233493,
|
||||||
|
"narHash": "sha256-erk1llMWMpSoUrnjHUY99FSP1mexMwjdPS7xaSQT0kk=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "2fe2d0aeea8e7a14f4ef843755e2cb9e12d9085a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
11
flake.nix
Normal file
11
flake.nix
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
description = "Idris2 flake";
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs }: {
|
||||||
|
|
||||||
|
packages.x86_64-linux.idris2 = import ./default.nix { nixpkgs = nixpkgs.legacyPackages.x86_64-linux; };
|
||||||
|
|
||||||
|
defaultPackage.x86_64-linux = self.packages.x86_64-linux.idris2;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
63
package.nix
Normal file
63
package.nix
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
{ stdenv, fetchFromGitHub, makeWrapper
|
||||||
|
, clang, chez
|
||||||
|
}:
|
||||||
|
|
||||||
|
# Uses scheme to bootstrap the build of idris2
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "idris2";
|
||||||
|
version = "0.3.0";
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
strictDeps = true;
|
||||||
|
nativeBuildInputs = [ makeWrapper clang chez ];
|
||||||
|
buildInputs = [ chez ];
|
||||||
|
|
||||||
|
prePatch = ''
|
||||||
|
patchShebangs --build tests
|
||||||
|
'';
|
||||||
|
|
||||||
|
makeFlags = [ "PREFIX=$(out)" ]
|
||||||
|
++ stdenv.lib.optional stdenv.isDarwin "OS=";
|
||||||
|
|
||||||
|
# The name of the main executable of pkgs.chez is `scheme`
|
||||||
|
buildFlags = [ "bootstrap-build" "SCHEME=scheme" ];
|
||||||
|
|
||||||
|
checkTarget = "bootstrap-test";
|
||||||
|
|
||||||
|
# TODO: Move this into its own derivation, such that this can be changed
|
||||||
|
# without having to recompile idris2 every time.
|
||||||
|
postInstall = let
|
||||||
|
includedLibs = [ "base" "contrib" "network" "prelude" ];
|
||||||
|
name = "${pname}-${version}";
|
||||||
|
packagePaths = builtins.map (l: "$out/${name}/" + l) includedLibs;
|
||||||
|
additionalIdris2Paths = builtins.concatStringsSep ":" packagePaths;
|
||||||
|
in ''
|
||||||
|
# Remove existing idris2 wrapper that sets incorrect LD_LIBRARY_PATH
|
||||||
|
rm $out/bin/idris2
|
||||||
|
# Move actual idris2 binary
|
||||||
|
mv $out/bin/idris2_app/idris2.so $out/bin/idris2
|
||||||
|
# After moving the binary, there is nothing left in idris2_app that isn't
|
||||||
|
# either contained in lib/ or is useless to us.
|
||||||
|
rm $out/bin/idris2_app/*
|
||||||
|
rmdir $out/bin/idris2_app
|
||||||
|
# idris2 needs to find scheme at runtime to compile
|
||||||
|
# idris2 installs packages with --install into the path given by PREFIX.
|
||||||
|
# Since PREFIX is in nix-store, it is immutable so --install does not work.
|
||||||
|
# If the user redefines PREFIX to be able to install packages, idris2 will
|
||||||
|
# not find the libraries and packages since all paths are relative to
|
||||||
|
# PREFIX by default.
|
||||||
|
# We explicitly make all paths to point to nix-store, such that they are
|
||||||
|
# independent of what IDRIS2_PREFIX is. This allows the user to redefine
|
||||||
|
# IDRIS2_PREFIX and use --install as expected.
|
||||||
|
# TODO: Make support libraries their own derivation such that
|
||||||
|
# overriding LD_LIBRARY_PATH is unnecessary
|
||||||
|
# TODO: Maybe set IDRIS2_PREFIX to the users home directory
|
||||||
|
wrapProgram "$out/bin/idris2" \
|
||||||
|
--set-default CHEZ "${chez}/bin/scheme" \
|
||||||
|
--suffix IDRIS2_LIBS ':' "$out/${name}/lib" \
|
||||||
|
--suffix IDRIS2_DATA ':' "$out/${name}/support" \
|
||||||
|
--suffix IDRIS2_PATH ':' "${additionalIdris2Paths}" \
|
||||||
|
--suffix LD_LIBRARY_PATH ':' "$out/${name}/lib"
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user