mio-ops/profiles/host_common.nix

129 lines
3.9 KiB
Nix
Raw 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
{ config, pkgs, lib, ... }:
{
2019-09-06 06:52:44 +00:00
2020-05-10 22:22:52 +00:00
imports = [
2021-01-25 05:24:10 +00:00
./chrony.nix
2020-05-10 22:22:52 +00:00
./tmux.nix
];
# Common boot settings
boot = {
cleanTmpDir = 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 = {
2020-04-21 08:23:43 +00:00
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-v16Rv"; # Set the default console font
2019-06-27 01:44:00 +00:00
};
time.timeZone = "Australia/Brisbane"; # Set your preferred timezone:
# Set security options:
security.sudo.enable = true;
security.sudo.wheelNeedsPassword = false;
# Configure and install required fonts
fonts.enableDefaultFonts = true;
fonts.enableFontDir = true;
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
cfg = pkgs.writeText "configuration.nix"
''
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 = {
automatic = true; # Enable Nix garbage collection:
dates = "weekly";
options = "--delete-older-than 90d";
};
autoOptimiseStore = true;
2020-07-14 01:58:38 +00:00
extraOptions = ''
show-trace = true # Enable --show-trace by default for nix
'';
2020-10-21 00:19:48 +00:00
trustedUsers = ["craige"];
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
2019-07-03 13:00:17 +00:00
# Set the system-wide environment
environment = {
systemPackages = with pkgs; [
2019-08-20 11:04:28 +00:00
byobu # text-based window manager and terminal multiplexer.
2020-06-14 06:11:20 +00:00
direnv # A shell extension that manages your environment
2020-03-18 23:59:47 +00:00
dnsutils # Bind DNS utilities
2021-01-25 05:34:01 +00:00
fd # A simple, fast and user-friendly alternative to find
2020-04-07 12:16:37 +00:00
(if config.services.xserver.enable then gitAndTools.gitFull else git) # Distributed version control system
2020-05-27 11:53:59 +00:00
htop # interactive process viewer
2020-06-14 06:17:07 +00:00
hwinfo # Hardware detection tool
2020-06-14 06:11:20 +00:00
killall # kill processes by name
lshw # Detailed information on the hardware configuration
lsof # list open files
2020-05-27 11:53:59 +00:00
mosh # Mobile shell (ssh replacement)
2020-04-07 12:21:47 +00:00
ncdu # Disk usage analyzer with an ncurses interface
2020-05-05 09:21:21 +00:00
nix-index # A files database for nixpkgs
2020-04-21 08:23:43 +00:00
#openssl # A cryptographic library that implements the SSL and TLS protocols
2020-06-01 03:10:25 +00:00
ripgrep # Utility that provides usability of The Silver Searcher with the raw speed of grep
2019-09-10 11:13:48 +00:00
(
2021-03-03 05:52:21 +00:00
import ../profiles/vim.nix
2019-09-10 11:13:48 +00:00
)
2019-07-03 13:00:17 +00:00
];
variables = {
EDITOR = [ "vim"]; # Set the default editor
};
2019-07-03 13:00:17 +00:00
};
2019-12-10 14:37:04 +00:00
# Program defaults for all hosts
2019-07-02 03:47:20 +00:00
programs.zsh = {
enable = true;
autosuggestions = {
enable = true;
};
2019-11-12 23:30:29 +00:00
interactiveShellInit = ''
2020-04-21 22:15:25 +00:00
export TERM="xterm-256color"
2019-11-12 23:30:29 +00:00
eval "$(direnv hook zsh)"
2020-03-06 04:53:43 +00:00
test -r ~/.dir_colors && eval $(dircolors ~/.dir_colors)
export GPG_TTY="$(tty)"
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpgconf --launch gpg-agent
2019-11-12 23:30:29 +00:00
'';
2019-07-03 13:00:17 +00:00
ohMyZsh = {
2019-07-02 03:47:20 +00:00
enable = true;
2020-05-05 09:21:21 +00:00
plugins = [ "git" ];
2019-07-02 03:47:20 +00:00
};
2020-01-07 00:01:42 +00:00
promptInit = "source ${pkgs.zsh-powerlevel9k}/share/zsh-powerlevel9k/powerlevel9k.zsh-theme";
2019-07-02 03:47:20 +00:00
};
2019-06-27 01:44:00 +00:00
2019-12-10 14:37:04 +00:00
users.defaultUserShell = pkgs.zsh; # Set the default shell for all users
2019-07-02 03:12:01 +00:00
2019-06-27 01:44:00 +00:00
# Users common across MIO Ops:
users.mutableUsers = false; # Remove any users not defined in here
}