feat: add much required NixOS stuff

This commit is contained in:
Kat Inskip 2023-01-29 08:07:48 -08:00
parent a1d954f29a
commit e29aa76eac
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
47 changed files with 1324 additions and 72 deletions

9
nixos/common/base16.nix Normal file
View file

@ -0,0 +1,9 @@
{ config, ... }: {
base16 = {
inherit (config.home-manager.users.kat.base16) defaultSchemeName defaultScheme schemes;
console = {
enable = true;
getty.enable = true;
};
};
}

29
nixos/common/boot.nix Normal file
View file

@ -0,0 +1,29 @@
{ config, lib, std, ... }: let
inherit (lib.modules) mkDefault mkIf mkMerge;
inherit (std) list;
in {
boot = mkMerge [
({
kernel.sysctl = {
"fs.inotify.max_user_watches" = 524288;
"net.core.rmem_max" = 16777216;
"net.core.wmem_max" = 16777216;
"net.ipv4.tcp_rmem" = "4096 87380 16777216";
"net.ipv4.tcp_wmem" = "4096 65536 16777216";
"net.ipv4.ip_forward" = "1";
"net.ipv6.conf.all.forwarding" = "1";
};
loader = {
grub.configurationLimit = 8;
systemd-boot.configurationLimit = 8;
};
tmpOnTmpfs = true;
tmpOnTmpfsSize = "80%";
kernelPackages = mkIf (list.elem "zfs" config.boot.supportedFilesystems) (mkDefault config.boot.zfs.package.latestCompatibleLinuxPackages);
})
(mkIf (list.elem "zfs" config.boot.supportedFilesystems) {
kernelPackages = mkDefault config.boot.zfs.package.latestCompatibleLinuxPackages;
zfs.enableUnstable = true;
})
];
}

3
nixos/common/docs.nix Normal file
View file

@ -0,0 +1,3 @@
_: {
documentation.nixos.enable = false;
}

10
nixos/common/getty.nix Normal file
View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, std, ... }: let
inherit (std) string;
inherit (lib.modules) mkForce;
in
{
console = {
font = "Tamzen7x14";
earlySetup = true;
};
}

View file

@ -1,6 +0,0 @@
_: {
boot.loader = {
grub.configurationLimit = 8;
systemd-boot.configurationLimit = 8;
};
}

20
nixos/common/locale.nix Normal file
View file

@ -0,0 +1,20 @@
{ pkgs, ... }: {
fonts.fonts = [
pkgs.tamzen
];
i18n = {
defaultLocale = "en_CA.UTF-8";
supportedLocales = [
"en_CA.UTF-8/UTF-8"
"en_GB.UTF-8/UTF-8"
"en_US.UTF-8/UTF-8"
"en_DK.UTF-8/UTF-8"
];
};
console = {
packages = [ pkgs.tamzen ];
font = "Tamzen7x14";
earlySetup = true;
keyMap = "uk";
};
}

3
nixos/common/network.nix Normal file
View file

@ -0,0 +1,3 @@
_: {
networking.nftables.enable = true;
}

6
nixos/common/shell.nix Normal file
View file

@ -0,0 +1,6 @@
_: {
programs.zsh = {
enable = true;
enableCompletion = true;
};
}

26
nixos/common/ssh.nix Normal file
View file

@ -0,0 +1,26 @@
{ config, lib, std, ... }: let
inherit (lib.modules) mkDefault;
inherit (std) list;
in {
networking.firewall = {
allowedTCPPorts = [ (list.unsafeHead config.services.openssh.ports) ];
allowedUDPPortRanges = [ { from = 60000; to = 61000; } ];
};
services.openssh = {
enable = true;
kexAlgorithms = [ "curve25519-sha256@libssh.org" ];
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
PermitRootLogin = mkDefault "prohibit-password";
};
extraConfig = ''
PubkeyAcceptedAlgorithms +ssh-rsa
StreamLocalBindUnlink yes
LogLevel VERBOSE
'';
};
programs.mosh.enable = true;
}

12
nixos/common/time.nix Normal file
View file

@ -0,0 +1,12 @@
_: {
services.tzupdate.enable = true;
systemd.timers."tzupdate" = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "5m";
OnUnitActiveSec = "5m";
Unit = "tzupdate.service";
};
};
}

3
nixos/common/users.nix Normal file
View file

@ -0,0 +1,3 @@
_: {
users.mutableUsers = false;
}