Skip to content

Commit

Permalink
add shared update-diff (#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
zowoq authored Oct 5, 2024
1 parent 5db64ee commit 168679c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 5 deletions.
1 change: 1 addition & 0 deletions darwin/common/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
./flake.nix
./nix.nix
./openssh.nix
./update-diff.nix
];

# It's the default login shell, and if not enabled, a lot of important configuration is not applied correctly
Expand Down
12 changes: 12 additions & 0 deletions darwin/common/update-diff.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ config, lib, ... }:
{
imports = [
../../shared/common/update-diff.nix
];

config = lib.mkIf config.srvos.update-diff.enable {
system.activationScripts.preActivation = {
inherit (config.srvos.update-diff) text;
};
};
}
2 changes: 1 addition & 1 deletion nixos/common/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
./openssh.nix
./serial.nix
./sudo.nix
./upgrade-diff.nix
./update-diff.nix
./well-known-hosts.nix
./zfs.nix
];
Expand Down
13 changes: 13 additions & 0 deletions nixos/common/update-diff.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ config, lib, ... }:
{
imports = [
../../shared/common/update-diff.nix
];

config = lib.mkIf config.srvos.update-diff.enable {
system.activationScripts.update-diff = {
supportsDryActivation = true;
inherit (config.srvos.update-diff) text;
};
};
}
10 changes: 6 additions & 4 deletions nixos/common/upgrade-diff.nix → shared/common/update-diff.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
}:
{
options.srvos.update-diff = {
enable = lib.mkEnableOption "show package diff when updating nixos" // {
enable = lib.mkEnableOption "show package diff when updating" // {
default = true;
};
text = lib.mkOption {
type = lib.types.str;
};
};
config = lib.mkIf config.srvos.update-diff.enable {
system.activationScripts.update-diff = {
supportsDryActivation = true;
config = {
srvos.update-diff = {
text = ''
if [[ -e /run/current-system ]]; then
echo "--- diff to current-system"
Expand Down

0 comments on commit 168679c

Please sign in to comment.