about summary refs log tree commit diff
path: root/ci-builds.nix
diff options
authorGriffin Smith <grfn@gws.fyi>2020-07-03T04·26-0400
committerglittershark <grfn@gws.fyi>2020-07-06T15·16+0000
commita73714a93c2d5e1ce2f9e52f23eaf3019a5d46ed (patch)
tree9162ebd1a732ddcd743794eba602f88cd6ba4e27 /ci-builds.nix
parent8bcdff263c31892161c5c40eb848f02b88c18624 (diff)
feat(ops/nixos): Add generic rebuild-system script r/1221
This adds a first crack at one idea for a generic, non-user-specific
rebuild-system script to ops.nixos.rebuild-system. The idea here is that
we enumerate all the nixos systems stored in the monorepo (similarly to
what we do for ci-builds right now) then search through them by hostname
to find the one matching the hostname of the current system, which is an
attempt at a more generic version of tazjin's rebuilder script which
does the same thing but with an explicit case block.

As a caveat, it feels like there's a slight possibility that this way of
finding systems is going to get slow to evaluate - on my system it feels
fine but if it grows out of hand it's probably feasible to just bake
this into the built script as a dynamically generated case statement.

Change-Id: I2e4c5401913b6f4d936ab48ba2f95f96e0e78eb4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/894
Tested-by: BuildkiteCI
Reviewed-by: lukegb <lukegb@tvl.fyi>
Diffstat (limited to 'ci-builds.nix')
1 files changed, 9 insertions, 11 deletions
diff --git a/ci-builds.nix b/ci-builds.nix
index 26f7e105d..437804eef 100644
--- a/ci-builds.nix
+++ b/ci-builds.nix
@@ -16,6 +16,10 @@ let
     owo = lib.generators.toPretty {} exp;
+  systemFor = configuration: (depot.third_party.nixos {
+    inherit configuration;
+  }).system;
 in lib.fix (self: {
   __apprehendEvaluators = throw ''
     Do not evaluate this attribute set directly. It exists only to group builds
@@ -28,18 +32,10 @@ in lib.fix (self: {
   # used to trigger builds for each key.
   __evaluatable = filter (key: (substring 0 2 key) != "__") (attrNames self);
-  # List of non-public targets, these are only used in local builds
-  # and not in CI.
-  __nonpublic = with depot; [
-    users.tazjin.nixos.camdenSystem
-    users.tazjin.nixos.frogSystem
-  ];
   # Combined list of all the targets, used for building everything locally.
   __allTargets =
     (with depot.nix.yants; list drv)
-      (foldl' (x: y: x ++ y) self.__nonpublic
-        (map (k: getAttr k self) self.__evaluatable));
+    (foldl' (x: y: x ++ y) [] (map (k: getAttr k self) self.__evaluatable));
   fun = with depot.fun; [
@@ -57,7 +53,7 @@ in lib.fix (self: {
-    nixos.whitby
+    (systemFor nixos.whitby)
   third_party = with depot.third_party; [
@@ -98,10 +94,12 @@ in lib.fix (self: {
+    (systemFor nixos.camden)
+    (systemFor nixos.frog)
   glittershark = with depot.users.glittershark; [
-    system.system.chupacabra
+    (systemFor system.system.chupacabra)