Make local cache configurable

This commit is contained in:
Greg Hellings
2025-05-29 10:48:46 -05:00
parent 04723ae03e
commit 24d1247a79
3 changed files with 67 additions and 53 deletions
+7 -2
View File
@@ -3,6 +3,10 @@ let
username = "gregory.hellings";
in
{
greg = {
nix.cache = false;
};
homebrew = {
enable = true;
brews = [
@@ -12,7 +16,9 @@ in
name = "libvirt";
restart_service = true;
}
"mysql"
"nushell"
"poetry"
"qemu"
];
casks = [
@@ -22,15 +28,14 @@ in
"chromium"
"firefox"
"microsoft-teams"
"mysql"
"onlyoffice"
"pgadmin4"
"poetry"
"tabby"
"twine"
"vagrant"
"visual-studio-code"
"zed"
"zoho-workdrive"
];
user = username;
};
-3
View File
@@ -14,9 +14,6 @@ let
[ ];
in
{
# This is a dumb hack to pass the value into the import below, but it's how we have to do it,
# since that's how the module system works
_module.args.cache = true;
imports = [
./nix-conf.nix
];
+14 -2
View File
@@ -1,11 +1,22 @@
{
pkgs,
lib,
cache,
config,
...
}:
let
cfg = config.greg.nix;
in
{
options.greg.nix = {
cache = lib.mkOption {
type = lib.types.bool;
default = true;
};
};
config = {
nix = {
gc = {
automatic = true;
@@ -29,7 +40,7 @@
"gregory.hellings"
]; # For home and for work machines
substituters =
(lib.optionals cache [
(lib.optionals cfg.cache [
"http://nas.thehellings.lan:9000/binary-cache/"
"http://nas.home:9000/binary-cache/"
])
@@ -57,4 +68,5 @@
allowUnfreePredicate = _: true;
permittedInsecurePackages = [ "ventoy-1.1.05" ];
};
};
}