From 15b1a9e73a83350041cec076190f8344e759d0ed Mon Sep 17 00:00:00 2001 From: Théo Zimmermann Date: Wed, 4 Jul 2018 11:22:47 +0200 Subject: [pkg:nix] Cache the build using Cachix when signing key is set. --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 773a89a46..f2491fd12 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -245,7 +245,8 @@ pkg:nix: before_script: [] # We don't want to use the shared 'before_script' script: - export TMPDIR=$PWD - - nix-build "$CI_PROJECT_URL/-/archive/$CI_COMMIT_SHA.tar.gz" -K + - nix-env -if https://github.com/cachix/cachix/tarball/master --substituters https://cachix.cachix.org --trusted-public-keys cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM= + - nix-build "$CI_PROJECT_URL/-/archive/$CI_COMMIT_SHA.tar.gz" -K --extra-substituters https://coq.cachix.org --trusted-public-keys "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= coq.cachix.org-1:Jgt0DwGAUo+wpxCM52k2V+E0hLoOzFPzvg94F65agtI=" | if [ ! -z "$CACHIX_SIGNING_KEY" ]; then cachix push coq; fi artifacts: name: "$CI_JOB_NAME.logs" when: on_failure -- cgit v1.2.3 From 1f9be66ae0a4510f3564c8ed2add9b0228407f01 Mon Sep 17 00:00:00 2001 From: Théo Zimmermann Date: Thu, 5 Jul 2018 09:46:26 +0200 Subject: [pkg:nix] Pass through the ocamlPackages version used to build. This will be useful for users wanting to build a plugin using this package. --- default.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/default.nix b/default.nix index 1be274081..c791706db 100644 --- a/default.nix +++ b/default.nix @@ -86,4 +86,18 @@ stdenv.mkDerivation rec { installCheckTarget = [ "check" ]; + passthru = { inherit ocamlPackages; }; + + meta = { + description = "Coq proof assistant"; + longDescription = '' + Coq is a formal proof management system. It provides a formal language + to write mathematical definitions, executable algorithms and theorems + together with an environment for semi-interactive development of + machine-checked proofs. + ''; + homepage = http://coq.inria.fr; + license = licenses.lgpl21; + }; + } -- cgit v1.2.3 From f758debf01fc88d5531825fe42f59f4f8c19247c Mon Sep 17 00:00:00 2001 From: Théo Zimmermann Date: Thu, 5 Jul 2018 09:49:44 +0200 Subject: [pkg:nix] Change the download method. This will allow for better reuse of the cache when the URL is different but the archive is the same. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f2491fd12..9b2f45e53 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -246,7 +246,7 @@ pkg:nix: script: - export TMPDIR=$PWD - nix-env -if https://github.com/cachix/cachix/tarball/master --substituters https://cachix.cachix.org --trusted-public-keys cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM= - - nix-build "$CI_PROJECT_URL/-/archive/$CI_COMMIT_SHA.tar.gz" -K --extra-substituters https://coq.cachix.org --trusted-public-keys "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= coq.cachix.org-1:Jgt0DwGAUo+wpxCM52k2V+E0hLoOzFPzvg94F65agtI=" | if [ ! -z "$CACHIX_SIGNING_KEY" ]; then cachix push coq; fi + - nix-build -E "import (fetchTarball $CI_PROJECT_URL/-/archive/$CI_COMMIT_SHA.tar.gz) {}" -K --extra-substituters https://coq.cachix.org --trusted-public-keys "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= coq.cachix.org-1:Jgt0DwGAUo+wpxCM52k2V+E0hLoOzFPzvg94F65agtI=" | if [ ! -z "$CACHIX_SIGNING_KEY" ]; then cachix push coq; fi artifacts: name: "$CI_JOB_NAME.logs" when: on_failure -- cgit v1.2.3 From 42774708bafe48aefe411fab4ca4d75407f9d1d6 Mon Sep 17 00:00:00 2001 From: Théo Zimmermann Date: Thu, 5 Jul 2018 11:44:43 +0200 Subject: [pkg:nix] Stop using lib.inNixShell. --- default.nix | 7 +++++-- shell.nix | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/default.nix b/default.nix index c791706db..d9317bcca 100644 --- a/default.nix +++ b/default.nix @@ -30,6 +30,9 @@ , buildIde ? true , buildDoc ? true , doInstallCheck ? true +, shell ? false + # We don't use lib.inNixShell because that would also apply + # when in a nix-shell of some package depending on this one. }: with pkgs; @@ -58,13 +61,13 @@ stdenv.mkDerivation rec { optional (!versionAtLeast ocaml.version "4.07") ncurses ++ [ ocamlPackages.ounit rsync which ] ) - ++ optionals lib.inNixShell ( + ++ optionals shell ( [ jq curl git gnupg ] # Dependencies of the merging script ++ (with ocamlPackages; [ merlin ocp-indent ocp-index ]) # Dev tools ); src = - if lib.inNixShell then null + if shell then null else with builtins; filterSource (path: _: diff --git a/shell.nix b/shell.nix index 45070b2ba..3201c5050 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,4 @@ # Some developers don't want a pinned nix-shell by default. # If you want to use the pin nix-shell or a more sophisticated set of arguments: -# $ nix-shell default.nix -import ./default.nix { pkgs = import {}; } +# $ nix-shell default.nix --arg shell true +import ./default.nix { pkgs = import {}; shell = true; } -- cgit v1.2.3 From c2ab1e847670190d5c42d280c4375a73478d191d Mon Sep 17 00:00:00 2001 From: Théo Zimmermann Date: Thu, 5 Jul 2018 16:06:25 +0200 Subject: [pkg:nix] Add more comments and allow overriding extra substituters. --- .gitlab-ci.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9b2f45e53..11614bc38 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -240,13 +240,25 @@ pkg:nix: image: nixorg/nix:latest # Minimal NixOS image which doesn't even contain git stage: test variables: + # By default we use coq.cachix.org as an extra substituter but this can be overridden + EXTRA_SUBSTITUTERS: https://coq.cachix.org + EXTRA_PUBLIC_KEYS: coq.cachix.org-1:Jgt0DwGAUo+wpxCM52k2V+E0hLoOzFPzvg94F65agtI= + # The following variables should not be overridden GIT_STRATEGY: none + CACHIX_PUBLIC_KEY: cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM= + NIXOS_PUBLIC_KEY: cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= + dependencies: [] # We don't need to download build artifacts before_script: [] # We don't want to use the shared 'before_script' script: + # Use current worktree as tmpdir to allow exporting artifacts in case of failure - export TMPDIR=$PWD - - nix-env -if https://github.com/cachix/cachix/tarball/master --substituters https://cachix.cachix.org --trusted-public-keys cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM= - - nix-build -E "import (fetchTarball $CI_PROJECT_URL/-/archive/$CI_COMMIT_SHA.tar.gz) {}" -K --extra-substituters https://coq.cachix.org --trusted-public-keys "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= coq.cachix.org-1:Jgt0DwGAUo+wpxCM52k2V+E0hLoOzFPzvg94F65agtI=" | if [ ! -z "$CACHIX_SIGNING_KEY" ]; then cachix push coq; fi + # Install Cachix as documented at https://github.com/cachix/cachix + - nix-env -if https://github.com/cachix/cachix/tarball/master --substituters https://cachix.cachix.org --trusted-public-keys "$CACHIX_PUBLIC_KEY" + # We build an expression rather than a direct URL to not be dependent on + # the URL location; we are forced to put the public key of cache.nixos.org + # because there is no --extra-trusted-public-key option. + - nix-build -E "import (fetchTarball $CI_PROJECT_URL/-/archive/$CI_COMMIT_SHA.tar.gz) {}" -K --extra-substituters "$EXTRA_SUBSTITUTERS" --trusted-public-keys "$NIXOS_PUBLIC_KEY $EXTRA_PUBLIC_KEYS" | if [ ! -z "$CACHIX_SIGNING_KEY" ]; then cachix push coq; fi artifacts: name: "$CI_JOB_NAME.logs" when: on_failure -- cgit v1.2.3