2023-08-08 16:30:43 +02:00
|
|
|
{
|
|
|
|
description = "Matabas — databas för mat";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOs/nixpkgs/nixos-23.05";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, flake-utils, nixpkgs }:
|
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
let pkgs = nixpkgs.legacyPackages.${system};
|
2023-08-09 23:14:39 +02:00
|
|
|
buildInputs = [
|
|
|
|
pkgs.postgresql_15_jit
|
2023-08-10 00:55:07 +02:00
|
|
|
( pkgs.ghc.withPackages (ps: with ps; [
|
|
|
|
scotty postgresql-typed http-client-tls aeson
|
|
|
|
]) )
|
2023-08-09 23:14:39 +02:00
|
|
|
];
|
2023-08-08 16:30:43 +02:00
|
|
|
in rec {
|
2023-08-09 19:18:49 +02:00
|
|
|
packages = {
|
2023-08-09 23:14:39 +02:00
|
|
|
matabas = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "matabas";
|
|
|
|
src = ./. ;
|
|
|
|
inherit buildInputs ;
|
|
|
|
buildPhase = builtins.readFile ./buildScripts/setupEnv.sh + ''
|
|
|
|
build
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
mv artifacts/Main "$out/bin/matabas"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
default = packages.matabas;
|
2023-08-08 16:30:43 +02:00
|
|
|
};
|
|
|
|
devShells.default = pkgs.mkShell {
|
2023-08-09 23:14:39 +02:00
|
|
|
packages = buildInputs;
|
|
|
|
shellHook = builtins.readFile ./buildScripts/setupEnv.sh ;
|
2023-08-08 16:30:43 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
) // {
|
|
|
|
nixosConfigurations.matabas-container =
|
|
|
|
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
|
|
|
in nixpkgs.lib.nixosSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
modules = [({ pkgs, ... }: {
|
|
|
|
boot.isContainer = true;
|
|
|
|
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
|
|
|
|
system.stateVersion = "23.05";
|
|
|
|
environment.systemPackages = [ self.packages.x86_64-linux.default ];
|
|
|
|
})];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|