-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
118 lines (105 loc) · 3.29 KB
/
Copy pathflake.nix
File metadata and controls
118 lines (105 loc) · 3.29 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
{
description = "nxbd - NixOS Build and Deploy Tool";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
mkdocs-flake.url = "github:applicative-systems/mkdocs-flake";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
imports = [
inputs.mkdocs-flake.flakeModules.default
];
perSystem =
{
config,
lib,
pkgs,
system,
...
}:
let
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs = {
deadnix.enable = true;
# disabled for now because mkdocs wants 4 spaces indent for
# multi level bullet point lists, but mdformat doesn't allow it.
mdformat.enable = false;
nixfmt.enable = true;
rustfmt.enable = true;
shfmt.enable = true;
statix.enable = true;
taplo.enable = true;
};
};
in
{
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.self.overlays.default
];
config = { };
};
packages = {
inherit (pkgs) nxbd;
default = config.packages.nxbd;
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
pkgs.cargo
pkgs.cargo-edit
pkgs.cargo-watch
pkgs.clippy
pkgs.rustc
treefmtEval.config.build.wrapper
];
RUST_SRC_PATH = pkgs.rust.packages.stable.rustPlatform.rustLibSrc;
RUST_BACKTRACE = 1;
};
documentation.mkdocs-root = pkgs.runCommand "documentation-root" { } ''
mkdir $out
cp -r ${./documentation}/* "$out"
chmod -R 777 "$out"/*
${pkgs.nxbd}/bin/nxbd generate-docs "$out/docs"
'';
formatter = treefmtEval.config.build.wrapper;
checks =
config.packages
// lib.optionalAttrs (pkgs.stdenv.isx86_64 && pkgs.stdenv.isLinux) {
# Should run on all CPUs, but first we need to make the system
# attribute inside the config a bit more dynamic.
switch-local = pkgs.testers.runNixOSTest ./tests/switch-local.nix;
switch-remote = pkgs.testers.runNixOSTest ./tests/switch-remote.nix;
}
// {
formatting = treefmtEval.config.build.check inputs.self;
};
apps.watch-documentation = lib.mkForce {
type = "app";
program = "";
};
};
flake = {
overlays.default = import ./overlay.nix;
};
};
nixConfig = {
extra-substituters = [
"https://appsys.cachix.org"
];
extra-trusted-public-keys = [
"appsys.cachix.org-1:VoZof6Mp3Aqlj3tQ21wFdxW0lhHTzAu/5q04LYUtXM8="
];
};
}