update: switch flake to Sort.java

This commit is contained in:
Ture Bentzin 2025-11-20 16:32:24 +00:00
parent 7adbc33487
commit 0793bd0eec
No known key found for this signature in database
GPG Key ID: F1E670A1ED8E92CE

View File

@ -6,12 +6,27 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
}; };
outputs = inputs@{ flake-parts, ... }: outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ imports = [
]; ];
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; systems = [
perSystem = { config, self', inputs', pkgs, system, ... }: let "x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
let
jdk = pkgs.jdk21.override { jdk = pkgs.jdk21.override {
}; };
@ -24,14 +39,15 @@
pkgs.google-java-format pkgs.google-java-format
]; ];
in { in
{
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
buildInputs = buildInputs ++ devTools; buildInputs = buildInputs ++ devTools;
}; };
packages = { packages = {
default = pkgs.stdenv.mkDerivation { default = pkgs.stdenv.mkDerivation {
pname = "java-template"; pname = "ssort";
version = "1.0.0"; version = "1.0.0";
src = ./.; src = ./.;
@ -39,14 +55,14 @@
nativeBuildInputs = buildInputs ++ [ pkgs.makeWrapper ]; nativeBuildInputs = buildInputs ++ [ pkgs.makeWrapper ];
buildPhase = '' buildPhase = ''
javac -Werror -g:none -deprecation -verbose Main.java javac -Werror -g:none -deprecation -verbose Sort.java
''; '';
installPhase = '' installPhase = ''
mkdir -p $out/{bin,lib} mkdir -p $out/{bin,lib}
cp *.class $out/lib cp *.class $out/lib
makeWrapper ${pkgs.lib.getExe jdk} $out/bin/java-template --add-flags "-cp $out/lib/ Main" makeWrapper ${pkgs.lib.getExe jdk} $out/bin/ssort --add-flags "-cp $out/lib/ Sort"
''; '';
}; };
}; };