mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 00:43:20 +00:00
nixos/systemd-lib: don't fail on systemd.packages duplicates
In some cases like we've noticed in https://github.com/NixOS/nixpkgs/issues/76169, having duplicate packages in systemd.packages like ``` systemd.packages = [ gnome-shell gnome-shell gnome-session ]; ``` breaks. Here we use an associative array to ensure no duplicate paths when we symlink all the units listed in systemd.packages.
This commit is contained in:
parent
ffe6b959a1
commit
1c2e27e4d5
@ -147,7 +147,13 @@ in rec {
|
||||
done
|
||||
|
||||
# Symlink all units provided listed in systemd.packages.
|
||||
for i in ${toString cfg.packages}; do
|
||||
packages="${toString cfg.packages}"
|
||||
|
||||
# Filter duplicate directories
|
||||
declare -A unique_packages
|
||||
for k in $packages ; do unique_packages[$k]=1 ; done
|
||||
|
||||
for i in ''${!unique_packages[@]}; do
|
||||
for fn in $i/etc/systemd/${type}/* $i/lib/systemd/${type}/*; do
|
||||
if ! [[ "$fn" =~ .wants$ ]]; then
|
||||
if [[ -d "$fn" ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user