From 6ab3a2b8262080ccf3c414a0a1f63274c1b54849 Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Thu, 18 Sep 2025 13:11:04 +0000 Subject: [PATCH] feat: use nix-output-monitor for builds Change-Id: tqrsnzyqotlzuxyzmyyvztvzroyxkxso It'd be nice to use nix output monitor for builds - there's a project which automatically uses nix output monitor when nix is called (even supporting nix-direnv/nixos-rebuild)... this looks probably good for us to use. There is [one issue](https://github.com/ners/nix-monitored/issues/3) of some importance on the nix-monitored tracker which suggests that nix-monitored incorrectly transforms some 'nix run' invocations... fortunately, we don't use flakes so this shouldn't be a huge issue If it is, using NIX_MONITOR=disable will temporarily disable nix monitor, allowing you to run whatever you needed without issue while using nom for everything else --- packetmix/npins/sources.json | 13 +++++++++++++ packetmix/systems/common/lix.nix | 24 +++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/packetmix/npins/sources.json b/packetmix/npins/sources.json index effa1768..27b16070 100644 --- a/packetmix/npins/sources.json +++ b/packetmix/npins/sources.json @@ -274,6 +274,19 @@ "url": "https://github.com/nix-community/nix-index-database/archive/050a5feb5d1bb5b6e5fc04a7d3d816923a87c9ea.tar.gz", "hash": "sha256-3HIpe3P2h1AUPYcAH9cjuX0tZOqJpX01c0iDwoUYNZ8=" }, + "nix-monitored": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "ners", + "repo": "nix-monitored" + }, + "branch": "master", + "submodules": false, + "revision": "60f3baa4701d58eab86c2d1d9c3d7e820074d461", + "url": "https://github.com/ners/nix-monitored/archive/60f3baa4701d58eab86c2d1d9c3d7e820074d461.tar.gz", + "hash": "sha256-Z8PknjkmIr/8ZCH+dmc2Pc+UltiOr7/oKg37PXuVvuU=" + }, "nixos-unstable": { "type": "Channel", "name": "nixos-unstable", diff --git a/packetmix/systems/common/lix.nix b/packetmix/systems/common/lix.nix index ba848538..c05b4ca1 100644 --- a/packetmix/systems/common/lix.nix +++ b/packetmix/systems/common/lix.nix @@ -2,7 +2,12 @@ # # SPDX-License-Identifier: MIT -{ project, ... }: +{ + project, + pkgs, + system, + ... +}: { imports = [ (import "${project.inputs.lix-module.result}/module.nix" { lix = project.inputs.lix.src; }) @@ -16,4 +21,21 @@ options = "--delete-older-than 7d"; dates = "08:30"; }; + + nixpkgs.overlays = [ + (final: prev: { + nix-monitored = project.inputs.nix-monitored.result.packages.${system}.default.override { + nix = final.lix; + withNotify = pkgs.stdenv.isLinux; + }; + nixos-rebuild = prev.nixos-rebuild.override { + nix = final.nix-monitored; + }; + nix-direnv = prev.nix-direnv.override { + nix = final.nix-monitored; + }; + }) + ]; + + nix.package = pkgs.nix-monitored; } -- 2.43.0