-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
71 lines (62 loc) · 2.08 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
description = "A library for working with Tahoe-LAFS capability values";
inputs.nixpkgs = {
url = "github:NixOS/nixpkgs?ref=nixos-22.05";
};
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.pypi-deps-db = {
flake = false;
url = "github:DavHau/pypi-deps-db";
};
inputs.mach-nix = {
flake = true;
url = "github:DavHau/mach-nix";
inputs = {
pypi-deps-db.follows = "pypi-deps-db";
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
outputs = { self, nixpkgs, flake-utils, mach-nix, ... }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: let
lib = import ./nix/lib.nix {
inherit system pkgs mach-nix;
};
inherit (lib) checksForVersions packageForVersions devShellForVersions withDefault;
pkgs = nixpkgs.legacyPackages.${system};
# the Python version used by the default package
defaultPythonVersion = "python310";
# the Python versions for which packages are available
supportedPythonVersions = ["python37" "python38" "python39" "python310"];
in rec {
packages =
let
packages = packageForVersions [] supportedPythonVersions;
tests = checksForVersions ["test"] supportedPythonVersions;
in
# Define tests alongside the packages because it's easier to pick
# and choose which to run this way (as compared to making them all
# "checks").
{
wheel = lib.toWheel self.packages.${system}.default;
} // withDefault (packages // tests) defaultPythonVersion;
apps = {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/tahoe";
};
twine = {
type = "app";
program =
let
twine-env = pkgs.python310.withPackages (ps: [ ps.twine ]);
in
"${twine-env}/bin/twine";
};
};
devShells =
withDefault
(devShellForVersions [] supportedPythonVersions)
defaultPythonVersion;
});
}