forked from tiiuae/ghaf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conditionally enable systemd timesyncd patch
The systemd package was patched nixpkgs upstream, causing the build against nixos-unstable to break, because same patch is about to be applied twice. Check if the patch is already present, and don't do timesync related overrides the second time if it is. Signed-off-by: Mika Tammi <[email protected]>
- Loading branch information
1 parent
a2c2dbf
commit e475f98
Showing
1 changed file
with
22 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
(final: prev: { | ||
systemd = prev.systemd.overrideAttrs (prevAttrs: { | ||
patches = prevAttrs.patches ++ [./systemd-timesyncd-disable-nscd.patch]; | ||
postPatch = | ||
prevAttrs.postPatch | ||
+ '' | ||
substituteInPlace units/systemd-timesyncd.service.in \ | ||
--replace \ | ||
"Environment=SYSTEMD_NSS_RESOLVE_VALIDATE=0" \ | ||
"${final.lib.concatStringsSep "\n" [ | ||
"Environment=LD_LIBRARY_PATH=$out/lib" | ||
"Environment=SYSTEMD_NSS_RESOLVE_VALIDATE=0" | ||
]}" | ||
''; | ||
}); | ||
systemd = let | ||
# The patch has been added nixpkgs upstream, don't override attributes if | ||
# the patch is already present. | ||
# | ||
# https://github.com/NixOS/nixpkgs/pull/239201 | ||
shouldOverride = !(final.lib.lists.any (p: final.lib.strings.hasSuffix "0020-timesyncd-disable-NSCD-when-DNSSEC-validation-is-dis.patch" p) prev.systemd.patches); | ||
in | ||
prev.systemd.overrideAttrs (prevAttrs: | ||
final.lib.optionalAttrs shouldOverride { | ||
patches = prevAttrs.patches ++ [./systemd-timesyncd-disable-nscd.patch]; | ||
postPatch = | ||
prevAttrs.postPatch | ||
+ '' | ||
substituteInPlace units/systemd-timesyncd.service.in \ | ||
--replace \ | ||
"Environment=SYSTEMD_NSS_RESOLVE_VALIDATE=0" \ | ||
"${final.lib.concatStringsSep "\n" [ | ||
"Environment=LD_LIBRARY_PATH=$out/lib" | ||
"Environment=SYSTEMD_NSS_RESOLVE_VALIDATE=0" | ||
]}" | ||
''; | ||
}); | ||
}) |