{ description = "A webserver to create files for tetsing purposes"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; poetry2nix-lib = { url = "github:nix-community/poetry2nix"; inputs.nixpkgs.follows = "nixpkgs"; }; microvm = { url = "github:astro/microvm.nix"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = {self, ...} @ inputs: let supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; forAllSystems = inputs.nixpkgs.lib.genAttrs supportedSystems; pkgs = forAllSystems (system: inputs.nixpkgs.legacyPackages.${system}); poetry2nix = forAllSystems (system: inputs.poetry2nix-lib.lib.mkPoetry2Nix {pkgs = pkgs.${system};}); addSetuptools = self: super: list: builtins.listToAttrs (builtins.map (package: { name = "${package}"; value = super."${package}".overridePythonAttrs (old: { nativeBuildInputs = (old.nativeBuildInputs or []) ++ [self.setuptools]; }); }) list); in { # `nix build` packages = forAllSystems (system: let mkPackage = {debug ? false}: poetry2nix.${system}.mkPoetryApplication { projectDir = self; checkPhase = if debug then "pyright --warnings testdata && pytest" else ""; # doCheck = debug; preferWheels = false; nativeBuildInputs = with pkgs.${system}; [pyright]; overrides = poetry2nix.${system}.overrides.withDefaults (self: super: addSetuptools self super ["sqlite-minutils" "fastlite" "python-fasthtml"]); }; in { default = mkPackage {debug = false;}; debug = mkPackage {debug = true;}; vm = self.nixosConfigurations.vm.config.microvm.declaredRunner; }); # `nix run` apps = forAllSystems (system: { default = { program = "${self.packages.${system}.default}/bin/testdata"; type = "app"; }; }); # `nix fmt` formatter = forAllSystems (system: pkgs.${system}.alejandra); # `nix develop` devShells = forAllSystems (system: { # Shell for app dependencies. # # nix develop # # Use this shell for developing your app. default = pkgs.${system}.mkShellNoCC { inputsFrom = [self.packages.${system}.default]; packages = [self.packages.${system}.default]; }; # Shell for poetry. # # nix develop .#poetry # # Use this shell for changes to pyproject.toml and poetry.lock. poetry = pkgs.${system}.mkShellNoCC { packages = [pkgs.${system}.poetry]; }; }); # NixOS Module nixosModules.default = import ./nix/module.nix inputs; }; }