From 0f9aac09f6cd4f6b72f8a116f6a976ccf20b2c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Zimmermann?= Date: Thu, 1 Jul 2021 21:22:03 +0200 Subject: [PATCH] Update the Nix setup to rely on the Coq Nix Toolbox. Use the dynamic workflow generation. --- .github/workflows/nix-action.yml | 49 ++++++++++++++++++++++++++++++++ .github/workflows/nix-ci.yml | 30 ------------------- .nix/coq-nix-toolbox.nix | 3 ++ .nix/fallback-config.nix | 47 ++++++++++++++++++++++++++++++ default.nix | 40 +++++++------------------- meta.yml | 14 +++++++-- 6 files changed, 121 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/nix-action.yml delete mode 100644 .github/workflows/nix-ci.yml create mode 100644 .nix/coq-nix-toolbox.nix create mode 100644 .nix/fallback-config.nix diff --git a/.github/workflows/nix-action.yml b/.github/workflows/nix-action.yml new file mode 100644 index 0000000..fc55df9 --- /dev/null +++ b/.github/workflows/nix-action.yml @@ -0,0 +1,49 @@ +# This file was generated from `meta.yml`, please do not edit manually. +# Follow the instructions on https://github.com/coq-community/templates to regenerate. +name: Nix CI + +on: + push: + branches: + - master + pull_request: + branches: + - '**' + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - name: Do nothing + run: echo "No setup, using meta.yml bundles" + "aac-tactics": + name: Main build + runs-on: ubuntu-latest + strategy: + matrix: + bundle: + - default + steps: + - name: Cachix install + uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=channel:nixpkgs-unstable + - name: Cachix setup coq + uses: cachix/cachix-action@v8 + with: + # Name of a cachix cache to pull/substitute + name: coq + - name: Cachix setup coq-community + uses: cachix/cachix-action@v8 + with: + # Name of a cachix cache to pull/substitute + name: coq-community + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Git checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Building/fetching dependencies + run: nix-build --no-out-link --argstr bundle "${{ matrix.bundle }}" --argstr job "_deps" + - name: Building/fetching current project + run: nix-build --no-out-link --argstr bundle "${{ matrix.bundle }}" --argstr job "aac-tactics" diff --git a/.github/workflows/nix-ci.yml b/.github/workflows/nix-ci.yml deleted file mode 100644 index 110623d..0000000 --- a/.github/workflows/nix-ci.yml +++ /dev/null @@ -1,30 +0,0 @@ -# This file was generated from `meta.yml`, please do not edit manually. -# Follow the instructions on https://github.com/coq-community/templates to regenerate. -name: Nix CI - -on: - push: - branches: - - master - pull_request: - branches: - - '**' - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - version_or_url: - - 'https://github.com/coq/coq-on-cachix/tarball/master' - fail-fast: false - steps: - - uses: cachix/install-nix-action@v12 - with: - nix_path: nixpkgs=channel:nixpkgs-unstable - - uses: cachix/cachix-action@v8 - with: - # Name of a cachix cache to pull/substitute - name: coq - - uses: actions/checkout@v2 - - run: nix-build --argstr coq-version-or-url "${{ matrix.version_or_url }}" diff --git a/.nix/coq-nix-toolbox.nix b/.nix/coq-nix-toolbox.nix new file mode 100644 index 0000000..3377050 --- /dev/null +++ b/.nix/coq-nix-toolbox.nix @@ -0,0 +1,3 @@ +# This file was generated from meta.yml, please do not edit manually. +# Follow the instructions on https://github.com/coq-community/templates to regenerate. +"a0c0f3d7deddacbe4575ac3c3c63f43dd103c175" diff --git a/.nix/fallback-config.nix b/.nix/fallback-config.nix new file mode 100644 index 0000000..a067b51 --- /dev/null +++ b/.nix/fallback-config.nix @@ -0,0 +1,47 @@ +# This file was generated from `meta.yml`, please do not edit manually. +# Follow the instructions on https://github.com/coq-community/templates to regenerate. + +# *However*, you may copy paste it to `config.nix` +# in the same subdirectory .nix and extend it as needed. +# Note that this would completely deactivate this file. + +{ + ## DO NOT CHANGE THE format + format = "1.0.0"; + ## unless you made an automated or manual update + ## to another supported format. + + ## The attribute to build, either from nixpkgs + ## of from the overlays located in `.nix/coq-overlays` + attribute = "aac-tactics"; + + ## If you want to select a different attribute + ## to serve as a basis for nix-shell edit this + # shell-attribute = "aac-tactics"; + + ## Maybe the shortname of the library is different from + ## the name of the nixpkgs attribute, if so, set it here: + pname = "aac-tactics"; + + ## Lists the dependencies, phrased in terms of nix attributes. + ## No need to list Coq, it is already included. + ## These dependencies will systematically be added to the currently + ## known dependencies, if any more than Coq. + ## /!\ Remove this field as soon as the package is available on nixpkgs. + ## /!\ Manual overlays in `.nix/coq-overlays` should be preferred then. + #buildInputs = [ ]; + + ## Indicate the relative location of your _CoqProject + ## If not specified, it defaults to "_CoqProject" + coqproject = "_CoqProject"; + + ## Select a bundle to build by default in the following `bundles` set + ## It will be used when typing nix-shell or nix-build without argument + ## defaults to "default" + default-bundle = "default"; + bundles."default" = {}; + + bundles."default" = { + coqPackages."coq".override.version = "master"; + }; +} diff --git a/default.nix b/default.nix index 5583068..6ec7fba 100644 --- a/default.nix +++ b/default.nix @@ -1,31 +1,13 @@ # This file was generated from `meta.yml`, please do not edit manually. # Follow the instructions on https://github.com/coq-community/templates to regenerate. - -{ pkgs ? (import {}), coq-version-or-url, shell ? false }: - -let - coq-version-parts = builtins.match "([0-9]+).([0-9]+)" coq-version-or-url; - coqPackages = - if coq-version-parts == null then - pkgs.mkCoqPackages (import (fetchTarball coq-version-or-url) {}) - else - pkgs."coqPackages_${builtins.concatStringsSep "_" coq-version-parts}"; -in - -with coqPackages; - -pkgs.stdenv.mkDerivation { - - name = "aac-tactics"; - - buildInputs = with coq.ocamlPackages; [ ocaml findlib ] - ++ pkgs.lib.optionals shell [ merlin ocp-indent ocp-index ]; - - propagatedBuildInputs = [ - coq - ]; - - src = if shell then null else ./.; - - installFlags = "COQMF_COQLIB=$(out)/lib/coq/${coq.coq-version}/"; -} +{ config ? {}, withEmacs ? false, print-env ? false, do-nothing ? false, + update-nixpkgs ? false, ci-matrix ? false, + override ? {}, ocaml-override ? {}, global-override ? {}, + bundle ? null, job ? null, inNixShell ? null, src ? ./., +}@args: +let auto = fetchGit { + url = "https://github.com/coq-community/coq-nix-toolbox.git"; + ref = "master"; + rev = import ./.nix/coq-nix-toolbox.nix; +}; in +(import auto ({inherit src;} // args)) diff --git a/meta.yml b/meta.yml index ae95d9b..4b6ac80 100644 --- a/meta.yml +++ b/meta.yml @@ -53,12 +53,20 @@ supported_ocaml_versions: text: 4.05.0 or later opam: '{>= "4.05.0"}' -tested_coq_nix_versions: -- version_or_url: https://github.com/coq/coq-on-cachix/tarball/master - tested_coq_opam_versions: - version: dev +cachix: +- name: coq +- name: coq-community + token: CACHIX_AUTH_TOKEN + +nix-bundles: +- bundle: default + packages: + - name: coq + version: master + namespace: AAC_tactics keywords: