From a8584b2f23342bf24f73005ac7dade8298e00246 Mon Sep 17 00:00:00 2001 From: cswimr Date: Tue, 28 Jan 2025 07:18:34 -0600 Subject: [PATCH] add `/etc/current-system-packages` to vms --- hosts/virtual-machines/template.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hosts/virtual-machines/template.nix b/hosts/virtual-machines/template.nix index 5fb2332..deeca02 100644 --- a/hosts/virtual-machines/template.nix +++ b/hosts/virtual-machines/template.nix @@ -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"; }