prettified config

This commit is contained in:
Lyn 2024-10-18 23:01:33 +02:00
parent 40b9733f57
commit c09b1e8e17
8 changed files with 35 additions and 36 deletions

View file

@ -2,9 +2,9 @@
imports = imports =
[ [
./hardware-configuration.nix ./hardware-configuration.nix
./../../users/lyn
]; ];
lyn.sops.secrets."hosts/forgejo-ci/forgejo_ci_token" = {}; lyn.sops.secrets."hosts/forgejo-ci/forgejo_ci_token" = {};
lyn.users.lyn.enable = true;
lyn.kernel.latest.enable = true; lyn.kernel.latest.enable = true;
lyn.kernel.hardened.enable = true; lyn.kernel.hardened.enable = true;
lyn.profiles.base.enable = true; lyn.profiles.base.enable = true;
@ -12,13 +12,9 @@
lyn.services.forgejo-ci.enable = true; lyn.services.forgejo-ci.enable = true;
lyn.services.forgejo-ci.domain = "git.shibe.pro"; lyn.services.forgejo-ci.domain = "git.shibe.pro";
lyn.services.forgejo-ci.instancename = "shibepro-ci"; lyn.services.forgejo-ci.instancename = "shibepro-ci";
# Use UEFI
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
networking.hostName = "forgejo-ci"; # Define your hostname. networking.hostName = "forgejo-ci"; # Define your hostname.
# Firewall stuff:
networking.firewall.enable = true;
networking.firewall.allowPing = true;
system.stateVersion = "23.05"; system.stateVersion = "23.05";
} }

View file

@ -1,11 +1,10 @@
{ config, pkgs, lib, inputs, ... }: { { config, pkgs, lib, inputs, ... }: {
imports = imports =
[ [
./../../users/lyn
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
lyn.sops.secrets."hosts/forgenite/forgejo_db_password".owner = "forgejo"; lyn.sops.secrets."hosts/forgenite/forgejo_db_password".owner = "forgejo";
lyn.users.lyn.enable = true;
lyn.kernel.latest.enable = true; lyn.kernel.latest.enable = true;
lyn.kernel.hardened.enable =true; lyn.kernel.hardened.enable =true;
lyn.profiles.base.enable = true; lyn.profiles.base.enable = true;
@ -18,10 +17,6 @@
lyn.services.forgejo.domain = "git.shibe.pro"; lyn.services.forgejo.domain = "git.shibe.pro";
networking.hostName = "forgenite"; # Define your hostname. networking.hostName = "forgenite"; # Define your hostname.
# Firewall stuff:
networking.firewall.enable = true;
networking.firewall.allowPing = true;
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave # on your system were taken. It's perfectly fine and recommended to leave
@ -30,10 +25,5 @@
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment? system.stateVersion = "24.05"; # Did you read the comment?
nix.gc = {
automatic = true;
persistent = true;
options = "--delete-older-than 8d";
};
} }

View file

@ -2,36 +2,31 @@
imports = imports =
[ [
./hardware-configuration.nix ./hardware-configuration.nix
./../../users/lyn
]; ];
lyn.kernel.latest.enable = true; lyn.kernel.latest.enable = true;
lyn.profiles.base.enable = true; lyn.profiles.base.enable = true;
lyn.users.lyn.enable = true;
networking.useDHCP = true;
# Use UEFI
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelParams = [ "ip=dhcp" ];
# Firewall stuff:
networking.firewall.enable = true;
networking.firewall.allowPing = true;
networking.hostName = "supernova"; networking.hostName = "supernova";
system.stateVersion = "24.05"; boot.loader.efi.canTouchEfiVariables = true;
# this is overridden by the secureboot profile, still here so the system retains a bootloader in case secure boot profile is disabled:
boot.loader.systemd-boot.enable = true;
# Firmware updates: # Firmware updates:
services.fwupd.enable = true; services.fwupd.enable = true;
############## ##1##3##3##7##
## Security ## ## Security ##
############## ##1##3##3##7##
# Kernel hardening # Kernel hardening
lyn.kernel.hardened.enable = true; lyn.kernel.hardened.enable = true;
# Secure boot # Secure boot
lyn.profiles.secureboot.enable = true; lyn.profiles.secureboot.enable = true;
# FDE stuff # FDE + initrd stuff
boot.kernelParams = [ "ip=dhcp" ];
boot.loader.timeout = 2; boot.loader.timeout = 2;
boot.initrd = { boot.initrd = {
availableKernelModules = [ "r8169" ]; availableKernelModules = [ "r8169" ];
@ -42,11 +37,15 @@
ssh = { ssh = {
enable = true; enable = true;
port = 2222; port = 2222;
# WARNING: this key will be globally accessible through Nix store. Don't use the booted/decrypted systems host key here.
hostKeys = [ /root/initrd-ssh-key ]; hostKeys = [ /root/initrd-ssh-key ];
# this includes the ssh keys of all users in the wheel group, but you can just specify some keys manually # this includes the ssh keys of all users in the wheel group, but you can just specify some keys manually
# authorizedKeys = [ "ssh-rsa ..." ]; # authorizedKeys = [ "ssh-rsa ..." ];
authorizedKeys = with lib; concatLists (mapAttrsToList (name: user: if elem "wheel" user.extraGroups then user.openssh.authorizedKeys.keys else []) config.users.users); authorizedKeys = with lib; concatLists (mapAttrsToList (name: user: if elem "wheel" user.extraGroups then user.openssh.authorizedKeys.keys else []) config.users.users);
}; };
}; };
}; };
system.stateVersion = "24.05";
} }

