about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-04-12T20·26+0200
committertazjin <mail@tazj.in>2021-04-12T21·55+0000
commitf520bd40cab9bae4f8fa26fe36365a7bf9bccd5a (patch)
tree5f116d10e44b7f3616fb63c28e7de03d81869071
parenta5591359702b62e4edd7fdbbd135475037aa6727 (diff)
refactor: Replace 'depotPath' with 'depot.path' r/2497
Instead of having two ways of accessing the path to the depot (one of
which was stuttering, depot.depotPath) we settle on only one:
depot.path.

This was mostly used for NixOS module imports.

Co-Authored-By: Florian Klink <flokli@flokli.de>
Change-Id: I2c0db23383fc34f6ca76baaad4cc4af2d9dfae15
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2962
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Reviewed-by: sterni <sternenseemann@systemli.org>
-rw-r--r--default.nix9
-rw-r--r--docs/designs/SPARSE_CHECKOUTS.md2
-rw-r--r--nix/bufCheck/default.nix4
-rw-r--r--ops/machines/whitby/default.nix40
-rw-r--r--ops/modules/www/wigglydonke.rs.nix2
-rw-r--r--ops/nixos.nix2
-rw-r--r--third_party/nix/default.nix3
-rw-r--r--third_party/nix/test-vm.nix2
-rw-r--r--users/tazjin/nixos/camden/default.nix4
-rw-r--r--users/tazjin/nixos/frog/default.nix2
-rw-r--r--web/bubblegum/default.nix2
-rw-r--r--web/todolist/default.nix2
12 files changed, 35 insertions, 39 deletions
diff --git a/default.nix b/default.nix
index a73e46877a..d8b9b08b69 100644
--- a/default.nix
+++ b/default.nix
@@ -47,12 +47,7 @@ let
            (node.meta.targets or []))
     else [];
 
