From ac66ed6530f2d0b96003e2f980065c12b8599494 Mon Sep 17 00:00:00 2001 From: reo101 Date: Mon, 25 Dec 2023 18:49:26 +0200 Subject: [PATCH] feat(nix): use `nix-monitored` Automatically pipes all nix output through `nix-output-monitor` Deprecates the manual pipe in the `rebuild` script --- flake.nix | 5 +++++ modules/home-manager/reo101-shell/default.nix | 2 +- overlays/default.nix | 10 ++++++++++ util/default.nix | 18 ++++++++++++++++-- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index a7241db..85b5d19 100644 --- a/flake.nix +++ b/flake.nix @@ -36,6 +36,10 @@ flake = false; }; + nix-monitored = { + url = "github:ners/nix-monitored"; + }; + disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; @@ -110,6 +114,7 @@ , nix-darwin , mac-app-util , home-manager + , nix-monitored , disko , deploy-rs , agenix diff --git a/modules/home-manager/reo101-shell/default.nix b/modules/home-manager/reo101-shell/default.nix index ca31b61..fa25d22 100644 --- a/modules/home-manager/reo101-shell/default.nix +++ b/modules/home-manager/reo101-shell/default.nix @@ -33,7 +33,7 @@ let if cfg.hostname != null then "${cfg.flakePath}#${cfg.hostname}" else "${cfg.flakePath}" - } ''$''\{1:-switch''\} "''$''\{@:2''\}" |& nix run nixpkgs#nix-output-monitor + } ''$''\{1:-switch''\} "''$''\{@:2''\}" # |& nix run nixpkgs#nix-output-monitor ''; in "${rebuild_script}"; diff --git a/overlays/default.nix b/overlays/default.nix index fd559b6..d9981d4 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -30,6 +30,16 @@ }; }; + nix = inputs.nix-monitored.packages.${final.system}.default.override { + nix = prev.nix; + nix-output-monitor = prev.nix-output-monitor; + }; + + nixUnstable = inputs.nix-monitored.packages.${final.system}.default.override { + nix = prev.nixUnstable; + nix-output-monitor = prev.nix-output-monitor; + }; + himalaya = prev.himalaya.overrideAttrs (oldAttrs: rec { buildInputs = (prev.buildInputs or [ ]) ++ diff --git a/util/default.nix b/util/default.nix index 185f982..9c43917 100644 --- a/util/default.nix +++ b/util/default.nix @@ -118,6 +118,9 @@ rec { modules = [ (lib.path.append root "configuration.nix") inputs.home-manager.nixosModules.home-manager + { + nixpkgs.overlays = builtins.attrValues outputs.overlays; + } { home-manager = { useGlobalPkgs = false; @@ -154,6 +157,9 @@ rec { modules = [ (lib.path.append root "configuration.nix") { nix.registry.nixpkgs.flake = nixpkgs; } + { + nixpkgs.overlays = builtins.attrValues outputs.overlays; + } { home-manager = { config = (lib.path.append root "home.nix"); @@ -183,6 +189,12 @@ rec { modules = [ (lib.path.append root "configuration.nix") + { + nixpkgs.hostPlatform = system; + } + { + nixpkgs.overlays = builtins.attrValues outputs.overlays; + } inputs.home-manager.darwinModules.home-manager { home-manager = { @@ -200,9 +212,8 @@ rec { } ] ++ (builtins.attrValues nixDarwinModules); - inputs = { + specialArgs = { inherit inputs outputs; - inherit nixpkgs; }; }; @@ -211,6 +222,9 @@ rec { modules = [ (lib.path.append root "home.nix") + { + nixpkgs.overlays = builtins.attrValues outputs.overlays; + } ] ++ (builtins.attrValues homeManagerModules); extraSpecialArgs = {