diff --git a/flake.lock b/flake.lock index f8555f3..a4b4c9c 100644 --- a/flake.lock +++ b/flake.lock @@ -21,11 +21,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "lastModified": 1687709756, + "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", "owner": "numtide", "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", "type": "github" }, "original": { @@ -92,11 +92,11 @@ "opam2json": "opam2json" }, "locked": { - "lastModified": 1682411044, - "narHash": "sha256-HJY+LANQ75YQSfaTCOnmtiF4pF8d9Eb4dz+wLyNAihE=", + "lastModified": 1688594513, + "narHash": "sha256-sw9fsME6MxhX++J54JqP+v9gFQjaxAwxyoihEg0oX0M=", "owner": "tweag", "repo": "opam-nix", - "rev": "02f7ae28a210e17ca5811b0a4c116acd94e82faa", + "rev": "5bfdc95cfb7662cac808eb1baa70ae3fff0cab4f", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 725768d..7d6e324 100644 --- a/flake.nix +++ b/flake.nix @@ -9,24 +9,42 @@ let pkgs = nixpkgs.legacyPackages.${system}; on = opam-nix.lib.${system}; + localPackagesQuery = builtins.mapAttrs (_: pkgs.lib.last) (on.listRepo (on.makeOpamRepo ./.)); + devPackagesQuery = { ocaml-lsp-server = "*"; ocp-indent = "*"; merlin = "*"; }; + query = devPackagesQuery // { ocaml-base-compiler = "*"; }; + scope = on.buildDuneProject { } "polytt" ./. query; + + overlay = self: super: { + # Prevent unnecessary dependencies on the resulting derivation + polytt = super.polytt.overrideAttrs (_: { + removeOcamlReferences = true; + postFixup = "rm -rf $out/nix-support"; + }); + }; + + scope' = scope.overrideScope' overlay; + + # Packages from devPackagesQuery devPackages = builtins.attrValues - (pkgs.lib.getAttrs (builtins.attrNames devPackagesQuery) scope); + (pkgs.lib.getAttrs (builtins.attrNames devPackagesQuery) scope'); + + # Packages in this workspace packages = - pkgs.lib.getAttrs (builtins.attrNames localPackagesQuery) scope; + pkgs.lib.getAttrs (builtins.attrNames localPackagesQuery) scope'; in { - legacyPackages = scope; + legacyPackages = scope'; packages = packages // { default = packages.polytt; };