-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
88 lines (81 loc) · 2.49 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-parts.url = "github:hercules-ci/flake-parts";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
};
outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } (
{ inputs, ... }:
{
systems = [
"x86_64-linux"
"aarch64-linux"
];
perSystem =
{ pkgs, self', ... }:
let
poetry2nix = import inputs.poetry2nix { inherit pkgs; };
overrides = poetry2nix.overrides.withDefaults (
final: prev: {
pygeodesy = prev.pygeodesy.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ final.setuptools ];
});
}
);
devEnv = poetry2nix.mkPoetryEnv {
inherit overrides;
projectDir = ./.;
editablePackageSources = {
mapbuilder = ./.;
};
};
in
{
packages = {
default = poetry2nix.mkPoetryApplication {
inherit overrides;
projectDir = ./.;
checkGroups = [ ];
};
docker = pkgs.dockerTools.buildLayeredImage {
name = "ghcr.io/vatger-nav/mapbuilder";
tag = "latest";
contents = [
pkgs.cacert
pkgs.tzdata
self'.packages.default
];
config = {
Env = [
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
"PYTHONDONTWRITEBYTECODE=1"
"PYTHONUNBUFFERED=1"
];
WorkingDir = "/";
Entrypoint = [ "mapbuilder" ];
};
};
};
devShells.default = devEnv.env.overrideAttrs (attrs: {
nativeBuildInputs = attrs.nativeBuildInputs ++ [
pkgs.poetry
pkgs.pyright
];
shellHook = ''
export PYTHONPATH=${devEnv}/${devEnv.sitePackages}
'';
});
formatter = pkgs.nixfmt-rfc-style;
};
}
);
}