Skip to content

Commit

Permalink
Revert "Remove mavenix + unused old nix infrastructure" (#928)
Browse files Browse the repository at this point in the history
Reverts #923 closes #926
  • Loading branch information
Baltoli authored Dec 12, 2023
1 parent e8c7319 commit eeccaeb
Show file tree
Hide file tree
Showing 13 changed files with 5,839 additions and 144 deletions.
68 changes: 68 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
let
sources = import ./nix/sources.nix;
pinned = import sources."nixpkgs" {
config = { };
overlays = [ ];
};

in { pkgs ? pinned

# Override `src` when this project is imported as a Git submodule:
#
# > ttuegel.cleanGitSubtree {
# > name = "llvm-backend";
# > src = ./parent/repo;
# > subDir = "path/to/submodule";
# > };
#
# Use `cleanGitSubtree` whenever possible to preserve the same source code
# layout as the runtimeverification/llvm-backend repository (to enable cache re-use).
#
, src ? null

# Build an optimized release package.
# Currently requires dependents to use LTO. Use sparingly.
, cmakeBuildType ? "FastBuild" }:

let
localOverlay = import ./nix/overlay.nix;

localPkgs = import sources."nixpkgs" {
config = { };
overlays = [
(final: prev:
let
ttuegel = import sources."ttuegel" { inherit (prev) pkgs; };
# Avoid spurious rebuilds by ignoring files that don't affect the build.
mavenix = import sources."mavenix" { inherit (prev) pkgs; };
in {
llvm-version = 15;
llvm-backend-build-type = cmakeBuildType;
inherit (mavenix) buildMaven;
mavenix-cli = mavenix.cli;

llvm-backend-src = ttuegel.orElse src (ttuegel.cleanSourceWith {
name = "llvm-backend-src";
src = ./.;
ignore = [ "/nix" "*.nix" "*.nix.sh" "/.github" ];
});

llvm-backend-matching-src = ttuegel.cleanSourceWith {
name = "llvm-backend-matching-src";
src = ttuegel.orElse src (ttuegel.cleanGitSubtree {
name = "llvm-backend-src";
src = ./.;
});
subDir = "matching";
};

})
localOverlay
];
};
in {
inherit (localPkgs) llvm-backend llvm-backend-matching integration-tests;
inherit (localPkgs) clang; # for compatibility
inherit (localPkgs) mavenix-cli; # for CI
}

53 changes: 51 additions & 2 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 7 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
pybind11-src.url =
"github:pybind/pybind11/0ba639d6177659c5dc2955ac06ad7b5b0d22e05c";
pybind11-src.flake = false;
mavenix.url = "github:nix-community/mavenix";
};

outputs = { self, nixpkgs, utils, fmt-src, immer-src, rapidjson-src, pybind11-src }:
outputs = { self, nixpkgs, utils, fmt-src, immer-src, rapidjson-src, pybind11-src, mavenix }:
let
inherit (nixpkgs) lib;

# put required packages into local overlay
# put devShell and any other required packages into local overlay
# if you have additional overlays, you may add them here
localOverlay = import ./nix/overlay.nix;
localOverlay = import ./nix/overlay.nix; # this should expose devShell
depsOverlay = (final: prev: {
inherit fmt-src immer-src rapidjson-src pybind11-src;

Expand Down Expand Up @@ -70,10 +71,6 @@
] ./matching);
});

maven-overlay = (final: prev: {
maven = prev.callPackage ./nix/maven.nix { };
});

llvm-backend-overlay =
nixpkgs.lib.composeManyExtensions [ depsOverlay localOverlay ];

Expand All @@ -84,7 +81,7 @@
inherit llvm-version;
inherit llvm-backend-build-type;
})
maven-overlay
mavenix.overlay
llvm-backend-overlay
];
inherit system;
Expand All @@ -108,7 +105,7 @@
{
name = "llvm-backend-${toString args.llvm-version}-${args.build-type}";
value = {
inherit (pkgs) llvm-backend llvm-backend-matching llvm-kompile-testing integration-tests;
inherit (pkgs) llvm-backend llvm-backend-matching llvm-kompile-testing integration-tests devShell;
};
}
));
Expand All @@ -127,9 +124,9 @@
llvm-backend-15-FastBuild.integration-tests
llvm-backend-16-FastBuild.integration-tests
];
devShells.default = llvm-backend-16-FastBuild.devShell;
}) // {
# non-system suffixed items should go here
overlays.default = llvm-backend-overlay;
overlays.maven = maven-overlay;
};
}
74 changes: 0 additions & 74 deletions nix/build-maven-package.nix

This file was deleted.

7 changes: 7 additions & 0 deletions nix/devShell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ mkShell, llvm-backend, llvm-backend-matching, mavenix-cli }:

mkShell {
inputsFrom = [ llvm-backend llvm-backend-matching ];

nativeBuildInputs = [ mavenix-cli ];
}
Loading

0 comments on commit eeccaeb

Please sign in to comment.