View file

@ -15,7 +15,7 @@
boot.initrd.systemd.enable = true; boot.initrd.systemd.enable = true;
boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/db8a5cf9-c54b-4e6a-b3f9-e6323eb962a6"; boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/db8a5cf9-c54b-4e6a-b3f9-e6323eb962a6";
# doubles SSD performance because r/w queue is unnecessary here # doubles SSD performance because r/w queue is unnecessary here
boot.initrd.luks.devices."root".bypassWorkqueues = true; boot.initrd.luks.devices."root".bypassWorkqueues = true;
fileSystems."/" = fileSystems."/" =

View file

@ -1,6 +1,7 @@
{lib, pkgs, config, cfg, ...}: let {lib, pkgs, config, cfg, ...}: let
ifApparmor = cfg.apparmor.enable; ifApparmor = cfg.apparmor.enable;
in { in {
# TODO: Update this
opt.apparmor.enable = lib.mkEnableOption "apparmor"; opt.apparmor.enable = lib.mkEnableOption "apparmor";
boot.kernelPackages = let boot.kernelPackages = let
kernel = pkgs.linux-libre; kernel = pkgs.linux-libre;

View file

@ -5,8 +5,13 @@
nix.package = config.pkgsInstances.unstable.lix; nix.package = config.pkgsInstances.unstable.lix;
environment.variables.EDITOR = "nvim"; environment.variables.EDITOR = "nvim";
# TODO
time.timeZone = "Europe/Berlin"; time.timeZone = "Europe/Berlin";
# Firewall base config:
networking.firewall.enable = lib.mkDefault true;
networking.firewall.allowPing = true;
# SSH:
services.openssh = { services.openssh = {
enable = true; enable = true;
settings = { settings = {
@ -16,7 +21,9 @@
}; };
openFirewall = true; openFirewall = true;
}; };
# Disable password checking for wheel group users so we can solely rely on ssh keys
# Disable password checking for wheel group users so we can rely on ssh keys.
# WARNING: This has an security impact!
security.sudo.wheelNeedsPassword = false; security.sudo.wheelNeedsPassword = false;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -27,4 +34,10 @@
curl curl
htop htop
]; ];
nix.gc = {
automatic = true;
persistent = true;
options = "--delete-older-than 8d";
};
} }

View file

@ -1,4 +1,4 @@
{lib,pkgs, config, ...}:{ {lib,pkgs, config, cfg, ...}:{
imports = [ imports = [
./ssh.nix ./ssh.nix
]; ];