2021-02-23 12:58:29 -08:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
2021-11-02 09:40:51 -07:00
|
|
|
let
|
|
|
|
# Available to all users on the system. Keep it minimal.
|
|
|
|
global-packages = with pkgs; [
|
|
|
|
bind
|
|
|
|
cryptsetup
|
|
|
|
git
|
|
|
|
heimdal
|
|
|
|
openssh_gssapi
|
|
|
|
tldr
|
|
|
|
vim
|
|
|
|
wget
|
|
|
|
];
|
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
import-paths = [
|
|
|
|
./build
|
|
|
|
./host
|
|
|
|
./user
|
|
|
|
];
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
in {
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
imports = let
|
|
|
|
is-regular-file = filename: type: type == "regular" || type == "link";
|
|
|
|
regular-files = path:
|
|
|
|
attrNames (filterAttrs is-regular-file (builtins.readDir path));
|
|
|
|
is-nix-file = filename: (builtins.match "^(.+)\.nix$" filename) != null;
|
|
|
|
nix-files = path:
|
|
|
|
map
|
|
|
|
(file: path + "/${file}")
|
|
|
|
(filter is-nix-file (regular-files path));
|
|
|
|
in concatMap nix-files import-paths;
|
|
|
|
|
|
|
|
config = {
|
|
|
|
environment = {
|
|
|
|
etc.nixos-live.source = ../../.;
|
|
|
|
|
|
|
|
systemPackages = global-packages;
|
|
|
|
|
|
|
|
# shellInit = ''
|
|
|
|
# ${pkgs.gnupg}/bin/gpg-connect-agent /bye
|
|
|
|
# export SSH_AUTH_SOCK=$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket)
|
|
|
|
# '';
|
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
system.autoUpgrade.enable = false;
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
nix = {
|
|
|
|
package = pkgs.nixFlakes;
|
|
|
|
extraOptions = ''
|
2021-11-02 09:40:51 -07:00
|
|
|
experimental-features = nix-command flakes
|
|
|
|
'';
|
2021-11-05 07:06:08 -07:00
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
security.acme.acceptTerms = true;
|
|
|
|
hardware.enableRedistributableFirmware = true;
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
krb5 = {
|
|
|
|
enable = true;
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
appdefaults = {
|
|
|
|
forwardable = true;
|
|
|
|
proxiable = true;
|
|
|
|
encrypt = true;
|
|
|
|
forward = true;
|
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
libdefaults = {
|
|
|
|
allow_weak_crypto = true;
|
|
|
|
dns_lookup_kdc = true;
|
|
|
|
dns_lookup_realm = true;
|
|
|
|
forwardable = true;
|
|
|
|
proxiable = true;
|
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
kerberos = pkgs.heimdalFull;
|
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
services = {
|
|
|
|
openssh = {
|
|
|
|
enable = true;
|
|
|
|
startWhenNeeded = true;
|
|
|
|
useDns = true;
|
|
|
|
permitRootLogin = "prohibit-password";
|
|
|
|
extraConfig = ''
|
2021-11-02 09:40:51 -07:00
|
|
|
GSSAPIAuthentication yes
|
|
|
|
GSSAPICleanupCredentials yes
|
|
|
|
GSSAPIKeyExchange yes
|
|
|
|
GSSAPIStoreCredentialsOnRekey yes
|
|
|
|
'';
|
2021-11-05 07:06:08 -07:00
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
fail2ban = let
|
|
|
|
domain-name = config.fudo.hosts.${config.instance.hostname}.domain;
|
|
|
|
in {
|
|
|
|
enable = config.networking.firewall.enable;
|
|
|
|
bantime-increment.enable = true;
|
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
xserver = {
|
|
|
|
layout = "us";
|
|
|
|
xkbVariant = "dvp";
|
|
|
|
xkbOptions = "ctrl:nocaps";
|
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
# pcscd.enable = true;
|
|
|
|
# udev.packages = with pkgs; [ yubikey-personalization ];
|
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
networking.firewall = {
|
|
|
|
# Allow mosh connections if the firewall is enabled
|
|
|
|
allowedUDPPortRanges = [{
|
|
|
|
from = 60000;
|
|
|
|
to = 60100;
|
|
|
|
}];
|
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
console.useXkbConfig = true;
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
i18n.defaultLocale = "en_US.UTF-8";
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
programs = {
|
|
|
|
mosh.enable = true;
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
bash.enableCompletion = true;
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
fish.enable = true;
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
gnupg.agent = {
|
|
|
|
enable = true;
|
|
|
|
# enableSSHSupport = true;
|
|
|
|
# pinentryFlavor = if cfg.enable-gui then "gnome3" else "curses";
|
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
ssh = {
|
|
|
|
startAgent = true;
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
package = pkgs.openssh_gssapi;
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
extraConfig = ''
|
2021-11-02 09:40:51 -07:00
|
|
|
GSSAPIAuthentication yes
|
|
|
|
GSSAPIDelegateCredentials yes
|
|
|
|
'';
|
2021-11-05 07:06:08 -07:00
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
};
|
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
security.pam = {
|
|
|
|
enableSSHAgentAuth = true;
|
2021-11-02 09:40:51 -07:00
|
|
|
|
2021-11-05 07:06:08 -07:00
|
|
|
services = {
|
|
|
|
sshd = {
|
|
|
|
makeHomeDir = true;
|
|
|
|
sshAgentAuth = true;
|
|
|
|
# This isn't supposed to ask for a code unless ~/.google_authenticator exists...but it does
|
|
|
|
# googleAuthenticator.enable = true;
|
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
};
|
|
|
|
};
|
2021-11-05 07:06:08 -07:00
|
|
|
|
|
|
|
home-manager = {
|
|
|
|
useGlobalPkgs = true;
|
|
|
|
};
|
2021-11-02 09:40:51 -07:00
|
|
|
};
|
2021-02-23 12:58:29 -08:00
|
|
|
}
|