From aa122cbae78ce97d60c0c98ba14df753d97e40b1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 30 Jan 2022 19:06:58 +0300 Subject: style: format entire depot with nixpkgs-fmt This CL can be used to compare the style of nixpkgs-fmt against other formatters (nixpkgs, alejandra). Change-Id: I87c6abff6bcb546b02ead15ad0405f81e01b6d9e Reviewed-on: https://cl.tvl.fyi/c/depot/+/4397 Tested-by: BuildkiteCI Reviewed-by: sterni Reviewed-by: lukegb Reviewed-by: wpcarro Reviewed-by: Profpatsch Reviewed-by: kanepyork Reviewed-by: tazjin Reviewed-by: cynthia Reviewed-by: edef Reviewed-by: eta Reviewed-by: grfn --- nix/sparseTree/default.nix | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'nix/sparseTree/default.nix') diff --git a/nix/sparseTree/default.nix b/nix/sparseTree/default.nix index 5184f33d5c46..16fc9b6103f9 100644 --- a/nix/sparseTree/default.nix +++ b/nix/sparseTree/default.nix @@ -45,14 +45,16 @@ let let withLeading = p: if builtins.substring 0 1 p == "/" then p else "/" + p; fullPath = - /**/ if builtins.isPath path then path + /**/ + if builtins.isPath path then path else if builtins.isString path then (root + withLeading path) else builtins.throw "Unsupported path type ${builtins.typeOf path}"; strPath = toString fullPath; contextPath = "${fullPath}"; belowRoot = builtins.substring rootLength (-1) strPath; prefix = builtins.substring 0 rootLength strPath; - in assert toString root == prefix; { + in + assert toString root == prefix; { src = contextPath; dst = belowRoot; }; @@ -61,10 +63,12 @@ let in # TODO(sterni): teach readTree to also read symlinked directories, -# so we ln -sT instead of cp -aT. -pkgs.runCommandNoCC "sparse-${builtins.baseNameOf root}" {} ( - lib.concatMapStrings ({ src, dst }: '' - mkdir -p "$(dirname "$out${dst}")" - cp -aT --reflink=auto "${src}" "$out${dst}" - '') symlinks + # so we ln -sT instead of cp -aT. +pkgs.runCommandNoCC "sparse-${builtins.baseNameOf root}" { } ( + lib.concatMapStrings + ({ src, dst }: '' + mkdir -p "$(dirname "$out${dst}")" + cp -aT --reflink=auto "${src}" "$out${dst}" + '') + symlinks ) -- cgit 1.4.1