initial backend nix build - get jar

This commit is contained in:
efim 2023-04-29 19:12:30 +04:00
parent ba625d738e
commit d4eae63166
4 changed files with 65 additions and 4 deletions

1
.gitignore vendored
View File

@ -30,3 +30,4 @@ target
.metals
project/project
project/metals.sbt
/result

View File

@ -1,6 +1,7 @@
import org.scalajs.linker.interface.ModuleSplitStyle
lazy val commonSettings = Seq(
version := "0.1.1",
scalaVersion := "3.2.0"
)

View File

@ -18,6 +18,21 @@
"type": "github"
}
},
"flake-utils_2": {
"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"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1682080641,
@ -36,7 +51,30 @@
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"sbt-derivation": "sbt-derivation"
}
},
"sbt-derivation": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1675083208,
"narHash": "sha256-+sSFhSpV2jckr1qYlX/SaxQ6IdpagD6o4rru/3HAl0I=",
"owner": "zaninime",
"repo": "sbt-derivation",
"rev": "92d6d6d825e3f6ae5642d1cce8ff571c3368aaf7",
"type": "github"
},
"original": {
"owner": "zaninime",
"ref": "master",
"repo": "sbt-derivation",
"type": "github"
}
},
"systems": {

View File

@ -2,12 +2,17 @@
description = "Planning Poker web app. Trying to build something and learn new things";
inputs.nixpkgs.url = "github:nixos/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.sbt-derivation.url = "github:zaninime/sbt-derivation/master";
inputs.sbt-derivation.inputs.nixpkgs.follows = "nixpkgs";
outputs = { self, nixpkgs, flake-utils }:
outputs = { self, nixpkgs, flake-utils, sbt-derivation }:
flake-utils.lib.eachDefaultSystem
(system:
let pkgs = nixpkgs.legacyPackages.${system}; in
{
let
pkgs = nixpkgs.legacyPackages.${system};
packageName = "blanning-poker-grargh";
version = "0.1.1";
in {
devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.nodejs
@ -21,6 +26,22 @@
echo "dev env for planning poker BWARGH started"
'';
};
packages.backend = sbt-derivation.lib.mkSbtDerivation rec {
inherit pkgs version;
# ...and the rest of the arguments
pname = "${packageName}-backend";
depsSha256 = "sha256-UOEq6KFS4rh4eaKxnRcVOh4SQWn3hnfpzcyRqPnFvco=";
src = pkgs.nix-gitignore.gitignoreSource [] ./.;
buildPhase = ''
sbt backend/assembly
'';
installPhase = ''
mkdir -p $out/bin
cp backend/target/scala-*/backend-assembly-*.jar $out/bin/
'';
};
}
);
# see https://serokell.io/blog/practical-nix-flakes