diff options
-rw-r--r-- | nix/sparseTree/default.nix | 41 | ||||
-rw-r--r-- | tvix/store/protos/default.nix | 6 | ||||
-rw-r--r-- | users/grfn/xanthous/server/default.nix | 11 | ||||
-rw-r--r-- | users/tazjin/tgsa/default.nix | 13 | ||||
-rw-r--r-- | web/bubblegum/default.nix | 39 |
5 files changed, 68 insertions, 42 deletions
diff --git a/nix/sparseTree/default.nix b/nix/sparseTree/default.nix index 7bfa47237869..35fa459e1c2f 100644 --- a/nix/sparseTree/default.nix +++ b/nix/sparseTree/default.nix @@ -2,22 +2,33 @@ # and directories if they are listed in a supplied list: # # # A very minimal depot -# sparseTree ./depot [ -# ./default.nix -# ./depot/nix/readTree/default.nix -# ./third_party/nixpkgs -# ./third_party/overlays -# ] +# sparseTree { +# root = ./depot; +# paths = [ +# ./default.nix +# ./depot/nix/readTree/default.nix +# ./third_party/nixpkgs +# ./third_party/overlays +# ]; +# } { pkgs, lib, ... }: -# root path to use as a reference point -root: -# list of paths below `root` that should be -# included in the resulting directory -# -# If path, need to refer to the actual file / directory to be included. -# If a string, it is treated as a string relative to the root. -paths: +{ + # root path to use as a reference point + root +, # list of paths below `root` that should be + # included in the resulting directory + # + # If path, need to refer to the actual file / directory to be included. + # If a string, it is treated as a string relative to the root. + paths +, # (optional) name to use for the derivation + # + # This should always be set when using roots that do not have + # controlled names, such as when passing the top-level of a git + # repository (e.g. `depot.path.origSrc`). + name ? builtins.baseNameOf root +}: let rootLength = builtins.stringLength (toString root); @@ -63,7 +74,7 @@ in # TODO(sterni): teach readTree to also read symlinked directories, # so we ln -sT instead of cp -aT. -pkgs.runCommand "sparse-${builtins.baseNameOf root}" { } ( +pkgs.runCommand "sparse-${name}" { } ( lib.concatMapStrings ({ src, dst }: '' mkdir -p "$(dirname "$out${dst}")" diff --git a/tvix/store/protos/default.nix b/tvix/store/protos/default.nix index 0ffdcac0418a..d5c44842229d 100644 --- a/tvix/store/protos/default.nix +++ b/tvix/store/protos/default.nix @@ -9,4 +9,8 @@ let protoFileNames = filter (hasSuffix ".proto") (attrNames (readDir ./.)); protoFiles = map (f: ./. + ("/" + f)) protoFileNames; in -depot.nix.sparseTree depot.path.origSrc protoFiles +depot.nix.sparseTree { + name = "tvix-store-protos"; + root = depot.path.origSrc; + paths = protoFiles; +} diff --git a/users/grfn/xanthous/server/default.nix b/users/grfn/xanthous/server/default.nix index fbb5ccd26920..572230a56c5e 100644 --- a/users/grfn/xanthous/server/default.nix +++ b/users/grfn/xanthous/server/default.nix @@ -10,10 +10,13 @@ depot.third_party.naersk.buildPackage { # Workaround for a potential Nix bug related to restricted eval. # See https://github.com/nix-community/naersk/issues/169 - root = depot.nix.sparseTree ./. [ - ./Cargo.toml - ./Cargo.lock - ]; + root = depot.nix.sparseTree { + root = ./.; + paths = [ + ./Cargo.toml + ./Cargo.lock + ]; + }; passthru = { docker = import ./docker.nix args; diff --git a/users/tazjin/tgsa/default.nix b/users/tazjin/tgsa/default.nix index e413c99116fb..063781047a74 100644 --- a/users/tazjin/tgsa/default.nix +++ b/users/tazjin/tgsa/default.nix @@ -1,11 +1,14 @@ { depot, pkgs, ... }: depot.third_party.naersk.buildPackage { - src = depot.nix.sparseTree ./. [ - ./Cargo.lock - ./Cargo.toml - ./src - ]; + src = depot.nix.sparseTree { + root = ./.; + paths = [ + ./Cargo.lock + ./Cargo.toml + ./src + ]; + }; buildInputs = with pkgs; [ pkg-config diff --git a/web/bubblegum/default.nix b/web/bubblegum/default.nix index 528d73032ba6..ed9ab616804d 100644 --- a/web/bubblegum/default.nix +++ b/web/bubblegum/default.nix @@ -10,23 +10,28 @@ let nint ; - minimalDepot = sparseTree depot.path.origSrc [ - # general depot things - "default.nix" - "nix/readTree" - # nixpkgs for lib and packages - "third_party/nixpkgs" - "third_party/overlays" - # bubblegum and its dependencies - "web/bubblegum" - "nix/runExecline" - "nix/utils" - "nix/sparseTree" - # tvix docs for svg demo - "tvix/docs" - # for blog.nix - "users/sterni/nix" - ]; + minimalDepot = sparseTree { + root = depot.path.origSrc; + name = "minimal-depot"; + + paths = [ + # general depot things + "default.nix" + "nix/readTree" + # nixpkgs for lib and packages + "third_party/nixpkgs" + "third_party/overlays" + # bubblegum and its dependencies + "web/bubblegum" + "nix/runExecline" + "nix/utils" + "nix/sparseTree" + # tvix docs for svg demo + "tvix/docs" + # for blog.nix + "users/sterni/nix" + ]; + }; statusCodes = { # 1xx |