cachix: move out of root and into profile

This commit is contained in:
Timothy DeHerrera 2021-04-18 20:43:37 -06:00
parent 2d91946745
commit fbce126f4d
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
6 changed files with 17 additions and 8 deletions

View File

@ -1,8 +1,13 @@
# Cachix # Cachix
The cachix directory simple captures the output of `sudo cachix use` for the The system will automatically pull a cachix.nix at the root if one exists.
developers personal cache, as well as the nix-community cache. You can easily This is usually created automatically by a `sudo cachix use`. If your more
add your own cache, assuming the template lives in /etc/nixos, by simply inclined to keep the root clean, you can drop any generated files in the
running `sudo cachix use yourcache`. `cachix` directory into the `profiles/cachix` directory without further
modification.
For example, to add your own cache, assuming the template lives in /etc/nixos,
by simply running `sudo cachix use yourcache`. Then, optionally, move
`cachix/yourcache.nix` to `profiles/cachix/yourcache.nix`
These caches are only added to the system after a `nixos-rebuild switch`, so it These caches are only added to the system after a `nixos-rebuild switch`, so it
is recommended to call `cachix use nrdxp` before the initial deployment, as it is recommended to call `cachix use nrdxp` before the initial deployment, as it

View File

@ -63,7 +63,11 @@ let
# Everything in `./modules/list.nix`. # Everything in `./modules/list.nix`.
flakeModules = { imports = builtins.attrValues self.nixosModules ++ extern.modules; }; flakeModules = { imports = builtins.attrValues self.nixosModules ++ extern.modules; };
cachix = ../../cachix.nix; cachix = let rootCachix = ../../cachix.nix; in
if builtins.pathExists rootCachix
then rootCachix
else { }
;
}; };
specialArgs = extern.specialArgs // { suites = suites.system; }; specialArgs = extern.specialArgs // { suites = suites.system; };

View File

@ -1,9 +1,8 @@
# WARN: this file will get overwritten by $ cachix use <name>
{ pkgs, lib, ... }: { pkgs, lib, ... }:
let let
folder = ./cachix; folder = ./.;
toImport = name: value: folder + ("/" + name); toImport = name: value: folder + ("/" + name);
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key; filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key && key != "default.nix";
imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder)); imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder));
in in
{ {

View File

@ -2,6 +2,7 @@
let inherit (lib) fileContents; let inherit (lib) fileContents;
in in
{ {
imports = [ ../cachix ];
nix.systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; nix.systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];