add upgrade-diff

This commit is contained in:
Ingolf Wagner 2023-08-17 13:40:42 +02:00
parent 3f55aba94b
commit 7ab2734f3b
Signed by: palo
GPG key ID: 76BF5F1928B9618B
4 changed files with 36 additions and 2 deletions

View file

@ -119,7 +119,6 @@
config.allowUnfree = true;
config.permittedInsecurePackages = [
"python-2.7.18.6"
# "openssl-1.1.1u"
];
overlays = [
@ -141,7 +140,6 @@
landingpage = landingpage.packages.${system}.plain;
trilium-server = nixpkgs-unstable.legacyPackages.${system}.trilium-server;
kmonad = kmonad.packages.${system}.kmonad;
#deploy-rs = deploy-rs.packages.${system}.deploy-rs;
})
(import ./nixos/pkgs)
];
@ -153,6 +151,7 @@
};
# todo : why redefine it?
# Mic92 means, is not needed anymore
nixosSystem = args:
(lib.makeOverridable lib.nixosSystem)
(lib.recursiveUpdate args {

View file

@ -5,5 +5,6 @@
./media
./network
./terminal
./nixos
];
}

View file

@ -0,0 +1,12 @@
{ config, lib, ... }:
{
imports = [ ./upgrade-diff.nix ];
options.components.nixos.enable = lib.mkOption {
type = lib.types.bool;
default = true;
};
config = lib.mkIf (config.components.nixos.enable) { };
}

View file

@ -0,0 +1,22 @@
# MIT Jörg Thalheim - https://github.com/Mic92/dotfiles/blob/c6cad4e57016945c4816c8ec6f0a94daaa0c3203/nixos/modules/upgrade-diff.nix
{ config, lib, ... }:
{
options.components.nixos.update-diff.enable = lib.mkOption {
type = lib.types.bool;
default = config.components.nixos.enable;
};
config = lib.mkIf (config.components.nixos.update-diff.enable) {
system.activationScripts.diff = {
supportsDryActivation = true;
text = ''
if [[ -e /run/current-system ]]; then
echo "--- diff to current-system"
${config.nix.package}/bin/nix --extra-experimental-features nix-command store diff-closures /run/current-system "$systemConfig"
echo "---"
fi
'';
};
};
}