add /etc/current-system-packages to vms

This commit is contained in:
cswimr 2025-01-28 07:18:34 -06:00
parent 0721f6edfa
commit a8584b2f23
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087

View file

@ -1,7 +1,7 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ pkgs, config, ... }:
{
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
@ -21,5 +21,14 @@
services.qemuGuest.enable = true;
# Add /etc/current-system-packages
environment.etc."current-system-packages".text =
let
packages = builtins.map (p: "${p.name}") config.environment.systemPackages;
sortedUnique = builtins.sort builtins.lessThan (pkgs.lib.lists.unique packages);
formatted = builtins.concatStringsSep "\n" sortedUnique;
in
formatted;
system.stateVersion = "24.11";
}