Enable binary cache for nix-community

Finally fully enable binary cache for nix-community and emacs-overlay.
No I don't have to build emacs from scratch for every master update :)

This was done by means of cachix, which is a means to upload built derivations
for others to share with. Nix-community has their own, and it makes using
overlays provided by nix-community that much better. This should shave off 20-25
min per system rebuild.

I am not sure if this will work as is after moving this config to new system,
so here are the steps to follow:

1. nix shell nixpkgs#cachix
2. sudo cachix use nix-community
3. stage/commit cachix.nix and cachix/ from /etc/nixos
4. done

Hopefully this will be enough in the future system move. If not, all the best to
future me.
This commit is contained in:
Payas Relekar 2021-11-13 12:15:53 +05:30
parent 0ec98ff5a2
commit dfb3d3f7ee
3 changed files with 25 additions and 0 deletions

13
cachix.nix Normal file
View file

@ -0,0 +1,13 @@
# WARN: this file will get overwritten by $ cachix use <name>
{ pkgs, lib, ... }:
let
folder = ./cachix;
toImport = name: value: folder + ("/" + name);
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key;
imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder));
in {
inherit imports;
nix.binaryCaches = ["https://cache.nixos.org/"];
}

11
cachix/nix-community.nix Normal file
View file

@ -0,0 +1,11 @@
{
nix = {
binaryCaches = [
"https://nix-community.cachix.org"
];
binaryCachePublicKeys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
}

View file

@ -21,6 +21,7 @@
./hosts/enterprise/configuration.nix
{ nixpkgs.overlays = [ emacs-overlay.overlay ]; }
(import ./hosts/enterprise/sound.nix)
(import ./cachix.nix)
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;