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

add nixos support! #805

Closed
wants to merge 13 commits into from
11 changes: 10 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ permissions:
contents: write

jobs:
nixbuild:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-24.05
- uses: DeterminateSystems/magic-nix-cache-action@v3
- run: nix-build
test:
name: Run test suite
strategy:
Expand Down Expand Up @@ -162,4 +171,4 @@ jobs:
name: jreleaser-release
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
out/jreleaser/output.properties
13 changes: 5 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@ plugins {
allprojects {
group 'software.coley'
version '4.0.0-SNAPSHOT'
tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
}

subprojects {
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'com.github.ben-manes.versions'

repositories {
mavenLocal()
mavenCentral()
google()
maven { url 'https://maven.quiltmc.org/repository/release/' }
maven { url 'https://jitpack.io' }
}

// ======================= DEPENDENCIES ========================
dependencies {
// to enforce it everywhere as standard
Expand Down Expand Up @@ -109,6 +105,7 @@ subprojects {
includes = ['software/coley/recaf/**']
}
}

}

// Always emit HTML & XML aggregate reports
Expand Down
10 changes: 10 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).defaultNix
143 changes: 143 additions & 0 deletions flake.lock

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

49 changes: 49 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
inputs = {
# This must be the stable nixpkgs if you're running the app on a
# stable NixOS install. Mixing EGL library versions doesn't work.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
build-gradle-application.url = "github:raphiz/buildGradleApplication";
utils.url = "github:numtide/flake-utils";
flake-compat = {
url = github:edolstra/flake-compat;
flake = false;
};
};

outputs = inputs @ { self, nixpkgs, utils, build-gradle-application, ... }:
utils.lib.eachDefaultSystem (system:
let
overlays = [build-gradle-application.overlays.default];
pkgs = import nixpkgs {inherit system overlays;};
version = self.shortRev or "dirty";
jdk = pkgs.jdk22;
update_action = "build";
gradle = (pkgs.callPackage pkgs.gradle-packages.gradle_8 {
java = jdk;
});
libPath = with pkgs; lib.makeLibraryPath [
libGL
libxkbcommon
wayland
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
xorg.libXxf86vm
xorg.libXtst
fontconfig
];
in
{
defaultPackage = pkgs.callPackage ./package.nix {
inherit version gradle jdk;
};

devShell = with pkgs;
mkShellNoCC {
buildInputs = [jdk openjfx22 gradle xorg.libxcb (updateVerificationMetadata.override { updateAction = update_action; gradle = gradle; })];
LD_LIBRARY_PATH = libPath;
};
});
}
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.caching=true
org.gradle.caching=true
org.gradle.dependency.verification.console=verbose
Loading