Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
30 lines
927 B
Nix
30 lines
927 B
Nix
# This overlay implements mocking of the lib.path.splitRoot function
|
|
# It pretends that the last component named "mock-root" is the root:
|
|
#
|
|
# splitRoot /foo/mock-root/bar/mock-root/baz
|
|
# => {
|
|
# root = /foo/mock-root/bar/mock-root;
|
|
# subpath = "./baz";
|
|
# }
|
|
self: super: {
|
|
path = super.path // {
|
|
splitRoot =
|
|
path:
|
|
let
|
|
parts = super.path.splitRoot path;
|
|
components = self.path.subpath.components parts.subpath;
|
|
count = self.length components;
|
|
rootIndex =
|
|
count
|
|
- self.lists.findFirstIndex (component: component == "mock-root") (self.length components) (
|
|
self.reverseList components
|
|
);
|
|
root = self.path.append parts.root (self.path.subpath.join (self.take rootIndex components));
|
|
subpath = self.path.subpath.join (self.drop rootIndex components);
|
|
in
|
|
{
|
|
inherit root subpath;
|
|
};
|
|
};
|
|
}
|