-
Notifications
You must be signed in to change notification settings - Fork 144
flake: remove flake-utils dependency #1226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Original file line | Diff line number | Diff line change |
|---|---|---|---|
| @@ -1,21 +1,39 @@ | |||
| { | { | ||
| inputs = { | inputs = { | ||
| flake-utils.url = "github:numtide/flake-utils"; | |||
| nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; | nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; | ||
| }; | }; | ||
|
|
|
||
| outputs = { self, flake-utils, nixpkgs, ... }@inputs: | outputs = { self, nixpkgs, ... }@inputs: | ||
| let | let | ||
| package = "ocaml-lsp-server"; | package = "ocaml-lsp-server"; | ||
| overlay = final: prev: { |
|
||
| supportedSystems = [ | |||
| "aarch64-darwin" | |||
| "aarch64-linux" | |||
| "x86_64-darwin" | |||
| "x86_64-linux" | |||
| ]; | |||
|
|
|||
| forAllSystems = nixpkgs.lib.genAttrs supportedSystems; | |||
|
|
|||
| nixpkgsFor = forAllSystems (system: import nixpkgs { | |||
| inherit system; | |||
| overlays = builtins.attrValues self.overlays; | |||
| }); | |||
| in | |||
| { | |||
| overlays = { | |||
| default = final: prev: { | |||
| ${package} = prev.${package}.overrideAttrs (_: { | ${package} = prev.${package}.overrideAttrs (_: { | ||
| # Do not add share/nix-support, so that dependencies from | # Do not add share/nix-support, so that dependencies from | ||
| # the scope don't leak into dependent derivations | # the scope don't leak into dependent derivations | ||
| doNixSupport = false; | doNixSupport = false; | ||
| }); | }); | ||
|
|
|||
| dune-release = prev.dune-release.overrideAttrs (_: { | dune-release = prev.dune-release.overrideAttrs (_: { | ||
| doCheck = false; | doCheck = false; | ||
| }); | }); | ||
|
|
|||
| ocamlPackages = prev.ocamlPackages.overrideScope' (oself: osuper: | ocamlPackages = prev.ocamlPackages.overrideScope' (oself: osuper: | ||
| let | let | ||
| fixPreBuild = o: { | fixPreBuild = o: { | ||
|
|
@@ -32,16 +50,32 @@ | ||
| dune-action-plugin = osuper.dune-action-plugin.overrideAttrs fixPreBuild; | dune-action-plugin = osuper.dune-action-plugin.overrideAttrs fixPreBuild; | ||
| dune-rpc = osuper.dune-rpc.overrideAttrs fixPreBuild; | dune-rpc = osuper.dune-rpc.overrideAttrs fixPreBuild; | ||
| stdune = osuper.stdune.overrideAttrs fixPreBuild; | stdune = osuper.stdune.overrideAttrs fixPreBuild; | ||
| ocaml-lsp = self.packages.${prev.system}.ocaml-lsp; | |||
| }); | }); | ||
| }; | }; | ||
| lspPackage = pkgs: |
|
||
| with pkgs.ocamlPackages; | ocaml-lsp-only = final: prev: { | ||
| buildDunePackage { | ocamlPackages = prev.ocamlPackages.overrideScope' (_: _: { | ||
| ocaml-lsp = self.packages.${prev.system}.ocaml-lsp; | |||
| }); | |||
| }; | |||
| }; | |||
|
|
|||
| packages = forAllSystems (system: | |||
| let | |||
| pkgs = nixpkgsFor.${system}; | |||
| inherit (pkgs.ocamlPackages) buildDunePackage; | |||
| in | |||
| { | |||
| # we have a package without opam2nix for easy consumption for nix users | |||
| default = self.packages.${system}.ocaml-lsp; | |||
|
|
|||
| ocaml-lsp = buildDunePackage { | |||
| pname = package; | pname = package; | ||
| version = "n/a"; | version = "n/a"; | ||
| src = ./.; | src = ./.; | ||
| duneVersion = "3"; | duneVersion = "3"; | ||
| buildInputs = [ | buildInputs = with pkgs.ocamlPackages; [ | ||
| ocamlc-loc | ocamlc-loc | ||
| astring | astring | ||
| camlp-streams | camlp-streams | ||
|
|
@@ -62,6 +96,8 @@ | ||
| ppx_yojson_conv_lib | ppx_yojson_conv_lib | ||
| uutf | uutf | ||
| merlin-lib | merlin-lib | ||
| ] ++ [ | |||
| self.packages.${system}.lsp | |||
| ]; | ]; | ||
| propagatedBuildInputs = [ ]; | propagatedBuildInputs = [ ]; | ||
| doCheck = false; | doCheck = false; | ||
|
|
@@ -74,23 +110,8 @@ | ||
| mainProgram = "ocamllsp"; | mainProgram = "ocamllsp"; | ||
| }; | }; | ||
| }; | }; | ||
| in | |||
| { | |||
| overlays.default = (final: prev: { | |||
| ocamlPackages = prev.ocamlPackages.overrideScope (oself: osuper: | |||
| with oself; | |||
|
|
|||
| { | |||
| ocaml-lsp = lspPackage final; | |||
| } | |||
| ); | |||
| }); | |||
| } // (flake-utils.lib.eachDefaultSystem (system: | |||
| let | |||
| pkgs = import nixpkgs { overlays = [ overlay ]; inherit system; }; | |||
| inherit (pkgs.ocamlPackages) buildDunePackage; | |||
| fast = rec { | |||
|
|||
|
|
|
||
| # stub builds | |||
| jsonrpc = buildDunePackage { | jsonrpc = buildDunePackage { | ||
| pname = "jsonrpc"; | pname = "jsonrpc"; | ||
| version = "n/a"; | version = "n/a"; | ||
|
|
@@ -106,63 +127,24 @@ | ||
| src = ./.; | src = ./.; | ||
| duneVersion = "3"; | duneVersion = "3"; | ||
| propagatedBuildInputs = with pkgs.ocamlPackages; [ | propagatedBuildInputs = with pkgs.ocamlPackages; [ | ||
| jsonrpc | |||
| yojson | yojson | ||
| stdune | stdune | ||
| ppx_yojson_conv_lib | ppx_yojson_conv_lib | ||
| uutf | uutf | ||
| ] ++ [ | |||
| self.packages.${system}.jsonrpc | |||
| ]; | ]; | ||
| checkInputs = with pkgs.ocamlPackages; [ cinaps ppx_expect ]; | checkInputs = with pkgs.ocamlPackages; [ cinaps ppx_expect ]; | ||
| doCheck = false; | doCheck = false; | ||
| }; | }; | ||
| }); | |||
|
|
|
||
| ocaml-lsp = buildDunePackage { | devShells = forAllSystems (system: | ||
| pname = "ocaml-lsp"; | let pkgs = nixpkgsFor.${system}; in { | ||
| version = "n/a"; | |||
| src = ./.; | |||
| duneVersion = "3"; | |||
| checkInputs = with pkgs.ocamlPackages; [ ppx_expect ]; | |||
| propagatedBuildInputs = with pkgs.ocamlPackages; [ | |||
| ocamlc-loc | |||
| octavius | |||
| dune-build-info | |||
| re | |||
| dune-rpc | |||
| chrome-trace | |||
| dyn | |||
| fiber | |||
| xdg | |||
| ordering | |||
| spawn | |||
| pp | |||
| csexp | |||
| ocamlformat-rpc-lib | |||
| stdune | |||
| yojson | |||
| ppx_yojson_conv_lib | |||
| uutf | |||
| lsp | |||
| astring | |||
| camlp-streams | |||
| merlin-lib | |||
| ]; | |||
| doCheck = false; | |||
| }; | |||
| }; | |||
| in | |||
| { | |||
| packages = | |||
| rec { | |||
| # we have a package without opam2nix for easy consumption for nix users | |||
| default = lspPackage pkgs; | |||
|
|
|||
| ocaml-lsp = fast.ocaml-lsp; | |||
| }; | |||
|
|
|||
| devShells = { | |||
| default = pkgs.mkShell { | default = pkgs.mkShell { | ||
| buildInputs = (with pkgs; | name = package; | ||
| [ | inputsFrom = builtins.attrValues self.packages.${system}; | ||
| buildInputs = with pkgs; [ | |||
| # dev tools | # dev tools | ||
| ocamlformat_0_26_1 | ocamlformat_0_26_1 | ||
| yarn | yarn | ||
|
|
@@ -171,13 +153,12 @@ | ||
| ocamlPackages.utop | ocamlPackages.utop | ||
| ocamlPackages.cinaps | ocamlPackages.cinaps | ||
| ocamlPackages.ppx_yojson_conv | ocamlPackages.ppx_yojson_conv | ||
| ]); | ]; | ||
| inputsFrom = [ fast.ocaml-lsp fast.jsonrpc fast.lsp ]; | |||
| }; | }; | ||
|
|
|
||
| release = pkgs.mkShell { | release = pkgs.mkShell { | ||
| buildInputs = [ pkgs.dune-release ]; | buildInputs = [ pkgs.dune-release ]; | ||
| }; | }; | ||
| }); | |||
| }; | }; | ||
| })); | |||
| } | } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not Nix’s defaults (theirs includes 32-bit Linux last I checked), but matches the default systems of
flake-utilsso the change should have no effect on anyone.