This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
server/flake.nix

62 lines
1.2 KiB
Nix
Raw Normal View History

2024-05-22 19:43:12 +02:00
{
description = "Learning Pulse";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
2024-05-22 19:43:12 +02:00
};
outputs =
{ self
, nixpkgs
, maven
, makeWrapper
2024-05-25 16:33:17 +02:00
, stdenv
2024-05-24 09:37:55 +02:00
, ...
}:
2024-05-22 19:43:12 +02:00
let
overlays = [
(final: prev: rec {
2024-05-24 09:37:55 +02:00
jdk = prev."jdk22";
2024-05-22 19:43:12 +02:00
maven = prev.maven.override { inherit jdk; };
})
];
2024-05-24 09:37:55 +02:00
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
];
2024-05-22 19:43:12 +02:00
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
2024-05-22 19:43:12 +02:00
in
{
2024-05-24 09:37:55 +02:00
packages = {
2024-05-25 16:33:17 +02:00
learningpulse-discovery = stdenv.mkDerivation rec {
pname = "gateway";
version = "1.0";
2024-05-24 09:37:55 +02:00
2024-05-25 16:33:17 +02:00
src = ./.;
buildInputs = [ maven ];
2024-05-24 09:37:55 +02:00
2024-05-25 16:33:17 +02:00
buildPhase = ''
mvn --offline -Dmaven.repo.local=gateway package;
'';
2024-05-24 09:37:55 +02:00
installPhase = ''
2024-05-25 16:33:17 +02:00
install -Dm644 target/${pname}-${version}.jar $out/share/java
2024-05-24 09:37:55 +02:00
'';
};
2024-05-25 16:33:17 +02:00
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
jdk
maven
];
};
});
};
2024-05-22 19:43:12 +02:00
};
}