-
Notifications
You must be signed in to change notification settings - Fork 20
/
flake.nix
92 lines (89 loc) · 3.31 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
89
90
91
92
{
description = "Cluster account management";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
devenv.url = "github:cachix/devenv";
};
outputs = inputs@{ self, nixpkgs, flake-utils, poetry2nix, devenv }:
flake-utils.lib.eachDefaultSystem (system:
let
p2n = import poetry2nix { inherit pkgs; };
mkPoetryApplication = p2n.mkPoetryApplication;
pkgs = nixpkgs.legacyPackages.${system};
slapd = pkgs.writeShellScriptBin "slapd" ''
exec ${pkgs.openldap}/libexec/slapd "$@"
'';
devShell = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [{
packages = [
pkgs.poetry
pkgs.libffi
slapd
pkgs.openldap
pkgs.libmysqlclient
pkgs.cracklib
pkgs.pkg-config
pkgs.sentry-cli
pkgs.nodejs
pkgs.gcc
];
enterShell = ''
export KARAAGE_CONFIG_FILE=./dev_settings.py
export LD_LIBRARY_PATH="${pkgs.cracklib}/lib:$LD_LIBRARY_PATH"
'';
services.mysql = {
enable = true;
package = pkgs.mariadb;
ensureUsers = [{
name = "karaage";
password = "q1w2e3r4";
ensurePermissions = { "karaage.*" = "ALL PRIVILEGES"; };
}];
initialDatabases = [{ name = "karaage"; }];
};
}];
};
in {
packages = {
devenv-up = devShell.config.procfileScript;
karaage = p2n.mkPoetryApplication {
projectDir = self;
overrides = p2n.overrides.withDefaults (final: prev: {
#nh3 = prev.nh3.override { preferWheel = true; };
furo = prev.furo.override { preferWheel = true; };
cracklib = prev.cracklib.overridePythonAttrs (oldattrs: {
buildInputs = oldattrs.buildInputs
++ [ final.setuptools pkgs.cracklib ];
});
django-filter = prev.django-filter.overridePythonAttrs
(oldattrs: {
buildInputs = oldattrs.buildInputs ++ [ final.flit-core ];
});
django-ajax-selects = prev.django-ajax-selects.overridePythonAttrs
(oldattrs: {
buildInputs = oldattrs.buildInputs
++ [ final.setuptools final.poetry ];
});
python-alogger = prev.python-alogger.overridePythonAttrs
(oldattrs: {
buildInputs = oldattrs.buildInputs ++ [ final.setuptools ];
});
python-tldap = prev.python-tldap.overridePythonAttrs (oldattrs: {
buildInputs = oldattrs.buildInputs ++ [ final.poetry-core ];
});
bump2version = prev.bump2version.overridePythonAttrs (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ [ final.setuptools ];
});
});
};
default = self.packages.${system}.karaage;
};
devShells.default = devShell;
});
}