-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
89 lines (81 loc) · 2.35 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
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
treefmt-nix.url = "github:numtide/treefmt-nix";
poetry2nix.url = "github:bchmnn/poetry2nix";
naersk.url = "github:nix-community/naersk";
};
outputs = {
systems,
nixpkgs,
treefmt-nix,
poetry2nix,
naersk,
...
}: let
# Small tool to iterate over each systems
eachSystem = f:
nixpkgs.lib.genAttrs (import systems) (system:
f (import nixpkgs {
inherit system;
}));
treefmtEval = eachSystem (pkgs:
treefmt-nix.lib.evalModule pkgs ({...}: {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
rustfmt.enable = true;
deadnix.enable = true;
mix-format.enable = true;
};
settings.formatter.alejandra.excludes = ["2configs/vscode/extensions.nix"];
}));
naersk' = eachSystem (pkgs: pkgs.callPackage naersk {});
in {
devShells = eachSystem (pkgs: let
inherit (poetry2nix.lib.mkPoetry2Nix {inherit pkgs;}) mkPoetryEnv;
sqlx-cli = naersk'.${pkgs.system}.buildPackage rec {
pname = "sqlx-cli";
version = "0.7.3";
src = pkgs.fetchCrate {
inherit pname version;
sha256 = "sha256-QC1FjBTcbRrWBp12/9CVJ/9L3YMIOAG7k1XqagPv7XQ=";
};
buildInputs = [pkgs.openssl];
nativeBuildInputs = [pkgs.pkg-config];
# TODO: find better way to force sqlite
#cargoBuildOptions = s: ["--features" "sqlite"] ++ s;
};
in {
default = pkgs.mkShell {
packages = [
pkgs.docker-compose_1
pkgs.elixir_1_16
pkgs.cargo
pkgs.clippy
pkgs.rust-analyzer
pkgs.rustfmt
sqlx-cli
pkgs.netcat
pkgs.curl
(mkPoetryEnv {
projectDir = ./checker;
preferWheels = true;
})
pkgs.poetry
pkgs.openssl
pkgs.php83Packages.composer
pkgs.php83
pkgs.graphviz
];
shellHook = ''
export PROFILE=debug
alias cw="cargo watch -w build.rs -w src -w templates -w assets -x \"run\""
PS1="DEVELOP $PS1"
'';
};
});
formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
};
}