nix-dotfiles/systems/configuration.nix

207 lines
4.4 KiB
Nix
Raw Normal View History

{
lib,
pkgs,
config,
...
}:
{
security.auditd.enable = true;
nixpkgs.config.allowUnfree = true;
2023-12-23 06:49:01 +01:00
i18n = {
defaultLocale = "en_US.utf8";
2023-12-25 03:39:20 +01:00
supportedLocales = [ "en_US.UTF-8/UTF-8" ];
2023-12-23 06:49:01 +01:00
};
2023-12-24 20:09:35 +01:00
boot = {
default = true;
kernel.sysctl = {
"net.ipv6.conf.ens3.accept_ra" = 1;
};
2023-12-24 20:09:35 +01:00
};
2023-12-25 03:39:20 +01:00
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
};
users = {
defaultUserShell = pkgs.zsh;
mutableUsers = false;
};
2023-12-27 10:03:13 +01:00
networking = {
firewall = {
enable = lib.mkDefault true;
allowedTCPPorts = [ ];
2023-12-27 10:03:13 +01:00
};
};
2023-12-23 06:49:01 +01:00
services = {
2023-12-29 20:54:12 +01:00
fail2ban = {
enable = lib.mkIf config.networking.firewall.enable (lib.mkDefault true);
2023-12-29 20:54:12 +01:00
recommendedDefaults = true;
};
2023-12-23 06:49:01 +01:00
openssh = {
enable = true;
fixPermissions = true;
extraConfig = "StreamLocalBindUnlink yes";
2023-12-29 20:54:12 +01:00
hostKeys = [
{
bits = 4096;
path = "/etc/ssh/ssh_host_rsa_key";
type = "rsa";
}
{
path = "/etc/ssh/ssh_host_ed25519_key";
type = "ed25519";
}
{
path = "/etc/ssh/ssh_host_ecdsa_key";
type = "ecdsa";
}
];
2023-12-23 06:49:01 +01:00
settings = {
AllowAgentForwarding = "no";
AllowTcpForwarding = "no";
ChallengeResponseAuthentication = "no";
ClientAliveCountMax = lib.mkDefault 2;
2023-12-29 20:54:12 +01:00
Compression = "NO";
IgnoreRhosts = "yes";
LogLevel = lib.mkDefault "VERBOSE";
2023-12-29 20:54:12 +01:00
MaxAuthTries = 3;
MaxSessions = lib.mkDefault 2;
2023-12-23 06:49:01 +01:00
PasswordAuthentication = false;
2023-12-29 20:54:12 +01:00
PermitEmptyPasswords = "no";
PermitRootLogin = "no";
TcpKeepAlive = "no";
X11Forwarding = lib.mkDefault false;
KexAlgorithms = [
"curve25519-sha256@libssh.org"
"diffie-hellman-group-exchange-sha256"
];
Ciphers = [
"chacha20-poly1305@openssh.com"
"aes256-gcm@openssh.com"
"aes128-gcm@openssh.com"
"aes256-ctr"
"aes192-ctr"
"aes128-ctr"
];
Macs = [
"hmac-sha2-512-etm@openssh.com"
"hmac-sha2-256-etm@openssh.com"
"umac-128-etm@openssh.com"
"hmac-sha2-512"
"hmac-sha2-256"
"umac-128@openssh.com"
];
2023-12-23 06:49:01 +01:00
};
};
Add autopull service for testing & pre-commit-hooks (#4) * configure programs for photon * sops fix * Add flake-update-service for testing Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Add sops config Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * add photon password * Fix user password Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * actually fix user config Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * change password for user dennis * removed user password * fixed yaml secrets * yaml is silly, fix my yamls pls Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * quickfix * Enforce systemdboot on palatine-hill Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * reconfigure photon * Fix ZFS config on palatine-hill Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Fix systemd-boot on palatine-hill Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * sops update-keys Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Fix botched merge Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Add custom ssh command Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Fix option name, add package dependency Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Fix option name, add dependency Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * ssh-key path to str Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Fix git command Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Set up nixpkgs.fmt Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Allow autopull to trigger a rebuild Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Revert triggerRebuild on palatine-hill, add clarifying comment Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Attempt pre-commit hooks Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Increase pull frequency Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Fix duplicate flake-utils url Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Add fmt hook Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * add nix-flake-check hook Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Remove unnecessary flake-utils import by name Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Trying to setup inputs for nix-pre-commit Co-authored-by: Dennis <52411861+DerDennisOP@users.noreply.github.com> * Fixing input with flake inputs Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * make autopull service default and fix flake check hook Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Remove pre-commit-config.yml from gitignore that decision seems to be something from one of my previous attempts at this. Given that the config is needed for this to work it only makes sense to have it. /.pre-commit-config.yaml /.pre-commit-config.yaml Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Rollback previous commit. yml file is a softlink Signed-off-by: ahuston-0 <aliceghuston@gmail.com> --------- Signed-off-by: ahuston-0 <aliceghuston@gmail.com> Co-authored-by: Dennis Wuitz <dennish@wuitz.de> Co-authored-by: Dennis <52411861+DerDennisOP@users.noreply.github.com>
2024-01-01 12:41:32 -05:00
autopull = {
enable = true;
ssh-key = "/root/.ssh/id_ed25519_ghdeploy";
path = /root/dotfiles;
Add autopull service for testing & pre-commit-hooks (#4) * configure programs for photon * sops fix * Add flake-update-service for testing Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Add sops config Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * add photon password * Fix user password Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * actually fix user config Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * change password for user dennis * removed user password * fixed yaml secrets * yaml is silly, fix my yamls pls Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * quickfix * Enforce systemdboot on palatine-hill Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * reconfigure photon * Fix ZFS config on palatine-hill Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Fix systemd-boot on palatine-hill Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * sops update-keys Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Fix botched merge Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Add custom ssh command Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Fix option name, add package dependency Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Fix option name, add dependency Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * ssh-key path to str Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Fix git command Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Set up nixpkgs.fmt Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Allow autopull to trigger a rebuild Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Revert triggerRebuild on palatine-hill, add clarifying comment Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Attempt pre-commit hooks Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Increase pull frequency Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Fix duplicate flake-utils url Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Add fmt hook Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * add nix-flake-check hook Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Remove unnecessary flake-utils import by name Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Trying to setup inputs for nix-pre-commit Co-authored-by: Dennis <52411861+DerDennisOP@users.noreply.github.com> * Fixing input with flake inputs Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * make autopull service default and fix flake check hook Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Remove pre-commit-config.yml from gitignore that decision seems to be something from one of my previous attempts at this. Given that the config is needed for this to work it only makes sense to have it. /.pre-commit-config.yaml /.pre-commit-config.yaml Signed-off-by: ahuston-0 <aliceghuston@gmail.com> * Rollback previous commit. yml file is a softlink Signed-off-by: ahuston-0 <aliceghuston@gmail.com> --------- Signed-off-by: ahuston-0 <aliceghuston@gmail.com> Co-authored-by: Dennis Wuitz <dennish@wuitz.de> Co-authored-by: Dennis <52411861+DerDennisOP@users.noreply.github.com>
2024-01-01 12:41:32 -05:00
};
2023-12-23 06:49:01 +01:00
};
programs = {
git = {
enable = true;
lfs.enable = lib.mkDefault true;
2023-12-23 06:49:01 +01:00
config = {
interactive.singlekey = true;
pull.rebase = true;
rebase.autoStash = true;
safe.directory = "/etc/nixos";
};
};
2023-12-25 03:39:20 +01:00
neovim = {
enable = true;
defaultEditor = true;
configure = {
customRC = ''
2023-12-27 10:03:13 +01:00
set undofile " save undo file after quit
set undolevels=1000 " number of steps to save
set undoreload=10000 " number of lines to save
2023-12-25 03:39:20 +01:00
2023-12-27 10:03:13 +01:00
" Save Cursor Position
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
'';
2023-12-25 03:39:20 +01:00
};
};
2023-12-23 06:49:01 +01:00
zsh = {
enable = true;
syntaxHighlighting.enable = true;
zsh-autoenv.enable = true;
enableCompletion = true;
enableBashCompletion = true;
ohMyZsh.enable = true;
shellAliases.update = "sudo nixos-rebuild switch --fast --accept-flake-config --flake /root/dotfiles#${config.networking.hostName} -L |& nom";
2023-12-23 06:49:01 +01:00
autosuggestions = {
enable = true;
strategy = [ "completion" ];
async = true;
};
};
nix-ld = {
enable = true;
libraries = with pkgs; [
acl
attr
bzip2
curl
glib
libglvnd
libmysqlclient
libsodium
libssh
libxml2
openssl
stdenv.cc.cc
systemd
util-linux
xz
zlib
zstd
];
2023-12-23 06:49:01 +01:00
};
};
nix = {
diffSystem = true;
2023-12-23 06:49:01 +01:00
settings = {
experimental-features = [
"nix-command"
"flakes"
];
2023-12-23 06:49:01 +01:00
keep-outputs = true;
builders-use-substitutes = true;
connect-timeout = 20;
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
2023-12-23 06:49:01 +01:00
};
};
system = {
autoUpgrade = {
enable = true;
randomizedDelaySec = "1h";
persistent = true;
flake = "github:RAD-Development/nix-dotfiles";
2023-12-23 06:49:01 +01:00
};
};
}