This commit is contained in:
2025-11-07 16:45:29 +01:00
parent 88ebd62867
commit 8ac1645121
6 changed files with 56 additions and 13 deletions

View File

@@ -64,7 +64,7 @@
my $v = shift;
return '--version' if $v eq '-V' || $v eq '--version';
return '-s' if $v eq '-s' || $v eq '--show-stats';
return '--show-adv-stats' if $v eq '--show-adv-stats';
return '--show-adv-stats' if $v eq '--show-adv-stats';
return '-z' if $v eq '-z' || $v eq '--zero-stats';
exec('${lib.getExe pkgs.sccache}', '-h');
}

View File

@@ -1,14 +1,31 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
# dix: https://github.com/faukah/dix
# rust based
# module from https://github.com/getchoo/borealis/blob/a35749aa6280fbe4cbe72291bb9c4cc643780c76/modules/nixos/custom/activation-diff.nix
# nvd: https://discourse.nixos.org/t/nvd-simple-nix-nixos-version-diff-tool/12397
# python based
# module from https://github.com/luishfonseca/dotfiles/blob/ab7625ec406b48493eda701911ad1cd017ce5bc1/modules/upgrade-diff.nix
# gated on formatAttr which is set by nixos-generators
system.activationScripts.diff = lib.mkIf ((config.formatAttr or null) == null) {
system.activationScripts.show-nixos-closure-diff = lib.mkIf ((config.formatAttr or null) == null) {
supportsDryActivation = true;
text = ''
${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig"
'';
text =
if pkgs ? dix then
''
${pkgs.dix}/bin/dix /run/current-system "$systemConfig"
''
else
''
${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig"
'';
};
}