diff options
| author | Cyril Cohen | 2020-11-25 12:39:08 +0100 |
|---|---|---|
| committer | Cyril Cohen | 2020-11-25 12:39:08 +0100 |
| commit | 31664c1359908f3d82f3ceb14c0d412b108b3f04 (patch) | |
| tree | 6b3dc8c58674485c1b1e8a09c79260f087625c76 /default.nix | |
| parent | a32027b47948045c24b63645546371544a839609 (diff) | |
update nix
Diffstat (limited to 'default.nix')
| -rw-r--r-- | default.nix | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/default.nix b/default.nix index 75e8a66..9c4336c 100644 --- a/default.nix +++ b/default.nix @@ -1,9 +1,10 @@ { nixpkgs ? (if builtins.pathExists ./nixpkgs.nix then import ./nixpkgs.nix - else fetchTarball https://github.com/CohenCyril/nixpkgs/archive/mathcomp-fix-rec.tar.gz), + else fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/502845c3e31ef3de0e424f3fcb09217df2ce6df6.tar.gz), config ? (if builtins.pathExists ./config.nix then import ./config.nix else {}), withEmacs ? false, print-env ? false, + do-nothing ? false, package ? (if builtins.pathExists ./package.nix then import ./package.nix else "mathcomp-fast"), src ? (if builtins.pathExists ./package.nix then ./. else false) }: @@ -20,6 +21,7 @@ let "8.9" = coqPackages_8_9; "8.10" = coqPackages_8_10; "8.11" = coqPackages_8_11; + "8.12" = coqPackages_8_12; "default" = coqPackages_8_10; }.${(cfg-fun pkgs).coq or "default"}.overrideScope' (coqPackages: super-coqPackages: @@ -43,12 +45,10 @@ let # fixing mathcomp analysis to depend on real-closed mathcomp-analysis = {version, coqPackages} @ args: let mca = mec.initial.mathcomp-analysis args; in - mca // ( - if elem version [ "master" "cauchy_etoile" "holomorphy" ] - then { - propagatedBuildInputs = mca.propagatedBuildInputs ++ - [coqPackages.mathcomp-real-closed]; - } else {}); + mca // { + propagatedBuildInputs = mca.propagatedBuildInputs ++ + (if builtins.elem coq.version ["8.10" "8.11" "8.12"] then (with coqPackages; [ coq-elpi hierarchy-builder ]) else []); + }; }; for-coq-and-mc.${coqPackages.coq.coq-version}.${coqPackages.mathcomp.version} = (super-coqPackages.mathcomp-extra-config.${coqPackages.coq.coq-version}.${coqPackages.mathcomp.version} or {}) // @@ -88,16 +88,38 @@ let for x in $propagatedBuildInputs; do printf " "; echo $x | cut -d "-" -f "2-"; done echo "you can pass option --arg config '{coq = \"x.y\"; math-comp = \"x.y.z\";}' to nix-shell to change coq and/or math-comp versions" } + printEnv () { for x in $buildInputs; do echo $x; done for x in $propagatedBuildInputs; do echo $x; done } + cachixEnv () { echo "Pushing environement to cachix" printEnv | cachix push math-comp } + nixDefault () { cat $mathcompnix/default.nix + } > default.nix + + updateNixPkgs (){ + HASH=$(git ls-remote https://github.com/NixOS/nixpkgs-channels refs/heads/nixpkgs-unstable | cut -f1); + URL=https://github.com/NixOS/nixpkgs-channels/archive/$HASH.tar.gz + SHA256=$(nix-prefetch-url --unpack $URL) + echo "fetchTarball { + url = $URL; + sha256 = \"$SHA256\"; + }" > nixpkgs.nix + } + updateNixPkgsMaster (){ + HASH=$(git ls-remote https://github.com/NixOS/nixpkgs refs/heads/master | cut -f1); + URL=https://github.com/NixOS/nixpkgs/archive/$HASH.tar.gz + SHA256=$(nix-prefetch-url --unpack $URL) + echo "fetchTarball { + url = $URL; + sha256 = \"$SHA256\"; + }" > nixpkgs.nix } '' + pkgs.lib.optionalString print-env "nixEnv"; @@ -111,7 +133,12 @@ let in if pkgs.lib.trivial.inNixShell then pkg.overrideAttrs (old: { inherit shellHook mathcompnix; - buildInputs = (old.buildInputs or []) ++ - pkgs.lib.optional withEmacs emacs ++ - [ pkgs.lua pkgs.sedutil ]; + + buildInputs = if do-nothing then [] + else (old.buildInputs ++ + (if pkgs.lib.trivial.inNixShell then pkgs.lib.optional withEmacs pkgs.emacs + else [])); + + propagatedBuildInputs = if do-nothing then [] else old.propagatedBuildInputs; + }) else pkg |
