From cc0f3d605516a95f876ed372baa194391ff22fc5 Mon Sep 17 00:00:00 2001 From: Etienne Millon Date: Fri, 3 May 2024 15:43:23 +0200 Subject: [PATCH] WIP: build nixpkgs revdeps --- .github/workflows/nixpkgs.yml | 20 +++++++ flake.lock | 98 +++++++++++++++++++++++++++++++---- flake.nix | 36 +++++++++++++ 3 files changed, 143 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/nixpkgs.yml diff --git a/.github/workflows/nixpkgs.yml b/.github/workflows/nixpkgs.yml new file mode 100644 index 00000000000..f6e842032db --- /dev/null +++ b/.github/workflows/nixpkgs.yml @@ -0,0 +1,20 @@ +name: nixpkgs + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + merge_group: + +jobs: + nixpkgs: + name: Nixpkgs + # TODO: if: contains(github.event.pull_request.labels.*.name, 'test_nixpkgs') + + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v22 + - run: nix build .#buildNixpkgs.ncb + - run: ./result/bin/nix-ci-build --flake .#packages.x86_64-linux.buildNixpkgs.pkgs.build_4_14 diff --git a/flake.lock b/flake.lock index 6e7b356c3ba..c19023d6255 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -70,6 +70,28 @@ "type": "github" } }, + "nix-ci-build": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nix-filter": "nix-filter_2", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1714349772, + "narHash": "sha256-KvHAAPtw1ulnA7I3gTho6Z3tXtMdO36ylW9Ny7Xuno4=", + "owner": "nix-ocaml", + "repo": "nix-ci-build", + "rev": "37ea78475014d0cd07623659d294b765acb5a12a", + "type": "github" + }, + "original": { + "owner": "nix-ocaml", + "repo": "nix-ci-build", + "type": "github" + } + }, "nix-filter": { "locked": { "lastModified": 1705332318, @@ -85,13 +107,66 @@ "type": "github" } }, + "nix-filter_2": { + "locked": { + "lastModified": 1710156097, + "narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "3342559a24e85fc164b295c3444e8a139924675b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nixpkgs": { + "inputs": { + "flake-utils": [ + "nix-ci-build", + "flake-utils" + ], + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1714600174, + "narHash": "sha256-3JLRGZHG8sqi0vG9m0WUHYE+nIppDifmrUaWGpTt/2Y=", + "owner": "nix-ocaml", + "repo": "nix-overlays", + "rev": "6426c4ebbd3dc76bb8719c0865de16d2b6523add", + "type": "github" + }, + "original": { + "owner": "nix-ocaml", + "repo": "nix-overlays", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1714556388, + "narHash": "sha256-Mxp8hX2gH30HoIQ+INvWY5P0sKBli8BmiGzZcKVD6co=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c10b1bb002e7414ecf7c9d9e5f7ebaeaeae32c92", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c10b1bb002e7414ecf7c9d9e5f7ebaeaeae32c92", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { - "lastModified": 1708532945, - "narHash": "sha256-0KucnySzsz5Zgonjjm8cQMql+HGHa/OhB0fnKmGeD+0=", + "lastModified": 1714562304, + "narHash": "sha256-Mr3U37Rh6tH0FbaDFu0aZDwk9mPAe7ASaqDOGgLqqLU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ac4c5a60bebfb783f1106d126b9f39cc8e809e0e", + "rev": "bcd44e224fd68ce7d269b4f44d24c2220fd821e7", "type": "github" }, "original": { @@ -111,11 +186,11 @@ ] }, "locked": { - "lastModified": 1708563706, - "narHash": "sha256-9Mt5hD3W0hDyIcPos9anTFRW7RHjEg3+2inj6jOY2S4=", + "lastModified": 1713734511, + "narHash": "sha256-WytVDQJz0i3arHUDVSj+b/9/IQq/z9wBrkSeQDIZAgU=", "ref": "refs/heads/master", - "rev": "922a726d2dcd816263c34df7d8d0f44fd4700be2", - "revCount": 2062, + "rev": "e485128b11892dc1e6a17f28b687368f2ac0db32", + "revCount": 2067, "submodules": true, "type": "git", "url": "https://github.com/ocaml/ocaml-lsp" @@ -130,7 +205,8 @@ "inputs": { "flake-utils": "flake-utils", "melange": "melange", - "nixpkgs": "nixpkgs", + "nix-ci-build": "nix-ci-build", + "nixpkgs": "nixpkgs_3", "ocamllsp": "ocamllsp" } }, diff --git a/flake.nix b/flake.nix index 95b2fe58f18..dfc307db786 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,12 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; + nix-ci-build = { + url = "github:nix-ocaml/nix-ci-build"; + # TODO can't follow + #inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.follows = "flake-utils"; + }; }; outputs = { self @@ -20,6 +26,7 @@ , nixpkgs , ocamllsp , melange + , nix-ci-build }: flake-utils.lib.eachDefaultSystem (system: let @@ -79,6 +86,35 @@ installFlags = [ "PREFIX=${placeholder "out"}" "LIBDIR=$(OCAMLFIND_DESTDIR)" ]; }; dune = default; + + buildNixpkgs = + let + overlay = (self: super: { + ocaml-ng = + super.ocaml-ng // { + ocamlPackages_4_14 = super.ocaml-ng.ocamlPackages_4_14.overrideScope (pself: psuper: { + dune_3 = packages.default; + }); + }; + }); + nixpkgs-sources = + builtins.fetchTarball + # XXX change url + {url = https://github.com/nix-ocaml/nix-overlays/archive/809dfb173fca728e2834f284208e03b3d53c2581.tar.gz; + sha256= "sha256:1s5pxcwmsfhrr3fsh8n9nf8ahbcs25zi48hw6a0fhh4fyb6l8ggr";} + ; + pkgs' = + (import nixpkgs-sources { + inherit system; + config.allowUnfree = true; + }).extend overlay; + nix-ci-build-pkg = nix-ci-build.outputs.packages."${system}".default; + hydra = (import "${nixpkgs-sources}/ci/hydra.nix") {inherit system; pkgs = pkgs';}; + in + { + ncb = nix-ci-build-pkg; + pkgs = hydra; + }; }; devShells =