Skip to content

Commit a1d1456

Browse files
authored
Merge pull request #105 from math-comp/toolbox
remove old toolbox setup
2 parents 08a8459 + 55c1a6c commit a1d1456

File tree

5 files changed

+113
-148
lines changed

5 files changed

+113
-148
lines changed

.nix/config.nix

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
## DO NOT CHANGE THIS
3+
format = "1.0.0";
4+
## unless you made an automated or manual update
5+
## to another supported format.
6+
7+
## The attribute to build from the local sources,
8+
## either using nixpkgs data or the overlays located in `.nix/coq-overlays`
9+
## Will determine the default main-job of the bundles defined below
10+
attribute = "mathcomp-finmap";
11+
12+
## If you want to select a different attribute (to build from the local sources as well)
13+
## when calling `nix-shell` and `nix-build` without the `--argstr job` argument
14+
# shell-attribute = "{{nix_name}}";
15+
16+
## Maybe the shortname of the library is different from
17+
## the name of the nixpkgs attribute, if so, set it here:
18+
# pname = "{{shortname}}";
19+
20+
## Lists the dependencies, phrased in terms of nix attributes.
21+
## No need to list Coq, it is already included.
22+
## These dependencies will systematically be added to the currently
23+
## known dependencies, if any more than Coq.
24+
## /!\ Remove this field as soon as the package is available on nixpkgs.
25+
## /!\ Manual overlays in `.nix/coq-overlays` should be preferred then.
26+
# buildInputs = [ ];
27+
28+
## Indicate the relative location of your _CoqProject
29+
## If not specified, it defaults to "_CoqProject"
30+
# coqproject = "_CoqProject";
31+
32+
## select an entry to build in the following `bundles` set
33+
## defaults to "default"
34+
default-bundle = "default";
35+
36+
## write one `bundles.name` attribute set per
37+
## alternative configuration
38+
## When generating GitHub Action CI, one workflow file
39+
## will be created per bundle
40+
bundles.default = {
41+
42+
## You can override Coq and other Coq coqPackages
43+
## through the following attribute
44+
# coqPackages.coq.override.version = "8.11";
45+
46+
## In some cases, light overrides are not available/enough
47+
## in which case you can use either
48+
# coqPackages.<coq-pkg>.overrideAttrs = o: <overrides>;
49+
## or a "long" overlay to put in `.nix/coq-overlays
50+
## you may use `nix-shell --run fetchOverlay <coq-pkg>`
51+
## to automatically retrieve the one from nixpkgs
52+
## if it exists and is correctly named/located
53+
54+
## You can override Coq and other coqPackages
55+
## through the following attribute
56+
## If <ocaml-pkg> does not support light overrides,
57+
## you may use `overrideAttrs` or long overlays
58+
## located in `.nix/ocaml-overlays`
59+
## (there is no automation for this one)
60+
# ocamlPackages.<ocaml-pkg>.override.version = "x.xx";
61+
62+
## You can also override packages from the nixpkgs toplevel
63+
# <nix-pkg>.override.overrideAttrs = o: <overrides>;
64+
## Or put an overlay in `.nix/overlays`
65+
66+
## you may mark a package as a main CI job (one to take deps and
67+
## rev deps from) as follows
68+
# coqPackages.<main-pkg>.main-job = true;
69+
## by default the current package and its shell attributes are main jobs
70+
71+
## you may mark a package as a CI job as follows
72+
# coqPackages.<another-pkg>.job = "test";
73+
## It can then built through
74+
## nix-build --argstr bundle "default" --arg job "test";
75+
## in the absence of such a directive, the job "another-pkg" will
76+
## is still available, but will be automatically included in the CI
77+
## via the command genNixActions only if it is a dependency or a
78+
## reverse dependency of a job flagged as "main-job" (see above).
79+
80+
};
81+
82+
## Cachix caches to use in CI
83+
## Below we list some standard ones
84+
cachix.coq = {};
85+
cachix.math-comp = {};
86+
cachix.coq-community = {};
87+
88+
## If you have write access to one of these caches you can
89+
## provide the auth token or signing key through a secret
90+
## variable on GitHub. Then, you should give the variable
91+
## name here. For instance, coq-community projects can use
92+
## the following line instead of the one above:
93+
# cachix.coq-community.authToken = "CACHIX_AUTH_TOKEN";
94+
95+
## Or if you have a signing key for a given Cachix cache:
96+
# cachix.my-cache.signingKey = "CACHIX_SIGNING_KEY"
97+
98+
## Note that here, CACHIX_AUTH_TOKEN and CACHIX_SIGNING_KEY
99+
## are the names of secret variables. They are set in
100+
## GitHub's web interface.
101+
}

