mirror of
https://github.com/nmattia/snack.git
synced 2024-09-21 08:37:09 +03:00
reduce re-computation
Nix is not smart enough to promote calculated thunks to constants between function invocations
This commit is contained in:
parent
13c120327c
commit
153673db9e
@ -13,14 +13,14 @@ let
|
||||
# that file only)
|
||||
singleOut = base: file:
|
||||
let
|
||||
basePrefix = (builtins.toString base) + "/";
|
||||
pred = file: path: type:
|
||||
let
|
||||
topLevel = (builtins.toString base) + "/";
|
||||
actual = (pkgs.lib.strings.removePrefix topLevel path);
|
||||
actual = (pkgs.lib.strings.removePrefix basePrefix path);
|
||||
expected = file;
|
||||
in
|
||||
(expected == actual) ||
|
||||
(type == "directory" && (pkgs.lib.strings.hasPrefix actual expected));
|
||||
in
|
||||
(expected == actual) ||
|
||||
(type == "directory" && (pkgs.lib.strings.hasPrefix actual expected));
|
||||
mod = fileToModule file;
|
||||
# TODO: even though we're doing a lot of cleaning, there's sitll some
|
||||
# 'does-file-exist' happening
|
||||
|
Loading…
Reference in New Issue
Block a user