Skip to content

Commit

Permalink
Remove mavenix + unused old nix infrastructure (#923)
Browse files Browse the repository at this point in the history
Co-authored-by: Bruce Collie <[email protected]>
  • Loading branch information
goodlyrottenapple and Baltoli authored Dec 10, 2023
1 parent 87eefda commit e8c7319
Show file tree
Hide file tree
Showing 13 changed files with 144 additions and 5,839 deletions.
68 changes: 0 additions & 68 deletions default.nix

This file was deleted.

53 changes: 2 additions & 51 deletions flake.lock

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

17 changes: 10 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@
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, mavenix }:
outputs = { self, nixpkgs, utils, fmt-src, immer-src, rapidjson-src, pybind11-src }:
let
inherit (nixpkgs) lib;

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

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

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

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

Expand All @@ -81,7 +84,7 @@
inherit llvm-version;
inherit llvm-backend-build-type;
})
mavenix.overlay
maven-overlay
llvm-backend-overlay
];
inherit system;
Expand All @@ -105,7 +108,7 @@
{
name = "llvm-backend-${toString args.llvm-version}-${args.build-type}";
value = {
inherit (pkgs) llvm-backend llvm-backend-matching llvm-kompile-testing integration-tests devShell;
inherit (pkgs) llvm-backend llvm-backend-matching llvm-kompile-testing integration-tests;
};
}
));
Expand All @@ -124,9 +127,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: 74 additions & 0 deletions nix/build-maven-package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{ lib, stdenv, maven }:

{ src, sourceRoot ? null, buildOffline ? false, patches ? [ ], pname, version
, mvnHash ? "", mvnFetchExtraArgs ? { }, mvnDepsParameters ? ""
, manualMvnArtifacts ? [ ], mvnParameters ? "", ... }@args:

# originally extracted from dbeaver
# created to allow using maven packages in the same style as rust

let
fetchedMavenDeps = stdenv.mkDerivation ({
name = "${pname}-${version}-maven-deps";
inherit src sourceRoot patches;

nativeBuildInputs = [ maven ];

buildPhase = ''
runHook preBuild
'' + lib.optionalString buildOffline ''
mvn org.apache.maven.plugins:maven-dependency-plugin:3.6.1:go-offline -Dmaven.repo.local=$out/.m2 ${mvnDepsParameters}
for artifactId in ${builtins.toString manualMvnArtifacts}
do
echo "downloading manual $artifactId"
mvn dependency:get -Dartifact="$artifactId" -Dmaven.repo.local=$out/.m2
done
'' + lib.optionalString (!buildOffline) ''
mvn package -Dmaven.repo.local=$out/.m2 ${mvnParameters}
'' + ''
runHook postBuild
'';

# keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
installPhase = ''
runHook preInstall
find $out -type f \( \
-name \*.lastUpdated \
-o -name resolver-status.properties \
-o -name _remote.repositories \
-o -name \*.snapshots.xml \
-o -name \*.snapshots.xml.sha1 \) \
-delete
# delete any empty directories
find . -type d -empty -delete
runHook postInstall
'';

# don't do any fixup
dontFixup = true;
outputHashAlgo = if mvnHash != "" then null else "sha256";
outputHashMode = "recursive";
outputHash = mvnHash;
} // mvnFetchExtraArgs);
in stdenv.mkDerivation (builtins.removeAttrs args [ "mvnFetchExtraArgs" ] // {
inherit fetchedMavenDeps;

nativeBuildInputs = args.nativeBuildInputs or [ ] ++ [ maven ];

buildPhase = ''
runHook preBuild
mvnDeps=$(cp -dpR ${fetchedMavenDeps}/.m2 ./ && chmod +w -R .m2 && pwd)
mvn package -o -nsu "-Dmaven.repo.local=$mvnDeps/.m2" ${mvnParameters}
runHook postBuild
'';

meta = args.meta or { } // {
platforms = args.meta.platforms or maven.meta.platforms;
};
})
7 changes: 0 additions & 7 deletions nix/devShell.nix

This file was deleted.

Loading

0 comments on commit e8c7319

Please sign in to comment.