mio-ops/profiles/host_common.nix

110 lines
3.1 KiB
Nix
Raw Permalink Normal View History

2019-07-02 03:47:20 +00:00
# Configuration common to all my servers
2019-06-27 01:44:00 +00:00
{
2022-03-07 14:26:15 +00:00
config,
pkgs,
lib,
...
}: {
2020-05-10 22:22:52 +00:00
imports = [
../profiles/bash.nix
2021-01-25 05:24:10 +00:00
./chrony.nix
2021-06-01 05:50:27 +00:00
../profiles/neovim.nix
2021-05-25 01:40:51 +00:00
../profiles/logrotate.nix
../profiles/starship.nix
2020-05-10 22:22:52 +00:00
./tmux.nix
2021-03-04 10:48:18 +00:00
./zsh.nix
2020-05-10 22:22:52 +00:00
];
# Common boot settings
boot = {
2021-11-16 04:57:23 +00:00
cleanTmpDir = true; # Clean /tmp on reboot
2020-05-10 22:22:52 +00:00
};
2019-09-06 06:52:44 +00:00
2019-06-27 01:44:00 +00:00
# Select internationalisation properties.
i18n = {
2021-11-16 04:57:23 +00:00
defaultLocale = "en_AU.UTF-8"; # Set the default locale
2020-04-21 08:23:43 +00:00
};
# Set the defaul console properties
console = {
2021-11-16 04:57:23 +00:00
keyMap = "us"; # Set the default console key map
font = "ter-powerline-v16Rv"; # Set the default console font
2019-06-27 01:44:00 +00:00
};
time.timeZone = "Australia/Brisbane"; # Set your preferred timezone:
2021-11-16 04:57:23 +00:00
documentation.nixos.enable = false; # Disable documentation, save space
2019-06-27 01:44:00 +00:00
# Set security options:
security.sudo.enable = true;
security.sudo.wheelNeedsPassword = false;
# Configure and install required fonts
fonts.enableDefaultFonts = true;
2021-06-04 00:32:51 +00:00
fonts.fontDir.enable = true;
2022-03-07 14:26:15 +00:00
fonts.fonts = with pkgs; [
powerline-fonts # Required for Powerline prompts
];
2020-09-03 09:14:20 +00:00
fonts.fontconfig.includeUserConf = false;
2020-06-23 02:31:05 +00:00
# Adapted from gchristensen and clever
nix = {
nixPath = [
# Ruin the config so we don't accidentally run
# nixos-rebuild switch on the host
(let
2021-11-16 04:57:23 +00:00
cfg = pkgs.writeText "configuration.nix" ''
assert builtins.trace "This system is managed by NixOps." false;
{}
'';
2020-06-23 02:31:05 +00:00
in "nixos-config=${cfg}")
# Copy the channel version from the deploy host to the target
"nixpkgs=/run/current-system/nixpkgs"
];
gc = {
2021-11-16 04:57:23 +00:00
automatic = true; # Enable Nix garbage collection:
2020-06-23 02:31:05 +00:00
dates = "weekly";
options = "--delete-older-than 90d";
};
autoOptimiseStore = true;
2020-07-14 01:58:38 +00:00
extraOptions = ''
2021-03-14 23:12:55 +00:00
show-trace = true # Enable --show-trace by default for nix
builders-use-substitutes = true # Set builders to use caches
2020-07-14 01:58:38 +00:00
'';
2022-03-07 14:26:15 +00:00
trustedUsers = ["craige"];
2020-06-23 02:31:05 +00:00
};
2022-03-07 14:26:15 +00:00
networking = {enableIPv6 = true;};
2020-06-23 02:31:05 +00:00
system.extraSystemBuilderCmds = ''
ln -sv ${pkgs.path} $out/nixpkgs
'';
environment.etc.host-nix-channel.source = pkgs.path;
2019-07-02 03:47:20 +00:00
2022-03-07 14:26:15 +00:00
environment.variables = {BAT_THEME = "Dracula";};
2021-07-28 00:29:32 +00:00
2019-07-03 13:00:17 +00:00
# Set the system-wide environment
environment = {
systemPackages = with pkgs; [
2021-11-16 04:57:23 +00:00
bat # cat clone with syntax highlighting & Git integration
dnsutils # Bind DNS utilities
fd # A simple, fast and user-friendly alternative to find
2022-03-07 14:26:15 +00:00
(if config.services.xserver.enable
then gitAndTools.gitFull
else git) # Distributed version control system
2021-11-16 04:57:23 +00:00
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
2019-07-03 13:00:17 +00:00
];
};
2019-06-27 01:44:00 +00:00
# Users common across MIO Ops:
2021-11-16 04:57:23 +00:00
users.mutableUsers = false; # Remove any users not defined in here
2019-06-27 01:44:00 +00:00
}