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

build: add initial nix build system #277

Draft
wants to merge 1 commit into
base: develop-v0
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
27 changes: 27 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
inputs = {
uninix.url = "github:pauliesnug/uninix";
flake-utils.follows = "uninix/flake-utils";
nixpkgs.follows = "uninix/nixpkgs";
};

outputs = inputs: with inputs;
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ uninix.overlays.gradle ];
};

pkgSystem = pkgs.builder.gradle.makePackageSet {
packageFn = import ./uni.demo.nix;
targets = "auto";
};
in rec {
packages = {
oneconfig = (pkgSystem.workspace.minecraft.eachDefaultVersion {}).bin;
default = packages.oneconfig;
};
}
);
}
37 changes: 37 additions & 0 deletions uni.demo.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This DEMO file was @generated by uninix alpha-1
# IT is not intended to be used in production or manually edited.
# This is a basic demo file intended to be a placeholder until
# the official uni.adapt.nix file is able to be configured.

args@{
release ? true,
uninixLib,
target ? null,
lib,
workspaceSource,
gradle,
compileMode ? null,
gradlePackages,
workspaceGen,
}:
let
workspaceSource = if args.workspaceSource == null then ./. else args.workspaceSource;
in let
inherit (uninixLib) genDrvsByVersion decideVersion;
inherit (gradle) makeGradlePkg fetchGradle;
versionsBySettings = {};
overridableMakeGradlePkg = f:
let
drvs = genDrvsByVersion versionsBySettings ({ version, versionName }: makeGradlePkg ({ inherit release version target; } // (f versionName)));
in { compileMode ? null, versionName ? decideVersion compileMode release }:
let drv = drvs.${versionName}; in if compileMode == null then drv else drv.override { inherit compileMode; };
in
{
uninixVersion = "alpha-1";
workspace = workspaceGen;
"unknown".workspace.version = overridableMakeGradlePkg (versionName: {
name = workspaceGen.minecraft.sort.name;
version = workspaceGen.minecraft.sort.version;
src = fetchGradle workspaceSource;
});
}