nix: use new nix.settings syntax
This commit is contained in:
parent
f6062d0019
commit
f97cf1d0e9
|
@ -1,10 +1,12 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.pub-solar.core;
|
||||
in
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.pub-solar.core;
|
||||
in {
|
||||
options.pub-solar.core = {
|
||||
enableCaddy = mkOption {
|
||||
type = types.bool;
|
||||
|
@ -17,12 +19,12 @@ in
|
|||
|
||||
binaryCaches = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
default = [];
|
||||
description = "Binary caches to use.";
|
||||
};
|
||||
publicKeys = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
default = [];
|
||||
description = "Public keys of binary caches.";
|
||||
};
|
||||
};
|
||||
|
@ -39,15 +41,16 @@ in
|
|||
networking.firewall.enable = true;
|
||||
|
||||
# Customized binary caches list (with fallback to official binary cache)
|
||||
nix.binaryCaches = cfg.binaryCaches;
|
||||
nix.binaryCachePublicKeys = cfg.publicKeys;
|
||||
nix.settings.substituters = cfg.binaryCaches;
|
||||
nix.settings.trusted-public-keys = cfg.publicKeys;
|
||||
|
||||
# These entries get added to /etc/hosts
|
||||
networking.hosts = {
|
||||
"127.0.0.1" = [ ]
|
||||
++ lib.optionals cfg.enableCaddy [ "caddy.local" ]
|
||||
++ lib.optionals config.pub-solar.printing.enable [ "cups.local" ]
|
||||
++ lib.optionals cfg.enableHelp [ "help.local" ];
|
||||
"127.0.0.1" =
|
||||
[]
|
||||
++ lib.optionals cfg.enableCaddy ["caddy.local"]
|
||||
++ lib.optionals config.pub-solar.printing.enable ["cups.local"]
|
||||
++ lib.optionals cfg.enableHelp ["help.local"];
|
||||
};
|
||||
|
||||
# Caddy reverse proxy for local services like cups
|
||||
|
|
|
@ -1,19 +1,25 @@
|
|||
{ config, pkgs, lib, inputs, ... }:
|
||||
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: {
|
||||
nix = {
|
||||
# Use default version alias for nix package
|
||||
package = pkgs.nix;
|
||||
# Improve nix store disk usage
|
||||
autoOptimiseStore = true;
|
||||
gc.automatic = true;
|
||||
optimise.automatic = true;
|
||||
# Prevents impurities in builds
|
||||
useSandbox = true;
|
||||
# give root and @wheel special privileges with nix
|
||||
trustedUsers = [ "root" "@wheel" ];
|
||||
# This is just a representation of the nix default
|
||||
systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
|
||||
settings = {
|
||||
# Improve nix store disk usage
|
||||
auto-optimise-store = true;
|
||||
# Prevents impurities in builds
|
||||
sandbox = true;
|
||||
# give root and @wheel special privileges with nix
|
||||
trusted-users = ["root" "@wheel"];
|
||||
# This is just a representation of the nix default
|
||||
system-features = ["nixos-test" "benchmark" "big-parallel" "kvm"];
|
||||
};
|
||||
# Generally useful nix option defaults
|
||||
extraOptions = ''
|
||||
min-free = 536870912
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
{ pkgs, lib, ... }:
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
folder = ./.;
|
||||
toImport = name: value: folder + ("/" + name);
|
||||
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key && key != "default.nix";
|
||||
imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder));
|
||||
in
|
||||
{
|
||||
in {
|
||||
inherit imports;
|
||||
nix.binaryCaches = [ "https://cache.nixos.org/" ];
|
||||
nix.settings.substituters = ["https://cache.nixos.org/"];
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
nix = {
|
||||
binaryCaches = [
|
||||
nix.settings = {
|
||||
substituters = [
|
||||
"https://nix-community.cachix.org"
|
||||
];
|
||||
binaryCachePublicKeys = [
|
||||
trusted-public-keys = [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
];
|
||||
};
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
nix = {
|
||||
binaryCaches = [
|
||||
nix.settings = {
|
||||
substituters = [
|
||||
"https://nrdxp.cachix.org"
|
||||
];
|
||||
binaryCachePublicKeys = [
|
||||
trusted-public-keys = [
|
||||
"nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4="
|
||||
];
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue