Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/etc: remove leading slash from paths #284508

Merged
merged 3 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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("/"))
nikstur marked this conversation as resolved.
Show resolved Hide resolved


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
Loading