1
0
Fork 0
nix-configuration/modules/base/system.nix

131 lines
3 KiB
Nix
Raw Normal View History

2024-02-29 09:53:34 -05:00
{ pkgs, config, lib, inputs, ... }:
# System options
let
cfg = config.host.system;
in
with lib;
{
config = {
# Set up the environment
environment = {
# Install base packages
systemPackages = with pkgs; [
bash
dconf # Needed to fix an issue with Home-manager. See https://github.com/nix-community/home-manager/issues/3113
git
home-manager
nano
p7zip
2024-03-21 09:52:43 -04:00
fastfetch
2024-04-20 01:01:17 -04:00
nh # Nix Helper: https://github.com/viperML/nh
2024-02-29 09:53:34 -05:00
];
2024-04-20 01:01:17 -04:00
variables = {
EDITOR = "nano"; # Set default editor to nano
};
2024-02-29 09:53:34 -05:00
# System configuration file overrides
etc = {
# Reduce systemd logout time to 30s
"systemd/system.conf.d/10-reduce-logout-wait-time.conf" = {
text = ''
[Manager]
DefaultTimeoutStopSec=30s
'';
};
};
};
# Configure automatic updates
2024-02-29 09:53:34 -05:00
system = {
# Enable automatic updates
autoUpgrade = {
enable = true;
flake = "${config.users.users.aires.home}/Development/nix-configuration";
dates = "daily";
2024-02-29 09:53:34 -05:00
allowReboot = false;
2024-03-22 09:28:34 -04:00
operation = "boot"; # Don't switch, just create a boot entry
2024-02-29 09:53:34 -05:00
};
};
# Set your time zone.
time.timeZone = "America/New_York";
# 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";
};
};
# Configure nix
nix = {
2024-04-17 15:29:31 -04:00
# Use the latest and greatest Nix
package = pkgs.nixVersions.unstable;
2024-02-29 09:53:34 -05:00
# Enables Flakes
settings.experimental-features = [ "nix-command" "flakes" ];
# Enable periodic nix store optimization
optimise.automatic = true;
# Configure NixOS to use the same software channel as Flakes
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
};
# Set up base apps
programs = {
direnv.enable = true;
nano = {
enable = true;
syntaxHighlight = true;
nanorc = ''
set linenumbers
set tabsize 4
set softwrap
'';
};
2024-04-20 01:01:17 -04:00
nh = {
enable = true;
flake = "/home/aires/Development/nix-configuration";
# Alternative garbage collection system to nix.gc.automatic
clean = {
enable = true;
dates = "daily";
extraArgs = "--keep-since 7d --keep 10"; # Keep the last 10 entries
};
};
2024-02-29 09:53:34 -05:00
};
2024-03-21 16:17:06 -04:00
services = {
# Scrub BTRFS partitions if the root partition is btrfs
btrfs.autoScrub = lib.mkIf (config.fileSystems."/".fsType == "btrfs") {
enable = true;
interval = "weekly";
fileSystems = [ "/" ];
};
2024-02-29 09:53:34 -05:00
2024-03-21 16:17:06 -04:00
# Enable fwupd (firmware updater)
fwupd.enable = true;
2024-02-29 09:53:34 -05:00
2024-03-21 16:17:06 -04:00
# Allow systemd user services to keep running after the user has logged out
logind.killUserProcesses = false;
};
2024-02-29 09:53:34 -05:00
};
}