aci/flake.nix

64 lines
1.7 KiB
Nix
Raw Normal View History

2024-02-16 13:02:22 +00:00
{
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
2024-03-08 19:19:52 +00:00
aiohttp
2024-02-16 13:02:22 +00:00
];
devDependencies = ps: with ps; [
fastapi
uvicorn
aiohttp
2024-02-16 13:02:22 +00:00
python-lsp-server
];
2024-02-17 22:08:17 +00:00
version = self.shortRev or self.dirtyShortDev or "dirty-inputs";
2024-02-16 13:02:22 +00:00
in
{
2024-02-17 21:47:42 +00:00
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 ];
2024-02-17 21:47:42 +00:00
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 *
'';
};
2024-02-17 21:47:42 +00:00
};
2024-02-16 13:02:22 +00:00
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
(python311.withPackages devDependencies)
];
};
});
}