Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
108 lines (91 loc) · 2.41 KB
/
Copy pathflake.nix
File metadata and controls
108 lines (91 loc) · 2.41 KB
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
{
description = "Basic Flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
pre-commit-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nix2container = {
url = "github:nlewo/nix2container";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
pre-commit-hooks,
nix2container,
rust-overlay,
...
}: let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSystem = nixpkgs.lib.genAttrs systems;
createSpace = system: let
pkgs = import nixpkgs {
inherit system;
config = {};
};
imageBuilder = import ./images/builder.nix {
inherit
nixpkgs
nix2container
rust-overlay
system
;
};
config = {
pre-commit = pre-commit-hooks.lib.${system}.run {
src = self;
hooks = import ./tools/pre-commit.nix {inherit pkgs;};
};
};
in {
checks.pre-commit = config.pre-commit;
formatter = pkgs.alejandra;
devShells.default = pkgs.mkShell {
packages = with pkgs; [
# Development tooling
git
tokei
ripgrep
gh
pre-commit
# Web tooling
bun
];
shellHook = ''
# Generate the .pre-commit-config.yaml symlink when entering the dev shell
${config.pre-commit.shellHook}
echo "Welcome to root dev shell on ${system}!"
'';
};
packages = {
document = import ./packages/document/package.nix {inherit pkgs;};
};
legacyPackages = {
image = {
document = imageBuilder.build {
package = ./packages/document/package.nix;
image = ./images/document.nix;
};
};
};
};
in {
devShells = forEachSystem (system: (createSpace system).devShells);
formatter = forEachSystem (system: (createSpace system).formatter);
checks = forEachSystem (system: (createSpace system).checks);
packages = forEachSystem (system: (createSpace system).packages);
legacyPackages = forEachSystem (system: (createSpace system).legacyPackages);
};
}