about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-08-17T08·48+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-08-20T10·26+0100
commit7833632a7961038e8898ef287fd2dedf8fa7f33b (patch)
tree2c7cc90e0eda2900314fdec02bbfddc1b55f7f1e
parent51cdb872237c86f33a14a845f62a6ee5f267bed6 (diff)
Attempt nix-build instead of nixos-rebuild switch
I've encountered a few problems with attempting to support nixos-rebuild:
- the activation step requires `sudo` privileges
- the `buildkite-agent` runs on the same machine, socrates, that is rebuilding
  itself. This means that when the activation step runs, it will attempt to
  restart `buildkite-agent` when the agent is still working

I'm slowly removing places in my nix code that rely on '<bracket>' notation, so
that I no longer depend on NIX_PATH being set. I still have more work to do.

{covid-uk,sandbox}/default.nix are breaking when I attempt to run my
build-socrates.sh script locally, so I'm temporarily disabling them until I can
get CI working as I expect.
-rw-r--r--ci/scripts/build-socrates.sh10
-rw-r--r--nixos/socrates/default.nix (renamed from nixos/socrates/configuration.nix)38
-rw-r--r--nixos/socrates/hardware.nix2
-rw-r--r--website/sandbox/covid-uk/default.nix.ignore (renamed from website/sandbox/covid-uk/default.nix)0
-rw-r--r--website/sandbox/default.nix.ignore (renamed from website/sandbox/default.nix)0
5 files changed, 17 insertions, 33 deletions
diff --git a/ci/scripts/build-socrates.sh b/ci/scripts/build-socrates.sh
index f89b9e657501..f62f97e89951 100644
--- a/ci/scripts/build-socrates.sh
+++ b/ci/scripts/build-socrates.sh
@@ -1,8 +1,6 @@
 set -euo pipefail
 
-nixos-rebuild \
-  -I nixos-config=/home/wpcarro/briefcase/nixos/socrates/configuration.nix \
-  -I nixpkgs=/home/wpcarro/nixpkgs \
-  -I depot=/home/wpcarro/depot \
-  -I briefcase=/home/wpcarro/briefcase \
-  switch
+nix-build /home/wpcarro/nixpkgs/nixos \
+  -I nixos-config=/home/wpcarro/briefcase/nixos/socrates/default.nix \
+  -A system \
+  --show-trace
diff --git a/nixos/socrates/configuration.nix b/nixos/socrates/default.nix
index 58b3c64cfee2..d98cdb993300 100644
--- a/nixos/socrates/configuration.nix
+++ b/nixos/socrates/default.nix
@@ -1,14 +1,6 @@
-{ ... }:
-
 let
-  # TODO(wpcarro): Instead of importing these dependencies as parameters that
-  # readTree will expose I need to import these dependencies manually because
-  # I'm building this using `nixos-rebuild`. When I better understand how to
-  # build socrates using readTree, prefer defining this as an anonymous
-  # function.
-  briefcase = import <briefcase> {};
+  briefcase = import /home/wpcarro/briefcase {};
   pkgs = briefcase.third_party.pkgs;
-
   trimNewline = x: pkgs.lib.removeSuffix "\n" x;
   readSecret = x: trimNewline (builtins.readFile ("/etc/secrets/" + x));
 in {
@@ -72,13 +64,7 @@ in {
   };
 
   nix = {
-    # Expose depot as <depot>, nixpkgs as <nixpkgs>
-    nixPath = [
-      "briefcase=/home/wpcarro/briefcase"
-      "depot=/home/wpcarro/depot"
-      "nixpkgs=/home/wpcarro/nixpkgs"
-    ];
-
+    nixPath = [];
     trustedUsers = [ "root" "wpcarro" ];
   };
 
@@ -229,16 +215,16 @@ in {
         enableACME = true;
         root = briefcase.website.blog;
       };
-      "sandbox.wpcarro.dev" = {
-        addSSL = true;
-        enableACME = true;
-        root = briefcase.website.sandbox;
-      };
-      "learnpianochords.app" = {
-        addSSL = true;
-        enableACME = true;
-        root = briefcase.website.sandbox.learnpianochords;
-      };
+      # "sandbox.wpcarro.dev" = {
+      #   addSSL = true;
+      #   enableACME = true;
+      #   root = briefcase.website.sandbox;
+      # };
+      # "learnpianochords.app" = {
+      #   addSSL = true;
+      #   enableACME = true;
+      #   root = briefcase.website.sandbox.learnpianochords;
+      # };
       "zoo.wpcarro.dev" = {
         addSSL = true;
         enableACME = true;
diff --git a/nixos/socrates/hardware.nix b/nixos/socrates/hardware.nix
index dde14eb1e627..d13ffd7e401d 100644
--- a/nixos/socrates/hardware.nix
+++ b/nixos/socrates/hardware.nix
@@ -5,7 +5,7 @@
 
 {
   imports =
-    [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
+    [ /home/wpcarro/nixpkgs/nixos/modules/installer/scan/not-detected.nix
     ];
 
   boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
diff --git a/website/sandbox/covid-uk/default.nix b/website/sandbox/covid-uk/default.nix.ignore
index 309b1fa64b4d..309b1fa64b4d 100644
--- a/website/sandbox/covid-uk/default.nix
+++ b/website/sandbox/covid-uk/default.nix.ignore
diff --git a/website/sandbox/default.nix b/website/sandbox/default.nix.ignore
index 4f86b49002a5..4f86b49002a5 100644
--- a/website/sandbox/default.nix
+++ b/website/sandbox/default.nix.ignore