63 lines
1.7 KiB
Nix
63 lines
1.7 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable;
|
|
flake-utils.url = github:numtide/flake-utils;
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
};
|
|
dependencies = ps: with ps; [
|
|
fastapi
|
|
uvicorn
|
|
aiohttp
|
|
];
|
|
devDependencies = ps: with ps; [
|
|
fastapi
|
|
uvicorn
|
|
aiohttp
|
|
python-lsp-server
|
|
];
|
|
version = self.shortRev or self.dirtyShortDev or "dirty-inputs";
|
|
in
|
|
{
|
|
packages = {
|
|
default = pkgs.python311Packages.buildPythonApplication {
|
|
pname = "aci-backend";
|
|
inherit version;
|
|
propagatedBuildInputs = dependencies pkgs.python311Packages;
|
|
src = ./backend;
|
|
};
|
|
|
|
docker = pkgs.dockerTools.buildLayeredImage {
|
|
name = self.packages.${system}.default.pname;
|
|
tag = "latest";
|
|
contents = [ self.packages.${system}.default pkgs.busybox pkgs.cacert ];
|
|
config = {
|
|
Cmd = [ "/bin/app.py" ];
|
|
WorkingDir = "/state";
|
|
};
|
|
};
|
|
|
|
extension = pkgs.stdenv.mkDerivation {
|
|
name = "aci-extension.zip";
|
|
inherit version;
|
|
src = ./extension;
|
|
phases = "installPhase";
|
|
nativeBuildInputs = [ pkgs.zip ];
|
|
installPhase = ''
|
|
cd $src/
|
|
zip -r $out *
|
|
'';
|
|
};
|
|
};
|
|
devShells.default = pkgs.mkShell {
|
|
nativeBuildInputs = with pkgs; [
|
|
(python311.withPackages devDependencies)
|
|
];
|
|
};
|
|
});
|
|
}
|