-
-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathflake.nix
148 lines (130 loc) · 3.88 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
{
description = "Elixir's application";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
inputs.devenv = {
url = "github:cachix/devenv";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
flake-parts,
devenv,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
flake = {};
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
perSystem = {
self',
inputs',
pkgs,
lib,
...
}: {
formatter = pkgs.alejandra;
packages = {
# Expose Devenv supervisor
devenv-up = self'.devShells.default.config.procfileScript;
supavisor = let
erl = pkgs.beam_nox.packages.erlang_27;
in
erl.callPackage ./nix/package.nix {};
default = self'.packages.supavisor;
};
devShells.default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
{
pre-commit.hooks = {
alejandra.enable = true;
typos = {
enable = true;
excludes = [
"test/integration/"
];
};
};
}
{
languages.elixir = {
enable = true;
package = pkgs.beam.packages.erlang_27.elixir_1_18;
};
packages = [
pkgs.lexical
];
pre-commit.hooks = {
mix-format.enable = true;
# credo.enable = true;
};
# env.DYLD_INSERT_LIBRARIES = "${pkgs.mimalloc}/lib/libmimalloc.dylib";
}
{
packages = [
pkgs.pgbouncer
];
services.postgres = {
enable = true;
package = pkgs.postgresql_15;
initialScript = ''
${builtins.readFile ./dev/postgres/00-setup.sql}
CREATE USER postgres SUPERUSER PASSWORD 'postgres';
'';
listen_addresses = "127.0.0.1";
port = 6432;
settings = {
max_prepared_transactions = 262143;
};
};
process.manager.implementation = "honcho";
# Force connection through TCP instead of Unix socket
env.PGHOST = lib.mkForce "";
}
{
languages.javascript = {
enable = true;
bun.enable = true;
yarn.enable = true;
};
}
({
pkgs,
lib,
config,
...
}: {
languages.rust.enable = true;
languages.cplusplus.enable = true;
packages =
[
pkgs.protobuf
pkgs.cargo-outdated
]
++ lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk; [
frameworks.System
frameworks.CoreFoundation
frameworks.CoreServices
frameworks.DiskArbitration
frameworks.IOKit
frameworks.CFNetwork
frameworks.Security
libs.libDER
]);
# Workaround for https://github.com/rust-lang/cargo/issues/5376
env.RUSTFLAGS = lib.mkForce (lib.optionals pkgs.stdenv.isDarwin [
"-L framework=${config.devenv.profile}/Library/Frameworks"
"-C link-arg=-undefined"
"-C link-arg=dynamic_lookup"
]);
})
];
};
};
};
}