-
Notifications
You must be signed in to change notification settings - Fork 7
/
flake.nix
55 lines (54 loc) · 1.59 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
{
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-23.11;
flake-utils.url = github:numtide/flake-utils;
poetry2nix.url = github:nix-community/poetry2nix;
poetry2nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, poetry2nix, ... }@attrs: flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: let
inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication mkPoetryEnv;
pkgs = nixpkgs.legacyPackages.${system};
add-setuptools = super: name: {
${name} = super.${name}.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ];
}
);
};
in let
common = {
projectDir = ./.;
python = pkgs.python312;
overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend
(self: super:
(add-setuptools super "martor")
// (add-setuptools super "alt-profanity-check")
);
preferWheels = true;
editablePackageSources = {
metropolis = ./.;
};
};
in {
devShells.default = (mkPoetryEnv common).env.overrideAttrs (prev: {
buildInputs = with pkgs; [
python312
poetry
openssl
black
isort
mypy
act
];
});
apps.default.type = "app";
apps.default.program = "" + pkgs.writeShellScript "run.sh" ''
set -eux
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
#docker run -d -p 5672:5672 rabbitmq &
./manage.py runserver &
celery -A metropolis worker -B --loglevel=DEBUG &
wait
'';
});
}