{ 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 ]; 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 ]; config = { Cmd = [ "/bin/app.py" ]; WorkingDir = "/state"; }; }; cross = flake-utils.lib.eachDefaultSystem (crossSystem: let pkgs = import nixpkgs { localSystem = system; inherit crossSystem; }; in { default = pkgs.python311Packages.buildPythonApplication { pname = "aci-backend"; inherit version; propagatedBuildInputs = dependencies pkgs.python311Packages; src = ./backend; }; docker = pkgs.dockerTools.buildLayeredImage { name = self.packages.${system}.cross.default.${crossSystem}.pname; tag = "latest"; contents = [ self.packages.${system}.cross.default.${crossSystem} pkgs.busybox ]; config = { Cmd = [ "/bin/app.py" ]; WorkingDir = "/state"; }; }; }); }; devShells.default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ (python311.withPackages devDependencies) ]; }; }); }