{ description = "Reproducible"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; poetry2nix = { url = "github:nix-community/poetry2nix"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = inputs @ { self, nixpkgs, flake-parts, poetry2nix, ... } : flake-parts.lib.mkFlake { inherit inputs; } { flake = { }; systems = [ "x86_64-linux" "x86_64-darwin" ]; perSystem = { system, pkgs, ... }: let inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) defaultPoetryOverrides mkPoetryApplication mkPoetryEnv; args = { python = pkgs.python311; # Required since pycapnp can't be built for some reason - Maybe this is a # missing dependency issue. preferWheels = true; overrides = defaultPoetryOverrides; }; application = mkPoetryApplication (args // { projectDir = ./.; }); env = mkPoetryEnv (args // { projectDir = ./.; editablePackageSources = let project_dir = builtins.getEnv "PROJECT_DIR"; in { reproducible = if project_dir == "" then ./. else "${project_dir}"; }; }); dockerImage = pkgs.dockerTools.buildImage { name = "reproducible"; config = { Cmd = [ "python" "main.py" ]; }; }; in rec { packages = { default = application; inherit dockerImage; }; devShells.default = pkgs.mkShell { packages = [ env pkgs.poetry ]; }; }; }; }