Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
157 lines (149 loc) · 4.9 KB
/
Copy pathflake.nix
File metadata and controls
157 lines (149 loc) · 4.9 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
{
description = "maintainer-mode - review a nixpkgs pull request, get yours on the list";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
treefmt-nix.url = "github:numtide/treefmt-nix";
iets = {
url = "github:numtide/iets";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
treefmt-nix,
iets,
}:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
forAll = nixpkgs.lib.genAttrs systems;
treefmtFor = system: treefmt-nix.lib.evalModule nixpkgs.legacyPackages.${system} ./treefmt.nix;
in
{
packages = forAll (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
maintainer-mode = pkgs.callPackage ./package.nix {
evaluator = iets.packages.${system}.classic or null;
rev = self.rev or self.dirtyRev or null;
};
in
{
inherit maintainer-mode;
default = maintainer-mode;
}
// nixpkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
ux-audit = pkgs.callPackage ./nix/ux-audit.nix { inherit maintainer-mode; };
}
);
apps = forAll (
system:
nixpkgs.lib.optionalAttrs nixpkgs.legacyPackages.${system}.stdenv.hostPlatform.isLinux {
ux-audit = {
type = "app";
program = nixpkgs.lib.getExe self.packages.${system}.ux-audit;
meta.description = "Screenshot and check every page of Maintainer Mode";
};
}
);
devShells = forAll (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
# the full primer.css, so a new class works before the build trims it
PRIMER_DIR = "${self.packages.${system}.maintainer-mode.primer.override { classes = null; }}";
packages = [
pkgs.cargo
pkgs.rustc
pkgs.clippy
pkgs.rustfmt
pkgs.rust-analyzer
pkgs.pkg-config
pkgs.jq
(treefmtFor system).config.build.wrapper
]
++ nixpkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [
(pkgs.callPackage ./nix/ux-audit.nix { })
];
};
}
);
# the host and the checks run on x86_64-linux; the other systems are
# for the dev shell
checks = nixpkgs.lib.genAttrs [ "x86_64-linux" ] (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
build = self.packages.${system}.maintainer-mode;
}
// nixpkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
vm = import ./nix/test.nix { inherit self pkgs; };
instance =
let
node = nixpkgs.lib.nixosSystem {
modules = [
self.nixosModules.instance
{
nixpkgs.hostPlatform = system;
boot.loader.grub.enable = false;
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
};
system.stateVersion = "26.05";
security.acme.acceptTerms = true;
security.acme.defaults.email = "acme@example.org";
maintainermode = {
enable = true;
githubClientSecretFile = "/run/secrets/client-secret";
botTokenFile = "/run/secrets/bot-token";
githubAppId = 1;
githubAppKeyFile = "/run/secrets/github-app-key";
};
}
];
};
in
pkgs.writeText "instance-eval" (
builtins.unsafeDiscardStringContext node.config.system.build.toplevel.drvPath
);
}
// {
fmt = (treefmtFor system).config.build.check self;
clippy = self.packages.${system}.maintainer-mode.overrideAttrs (old: {
pname = "maintainer-mode-clippy";
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.clippy ];
buildPhase = "cargo clippy --all-targets -- -D warnings";
installPhase = "touch $out";
doCheck = false;
});
}
);
nixosModules.default =
{ lib, pkgs, ... }:
{
imports = [ ./nix/module.nix ];
services.maintainer-mode.package =
lib.mkDefault
self.packages.${pkgs.stdenv.hostPlatform.system}.maintainer-mode;
};
nixosModules.instance = {
imports = [
self.nixosModules.default
./nix/instance.nix
];
};
formatter = forAll (system: (treefmtFor system).config.build.wrapper);
};
}