reciproka-ops/profiles/host_common.nix
2024-03-01 03:21:55 +10:00

114 lines
3.2 KiB
Nix

# Configuration common to all Reciproka Kolektivo servers
{
config,
pkgs,
lib,
...
}: {
imports = [
../profiles/bash.nix
../profiles/chrony.nix
../profiles/neovim.nix
../profiles/logrotate.nix
../profiles/nix-direnv.nix
../profiles/starship.nix
../profiles/tmux.nix
../profiles/zsh.nix
];
# Common boot settings
boot.tmp.cleanOnBoot = true; # Clean /tmp on reboot ;
# Select internationalisation properties.
i18n = {
defaultLocale = "en_AU.UTF-8"; # Set the default locale
};
# Set the defaul console properties
console = {
keyMap = "us"; # Set the default console key map
font = "ter-powerline-v32n"; # Set the default console font
};
time.timeZone = "Etc/UTC";
documentation.nixos.enable = false; # Disable documentation, save space
# Set security options:
security.sudo.enable = true;
security.sudo.wheelNeedsPassword = false;
# Configure and install required fonts
fonts = {
enableDefaultPackages = true;
fontDir.enable = true;
packages = with pkgs; [
powerline-fonts # Required for Powerline prompts
];
fontconfig.includeUserConf = false;
};
# Adapted from gchristensen and clever
nix = {
nixPath = [
# Ruin the config so we don't accidentally run
# nixos-rebuild switch on the host
(let
cfg =
pkgs.writeText "configuration.nix"
''
assert builtins.trace "This system is managed by Colmena." false;
{}
'';
in "nixos-config=${cfg}")
# Copy the channel version from the deploy host to the target
"nixpkgs=/run/current-system/nixpkgs"
];
gc = {
automatic = true; # Enable Nix garbage collection:
dates = "weekly";
options = "--delete-older-than 90d";
};
extraOptions = ''
show-trace = true # Enable --show-trace by default for nix
builders-use-substitutes = true # Set builders to use caches
'';
settings = {
auto-optimise-store = true;
trusted-users = ["fiscalvelvetpoet"];
};
};
system.extraSystemBuilderCmds = ''
ln -sv ${pkgs.path} $out/nixpkgs
'';
environment.etc.host-nix-channel.source = pkgs.path;
environment.variables = {
BAT_THEME = "Dracula";
};
# Set the system-wide environment
environment = {
systemPackages = with pkgs; [
bat # cat clone with syntax highlighting & Git integration
byobu # text-based window manager and terminal multiplexer.
dnsutils # Bind DNS utilities
fd # A simple, fast and user-friendly alternative to find
git # Distributed version control system
htop # interactive process viewer
hwinfo # Hardware detection tool
killall # kill processes by name
lshw # Detailed information on the hardware configuration
lsof # list open files
mosh # Mobile shell (ssh replacement)
ncdu # Disk usage analyzer with an ncurses interface
nix-index # A files database for nixpkgs
ripgrep # Utility that provides usability of The Silver Searcher with the raw speed of grep
];
};
# Users common across Reciproka Ops:
users.mutableUsers = false; # Remove any users not defined in here
}