django-template/flake.nix
2023-01-20 21:17:40 +03:00

61 lines
2.1 KiB
Nix

{
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@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ];
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
{
packages = rec {
myapp = mkPoetryApplication { projectDir = ./.; };
default = myapp;
};
devShells = {
default = pkgs.mkShell {
packages = [
inputs.poetry2nix.packages.${system}.poetry
poetry-env
pkgs.sqlite
];
};
poetry = pkgs.mkShell {
packages = [ inputs.poetry2nix.packages.${system}.poetry ];
};
};
};
};
}