From fd48880a0a2366327111faafa75645b0af14ee8e Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 28 Jun 2022 03:44:10 -0700 Subject: [PATCH] nixcache: only enable on moby it's annoying to rebuild on desko/lappy, and have that fail when servo is offline/unreachable. and it's really silly to have servo use its own cache *over the network*. long-term would be better to do properly distributed builds instead of the cache. --- machines/moby/default.nix | 1 + modules/default.nix | 1 + modules/nix.nix | 34 ++++++++++++++++++++++++++++++++++ modules/universal/default.nix | 1 - modules/universal/nix.nix | 21 --------------------- 5 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 modules/nix.nix delete mode 100644 modules/universal/nix.nix diff --git a/machines/moby/default.nix b/machines/moby/default.nix index 7d8dee5b..e369c224 100644 --- a/machines/moby/default.nix +++ b/machines/moby/default.nix @@ -32,6 +32,7 @@ # pkgs.alacritty # terminal; crashes phosh ]; + colinsane.nixcache.enable = true; colinsane.gui.phosh.enable = true; boot.loader.grub.enable = false; mobile.bootloader.enable = false; diff --git a/modules/default.nix b/modules/default.nix index e4eaad3f..5ab7a57f 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -6,6 +6,7 @@ ./hardware ./image.nix ./impermanence.nix + ./nix.nix ./services/duplicity.nix ./universal ]; diff --git a/modules/nix.nix b/modules/nix.nix new file mode 100644 index 00000000..7b135f04 --- /dev/null +++ b/modules/nix.nix @@ -0,0 +1,34 @@ +{ lib, config, ... }: + +with lib; +let + cfg = config.colinsane.nixcache; +in +{ + options = { + colinsane.nixcache.enable = mkOption { + default = false; + type = types.bool; + }; + }; + + config = { + # use our own binary cache + nix.settings = mkIf cfg.enable { + substituters = [ + "https://nixcache.uninsane.org" + "https://nix-community.cachix.org" + "https://cache.nixos.org/" + ]; + trusted-public-keys = [ + "nixcache.uninsane.org:r3WILM6+QrkmsLgqVQcEdibFD7Q/4gyzD9dGT33GP70=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + + # allow `nix flake ...` command + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + }; +} diff --git a/modules/universal/default.nix b/modules/universal/default.nix index 5cf409b0..af458285 100644 --- a/modules/universal/default.nix +++ b/modules/universal/default.nix @@ -4,7 +4,6 @@ imports = [ ./fs.nix ./home-manager.nix - ./nix.nix ./secrets.nix ./users.nix ./vpn.nix diff --git a/modules/universal/nix.nix b/modules/universal/nix.nix deleted file mode 100644 index 3c2f4b59..00000000 --- a/modules/universal/nix.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ ... }: - -{ - # use our own binary cache - nix.settings = { - substituters = [ - "https://nixcache.uninsane.org" - "https://nix-community.cachix.org" - "https://cache.nixos.org/" - ]; - trusted-public-keys = [ - "nixcache.uninsane.org:r3WILM6+QrkmsLgqVQcEdibFD7Q/4gyzD9dGT33GP70=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - - # allow `nix flake ...` command - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; -}