system: Enable cachix for nix-community

This commit is contained in:
Jez Cope 2021-04-11 20:59:43 +01:00
parent 58540efc77
commit 7f5dd75732
3 changed files with 34 additions and 2 deletions

14
cachix.nix Normal file
View File

@ -0,0 +1,14 @@
# 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/"];
}

12
cachix/nix-community.nix Normal file
View File

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

View File

@ -10,8 +10,12 @@ let
host-config = ./machines + "/${hostName}.nix";
optionalPath = path: lib.lists.optional (builtins.pathExists path) path;
in {
imports = [ <home-manager/nixos> ./hardware-configuration.nix ./local.nix ]
++ optionalPath host-config;
imports = [
<home-manager/nixos>
./hardware-configuration.nix
./local.nix
./cachix.nix
] ++ optionalPath host-config;
# Nix ######################################################################
system.stateVersion = "20.03"; # Leave this alone (see configuration.nix(5))
@ -119,6 +123,8 @@ in {
# General ##################################################################
environment.systemPackages = with pkgs; [
cachix
wget
vim
git