2022-03-08 14:02:04 +00:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2022-03-08 01:42:46 +00:00
|
|
|
}: {
|
2022-03-08 14:02:04 +00:00
|
|
|
imports = [../../common ./admin.nix ../../cachix.nix];
|
2018-02-08 22:16:23 +00:00
|
|
|
|
2020-10-04 14:24:18 +00:00
|
|
|
i18n.defaultLocale = "en_US.UTF-8";
|
2018-05-29 19:52:35 +00:00
|
|
|
|
2020-05-21 23:13:42 +00:00
|
|
|
# For nixos-rebuild
|
2020-12-16 18:26:20 +00:00
|
|
|
nixpkgs.overlays =
|
2022-03-08 14:02:04 +00:00
|
|
|
[(_: _: (import ../../channels.nix)."${config.networking.hostName}")]
|
|
|
|
++ import ../../overlays {inherit lib;};
|
2020-05-21 23:13:42 +00:00
|
|
|
|
2019-08-02 17:03:36 +00:00
|
|
|
time.timeZone = "Europe/Berlin";
|
2018-02-08 22:55:24 +00:00
|
|
|
|
2019-08-02 17:03:36 +00:00
|
|
|
networking = {
|
2022-04-10 23:10:13 +00:00
|
|
|
resolvconf.dnsExtensionMechanism = false; # this breaks dnssec but is necessary for certain bad-behaved hotspots
|
2019-08-02 17:03:36 +00:00
|
|
|
firewall.allowPing = true;
|
2022-04-10 23:10:13 +00:00
|
|
|
useDHCP = false; # enabled per interface
|
2019-08-02 17:03:36 +00:00
|
|
|
hosts = lib.zipAttrs
|
2022-03-08 14:02:04 +00:00
|
|
|
(
|
|
|
|
lib.mapAttrsToList
|
|
|
|
(host: ip:
|
|
|
|
if builtins.typeOf ip == "set"
|
|
|
|
then {}
|
|
|
|
else {"${ip}" = "${host} ${host}.m-0.eu";})
|
|
|
|
config.m-0.hosts
|
|
|
|
);
|
2019-08-02 17:03:36 +00:00
|
|
|
};
|
2018-02-08 22:16:23 +00:00
|
|
|
|
2022-06-02 22:32:02 +00:00
|
|
|
security.acme = {
|
|
|
|
defaults.email = "security@maralorn.de";
|
2020-04-26 15:38:32 +00:00
|
|
|
acceptTerms = true;
|
|
|
|
};
|
|
|
|
|
2020-10-01 05:10:28 +00:00
|
|
|
users = {
|
|
|
|
defaultUserShell = pkgs.zsh;
|
|
|
|
mutableUsers = false;
|
|
|
|
};
|
2019-02-22 00:45:45 +00:00
|
|
|
|
2019-08-02 17:03:36 +00:00
|
|
|
environment = {
|
2022-03-08 01:42:46 +00:00
|
|
|
etc =
|
|
|
|
lib.mapAttrs'
|
2022-03-08 14:02:04 +00:00
|
|
|
(name: value: lib.nameValuePair "nix-path/${name}" {source = value;})
|
|
|
|
(lib.filterAttrs (name: value: name != "__functor") pkgs.sources)
|
2022-03-08 01:42:46 +00:00
|
|
|
// {
|
2022-03-08 02:19:09 +00:00
|
|
|
"nix-path/nixos".source = pkgs.sources."${pkgs.nixpkgs-channel}";
|
|
|
|
"nix-path/nixpkgs".source = pkgs.sources."${pkgs.nixpkgs-channel}";
|
2022-03-08 01:42:46 +00:00
|
|
|
"nix-path/home-manager".source =
|
2022-03-08 02:19:09 +00:00
|
|
|
pkgs.sources."${pkgs.home-manager-channel}";
|
2022-03-08 01:42:46 +00:00
|
|
|
};
|
2020-04-18 14:42:22 +00:00
|
|
|
variables =
|
2022-03-08 14:02:04 +00:00
|
|
|
lib.genAttrs ["CURL_CA_BUNDLE" "GIT_SSL_CAINFO" "SSL_CERT_FILE"]
|
|
|
|
(_: "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt");
|
2019-08-02 17:03:36 +00:00
|
|
|
};
|
2019-07-23 17:21:56 +00:00
|
|
|
|
2020-09-30 23:30:40 +00:00
|
|
|
system.activationScripts =
|
2022-03-08 14:02:04 +00:00
|
|
|
lib.mkIf (!pkgs.withSecrets) {text = "echo No secrets loaded!; exit 1;";};
|
2020-09-30 23:30:40 +00:00
|
|
|
|
2019-08-02 17:03:36 +00:00
|
|
|
nix = {
|
2021-10-26 23:32:09 +00:00
|
|
|
binaryCaches = lib.mkAfter (
|
2022-03-08 14:02:04 +00:00
|
|
|
pkgs.privateValue [] "binary-caches"
|
2022-03-05 18:48:50 +00:00
|
|
|
# ++ (
|
|
|
|
# if config.networking.hostName != "hera" then [ "ssh-ng://nix-ssh@hera.m-0.eu?trusted=true&priority=100" ] else [ ]
|
|
|
|
# )
|
2021-10-26 23:32:09 +00:00
|
|
|
);
|
2022-03-08 01:42:46 +00:00
|
|
|
binaryCachePublicKeys = [
|
|
|
|
"ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI="
|
|
|
|
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
|
|
|
|
"nixbuild.net/maralorn-1:cpqv21sJgRL+ROaKY1Gr0k7AKolAKaP3S3iemGxK/30="
|
|
|
|
];
|
2022-03-08 14:02:04 +00:00
|
|
|
nixPath = ["/etc/nix-path"];
|
|
|
|
trustedUsers = ["maralorn" "laminar"];
|
|
|
|
buildMachines = pkgs.privateValue [] "remote-builders";
|
2019-08-12 10:54:55 +00:00
|
|
|
extraOptions = ''
|
2022-03-07 16:13:18 +00:00
|
|
|
experimental-features = nix-command flakes
|
2019-08-12 10:54:55 +00:00
|
|
|
fallback = true
|
2020-09-30 23:30:40 +00:00
|
|
|
auto-optimise-store = true
|
|
|
|
builders-use-substitutes = true
|
2019-08-12 10:54:55 +00:00
|
|
|
'';
|
2021-01-30 22:24:32 +00:00
|
|
|
optimise = {
|
2022-03-08 14:02:04 +00:00
|
|
|
dates = [];
|
2021-01-30 22:24:32 +00:00
|
|
|
automatic = true;
|
|
|
|
};
|
2019-08-02 17:03:36 +00:00
|
|
|
};
|
2019-04-29 00:06:22 +00:00
|
|
|
|
2022-03-08 14:02:04 +00:00
|
|
|
systemd.services = let
|
|
|
|
hosts = builtins.attrNames config.services.nginx.virtualHosts;
|
|
|
|
makeConfig = host: {
|
|
|
|
name = "acme-${host}";
|
|
|
|
value = {
|
|
|
|
serviceConfig = {
|
|
|
|
Restart = "on-failure";
|
|
|
|
RestartSec = 600;
|
|
|
|
};
|
|
|
|
unitConfig = {
|
|
|
|
StartLimitIntervalSec = 2400;
|
|
|
|
StartLimitBurst = 3;
|
2020-06-15 13:55:16 +00:00
|
|
|
};
|
|
|
|
};
|
2022-03-08 14:02:04 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
{nix-optimise.serviceConfig.Type = "oneshot";} // builtins.listToAttrs (map makeConfig hosts);
|
2020-06-15 13:55:16 +00:00
|
|
|
|
2019-08-02 17:03:36 +00:00
|
|
|
services = {
|
2021-12-22 14:08:34 +00:00
|
|
|
logind.killUserProcesses = false;
|
2022-01-04 14:13:55 +00:00
|
|
|
journald.extraConfig = "SystemMaxUse=5G";
|
2019-08-02 17:03:36 +00:00
|
|
|
prometheus.exporters = {
|
|
|
|
node = {
|
|
|
|
enable = true;
|
2022-03-08 14:02:04 +00:00
|
|
|
enabledCollectors = ["systemd" "logind"];
|
|
|
|
disabledCollectors = ["timex"];
|
2019-03-07 23:37:39 +00:00
|
|
|
};
|
2019-02-22 00:45:45 +00:00
|
|
|
nginx = {
|
2022-03-08 02:19:09 +00:00
|
|
|
inherit (config.services.nginx) enable;
|
2019-08-02 17:03:36 +00:00
|
|
|
openFirewall = true;
|
2019-02-22 00:45:45 +00:00
|
|
|
};
|
|
|
|
};
|
2019-08-02 17:03:36 +00:00
|
|
|
nginx = {
|
|
|
|
statusPage = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedTlsSettings = true;
|
2020-05-17 17:39:45 +00:00
|
|
|
clientMaxBodySize = "500m";
|
2019-08-02 17:03:36 +00:00
|
|
|
};
|
2018-02-08 22:16:23 +00:00
|
|
|
};
|
2020-10-01 05:10:28 +00:00
|
|
|
programs = {
|
2022-03-08 01:42:46 +00:00
|
|
|
command-not-found.dbPath = "${
|
|
|
|
builtins.fetchTarball {
|
|
|
|
url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz";
|
|
|
|
}
|
|
|
|
}/programs.sqlite";
|
2022-03-27 06:37:30 +00:00
|
|
|
git.config.init.defaultBranch = "main";
|
2022-03-08 14:01:15 +00:00
|
|
|
ssh = {
|
|
|
|
extraConfig = pkgs.privateValue "" "ssh-config";
|
|
|
|
startAgent = true;
|
|
|
|
};
|
2020-10-01 05:10:28 +00:00
|
|
|
zsh = {
|
|
|
|
enable = true;
|
|
|
|
autosuggestions.enable = true;
|
|
|
|
enableCompletion = true;
|
|
|
|
syntaxHighlighting.enable = true;
|
|
|
|
};
|
|
|
|
};
|
2018-02-08 22:16:23 +00:00
|
|
|
}
|