nomen/flake.nix

65 lines
1.7 KiB
Nix
Raw Normal View History

2024-09-16 10:46:23 -04:00
{
inputs = {
nixpkgs.url = "github:Infinidoge/nixpkgs/feat/disnake";
flake-parts.url = "github:hercules-ci/flake-parts";
devshell.url = "github:numtide/devshell";
pyproject-nix.url = "github:nix-community/pyproject.nix";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
devshell.inputs.nixpkgs.follows = "nixpkgs";
pyproject-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ];
imports = with inputs; [
devshell.flakeModule
];
perSystem = { config, pkgs, ... }:
let
project = inputs.pyproject-nix.lib.project.loadPyproject {
projectRoot = ./.;
};
python = pkgs.python3;
in
{
packages.default = (python.pkgs.buildPythonPackage (
project.renderers.buildPythonPackage { inherit python; }
)).overrideAttrs { allowSubstitutes = false; preferLocalBuild = true; };
devshells.default =
let
env = python.withPackages (
project.renderers.withPackages {
inherit python;
extraPackages = p: with p; [
python-lsp-server
python-lsp-ruff
pylsp-rope
isort
black
];
}
);
in
{
devshell = {
name = "nomen";
motd = "";
packages = [
env
];
};
env = [
{ name = "PYTHONPATH"; prefix = "${env}/${env.sitePackages}"; }
];
};
};
};
}