-  # Make the path to the depot available for things that might need it
-  # (e.g. NixOS module inclusions)
-  depotPath = ./.;
 in fix(self: (readTree' {
-  # TODO(tazjin): Settle on one way of using depotPath
-  inherit depotPath;
   depot = self;
 
   # Pass third_party as 'pkgs' (for compatibility with external
@@ -69,7 +64,9 @@ in fix(self: (readTree' {
   # debugging by bisecting nixpkgs.
   externalArgs = args;
 } ./.) // {
-  inherit depotPath;
+  # Make the path to the depot available for things that might need it
+  # (e.g. NixOS module inclusions)
+  path = ./.;
 
   # List of all buildable targets, for CI purposes.
   #
diff --git a/docs/designs/SPARSE_CHECKOUTS.md b/docs/designs/SPARSE_CHECKOUTS.md
index fe3a4c0104..7bd4963f61 100644
--- a/docs/designs/SPARSE_CHECKOUTS.md
+++ b/docs/designs/SPARSE_CHECKOUTS.md
@@ -9,7 +9,7 @@ Open items:
    the closure of a given source directory, using [depot-scan].
 
 ```bash
-DEPOT_ROOT="${depot.depotPath}"
+DEPOT_ROOT="${depot.path}"
 XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
 CLIENT_ROOT="$XDG_DATA_HOME/tvlc/clients"
 NICE_CHECKOUT_ROOT="$HOME/tvlc"
diff --git a/nix/bufCheck/default.nix b/nix/bufCheck/default.nix
index 6d17cb460e..7613d9215b 100644
--- a/nix/bufCheck/default.nix
+++ b/nix/bufCheck/default.nix
@@ -3,7 +3,7 @@
 { depot, pkgs, ... }:
 
 pkgs.writeShellScriptBin "ci-buf-check" ''
-  ${depot.third_party.bufbuild}/bin/buf check lint --input "${depot.depotPath}"
+  ${depot.third_party.bufbuild}/bin/buf check lint --input "${depot.path}"
   # Report-only
-  ${depot.third_party.bufbuild}/bin/buf check breaking --input "${depot.depotPath}" --against-input "${depot.depotPath}/.git#branch=canon" || true
+  ${depot.third_party.bufbuild}/bin/buf check breaking --input "${depot.path}" --against-input "${depot.path}/.git#branch=canon" || true
 ''
diff --git a/ops/machines/whitby/default.nix b/ops/machines/whitby/default.nix
index df280b96f7..554caa6642 100644
--- a/ops/machines/whitby/default.nix
+++ b/ops/machines/whitby/default.nix
@@ -6,26 +6,26 @@ let
   inherit (lib) range;
 in lib.fix(self: {
   imports = [
-    "${depot.depotPath}/ops/modules/clbot.nix"
-    "${depot.depotPath}/ops/modules/irccat.nix"
-    "${depot.depotPath}/ops/modules/monorepo-gerrit.nix"
-    "${depot.depotPath}/ops/modules/panettone.nix"
-    "${depot.depotPath}/ops/modules/paroxysm.nix"
-    "${depot.depotPath}/ops/modules/smtprelay.nix"
-    "${depot.depotPath}/ops/modules/sourcegraph.nix"
-    "${depot.depotPath}/ops/modules/tvl-buildkite.nix"
-    "${depot.depotPath}/ops/modules/tvl-slapd/default.nix"
-    "${depot.depotPath}/ops/modules/tvl-sso/default.nix"
-    "${depot.depotPath}/ops/modules/www/b.tvl.fyi.nix"
-    "${depot.depotPath}/ops/modules/www/cache.tvl.su.nix"
-    "${depot.depotPath}/ops/modules/www/cl.tvl.fyi.nix"
-    "${depot.depotPath}/ops/modules/www/code.tvl.fyi.nix"
-    "${depot.depotPath}/ops/modules/www/cs.tvl.fyi.nix"
-    "${depot.depotPath}/ops/modules/www/login.tvl.fyi.nix"
-    "${depot.depotPath}/ops/modules/www/tazj.in.nix"
-    "${depot.depotPath}/ops/modules/www/todo.tvl.fyi.nix"
-    "${depot.depotPath}/ops/modules/www/tvl.fyi.nix"
-    "${depot.depotPath}/ops/modules/www/wigglydonke.rs.nix"
+    "${depot.path}/ops/modules/clbot.nix"
+    "${depot.path}/ops/modules/irccat.nix"
+    "${depot.path}/ops/modules/monorepo-gerrit.nix"
+    "${depot.path}/ops/modules/panettone.nix"
+    "${depot.path}/ops/modules/paroxysm.nix"
+    "${depot.path}/ops/modules/smtprelay.nix"
+    "${depot.path}/ops/modules/sourcegraph.nix"
+    "${depot.path}/ops/modules/tvl-buildkite.nix"
+    "${depot.path}/ops/modules/tvl-slapd/default.nix"
+    "${depot.path}/ops/modules/tvl-sso/default.nix"
+    "${depot.path}/ops/modules/www/b.tvl.fyi.nix"
+    "${depot.path}/ops/modules/www/cache.tvl.su.nix"
+    "${depot.path}/ops/modules/www/cl.tvl.fyi.nix"
+    "${depot.path}/ops/modules/www/code.tvl.fyi.nix"
+    "${depot.path}/ops/modules/www/cs.tvl.fyi.nix"
+    "${depot.path}/ops/modules/www/login.tvl.fyi.nix"
+    "${depot.path}/ops/modules/www/tazj.in.nix"
+    "${depot.path}/ops/modules/www/todo.tvl.fyi.nix"
+    "${depot.path}/ops/modules/www/tvl.fyi.nix"
+    "${depot.path}/ops/modules/www/wigglydonke.rs.nix"
     "${pkgs.path}/nixos/modules/services/web-apps/gerrit.nix"
   ];
 
diff --git a/ops/modules/www/wigglydonke.rs.nix b/ops/modules/www/wigglydonke.rs.nix
index 4643b34317..bdfbca58d8 100644
--- a/ops/modules/www/wigglydonke.rs.nix
+++ b/ops/modules/www/wigglydonke.rs.nix
@@ -9,7 +9,7 @@
     services.nginx.virtualHosts."wigglydonke.rs" = {
       enableACME = true;
       forceSSL = true;
-      root = "${depot.depotPath}/users/grfn/wigglydonke.rs";
+      root = "${depot.path}/users/grfn/wigglydonke.rs";
     };
   };
 }
diff --git a/ops/nixos.nix b/ops/nixos.nix
index 465a2eed31..6a583c53db 100644
--- a/ops/nixos.nix
+++ b/ops/nixos.nix
@@ -33,7 +33,7 @@ in rec {
     fi
 
     echo "Rebuilding NixOS for $HOSTNAME"
-    system=$(nix-build -E "((import ${toString depot.depotPath} {}).ops.nixos.findSystem \"$HOSTNAME\").system" --no-out-link --show-trace)
+    system=$(nix-build -E "((import ${toString depot.path} {}).ops.nixos.findSystem \"$HOSTNAME\").system" --no-out-link --show-trace)
 
     nix-env -p /nix/var/nix/profiles/system --set $system
     $system/bin/switch-to-configuration switch
diff --git a/third_party/nix/default.nix b/third_party/nix/default.nix
index 2a66925f00..df6a6da72f 100644
--- a/third_party/nix/default.nix
+++ b/third_party/nix/default.nix
@@ -3,7 +3,6 @@ args@{
 , pkgs ? depot.third_party.nixpkgs
 , lib
 , buildType ? "release"
-, depotPath ? ../..
 , ...
 }:
 
@@ -198,7 +197,7 @@ in lib.fix (self: pkgs.llvmPackages.libcxxStdenv.mkDerivation {
       installCheckInputs = up.installCheckInputs ++ [run_clang_tidy];
 
       shellHook = ''
-        export NIX_DATA_DIR="${toString depotPath}/third_party"
+        export NIX_DATA_DIR="${toString depot.path}/third_party"
         export NIX_TEST_VAR=foo
       '';
     });
diff --git a/third_party/nix/test-vm.nix b/third_party/nix/test-vm.nix
index 550537679c..e5f8690fcb 100644
--- a/third_party/nix/test-vm.nix
+++ b/third_party/nix/test-vm.nix
@@ -11,7 +11,7 @@ let
     virtualisation.qemu.options = [ "-nographic" "-curses" ];
 
     nix.nixPath = [
-      "depot=${depot.depotPath}"
+      "depot=${depot.path}"
     ];
   };
 
diff --git a/users/tazjin/nixos/camden/default.nix b/users/tazjin/nixos/camden/default.nix
index 2659db5e91..eae359ccec 100644
--- a/users/tazjin/nixos/camden/default.nix
+++ b/users/tazjin/nixos/camden/default.nix
@@ -25,8 +25,8 @@ in lib.fix(self: {
       sha256 = "157c64220lf825ll4c0cxsdwg7cxqdx4z559fdp7kpz0g6p8fhhr";
     };
     in [
-      "${depot.depotPath}/ops/modules/quassel.nix"
-      "${depot.depotPath}/ops/modules/smtprelay.nix"
+      "${depot.path}/ops/modules/quassel.nix"
+      "${depot.path}/ops/modules/smtprelay.nix"
       "${oldChannel}/nixos/modules/security/acme.nix"
     ];
 
diff --git a/users/tazjin/nixos/frog/default.nix b/users/tazjin/nixos/frog/default.nix
index 1394f9cf4e..0b74d3e575 100644
--- a/users/tazjin/nixos/frog/default.nix
+++ b/users/tazjin/nixos/frog/default.nix
@@ -16,7 +16,7 @@ config: let
   };
 in lib.fix(self: {
   imports = [
-    "${depot.depotPath}/ops/modules/v4l2loopback.nix"
+    "${depot.path}/ops/modules/v4l2loopback.nix"
   ];
 
   boot = {
diff --git a/web/bubblegum/default.nix b/web/bubblegum/default.nix
index aecc701886..d9b106ddde 100644
--- a/web/bubblegum/default.nix
+++ b/web/bubblegum/default.nix
@@ -207,7 +207,7 @@ let
       ] ++ [
         "${bins.nint}"
         # always pass depot so scripts can use this library
-        "--arg depot '(import ${depot.depotPath} {})'"
+        "--arg depot '(import ${depot.path} {})'"
       ]);
     in runExecline.local drvName {} [
       "importas" "out" "out"
diff --git a/web/todolist/default.nix b/web/todolist/default.nix
index c9efbc03f9..3b4960aa3b 100644
--- a/web/todolist/default.nix
+++ b/web/todolist/default.nix
@@ -35,7 +35,7 @@ let
   };
 
   allTodos = fromJSON (readFile (runCommandNoCC "depot-todos.json" {} ''
-    ${ripgrep}/bin/rg --json 'TODO\(\w+\):.*$' ${depot.depotPath} | \
+    ${ripgrep}/bin/rg --json 'TODO\(\w+\):.*$' ${depot.path} | \
       ${jq}/bin/jq -s -f ${./extract-todos.jq} > $out
   ''));