build: add guestbook server build (scala)
This commit is contained in:
parent
b3b53dd1fc
commit
c3fcb13b63
37
flake.lock
37
flake.lock
@ -1,5 +1,20 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1667395993,
|
||||||
|
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"naked-shell": {
|
"naked-shell": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681286841,
|
"lastModified": 1681286841,
|
||||||
@ -66,9 +81,31 @@
|
|||||||
"naked-shell": "naked-shell",
|
"naked-shell": "naked-shell",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"parts": "parts",
|
"parts": "parts",
|
||||||
|
"sbt-derivation": "sbt-derivation",
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"sbt-derivation": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1698464090,
|
||||||
|
"narHash": "sha256-Pnej7WZIPomYWg8f/CZ65sfW85IfIUjYhphMMg7/LT0=",
|
||||||
|
"owner": "zaninime",
|
||||||
|
"repo": "sbt-derivation",
|
||||||
|
"rev": "6762cf2c31de50efd9ff905cbcc87239995a4ef9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "zaninime",
|
||||||
|
"repo": "sbt-derivation",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1680978846,
|
"lastModified": 1680978846,
|
||||||
|
34
flake.nix
34
flake.nix
@ -3,6 +3,8 @@
|
|||||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
inputs.systems.url = "github:nix-systems/x86_64-linux";
|
inputs.systems.url = "github:nix-systems/x86_64-linux";
|
||||||
inputs.naked-shell.url = "github:yusdacra/mk-naked-shell";
|
inputs.naked-shell.url = "github:yusdacra/mk-naked-shell";
|
||||||
|
inputs.sbt-derivation.url = "github:zaninime/sbt-derivation";
|
||||||
|
inputs.sbt-derivation.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
outputs = inp:
|
outputs = inp:
|
||||||
inp.parts.lib.mkFlake {inputs = inp;} {
|
inp.parts.lib.mkFlake {inputs = inp;} {
|
||||||
@ -12,9 +14,10 @@
|
|||||||
];
|
];
|
||||||
perSystem = {
|
perSystem = {
|
||||||
config,
|
config,
|
||||||
pkgs,
|
system,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
pkgs = inp.nixpkgs.legacyPackages.${system}.appendOverlays [inp.sbt-derivation.overlays.default];
|
||||||
packageJson = builtins.fromJSON (builtins.readFile ./package.json);
|
packageJson = builtins.fromJSON (builtins.readFile ./package.json);
|
||||||
in {
|
in {
|
||||||
devShells.default = config.mk-naked-shell.lib.mkNakedShell {
|
devShells.default = config.mk-naked-shell.lib.mkNakedShell {
|
||||||
@ -84,6 +87,35 @@
|
|||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
packages.guestbook-jar = pkgs.mkSbtDerivation rec {
|
||||||
|
pname = "guestbook";
|
||||||
|
version = "0.0.1-jar";
|
||||||
|
depsSha256 = "sha256-hIGZTEZpqgBuo6VGgZ6dQd5kK0RLVNy5REVBBYA3Gak=";
|
||||||
|
src = ./guestbook;
|
||||||
|
buildPhase = ''
|
||||||
|
sbt assembly
|
||||||
|
mkdir -p ./target/graalvm-native-image
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
cp target/scala-3.4.2/${pname}-assembly-0.0.1-SNAPSHOT.jar $out/${pname}.jar
|
||||||
|
'';
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.graalvm-ce
|
||||||
|
];
|
||||||
|
};
|
||||||
|
packages.guestbook = pkgs.stdenv.mkDerivation rec {
|
||||||
|
inherit (config.packages.guestbook-jar) pname nativeBuildInputs;
|
||||||
|
version = "0.0.1";
|
||||||
|
src = config.packages.guestbook-jar;
|
||||||
|
buildPhase = ''
|
||||||
|
native-image -H:+ReportExceptionStackTraces -H:+AddAllCharsets --allow-incomplete-classpath --no-fallback --initialize-at-run-time --enable-http --enable-all-security-services --verbose -jar "./${pname}.jar" ./${pname}
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp ${pname} $out/bin/${pname}
|
||||||
|
'';
|
||||||
|
};
|
||||||
packages.default = config.packages.gazesys;
|
packages.default = config.packages.gazesys;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user