Skip to content

Commit a5bb2d7

Browse files
blocky: build time config checking, finalAttrs, add kuflierl as maintainer (#480908)
2 parents 8dbbe5f + f92ea7c commit a5bb2d7

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

nixos/modules/services/networking/blocky.nix

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ in
1616

1717
package = lib.mkPackageOption pkgs "blocky" { };
1818

19+
enableConfigCheck = lib.mkEnableOption "checking the config during build time" // {
20+
default = true;
21+
};
22+
1923
settings = lib.mkOption {
2024
type = format.type;
2125
default = { };
@@ -80,6 +84,14 @@ in
8084
];
8185
};
8286
};
87+
system.checks = lib.mkIf cfg.enableConfigCheck [
88+
(pkgs.runCommand "check-blocky-config" { } ''
89+
${lib.getExe cfg.package} --config ${configFile} validate && touch $out
90+
'')
91+
];
8392
};
84-
meta.maintainers = with lib.maintainers; [ paepcke ];
93+
meta.maintainers = with lib.maintainers; [
94+
paepcke
95+
kuflierl
96+
];
8597
}

nixos/tests/blocky.nix

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@
1515
"printer.lan" = "192.168.178.3,2001:0db8:85a3:08d3:1319:8a2e:0370:7344";
1616
};
1717
};
18-
upstream = {
18+
upstreams.groups = {
1919
default = [
2020
"8.8.8.8"
2121
"1.1.1.1"
2222
];
2323
};
24-
port = 53;
25-
httpPort = 5000;
26-
logLevel = "info";
24+
ports = {
25+
dns = 53;
26+
http = 5000;
27+
};
28+
log.level = "info";
2729
};
2830
};
2931
};

pkgs/by-name/bl/blocky/package.nix

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
nixosTests,
66
}:
77

8-
buildGoModule rec {
8+
buildGoModule (finalAttrs: {
99
pname = "blocky";
1010
version = "0.28.2";
1111

1212
src = fetchFromGitHub {
1313
owner = "0xERR0R";
1414
repo = "blocky";
15-
rev = "v${version}";
15+
rev = "v${finalAttrs.version}";
1616
hash = "sha256-GLVyPb2Qyn1jnRz+e74dFzL/AMloKqSe1BUUAGTquWA=";
1717
};
1818

@@ -25,7 +25,7 @@ buildGoModule rec {
2525
ldflags = [
2626
"-s"
2727
"-w"
28-
"-X github.com/0xERR0R/blocky/util.Version=${version}"
28+
"-X github.com/0xERR0R/blocky/util.Version=${finalAttrs.version}"
2929
];
3030

3131
passthru.tests = { inherit (nixosTests) blocky; };
@@ -35,7 +35,10 @@ buildGoModule rec {
3535
homepage = "https://0xerr0r.github.io/blocky";
3636
changelog = "https://github.com/0xERR0R/blocky/releases";
3737
license = lib.licenses.asl20;
38-
maintainers = with lib.maintainers; [ ratsclub ];
38+
maintainers = with lib.maintainers; [
39+
ratsclub
40+
kuflierl
41+
];
3942
mainProgram = "blocky";
4043
};
41-
}
44+
})

0 commit comments

Comments
 (0)