{ inputs = { # dream2nix.url = "github:nix-community/dream2nix"; 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@{ flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } { systems = [ "x86_64-linux" ]; # imports = [ inputs.dream2nix.flakeModuleBeta ]; perSystem = { config, system, ... }: let inherit (inputs.poetry2nix.legacyPackages.${system}) mkPoetryApplication mkPoetryEnv mkPoetryEditablePackage defaultPoetryOverrides; pkgs = inputs.nixpkgs.legacyPackages.${system}; poetry-env = mkPoetryEnv { python = pkgs.python310Full; projectDir = ./.; groups = [ "dev" ]; overrides = defaultPoetryOverrides.extend (self: super: { djlint = super.djlint.overridePythonAttrs (old: { buildInputs = (old.buildInputs or [ ]) ++ [ super.poetry ]; }); html-void-elements = super.html-void-elements.overridePythonAttrs (old: { buildInputs = (old.buildInputs or [ ]) ++ [ super.poetry ]; }); html-tag-names = super.html-tag-names.overridePythonAttrs (old: { buildInputs = (old.buildInputs or [ ]) ++ [ super.poetry ]; }); cssbeautifier = super.cssbeautifier.overridePythonAttrs (old: { buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ]; }); }); }; in { # define an input for dream2nix to generate outputs for # dream2nix.inputs."django-app" = { # source = ./.; # projects.django-app = { # subsystem = "python"; # translator = "poetry"; # subsystemInfo.system = system; # subsystemInfo.pythonVersion = "3.10"; # }; # }; packages = rec { myapp = mkPoetryApplication { projectDir = ./.; }; default = myapp; }; devShells = { default = pkgs.mkShell { packages = [ inputs.poetry2nix.packages.${system}.poetry poetry-env pkgs.sqlite ]; shellHook = '' export POETRY_VIRTUALENVS_IN_PROJECT=1 ''; }; poetry = pkgs.mkShell { packages = [ inputs.poetry2nix.packages.${system}.poetry ]; shellHook = "export POETRY_VIRTUALENVS_IN_PROJECT=1"; }; }; }; }; }