From dbdae550ea6e564ac12b87c9bf6de3d78f4a18d7 Mon Sep 17 00:00:00 2001 From: Sebastian Ullrich Date: Wed, 28 Aug 2019 13:04:59 +0200 Subject: [PATCH] chore(*.nix): pin nixpkgs version, use clang/llvm 8, reorganize --- default.nix | 4 ++-- derivation.nix => nix/derivation.nix | 10 +++++----- nix/nixpkgs.nix | 7 +++++++ shell.nix | 8 ++++---- 4 files changed, 18 insertions(+), 11 deletions(-) rename derivation.nix => nix/derivation.nix (69%) create mode 100644 nix/nixpkgs.nix diff --git a/default.nix b/default.nix index c12f38c0e7..b97bbb56e3 100644 --- a/default.nix +++ b/default.nix @@ -1,3 +1,3 @@ -{ pkgs ? import {} }: +{ pkgs ? import ./nix/nixpkgs.nix, llvmPackages ? pkgs.llvmPackages_8 }: -pkgs.callPackage ./derivation.nix {} +pkgs.callPackage ./nix/derivation.nix { inherit llvmPackages; } diff --git a/derivation.nix b/nix/derivation.nix similarity index 69% rename from derivation.nix rename to nix/derivation.nix index 0955392d7b..309989fdb3 100644 --- a/derivation.nix +++ b/nix/derivation.nix @@ -1,14 +1,14 @@ -{ clangStdenv, cmake, llvm, python, gmp }: +{ llvmPackages, cmake, python, gmp }: -clangStdenv.mkDerivation rec { +llvmPackages.stdenv.mkDerivation rec { name = "lean-${version}"; version = "local"; # I have way too many untracked files in my checkout - src = builtins.fetchGit { url = ./.; }; + src = builtins.fetchGit { url = ../.; }; nativeBuildInputs = [ cmake python ]; - buildInputs = [ gmp llvm ]; + buildInputs = [ gmp llvmPackages.llvm ]; enableParallelBuilding = true; preConfigure = '' @@ -18,7 +18,7 @@ clangStdenv.mkDerivation rec { patchShebangs ../../bin ''; - meta = with clangStdenv.lib; { + meta = with llvmPackages.stdenv.lib; { description = "Automatic and interactive theorem prover"; homepage = https://leanprover.github.io/; license = licenses.asl20; diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix new file mode 100644 index 0000000000..fb25ccafa5 --- /dev/null +++ b/nix/nixpkgs.nix @@ -0,0 +1,7 @@ +import (builtins.fetchTarball { + name = "nixos-unstable-2019-08-28"; + # Commit hash from `git ls-remote https://github.com/nixos/nixpkgs-channels nixos-unstable` + url = https://github.com/nixos/nixpkgs/archive/3f4144c30a6351dd79b177328ec4dea03e2ce45f.tar.gz; + # Hash obtained using `nix-prefetch-url --unpack ` + sha256 = "1qg5n60n3fr6cypihnrjw451fadps5pysj5p0vvfb320mpfvlbjb"; + }) {} diff --git a/shell.nix b/shell.nix index 65c735b04a..ff0e494eb1 100644 --- a/shell.nix +++ b/shell.nix @@ -1,11 +1,11 @@ -{ pkgs ? import {}, clang ? pkgs.clang_7 }: +{ pkgs ? import ./nix/nixpkgs.nix }: let - lean = pkgs.callPackage ./derivation.nix { llvm = clang.cc.llvm; }; + lean = import ./default.nix { inherit pkgs; }; temci = pkgs.callPackage (builtins.fetchGit { url = https://github.com/parttimenerd/temci.git; rev = "2facd7c78ab35722f34db1d42883ec02f8a0de23"; }) {}; -in pkgs.mkShell rec { +in pkgs.mkShell.override { stdenv = lean.stdenv; } rec { inputsFrom = [ lean ]; - buildInputs = with pkgs; [ temci clang ccache ninja ]; + buildInputs = with pkgs; [ temci ccache ninja ]; # https://github.com/NixOS/nixpkgs/issues/60919 hardeningDisable = [ "all" ]; # TODO: this should not be necessary when leanc starts statically linking binaries