infra/profiles/common.nix

53 lines
1.2 KiB
Nix
Raw Normal View History

2019-08-11 19:53:02 +01:00
{ pkgs, lib, config, ... }:
{
imports = [ ./security.nix ];
# Nicer interactive shell
programs.fish.enable = true;
# And for the zsh peeps
programs.zsh.enable = true;
# Entropy gathering daemon
services.haveged.enable = true;
nix = let
asGB = size: toString (size * 1024 * 1024);
in {
extraOptions = ''
# auto-free the /nix/store
min-free = ${asGB 10}
max-free = ${asGB 200}
'';
# Hard-link duplicated files
autoOptimiseStore = true;
};
# No mutable users
users.mutableUsers = false;
services.openssh.enable = true;
networking.firewall.allowedTCPPorts = [
22
];
# Make debugging failed units easier
systemd.extraConfig = ''
DefaultStandardOutput=journal
DefaultStandardError=journal
'';
# The nix-community is global :)
time.timeZone = "UTC";
# Assign keys from all users in wheel group
# This is only done because nixops cant be deployed from any other account
users.extraUsers.root.openssh.authorizedKeys.keys = lib.unique (lib.flatten (
builtins.map (u: u.openssh.authorizedKeys.keys)
(lib.attrValues (lib.filterAttrs (_: u: lib.elem "wheel" u.extraGroups)
config.users.extraUsers))));
}