2024-06-24 15:38:28 +00:00
|
|
|
# System options
|
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
2024-12-06 18:04:47 +00:00
|
|
|
namespace,
|
2024-06-24 15:38:28 +00:00
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
2024-12-06 18:04:47 +00:00
|
|
|
cfg = config.${namespace};
|
2024-11-30 03:06:37 +00:00
|
|
|
|
|
|
|
gitWithLibsecret = pkgs.git.override { withLibsecret = true; };
|
2024-06-24 15:38:28 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
2024-12-06 18:04:47 +00:00
|
|
|
${namespace} = {
|
2024-07-25 18:33:47 +00:00
|
|
|
packages = lib.mkOption {
|
|
|
|
description = "Additional system packages to install. This is just a wrapper for environment.systemPackages.";
|
|
|
|
type = lib.types.listOf lib.types.package;
|
|
|
|
default = [ ];
|
|
|
|
example = lib.literalExpression "[ pkgs.firefox pkgs.thunderbird ]";
|
|
|
|
};
|
|
|
|
|
|
|
|
corePackages = lib.mkOption {
|
|
|
|
description = "Minimum set of packages to install.";
|
|
|
|
type = lib.types.listOf lib.types.package;
|
|
|
|
default = with pkgs; [
|
|
|
|
# Courtesy of https://discourse.nixos.org/t/how-to-use-other-packages-binary-in-systemd-service-configuration/14363
|
2024-06-24 16:24:21 +00:00
|
|
|
bash
|
2024-07-25 18:33:47 +00:00
|
|
|
coreutils
|
|
|
|
dconf
|
2024-06-24 16:24:21 +00:00
|
|
|
direnv
|
2024-11-30 03:06:37 +00:00
|
|
|
gitWithLibsecret
|
2024-07-25 18:33:47 +00:00
|
|
|
gnutar
|
|
|
|
gzip
|
2024-06-24 16:24:21 +00:00
|
|
|
home-manager
|
2024-10-10 16:16:37 +00:00
|
|
|
openssh
|
2024-07-25 18:33:47 +00:00
|
|
|
sudo
|
|
|
|
xz.bin
|
2024-11-29 04:52:58 +00:00
|
|
|
# Packages required for decrypting config files
|
|
|
|
transcrypt
|
|
|
|
openssl
|
|
|
|
xxd
|
2024-07-25 18:33:47 +00:00
|
|
|
];
|
|
|
|
};
|
2024-06-24 15:38:28 +00:00
|
|
|
};
|
2024-07-25 18:33:47 +00:00
|
|
|
};
|
|
|
|
config = {
|
|
|
|
# Install base packages
|
|
|
|
environment.systemPackages = cfg.corePackages ++ cfg.packages;
|
2024-06-24 15:38:28 +00:00
|
|
|
|
|
|
|
services = {
|
2024-09-08 15:58:56 +00:00
|
|
|
# Automatically set the timezone based on location
|
2024-08-11 23:08:42 +00:00
|
|
|
automatic-timezoned.enable = true;
|
2024-08-14 09:51:37 +00:00
|
|
|
geoclue2.enableDemoAgent = lib.mkForce true;
|
2024-08-11 23:08:42 +00:00
|
|
|
|
2024-06-24 15:38:28 +00:00
|
|
|
# Enable fwupd (firmware updater)
|
|
|
|
fwupd.enable = true;
|
|
|
|
|
|
|
|
# Allow systemd user services to keep running after the user has logged out
|
|
|
|
logind.killUserProcesses = false;
|
|
|
|
|
|
|
|
# Enable disk monitoring
|
|
|
|
smartd = {
|
|
|
|
enable = true;
|
|
|
|
autodetect = true;
|
2024-11-22 17:47:18 +00:00
|
|
|
notifications = {
|
|
|
|
wall.enable = true;
|
2024-12-06 18:04:47 +00:00
|
|
|
mail = lib.mkIf config.${namespace}.services.msmtp.enable {
|
2024-11-22 17:47:18 +00:00
|
|
|
enable = true;
|
|
|
|
mailer = "/run/wrappers/bin/sendmail";
|
2024-12-09 18:30:39 +00:00
|
|
|
sender = "${config.networking.hostName}@${config.${namespace}.secrets.networking.domains.primary}";
|
|
|
|
recipient = config.${namespace}.secrets.users.aires.email;
|
2024-11-22 17:47:18 +00:00
|
|
|
};
|
|
|
|
};
|
2024-06-24 15:38:28 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-08-11 23:08:42 +00:00
|
|
|
# Enable visual updates
|
|
|
|
system.activationScripts.diff = {
|
|
|
|
supportsDryActivation = true;
|
|
|
|
text = ''
|
|
|
|
${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-07-23 22:13:19 +00:00
|
|
|
# Limit logout stop timer duration to 30 seconds
|
|
|
|
systemd.user.extraConfig = ''
|
2024-06-24 15:38:28 +00:00
|
|
|
DefaultTimeoutStopSec=30s
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Select internationalisation properties.
|
|
|
|
i18n = {
|
|
|
|
defaultLocale = "en_US.UTF-8";
|
|
|
|
|
|
|
|
extraLocaleSettings = {
|
|
|
|
LC_ADDRESS = "en_US.UTF-8";
|
|
|
|
LC_IDENTIFICATION = "en_US.UTF-8";
|
|
|
|
LC_MEASUREMENT = "en_US.UTF-8";
|
|
|
|
LC_MONETARY = "en_US.UTF-8";
|
|
|
|
LC_NAME = "en_US.UTF-8";
|
|
|
|
LC_NUMERIC = "en_US.UTF-8";
|
|
|
|
LC_PAPER = "en_US.UTF-8";
|
|
|
|
LC_TELEPHONE = "en_US.UTF-8";
|
|
|
|
LC_TIME = "en_US.UTF-8";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|