Skip to content

Commit

Permalink
Merge pull request #284508 from nikstur/etc-overlay-leading-slash
Browse files Browse the repository at this point in the history
nixos/etc: remove leading slash from paths
  • Loading branch information
lheckemann authored Feb 3, 2024
2 parents 8a93517 + dff64f5 commit 9f571cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions nixos/modules/services/x11/xserver.nix
Original file line number Diff line number Diff line change
Expand Up @@ -710,9 +710,9 @@ in
'';
}
# Needed since 1.18; see https://bugs.freedesktop.org/show_bug.cgi?id=89023#c5
// (let cfgPath = "/X11/xorg.conf.d/10-evdev.conf"; in
// (let cfgPath = "X11/xorg.conf.d/10-evdev.conf"; in
{
${cfgPath}.source = xorg.xf86inputevdev.out + "/share" + cfgPath;
${cfgPath}.source = xorg.xf86inputevdev.out + "/share/" + cfgPath;
});

environment.systemPackages = utils.removePackagesByName
Expand Down
14 changes: 11 additions & 3 deletions nixos/modules/system/etc/build-composefs-dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(
):
if path is None:
path = attrs["target"]
self.path = "/" + path
self.path = path
self.size = size
self.filetype = filetype
self.mode = mode
Expand All @@ -83,8 +83,12 @@ def write_line(self) -> str:
return " ".join(line_list)


def eprint(*args, **kwargs) -> None:
print(args, **kwargs, file=sys.stderr)
def eprint(*args: Any, **kwargs: Any) -> None:
print(*args, **kwargs, file=sys.stderr)


def normalize_path(path: str) -> str:
return str("/" + os.path.normpath(path).lstrip("/"))


def leading_directories(path: str) -> list[str]:
Expand Down Expand Up @@ -145,6 +149,10 @@ def main() -> None:

paths: dict[str, ComposefsPath] = {}
for attrs in config:
# Normalize the target path to work around issues in how targets are
# declared in `environment.etc`.
attrs["target"] = normalize_path(attrs["target"])

target = attrs["target"]
source = attrs["source"]
mode = attrs["mode"]
Expand Down

0 comments on commit 9f571cb

Please sign in to comment.