Add nixos-needsreboot

This commit is contained in:
2025-10-31 10:00:14 -04:00
parent e2957c13fe
commit 695d3a9b24
5 changed files with 70 additions and 22 deletions

View File

@@ -84,6 +84,7 @@
nix-tree nix-tree
nixfmt-rfc-style nixfmt-rfc-style
nixpkgs-review nixpkgs-review
nvd
# python # python
poetry poetry

54
flake.lock generated
View File

@@ -445,6 +445,25 @@
"url": "https://flakehub.com/f/DeterminateSystems/nix-src/%2A" "url": "https://flakehub.com/f/DeterminateSystems/nix-src/%2A"
} }
}, },
"nixos-needsreboot": {
"inputs": {
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1747839748,
"narHash": "sha256-WoqPStYVlE+EU2Hm4chd57E8BGvVikCIPa3vnH/N+Qw=",
"owner": "thefossguy",
"repo": "nixos-needsreboot",
"rev": "d0deaf4e1f0a7f5f528ca9f1b96377d2845960cd",
"type": "github"
},
"original": {
"owner": "thefossguy",
"ref": "master",
"repo": "nixos-needsreboot",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1755922037, "lastModified": 1755922037,
@@ -477,11 +496,11 @@
}, },
"nixpkgs-master": { "nixpkgs-master": {
"locked": { "locked": {
"lastModified": 1761874065, "lastModified": 1761917136,
"narHash": "sha256-NmiCO/7hKv3TVIXXtEAkpGHiJzQc/5z8PT8tO+SKPZA=", "narHash": "sha256-GgKFqLCo51RigP4lvI6/WEex59OTGHhKGg/qLOxPU6I=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b976292fb39a449bcf410219e4cf0aa05a8b4d04", "rev": "312a22c734c18ba4575a5bf5ff7a694f6eaaac2a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -554,6 +573,20 @@
} }
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": {
"lastModified": 1712867921,
"narHash": "sha256-edTFV4KldkCMdViC/rmpJa7oLIU8SE/S35lh/ukC7bg=",
"rev": "51651a540816273b67bc4dedea2d37d116c5f7fe",
"revCount": 557634,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.557634%2Brev-51651a540816273b67bc4dedea2d37d116c5f7fe/018ed69f-a175-7ab0-bc05-651225022c5a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/%2A.tar.gz"
}
},
"nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1761597516, "lastModified": 1761597516,
"narHash": "sha256-wxX7u6D2rpkJLWkZ2E932SIvDJW8+ON/0Yy8+a5vsDU=", "narHash": "sha256-wxX7u6D2rpkJLWkZ2E932SIvDJW8+ON/0Yy8+a5vsDU=",
@@ -569,7 +602,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_5": { "nixpkgs_6": {
"locked": { "locked": {
"lastModified": 1759070547, "lastModified": 1759070547,
"narHash": "sha256-JVZl8NaVRYb0+381nl7LvPE+A774/dRpif01FKLrYFQ=", "narHash": "sha256-JVZl8NaVRYb0+381nl7LvPE+A774/dRpif01FKLrYFQ=",
@@ -585,7 +618,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_6": { "nixpkgs_7": {
"locked": { "locked": {
"lastModified": 1751211869, "lastModified": 1751211869,
"narHash": "sha256-1Cu92i1KSPbhPCKxoiVG5qnoRiKTgR5CcGSRyLpOd7Y=", "narHash": "sha256-1Cu92i1KSPbhPCKxoiVG5qnoRiKTgR5CcGSRyLpOd7Y=",
@@ -601,7 +634,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_7": { "nixpkgs_8": {
"locked": { "locked": {
"lastModified": 1743814133, "lastModified": 1743814133,
"narHash": "sha256-drDyYyUmjeYGiHmwB9eOPTQRjmrq3Yz26knwmMPLZFk=", "narHash": "sha256-drDyYyUmjeYGiHmwB9eOPTQRjmrq3Yz26knwmMPLZFk=",
@@ -694,7 +727,7 @@
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
"gitignore": "gitignore", "gitignore": "gitignore",
"nixpkgs": "nixpkgs_5" "nixpkgs": "nixpkgs_6"
}, },
"locked": { "locked": {
"lastModified": 1760663237, "lastModified": 1760663237,
@@ -715,7 +748,8 @@
"darwin": "darwin", "darwin": "darwin",
"determinate": "determinate", "determinate": "determinate",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs_4", "nixos-needsreboot": "nixos-needsreboot",
"nixpkgs": "nixpkgs_5",
"nixpkgs-master": "nixpkgs-master", "nixpkgs-master": "nixpkgs-master",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"nixvim": "nixvim", "nixvim": "nixvim",
@@ -733,7 +767,7 @@
"firefox-gnome-theme": "firefox-gnome-theme", "firefox-gnome-theme": "firefox-gnome-theme",
"flake-parts": "flake-parts_3", "flake-parts": "flake-parts_3",
"gnome-shell": "gnome-shell", "gnome-shell": "gnome-shell",
"nixpkgs": "nixpkgs_6", "nixpkgs": "nixpkgs_7",
"nur": "nur", "nur": "nur",
"systems": "systems_3", "systems": "systems_3",
"tinted-foot": "tinted-foot", "tinted-foot": "tinted-foot",
@@ -923,7 +957,7 @@
"vpngate": { "vpngate": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_7" "nixpkgs": "nixpkgs_8"
}, },
"locked": { "locked": {
"lastModified": 1753748785, "lastModified": 1753748785,

View File

@@ -6,6 +6,7 @@
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-master.url = "github:NixOS/nixpkgs/master"; nixpkgs-master.url = "github:NixOS/nixpkgs/master";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
nixos-needsreboot.url = "github:thefossguy/nixos-needsreboot/master";
pre-commit-hooks.url = "github:cachix/git-hooks.nix"; pre-commit-hooks.url = "github:cachix/git-hooks.nix";
darwin = { darwin = {
url = "github:lnl7/nix-darwin/nix-darwin-25.05"; url = "github:lnl7/nix-darwin/nix-darwin-25.05";
@@ -31,6 +32,7 @@
nixpkgs-master, nixpkgs-master,
stylix, stylix,
vpngate, vpngate,
nixos-needsreboot,
... ...
}@inputs: }@inputs:
let let
@@ -75,11 +77,11 @@
inherit unstable; inherit unstable;
inherit master; inherit master;
inherit vpngate; inherit vpngate;
inherit inputs;
}; };
modules = [ modules = [
./hosts/hephaestus.nix ./hosts/hephaestus.nix
./common-packages.nix ./common-packages.nix
./upgrade-diff.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
stylix.nixosModules.stylix stylix.nixosModules.stylix
( (
@@ -154,8 +156,6 @@
stylix.darwinModules.stylix stylix.darwinModules.stylix
./hosts/zelus.nix ./hosts/zelus.nix
./common-packages.nix ./common-packages.nix
./upgrade-diff.nix
( (
{ ... }: { ... }:
{ {

View File

@@ -1,6 +1,7 @@
{ {
config, config,
lib, lib,
inputs,
master, master,
modulesPath, modulesPath,
pkgs, pkgs,
@@ -131,6 +132,7 @@
whois whois
wine wine
wl-clipboard wl-clipboard
inputs.nixos-needsreboot.packages.${pkgs.system}.default
]; ];
@@ -239,6 +241,26 @@
system = { system = {
autoUpgrade.enable = true; autoUpgrade.enable = true;
stateVersion = "25.05"; stateVersion = "25.05";
activationScripts = {
diff = {
supportsDryActivation = true;
text = ''
if [[ -e /run/current-system ]]; then
echo -e "\e[36mPackage version diffs:\e[0m"
${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig"
fi
'';
};
needsreboot = {
supportsDryActivation = true;
text = ''
if [[ -e /run/current-system ]]; then
echo -e "\e[36mSystem changes requiring a reboot:\e[0m"
${inputs.nixos-needsreboot.packages.${pkgs.system}.default}/bin/nixos-needsreboot --dry-run
fi
'';
};
};
}; };
nix = { nix = {

View File

@@ -1,9 +0,0 @@
{ pkgs, ... }:
{
system.activationScripts.diff = {
supportsDryActivation = true;
text = ''
${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig"
'';
};
}