From 4433c993fae86634b813ee212803a84aaeedd374 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 15 Aug 2025 03:27:54 +0900 Subject: nix: check config via hakurei This is unfortunately the only feasible way of doing this in nix. Signed-off-by: Ophestra --- nixos.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'nixos.nix') diff --git a/nixos.nix b/nixos.nix index 90ce28b1..5d051438 100644 --- a/nixos.nix +++ b/nixos.nix @@ -204,11 +204,20 @@ in ] ); }; - }; + + checkedConfig = + name: value: + let + file = pkgs.writeText name (builtins.toJSON value); + in + pkgs.runCommand "checked-${name}" { nativeBuildInputs = [ cfg.package ]; } '' + ln -vs ${file} "$out" + hakurei show ${file} + ''; in pkgs.writeShellScriptBin app.name '' - exec hakurei${if app.verbose then " -v" else ""} app ${pkgs.writeText "hakurei-app-${app.name}.json" (builtins.toJSON conf)} $@ + exec hakurei${if app.verbose then " -v" else ""} app ${checkedConfig "hakurei-app-${app.name}.json" conf} $@ '' ) ] -- cgit v1.3.1