mio-ops/profiles/host_common.nix

115 lines
3.2 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.tmp.cleanOnBoot = true; # Clean /tmp on reboot
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
2024-02-06 01:55:33 +00:00
font = "ter-powerline-v32n"; # 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
2024-02-06 01:55:33 +00:00
fonts = {
enableDefaultPackages = true;
fontDir.enable = true;
packages = with pkgs; [
powerline-fonts # Required for Powerline prompts
powerline-symbols # Powerline symbols
];
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";
};
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-12-02 00:13:54 +00:00
settings = {
trusted-users = ["craige"];
auto-optimise-store = true;
};
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-12-02 00:04:25 +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
}