reciproka-ops/profiles/host_common.nix

114 lines
3.1 KiB
Nix
Raw Normal View History

2021-10-07 02:13:48 +00:00
# Configuration common to all JFDIC servers
{
2022-08-15 07:32:25 +00:00
config,
pkgs,
lib,
...
}: {
2021-10-07 02:13:48 +00:00
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 = {
2022-08-15 07:32:25 +00:00
cleanTmpDir = true; # Clean /tmp on reboot
2021-10-07 02:13:48 +00:00
};
# Select internationalisation properties.
i18n = {
2022-08-15 07:32:25 +00:00
defaultLocale = "en_AU.UTF-8"; # Set the default locale
2021-10-07 02:13:48 +00:00
};
# Set the defaul console properties
console = {
2022-08-15 07:32:25 +00:00
keyMap = "us"; # Set the default console key map
font = "ter-powerline-v16Rv"; # Set the default console font
2021-10-07 02:13:48 +00:00
};
time.timeZone = "Etc/UTC";
2022-08-15 07:32:25 +00:00
documentation.nixos.enable = false; # Disable documentation, save space
2021-10-07 02:13:48 +00:00
# Set security options:
security.sudo.enable = true;
security.sudo.wheelNeedsPassword = false;
# Configure and install required fonts
fonts.enableDefaultFonts = true;
fonts.fontDir.enable = true;
fonts.fonts = with pkgs; [
2022-08-15 07:32:25 +00:00
powerline-fonts # Required for Powerline prompts
2021-10-07 02:13:48 +00:00
];
fonts.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
2022-08-15 07:32:25 +00:00
cfg =
pkgs.writeText "configuration.nix"
2021-10-07 02:13:48 +00:00
''
assert builtins.trace "This system is managed by NixOps." false;
{}
'';
in "nixos-config=${cfg}")
# Copy the channel version from the deploy host to the target
"nixpkgs=/run/current-system/nixpkgs"
];
gc = {
2022-08-15 07:32:25 +00:00
automatic = true; # Enable Nix garbage collection:
2021-10-07 02:13:48 +00:00
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;
2023-05-02 01:32:17 +00:00
trusted-users = ["fiscalvelvetpoet"];
};
2021-10-07 02:13:48 +00:00
};
system.extraSystemBuilderCmds = ''
ln -sv ${pkgs.path} $out/nixpkgs
'';
environment.etc.host-nix-channel.source = pkgs.path;
environment.variables = {
2022-08-15 07:32:25 +00:00
BAT_THEME = "Dracula";
2021-10-07 02:13:48 +00:00
};
# Set the system-wide environment
environment = {
systemPackages = with pkgs; [
2022-08-15 07:32:25 +00:00
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
2021-10-07 02:13:48 +00:00
];
};
# Users common across JFDIC Ops:
2022-08-15 07:32:25 +00:00
users.mutableUsers = false; # Remove any users not defined in here
2021-10-07 02:13:48 +00:00
}