-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
52 lines (49 loc) · 1.43 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
{
description = "A Python development environment with poetry";
inputs = {
nixpkgs.url = "nixpkgs";
};
outputs = { nixpkgs, ... }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
eachSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f rec {
inherit system;
pkgs = import nixpkgs { inherit system; };
python = pkgs.python3; # use pkgs.python3.withPackages (p: []) if you need more python packages in nixpkgs
});
in
{
packages = eachSystem ({pkgs, ...}: {
easy-sync = let
pyproject = pkgs.lib.importTOML ./pyproject.toml;
meta = pyproject.tool.poetry;
in
pkgs.python3Packages.buildPythonPackage {
pname = meta.name;
version = meta.version;
pyproject = true;
src = ./.;
buildInputs = [ pkgs.python3Packages.poetry-core ];
doCheck = true;
meta = with pkgs.lib; {
description = meta.description;
homepage = meta.repository;
license = licenses.asl20;
maintainers = with maintainers; [ luochen1990 ];
};
};
});
devShells = eachSystem ({pkgs, python, ...}: rec {
default = poetry;
poetry = pkgs.mkShell {
buildInputs = [
python
pkgs.poetry
];
shellHook = ''
export PATH=$(poetry env info --path)/bin:$PATH
'';
};
});
};
}