.nix/coq-nix-toolbox.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"ee0b136a68e3ca2148100e5cc6468fac8a5dfc3b"

config.nix

Lines changed: 0 additions & 4 deletions
This file was deleted.

default.nix

Lines changed: 11 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -1,144 +1,12 @@
1-
{
2-
nixpkgs ? (if builtins.pathExists ./nixpkgs.nix then import ./nixpkgs.nix
3-
else fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/502845c3e31ef3de0e424f3fcb09217df2ce6df6.tar.gz),
4-
config ? (if builtins.pathExists ./config.nix then import ./config.nix else {}),
5-
withEmacs ? false,
6-
print-env ? false,
7-
do-nothing ? false,
8-
package ? (if builtins.pathExists ./package.nix then import ./package.nix else "mathcomp-fast"),
9-
src ? (if builtins.pathExists ./package.nix then ./. else false)
10-
}:
11-
with builtins;
12-
let
13-
cfg-fun = if isFunction config then config else (pkgs: config);
14-
pkg-src = if src == false then {}
15-
else { ${if package == "mathcomp.single" then "mathcomp" else package} = src; };
16-
pkgs = if isAttrs nixpkgs then nixpkgs else import nixpkgs {
17-
overlays = [ (pkgs: super-pkgs: with pkgs.lib;
18-
let coqPackages = with pkgs; {
19-
"8.7" = coqPackages_8_7;
20-
"8.8" = coqPackages_8_8;
21-
"8.9" = coqPackages_8_9;
22-
"8.10" = coqPackages_8_10;
23-
"8.11" = coqPackages_8_11;
24-
"8.12" = coqPackages_8_12;
25-
"default" = coqPackages_8_10;
26-
}.${(cfg-fun pkgs).coq or "default"}.overrideScope'
27-
(coqPackages: super-coqPackages:
28-
let
29-
all-pkgs = pkgs // { inherit coqPackages; };
30-
cfg = pkg-src // {
31-
mathcomp-fast = {
32-
src = ./.;
33-
propagatedBuildInputs = with coqPackages; ([ mathcomp ] ++ mathcomp-extra-fast);
34-
};
35-
mathcomp-full = {
36-
src = ./.;
37-
propagatedBuildInputs = with coqPackages; ([ mathcomp ] ++ mathcomp-extra-all);
38-
};
39-
} // (cfg-fun all-pkgs);
40-
in {
41-
mathcomp-extra-config =
42-
let mec = super-coqPackages.mathcomp-extra-config; in
43-
lib.recursiveUpdate mec {
44-
initial = {
45-
# fixing mathcomp analysis to depend on real-closed
46-
mathcomp-analysis = {version, coqPackages} @ args:
47-
let mca = mec.initial.mathcomp-analysis args; in
48-
mca // {
49-
propagatedBuildInputs = mca.propagatedBuildInputs ++
50-
(if builtins.elem coq.version ["8.10" "8.11" "8.12"] then (with coqPackages; [ coq-elpi hierarchy-builder ]) else []);
51-
};
52-
};
53-
for-coq-and-mc.${coqPackages.coq.coq-version}.${coqPackages.mathcomp.version} =
54-
(super-coqPackages.mathcomp-extra-config.${coqPackages.coq.coq-version}.${coqPackages.mathcomp.version} or {}) //
55-
(removeAttrs cfg [ "mathcomp" "coq" "mathcomp-fast" "mathcomp-full" ]);
56-
};
57-
mathcomp = if cfg?mathcomp then coqPackages.mathcomp_ cfg.mathcomp else super-coqPackages.mathcomp;
58-
} // mapAttrs
59-
(package: version: coqPackages.mathcomp-extra package version)
60-
(removeAttrs cfg ["mathcomp" "coq"])
61-
); in {
62-
coqPackages = coqPackages.filterPackages coqPackages.coq coqPackages;
63-
coq = coqPackages.coq;
64-
mc-clean = src: {
65-
version = baseNameOf src;
66-
src = cleanSourceWith {
67-
src = cleanSource src;
68-
filter = path: type: let baseName = baseNameOf (toString path); in ! (
69-
hasSuffix ".aux" baseName ||
70-
hasSuffix ".d" baseName ||
71-
hasSuffix ".vo" baseName ||
72-
hasSuffix ".glob" baseName ||
73-
elem baseName ["Makefile.coq" "Makefile.coq.conf" ".mailmap" ".git"]
74-
);
75-
};
76-
};
77-
})];
78-
};
79-
80-
mathcompnix = ./.;
81-
82-
shellHook = ''
83-
nixEnv () {
84-
echo "Here is your work environement"
85-
echo "buildInputs:"
86-
for x in $buildInputs; do printf " "; echo $x | cut -d "-" -f "2-"; done
87-
echo "propagatedBuildInputs:"
88-
for x in $propagatedBuildInputs; do printf " "; echo $x | cut -d "-" -f "2-"; done
89-
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"
90-
}
91-
92-
printEnv () {
93-
for x in $buildInputs; do echo $x; done
94-
for x in $propagatedBuildInputs; do echo $x; done
95-
}
96-
97-
cachixEnv () {
98-
echo "Pushing environement to cachix"
99-
printEnv | cachix push math-comp
100-
}
101-
102-
nixDefault () {
103-
cat $mathcompnix/default.nix
104-
} > default.nix
105-
106-
updateNixPkgs (){
107-
HASH=$(git ls-remote https://github.com/NixOS/nixpkgs-channels refs/heads/nixpkgs-unstable | cut -f1);
108-
URL=https://github.com/NixOS/nixpkgs-channels/archive/$HASH.tar.gz
109-
SHA256=$(nix-prefetch-url --unpack $URL)
110-
echo "fetchTarball {
111-
url = $URL;
112-
sha256 = \"$SHA256\";
113-
}" > nixpkgs.nix
114-
}
115-
updateNixPkgsMaster (){
116-
HASH=$(git ls-remote https://github.com/NixOS/nixpkgs refs/heads/master | cut -f1);
117-
URL=https://github.com/NixOS/nixpkgs/archive/$HASH.tar.gz
118-
SHA256=$(nix-prefetch-url --unpack $URL)
119-
echo "fetchTarball {
120-
url = $URL;
121-
sha256 = \"$SHA256\";
122-
}" > nixpkgs.nix
123-
}
124-
''
125-
+ pkgs.lib.optionalString print-env "nixEnv";
126-
127-
emacs = with pkgs; emacsWithPackages
128-
(epkgs: with epkgs.melpaStablePackages; [proof-general]);
129-
130-
pkg = with pkgs;
131-
if package == "mathcomp.single" then coqPackages.mathcomp.single
132-
else coqPackages.${package} or (coqPackages.current-mathcomp-extra package);
1+
{ config ? {}, withEmacs ? false, print-env ? false, do-nothing ? false,
2+
update-nixpkgs ? false, ci-matrix ? false,
3+
override ? {}, ocaml-override ? {}, global-override ? {},
4+
bundle ? null, job ? null, inNixShell ? null, src ? ./.,
5+
}@args:
6+
let auto = fetchGit {
7+
url = "https://github.com/coq-community/coq-nix-toolbox.git";
8+
ref = "master";
9+
rev = import .nix/coq-nix-toolbox.nix;
10+
};
13311
in
134-
if pkgs.lib.trivial.inNixShell then pkg.overrideAttrs (old: {
135-
inherit shellHook mathcompnix;
136-
137-
buildInputs = if do-nothing then []
138-
else (old.buildInputs ++
139-
(if pkgs.lib.trivial.inNixShell then pkgs.lib.optional withEmacs pkgs.emacs
140-
else []));
141-
142-
propagatedBuildInputs = if do-nothing then [] else old.propagatedBuildInputs;
143-
144-
}) else pkg
12+
import auto ({inherit src;} // args)

package.nix

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)