Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
122 lines (114 loc) · 3.49 KB
/
Copy pathflake.nix
File metadata and controls
122 lines (114 loc) · 3.49 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{
inputs = {
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts.url = "github:hercules-ci/flake-parts";
nci = {
url = "github:90-008/nix-cargo-integration";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.devshell.flakeModule
inputs.flake-parts.flakeModules.easyOverlay
inputs.nci.flakeModule
inputs.pre-commit-hooks.flakeModule
inputs.treefmt-nix.flakeModule
];
flake.flakeModules.default = import ./flake-module.nix { inherit (inputs) self; };
systems = [
"x86_64-linux"
"aarch64-linux"
];
perSystem =
{
config,
pkgs,
...
}:
let
projectName = "gfty";
in
{
devshells.default = {
packages = [
config.treefmt.build.wrapper
pkgs.esbuild
pkgs.live-server
pkgs.rust-analyzer
];
commands = [
{
name = "designer-dev";
help = "serve the Gridfinity Ultimate designer with live reload";
command = ''exec live-server --port 8080 "$PRJ_ROOT/designer"'';
}
{
name = "designer-preview";
help = "build and serve the production designer";
command = ''
nix build "$PRJ_ROOT#designer"
exec live-server --port 8081 "$PRJ_ROOT/result"
'';
}
];
devshell.startup.pre-commit.text = config.pre-commit.installationScript;
env = [
{
name = "RUST_SRC_PATH";
value = "${pkgs.rustPlatform.rustLibSrc}";
}
{
name = "GFTY_FONT_DIRS";
value = "${pkgs.dejavu_fonts}:${pkgs.liberation_ttf}:${pkgs.jetbrains-mono}";
}
];
};
pre-commit.settings.hooks.treefmt.enable = true;
treefmt = {
projectRootFile = "flake.nix";
programs = {
deadnix.enable = true;
statix.enable = true;
nixfmt.enable = true;
rustfmt.enable = true;
};
};
nci.projects.${projectName} = {
path = ./.;
numtideDevshell = "default";
};
checks.bin-designer-conformance =
pkgs.runCommand "bin-designer-conformance"
{
nativeBuildInputs = [ pkgs.nodejs ];
}
''
node ${./tests/bin-designer-conformance.js} \
${./designer/logic.js} \
${./designer/config-codec.js} \
${./tests/fixtures/bin/default.json}
touch "$out"
'';
packages = {
default = pkgs.callPackage ./package.nix { };
designer = pkgs.callPackage ./designer/package.nix { };
};
overlayAttrs.gfty = config.packages.default;
};
};
}