-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
99 lines (90 loc) · 2.61 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
{
description = "My templates for quickly bootstrapping a working environment";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
pre-commit.url = "github:cachix/git-hooks.nix";
treefmt.url = "github:numtide/treefmt-nix";
systems.url = "github:nix-systems/x86_64-linux";
nix-checks = {
url = "github:huuff/nix-checks";
inputs.nixpkgs.follows = "nixpkgs";
};
utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
};
outputs =
{
self,
nixpkgs,
utils,
pre-commit,
nix-checks,
treefmt,
...
}:
{
templates = {
rust = {
path = ./rust;
description = "Rust tools and rust analyzer";
welcomeText = ''
# Rust template
The template has been installed! You can now run `cargo init .` to create your cargo project. Some alternatives are:
* `cargo init . --lib` for a library project.
* `cargo init . --bin` for a binary project.
'';
};
leptos = {
path = ./leptos;
description = "Rust tools, rust analyzer, sass, wasm and leptos tooling";
};
# pretty much a copy-paste of this
nix = {
path = ./nix;
description = "Nix-only (or mostly) projects with nil, nixfmt and statix";
};
latex = {
path = ./latex;
description = "For quickly authoring latex docs";
};
};
}
// utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
treefmt-build = (treefmt.lib.evalModule pkgs ./treefmt.nix).config.build;
pre-commit-check = pre-commit.lib.${system}.run {
src = ./.;
hooks = import ./pre-commit.nix {
inherit pkgs;
treefmt = treefmt-build.wrapper;
};
};
inherit (nix-checks.lib.${system}) checks;
in
{
checks = {
# just check formatting is ok without changing anything
formatting = treefmt-build.check self;
statix = checks.statix ./.;
deadnix = checks.deadnix ./.;
flake-checker = checks.flake-checker ./.;
};
# for `nix fmt`
formatter = treefmt-build.wrapper;
devShells.default = pkgs.mkShell {
inherit (pre-commit-check) shellHook;
buildInputs =
with pkgs;
pre-commit-check.enabledPackages
++ [
nil
nixfmt-rfc-style
];
};
}
);
}