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.
			
			
This commit is contained in:
		
							parent
							
								
									51cdb87223
								
							
						
					
					
						commit
						7833632a79
					
				
					 5 changed files with 17 additions and 33 deletions
				
			
		| 
						 | 
					@ -1,8 +1,6 @@
 | 
				
			||||||
set -euo pipefail
 | 
					set -euo pipefail
 | 
				
			||||||
 | 
					
 | 
				
			||||||
nixos-rebuild \
 | 
					nix-build /home/wpcarro/nixpkgs/nixos \
 | 
				
			||||||
  -I nixos-config=/home/wpcarro/briefcase/nixos/socrates/configuration.nix \
 | 
					  -I nixos-config=/home/wpcarro/briefcase/nixos/socrates/default.nix \
 | 
				
			||||||
  -I nixpkgs=/home/wpcarro/nixpkgs \
 | 
					  -A system \
 | 
				
			||||||
  -I depot=/home/wpcarro/depot \
 | 
					  --show-trace
 | 
				
			||||||
  -I briefcase=/home/wpcarro/briefcase \
 | 
					 | 
				
			||||||
  switch
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,14 +1,6 @@
 | 
				
			||||||
{ ... }:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
let
 | 
					let
 | 
				
			||||||
  # TODO(wpcarro): Instead of importing these dependencies as parameters that
 | 
					  briefcase = import /home/wpcarro/briefcase {};
 | 
				
			||||||
  # 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> {};
 | 
					 | 
				
			||||||
  pkgs = briefcase.third_party.pkgs;
 | 
					  pkgs = briefcase.third_party.pkgs;
 | 
				
			||||||
 | 
					 | 
				
			||||||
  trimNewline = x: pkgs.lib.removeSuffix "\n" x;
 | 
					  trimNewline = x: pkgs.lib.removeSuffix "\n" x;
 | 
				
			||||||
  readSecret = x: trimNewline (builtins.readFile ("/etc/secrets/" + x));
 | 
					  readSecret = x: trimNewline (builtins.readFile ("/etc/secrets/" + x));
 | 
				
			||||||
in {
 | 
					in {
 | 
				
			||||||
| 
						 | 
					@ -72,13 +64,7 @@ in {
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  nix = {
 | 
					  nix = {
 | 
				
			||||||
    # Expose depot as <depot>, nixpkgs as <nixpkgs>
 | 
					    nixPath = [];
 | 
				
			||||||
    nixPath = [
 | 
					 | 
				
			||||||
      "briefcase=/home/wpcarro/briefcase"
 | 
					 | 
				
			||||||
      "depot=/home/wpcarro/depot"
 | 
					 | 
				
			||||||
      "nixpkgs=/home/wpcarro/nixpkgs"
 | 
					 | 
				
			||||||
    ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    trustedUsers = [ "root" "wpcarro" ];
 | 
					    trustedUsers = [ "root" "wpcarro" ];
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -229,16 +215,16 @@ in {
 | 
				
			||||||
        enableACME = true;
 | 
					        enableACME = true;
 | 
				
			||||||
        root = briefcase.website.blog;
 | 
					        root = briefcase.website.blog;
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      "sandbox.wpcarro.dev" = {
 | 
					      # "sandbox.wpcarro.dev" = {
 | 
				
			||||||
        addSSL = true;
 | 
					      #   addSSL = true;
 | 
				
			||||||
        enableACME = true;
 | 
					      #   enableACME = true;
 | 
				
			||||||
        root = briefcase.website.sandbox;
 | 
					      #   root = briefcase.website.sandbox;
 | 
				
			||||||
      };
 | 
					      # };
 | 
				
			||||||
      "learnpianochords.app" = {
 | 
					      # "learnpianochords.app" = {
 | 
				
			||||||
        addSSL = true;
 | 
					      #   addSSL = true;
 | 
				
			||||||
        enableACME = true;
 | 
					      #   enableACME = true;
 | 
				
			||||||
        root = briefcase.website.sandbox.learnpianochords;
 | 
					      #   root = briefcase.website.sandbox.learnpianochords;
 | 
				
			||||||
      };
 | 
					      # };
 | 
				
			||||||
      "zoo.wpcarro.dev" = {
 | 
					      "zoo.wpcarro.dev" = {
 | 
				
			||||||
        addSSL = true;
 | 
					        addSSL = true;
 | 
				
			||||||
        enableACME = true;
 | 
					        enableACME = true;
 | 
				
			||||||
| 
						 | 
					@ -5,7 +5,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  imports =
 | 
					  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" ];
 | 
					  boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue