-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
114 lines (102 loc) · 2.6 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
{
description = "A little leptos app to track your trash";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix.url = "github:numtide/treefmt-nix";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {
self,
nixpkgs,
flake-parts,
fenix,
crane,
treefmt-nix,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = ["x86_64-linux" "aarch64-linux"];
imports = [
inputs.treefmt-nix.flakeModule
];
perSystem = {
config,
self',
inputs',
pkgs,
system,
lib,
...
}: let
Fenix = fenix.packages.${system};
fenixChannel = "stable";
fenixToolchain = Fenix.combine [
Fenix.targets.wasm32-unknown-unknown.${fenixChannel}.rust-std
Fenix.${fenixChannel}.rust-src
Fenix.${fenixChannel}.cargo
Fenix.${fenixChannel}.rust-analyzer
Fenix.${fenixChannel}.rustfmt
Fenix.${fenixChannel}.clippy
];
craneLib =
crane.lib.${system}.overrideToolchain fenixToolchain;
in {
devShells.default = pkgs.mkShell {
shellHook = ''
export RUST_BACKTRACE=1
'';
nativeBuildInputs = with pkgs; [
# Nix
alejandra
nil
# Node.js
yarn
# Rust
fenixToolchain
];
};
treefmt.config = {
projectRootFile = "flake.nix";
programs = {
prettier.enable = true;
alejandra.enable = true;
rustfmt = {
enable = true;
package = Fenix.${fenixChannel}.rustfmt;
};
leptosfmt.enable = true;
};
};
apps = {
trunk = {
program =
(pkgs.substituteAll
{
inherit (pkgs) trunk;
isExecutable = true;
src = ./scripts/trunk.sh;
})
.outPath;
};
tailwind = {
program =
(pkgs.substituteAll
{
inherit (pkgs.nodePackages) tailwindcss;
isExecutable = true;
src = ./scripts/tailwind.sh;
})
.outPath;
};
};
};
};
}