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