From 82bf8ab05ff9cacd698161ac3bd49db6eafed88e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 1 Jun 2024 01:12:39 +0200 Subject: [PATCH] core: wrap nix with wrapped commands --- nix-os/core.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index 273753f..8ab04d8 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -23,10 +23,17 @@ let } ); - wrapedNixPrograms = [ - (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-build"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar-with-logs"];}) + # bool -> nixpkgs[] + wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; [ + (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-build"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar${lib.optionalString inEnvironment "-with-logs"}"];}) (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-shell"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];}) ]; + wrappedNix = (pkgs.buildEnv { + name = "wrappedNix-${pkgs.nix.version}"; + paths = [ pkgs.nix ] ++ wrappedNixExecutables false; + }).overrideAttrs { + version = pkgs.nix.version; + }; in { # kernel @@ -37,6 +44,7 @@ in # Allow unfree packages nixpkgs.config.allowUnfree = true; + nix.package = wrappedNix; # List packages installed in system profile. To search, run: # $ nix search wget @@ -49,7 +57,7 @@ in fastfetch smartmontools ddrescue - ] ++ wrapedNixPrograms; + ] ++ wrappedNixExecutables true; programs.git.enable = true; programs.git.config = {