NixOS must remove all software components after updated versions have been installed.

Severity
Group ID
Group Title
Version
Rule ID
Date
STIG Version
mediumV-268162SRG-OS-000437-GPOS-00194ANIX-00-001680SV-268162r1039374_rule2024-10-251
Description
Previous versions of software components that are not removed from the information system after updates have been installed may be exploited by adversaries. Some information technology products may remove older versions of software automatically from the information system.
ℹ️ Check
Verify NixOS removes all software components after updated versions have been installed by reviewing /etc/nixos/configuration.nix and remove any references to outdated versions of nixpkgs. If any outdated versions of nixpkgs are present in the configuration.nix file, this is a finding.
✔️ Fix
After updating NixOS (either via "cd /etc/nixos; sudo nix flake update; sudo nixos-rebuild switch" or "sudo nixos-rebuild switch –upgrade"), reboot the system to ensure all running software comes from the current active NixOS generation. Edit /etc/nixos/configuration.nix and remove any references to outdated versions of nixpkgs.