Files
nixos-setup/modules/nixos/common/core.nix
T

89 lines
2.2 KiB
Nix

{ pkgs, config, lib, ... }:
{
options.skyg = {
gc = {
rootDays = lib.mkOption {
type = lib.types.int;
description = "How often (in days) we call 'nix-collect-garbage' on root user";
default = 7;
};
userDays = lib.mkOption {
type = lib.types.int;
description = "How often in (days) we call 'nix-collect-garbage' on skyg.user.name";
default = 7;
};
};
nixos.common.minimal = lib.mkOption {
type = lib.types.bool;
description = "Minimal common system: skip heavy always-on packages for lean hosts.";
default = false;
};
};
config = let skyg = config.skyg; in {
# System Packages
services.hydra.useSubstitutes = true;
programs.dconf.enable = true;
programs.nix-ld.enable = true;
nixpkgs.config.allowUnfree = true;
nix = {
optimise.automatic = true;
settings.experimental-features = [ "nix-command" "flakes" ];
};
programs.nh = {
enable = true;
clean.enable = true;
};
environment.systemPackages =
(with pkgs; [
# shell tools
git
usbutils
# shell tools
wget
])
# On lean hosts, skip the heavy server/nix-dev extra tools.
++ (lib.optionals (!config.skyg.nixos.common.minimal) (with pkgs; [
# system utils
nfs-utils
lm_sensors
hwinfo
dig
iperf
# misc
glib-networking
glib
glibc
# printer
system-config-printer
# nix utils
nix-index
nil
cachix
nixpkgs-fmt
nvd
]));
services.xserver.excludePackages = with pkgs; [
xterm
];
# Set your time zone.
time.timeZone = "America/Toronto";
# Select internationalisation properties.
i18n.defaultLocale = "en_CA.UTF-8";
# Storage Clean up
services.cron = {
enable = true;
systemCronJobs = [
"0 23 * * * root nix-collect-garbage --delete-older-than ${toString skyg.gc.rootDays}d"
"0 23 * * * ${skyg.user.name} nix-collect-garbage --delete-older-than ${toString skyg.gc.userDays}d"
];
};
};
}