2025-01-24 10:20:27 +01:00
|
|
|
# See NixOS.md -> List installed packages
|
|
|
|
|
2025-01-22 17:40:49 +01:00
|
|
|
# Sources:
|
|
|
|
# https://www.reddit.com/r/NixOS/comments/fsummx/comment/fm45htj/
|
|
|
|
# https://www.reddit.com/r/NixOS/comments/fsummx/comment/kt9fb74/
|
|
|
|
# https://discourse.nixos.org/t/better-why-depends-fill-in-the-gaps/31246/10
|
|
|
|
|
|
|
|
# This creates /etc/current-system-packages with list of all packages and their versions.
|
|
|
|
|
|
|
|
{ lib, config, options, pkgs, ... }:
|
|
|
|
{
|
|
|
|
environment.etc."system-packages-with-source-v1".text =
|
|
|
|
builtins.concatStringsSep "\n\n" (
|
|
|
|
map
|
|
|
|
(x: x.file + "\n" +
|
|
|
|
builtins.concatStringsSep "\n" (map (s: " " + s) x.value)
|
|
|
|
)
|
|
|
|
options.environment.systemPackages.definitionsWithLocations
|
|
|
|
);
|
|
|
|
|
|
|
|
environment.etc."current-system-packages-v2".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;
|
|
|
|
}
|