aci/flake.nix

50 lines
1.3 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
];
devDependencies = ps: with ps; [
fastapi
uvicorn
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";
2024-02-17 21:47:42 +00:00
contents = [ self.packages.${system}.default pkgs.busybox ];
config = {
Cmd = [ "/bin/app.py" ];
WorkingDir = "/state";
};
};
};
2024-02-16 13:02:22 +00:00
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
(python311.withPackages devDependencies)
];
};
});
}