-
Notifications
You must be signed in to change notification settings - Fork 47
/
flake.nix
57 lines (51 loc) · 1.34 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
description = "Astral - Calculations for the sun and moon.";
inputs.pyproject-nix.url = "github:nix-community/pyproject.nix";
inputs.pyproject-nix.inputs.nixpkgs.follows = "nixpkgs";
nixConfig = {
bash-prompt = ''\n\[\033[1;34m\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\\$\[\033[0m\] '';
};
outputs = {
nixpkgs,
pyproject-nix,
...
}: let
inherit (nixpkgs) lib;
project = pyproject-nix.lib.project.loadPyproject {
projectRoot = ./.;
};
forAllSystems = function:
nixpkgs.lib.genAttrs [
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
] (system: function nixpkgs.legacyPackages.${system});
in {
devShells = forAllSystems (pkgs: (
let
python = pkgs.python3;
arg = project.renderers.withPackages {inherit python;};
pythonEnv = python.withPackages arg;
in {
default = pkgs.mkShell {
packages = [
pkgs.pdm
pkgs.ruff
pythonEnv
];
shellHook = ''
export PYTHONPATH=${builtins.toString ./src}
'';
};
}
));
packages = forAllSystems (pkgs: (
let
python = pkgs.python3;
attrs = project.renderers.buildPythonPackage {inherit python;};
in {
default = python.pkgs.buildPythonPackage attrs;
}
));
};
}