Skip to content
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

flake: add overlay #11192

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 34 additions & 26 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,11 @@
configureFlags = [ "-native-compiler" "yes" ];
});
})
self.overlays.default
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not the biggest fan of applying the own overlay when declaring pkgs. can we do it another way? maybe a common function that both the overlays and outputs call.

];
dune-static-overlay = self: super: {
ocamlPackages = super.ocaml-ng.ocamlPackages_5_1.overrideScope (oself: osuper: {
dune_3 = osuper.dune_3.overrideAttrs (a: {
src = ./.;
preBuild = "ocaml boot/bootstrap.ml --static";
});
});
};
pkgs-static = nixpkgs.legacyPackages.${system}.appendOverlays [
ocaml-overlays.overlays.default
dune-static-overlay
self.overlays.dune-static
];

add-experimental-configure-flags = pkg: pkg.overrideAttrs {
Expand Down Expand Up @@ -93,22 +86,9 @@
formatter = pkgs.nixpkgs-fmt;

packages = {
default = with pkgs; stdenv.mkDerivation {
pname = "dune";
version = "n/a";
src = ./.;
nativeBuildInputs = with ocamlPackages; [ ocaml findlib ];
buildInputs = lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreServices
];
strictDeps = true;
buildFlags = [ "release" ];
dontAddPrefix = true;
dontAddStaticConfigureFlags = true;
configurePlatforms = [ ];
installFlags = [ "PREFIX=${placeholder "out"}" "LIBDIR=$(OCAMLFIND_DESTDIR)" ];
};
dune = self.packages.${system}.default;
default = self.packages.${system}.dune;

dune = pkgs.dune;
dune-static = pkgs-static.pkgsCross.musl64.ocamlPackages.dune;
dune-experimental = add-experimental-configure-flags self.packages.${system}.dune;
dune-static-experimental = add-experimental-configure-flags self.packages.${system}.dune-static;
Expand Down Expand Up @@ -278,5 +258,33 @@
'';
};
};
});
}) // {
overlays = {
default = self: super: {
dune = with self; stdenv.mkDerivation {
pname = "dune";
version = "n/a";
src = ./.;
nativeBuildInputs = with ocamlPackages; [ ocaml findlib ];
buildInputs = lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreServices
];
strictDeps = true;
buildFlags = [ "release" ];
dontAddPrefix = true;
dontAddStaticConfigureFlags = true;
configurePlatforms = [ ];
installFlags = [ "PREFIX=${placeholder "out"}" "LIBDIR=$(OCAMLFIND_DESTDIR)" ];
};
};
dune-static = self: super: {
ocamlPackages = super.ocaml-ng.ocamlPackages_5_1.overrideScope (oself: osuper: {
dune_3 = osuper.dune_3.overrideAttrs (a: {
src = ./.;
preBuild = "ocaml boot/bootstrap.ml --static";
});
});
};
};
};
}