2020-12-05 14:18:57 +01:00
|
|
|
|
{ config, lib, pkgs, ... }:
|
2021-04-09 11:34:49 +02:00
|
|
|
|
|
2020-12-05 14:18:57 +01:00
|
|
|
|
{
|
|
|
|
|
# Options that affect multiple modules
|
|
|
|
|
options.sbruder = {
|
2021-01-20 16:23:18 +01:00
|
|
|
|
full = lib.mkOption {
|
|
|
|
|
type = lib.types.bool;
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to build the full system. If disabled, the system closure will
|
|
|
|
|
be smaller, but some features will not be available.
|
|
|
|
|
'';
|
|
|
|
|
default = true;
|
|
|
|
|
};
|
2020-12-05 15:44:58 +01:00
|
|
|
|
gui.enable = lib.mkEnableOption "gui";
|
2021-07-26 20:43:52 +02:00
|
|
|
|
games = {
|
|
|
|
|
enable = lib.mkEnableOption "games";
|
|
|
|
|
performanceIndex = lib.mkOption {
|
|
|
|
|
type = lib.types.int;
|
|
|
|
|
description = ''
|
|
|
|
|
Arbitrary number specifying how powerful the machine is. To be
|
|
|
|
|
replaced by taking into account single- and multi-core CPU and GPU
|
|
|
|
|
metrics separately should this system not map to my machines in
|
|
|
|
|
practice.
|
|
|
|
|
|
|
|
|
|
* 2: ~ 2014 ultrabook
|
|
|
|
|
* 8: ~ 2016 quad-core workstation with mid-range GPU
|
|
|
|
|
'';
|
|
|
|
|
default = 1;
|
|
|
|
|
};
|
|
|
|
|
};
|
2020-12-05 14:18:57 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# All modules are imported but non-essential modules are activated by
|
|
|
|
|
# configuration options
|
|
|
|
|
imports = [
|
2021-01-31 19:47:54 +01:00
|
|
|
|
../pkgs/modules.nix
|
2020-12-05 14:18:57 +01:00
|
|
|
|
./cups.nix
|
|
|
|
|
./docker.nix
|
|
|
|
|
./fonts.nix
|
|
|
|
|
./grub.nix
|
2021-01-01 12:32:55 +01:00
|
|
|
|
./gui.nix
|
2021-01-07 13:39:25 +01:00
|
|
|
|
./initrd-ssh.nix
|
2020-12-05 15:37:44 +01:00
|
|
|
|
./libvirt.nix
|
2020-12-05 14:18:57 +01:00
|
|
|
|
./locales.nix
|
2021-02-06 12:16:05 +01:00
|
|
|
|
./mailserver.nix
|
2020-12-31 15:44:24 +01:00
|
|
|
|
./media-proxy.nix
|
2021-05-31 23:02:11 +02:00
|
|
|
|
./mullvad
|
2020-12-05 14:18:57 +01:00
|
|
|
|
./network-manager.nix
|
2021-02-15 12:09:55 +01:00
|
|
|
|
./nginx-interactive-index
|
2021-03-05 15:57:21 +01:00
|
|
|
|
./nginx.nix
|
2021-04-09 11:34:49 +02:00
|
|
|
|
./nix.nix
|
2020-12-05 14:18:57 +01:00
|
|
|
|
./office.nix
|
|
|
|
|
./prometheus/node_exporter.nix
|
2020-12-05 16:42:49 +01:00
|
|
|
|
./pubkeys.nix
|
2021-07-10 12:44:09 +02:00
|
|
|
|
./pipewire.nix
|
2021-02-28 12:21:04 +01:00
|
|
|
|
./restic
|
2021-01-06 13:09:29 +01:00
|
|
|
|
./secrets.nix
|
2020-12-05 14:18:57 +01:00
|
|
|
|
./ssh.nix
|
|
|
|
|
./tools.nix
|
|
|
|
|
./udev.nix
|
2021-01-03 16:28:35 +01:00
|
|
|
|
./unfree.nix
|
2020-12-05 14:39:36 +01:00
|
|
|
|
./wireguard
|
2020-12-05 14:18:57 +01:00
|
|
|
|
];
|
|
|
|
|
|
2021-02-05 15:36:51 +01:00
|
|
|
|
config = lib.mkMerge [
|
|
|
|
|
{
|
|
|
|
|
# Essential system tools
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
|
git
|
|
|
|
|
git-crypt # used to store secrets in configuration
|
|
|
|
|
git-lfs # not so essential, but required to clone config
|
|
|
|
|
htop
|
|
|
|
|
tmux
|
|
|
|
|
vim
|
2020-12-12 16:15:43 +01:00
|
|
|
|
];
|
2020-12-05 14:18:57 +01:00
|
|
|
|
|
2021-02-05 15:36:51 +01:00
|
|
|
|
# Clean temporary files on boot
|
|
|
|
|
boot.cleanTmpDir = true;
|
|
|
|
|
|
|
|
|
|
# Set zsh as default shell
|
|
|
|
|
programs.zsh.enable = true;
|
|
|
|
|
users.defaultUserShell = pkgs.zsh;
|
2021-02-14 13:29:51 +01:00
|
|
|
|
environment.etc."zshrc.local".source = "${pkgs.grml-zsh-config}/etc/zsh/zshrc";
|
2021-02-05 15:36:51 +01:00
|
|
|
|
|
|
|
|
|
# command-not-found does not work without channels
|
|
|
|
|
programs.command-not-found.enable = false;
|
|
|
|
|
|
|
|
|
|
# Hard drive monitoring
|
|
|
|
|
services.smartd.enable = lib.mkDefault true;
|
|
|
|
|
# Network monitoring
|
|
|
|
|
services.vnstat.enable = true;
|
|
|
|
|
|
|
|
|
|
# Authentication/Encryption agents
|
|
|
|
|
programs.gnupg.agent.enable = true;
|
|
|
|
|
programs.ssh.startAgent = true;
|
|
|
|
|
|
|
|
|
|
# When this is set to true (default), routing everything through a
|
|
|
|
|
# wireguard tunnel does not work.
|
|
|
|
|
networking.firewall.checkReversePath = false;
|
|
|
|
|
|
2021-03-29 22:26:10 +02:00
|
|
|
|
# Open ports for quick tests
|
|
|
|
|
networking.firewall = {
|
|
|
|
|
allowedTCPPortRanges = lib.singleton { from = 9990; to = 9999; };
|
|
|
|
|
allowedUDPPortRanges = lib.singleton { from = 9990; to = 9999; };
|
|
|
|
|
};
|
|
|
|
|
|
2021-02-05 15:36:51 +01:00
|
|
|
|
# Globally set Let’s Encrypt requirements
|
|
|
|
|
security.acme = {
|
|
|
|
|
acceptTerms = true;
|
|
|
|
|
email = "security@sbruder.de";
|
|
|
|
|
};
|
2021-04-25 09:50:03 +02:00
|
|
|
|
|
|
|
|
|
system.activationScripts.diff = ''
|
|
|
|
|
[ -L /run/current-system ] && ${pkgs.nixUnstable}/bin/nix \
|
|
|
|
|
--experimental-features 'nix-command' \
|
|
|
|
|
store \
|
|
|
|
|
diff-closures /run/current-system "$systemConfig"
|
|
|
|
|
'';
|
2021-02-05 15:36:51 +01:00
|
|
|
|
}
|
|
|
|
|
(lib.mkIf (!config.sbruder.full) {
|
|
|
|
|
# Adapted from nixpkgs/nixos/modules/profiles/minimal.nix
|
|
|
|
|
i18n.supportedLocales = map
|
|
|
|
|
(locale: locale + "/UTF-8")
|
|
|
|
|
((lib.singleton config.i18n.defaultLocale)
|
|
|
|
|
++ (lib.attrValues config.i18n.extraLocaleSettings));
|
|
|
|
|
|
|
|
|
|
documentation.enable = lib.mkDefault false;
|
|
|
|
|
})
|
|
|
|
|
];
|
2020-12-05 14:18:57 +01:00
|
|
|
|
}
|