major refactor
This commit is contained in:
parent
20472f8d1b
commit
d778875a1b
32 changed files with 495 additions and 428 deletions
|
|
@ -1,16 +0,0 @@
|
|||
{ var, inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.agenix.nixosModules.default
|
||||
../mod
|
||||
../desktop
|
||||
./locale.nix
|
||||
./nix.nix
|
||||
./security.nix
|
||||
./shell.nix
|
||||
./users.nix
|
||||
];
|
||||
|
||||
environment.defaultPackages = [ ];
|
||||
networking.extraHosts = var.lan-dns.hostsFile;
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
{ ... }:
|
||||
{
|
||||
time.timeZone = "Europe/Berlin";
|
||||
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
i18n.extraLocaleSettings = {
|
||||
LC_ADDRESS = "de_DE.UTF-8";
|
||||
LC_IDENTIFICATION = "de_DE.UTF-8";
|
||||
LC_MEASUREMENT = "de_DE.UTF-8";
|
||||
LC_MONETARY = "de_DE.UTF-8";
|
||||
LC_NAME = "de_DE.UTF-8";
|
||||
LC_NUMERIC = "de_DE.UTF-8";
|
||||
LC_PAPER = "de_DE.UTF-8";
|
||||
LC_TELEPHONE = "de_DE.UTF-8";
|
||||
LC_TIME = "de_DE.UTF-8";
|
||||
};
|
||||
|
||||
console.keyMap = "de";
|
||||
|
||||
# Configure keymap in X11
|
||||
services.xserver.xkb = {
|
||||
layout = "de";
|
||||
variant = "";
|
||||
};
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
inputs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
nix.settings = {
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
trusted-users = [ "root" ];
|
||||
auto-optimise-store = true;
|
||||
};
|
||||
nix.registry = {
|
||||
hd.flake = inputs.self;
|
||||
nixpkgs.flake = inputs.nixpkgs;
|
||||
};
|
||||
nixpkgs.config.allowUnfree = false;
|
||||
}
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
boot = {
|
||||
kernel.sysctl = {
|
||||
"net.ipv4.icmp_ignore_bogus_error_responses" = 1;
|
||||
|
||||
"net.ipv4.conf.default.rp_filter" = 1;
|
||||
"net.ipv4.conf.all.rp_filter" = 1;
|
||||
|
||||
"net.ipv4.conf.all.accept_source_route" = 0;
|
||||
"net.ipv6.conf.all.accept_source_route" = 0;
|
||||
"net.ipv4.conf.all.send_redirects" = 0;
|
||||
"net.ipv4.conf.default.send_redirects" = 0;
|
||||
"net.ipv4.conf.all.accept_redirects" = 0;
|
||||
"net.ipv4.conf.default.accept_redirects" = 0;
|
||||
"net.ipv4.conf.all.secure_redirects" = 0;
|
||||
"net.ipv4.conf.default.secure_redirects" = 0;
|
||||
"net.ipv6.conf.all.accept_redirects" = 0;
|
||||
"net.ipv6.conf.default.accept_redirects" = 0;
|
||||
|
||||
"net.ipv4.tcp_syncookies" = 1;
|
||||
"net.ipv4.tcp_rfc1337" = 1;
|
||||
|
||||
"net.ipv4.tcp_fastopen" = 3;
|
||||
|
||||
"kernel.kptr_restrict" = 2;
|
||||
"randomize_kstack_offset" = "on";
|
||||
"spec_store_bypass_disable" = "on";
|
||||
};
|
||||
# otherwise /tmp is on disk. This *may* be problematic as nix
|
||||
# builds in /tmp but I think my swap is large enough...
|
||||
tmp.useTmpfs = lib.mkDefault true;
|
||||
tmp.cleanOnBoot = lib.mkDefault (!config.boot.tmp.useTmpfs);
|
||||
|
||||
kernelParams = [
|
||||
"init_on_free=1" # zero freed pages
|
||||
"page_alloc.shuffle=1"
|
||||
"page_poison=1"
|
||||
"slab_nomerge"
|
||||
# "slub_debug=FZ" # disabled due to https://lore.kernel.org/all/20210601182202.3011020-5-swboyd@chromium.org/T/#u
|
||||
"vsyscall=none" # diable virtual syscalls
|
||||
];
|
||||
|
||||
blacklistedKernelModules = [
|
||||
"ax25"
|
||||
"netrom"
|
||||
"rose"
|
||||
"adfs"
|
||||
"affs"
|
||||
"bfs"
|
||||
"befs"
|
||||
"cramfs"
|
||||
"efs"
|
||||
"erofs"
|
||||
"exofs"
|
||||
"freevxfs"
|
||||
"f2fs"
|
||||
"hfs"
|
||||
"hpfs"
|
||||
"jfs"
|
||||
"minix"
|
||||
"nilfs2"
|
||||
"ntfs"
|
||||
"omfs"
|
||||
"qnx4"
|
||||
"qnx6"
|
||||
"sysv"
|
||||
"ufs"
|
||||
];
|
||||
};
|
||||
|
||||
security = {
|
||||
protectKernelImage = true;
|
||||
forcePageTableIsolation = true;
|
||||
|
||||
apparmor.enable = true;
|
||||
apparmor.killUnconfinedConfinables = true;
|
||||
|
||||
sudo.enable = false;
|
||||
|
||||
doas = {
|
||||
enable = true;
|
||||
extraRules = [
|
||||
{
|
||||
groups = [ "wheel" ];
|
||||
persist = true;
|
||||
keepEnv = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
pki.certificateFiles = [ ../pki/ca.cert ];
|
||||
};
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
{ pkgs, inputs, ... }:
|
||||
{
|
||||
environment.shells = with pkgs; [
|
||||
bashInteractive
|
||||
fish
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
colmena
|
||||
dnsutils
|
||||
fd
|
||||
htop
|
||||
killall
|
||||
nettools
|
||||
podman-compose
|
||||
podman-tui
|
||||
ripgrep
|
||||
unison
|
||||
unzip
|
||||
wget
|
||||
];
|
||||
|
||||
programs = {
|
||||
fish.enable = true;
|
||||
tmux = {
|
||||
enable = true;
|
||||
clock24 = true;
|
||||
};
|
||||
neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
};
|
||||
};
|
||||
|
||||
# --- Excludes ---
|
||||
programs.nano.enable = false;
|
||||
|
||||
# Enabled by fish but takes soooo long.
|
||||
# This is apparently used by some of fish's
|
||||
# autocomplete features.
|
||||
documentation.man.generateCaches = false;
|
||||
|
||||
# To stop the annoying error on entering wrong commands
|
||||
programs.command-not-found.enable = false;
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
pkgs,
|
||||
secrets,
|
||||
var,
|
||||
...
|
||||
}:
|
||||
{
|
||||
age.secrets.hd-password = {
|
||||
file = secrets."hd-password.age";
|
||||
};
|
||||
|
||||
users = {
|
||||
mutableUsers = false;
|
||||
users."hd" = {
|
||||
description = "Henri";
|
||||
isNormalUser = true;
|
||||
createHome = true;
|
||||
home = "/home/hd";
|
||||
extraGroups = [ "wheel" ];
|
||||
shell = pkgs.fish;
|
||||
packages = [ ];
|
||||
openssh.authorizedKeys.keys = var.ssh-keys.trusted;
|
||||
hashedPasswordFile = config.age.secrets.hd-password.path;
|
||||
};
|
||||
users.root = {
|
||||
hashedPassword = "!";
|
||||
openssh.authorizedKeys.keys = var.ssh-keys.root;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.hd.desktop;
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./accounts.nix
|
||||
./audio.nix
|
||||
./fonts.nix
|
||||
./gpg.nix
|
||||
./network.nix
|
||||
./security.nix
|
||||
./services.nix
|
||||
./software
|
||||
./window-manager.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
hd.desktop.enable = mkEnableOption "Desktop Configuration";
|
||||
home = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
default = { };
|
||||
description = "home-manager configuration.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
hd.desktop = {
|
||||
accounts.enable = lib.mkDefault true;
|
||||
audio.enable = lib.mkDefault true;
|
||||
fonts.enable = lib.mkDefault true;
|
||||
gpg.enable = lib.mkDefault true;
|
||||
network.enable = lib.mkDefault true;
|
||||
security.enable = lib.mkDefault true;
|
||||
services.enable = lib.mkDefault true;
|
||||
software.enable = lib.mkDefault true;
|
||||
wm.enable = lib.mkDefault true;
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfreePredicate =
|
||||
pkg:
|
||||
builtins.elem (lib.getName pkg) [
|
||||
"nvidia-x11"
|
||||
];
|
||||
|
||||
programs.nix-ld.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
modules = [
|
||||
./host/solo
|
||||
./home
|
||||
./common
|
||||
./mod
|
||||
overlays
|
||||
];
|
||||
};
|
||||
|
|
@ -86,7 +86,7 @@
|
|||
modules = [
|
||||
./host/c2
|
||||
./home
|
||||
./common
|
||||
./mod
|
||||
overlays
|
||||
];
|
||||
};
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
modules = [
|
||||
./host/fw
|
||||
./home
|
||||
./common
|
||||
./mod
|
||||
overlays
|
||||
];
|
||||
};
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
};
|
||||
imports = [
|
||||
./host/roam
|
||||
./common
|
||||
./mod
|
||||
overlays
|
||||
];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@
|
|||
...
|
||||
}:
|
||||
{
|
||||
# `options.home` is declared in /mod/desktop/default.nix s.t. it is accessible
|
||||
# even when no home-manager is loaded.
|
||||
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{ inputs, pkgs, ... }:
|
||||
{
|
||||
networking.hostName = "c2";
|
||||
hd.desktop.enable = true;
|
||||
|
||||
age.identityPaths = [
|
||||
"/root/.ssh/id_ed25519"
|
||||
|
|
@ -8,7 +9,6 @@
|
|||
|
||||
imports = with inputs.nixos-hardware.nixosModules; [
|
||||
./hardware-configuration.nix
|
||||
# common-cpu-intel
|
||||
common-pc-laptop
|
||||
common-pc-laptop-ssd
|
||||
];
|
||||
|
|
@ -23,12 +23,9 @@
|
|||
device = "nodev";
|
||||
};
|
||||
};
|
||||
|
||||
resumeDevice = "/dev/disk/by-label/nixswap";
|
||||
|
||||
kernelPackages = pkgs.linuxPackages_6_12;
|
||||
kernel.sysctl."kernel.sysrq" = 1;
|
||||
|
||||
initrd.systemd.network.wait-online.enable = false;
|
||||
};
|
||||
|
||||
|
|
@ -40,36 +37,6 @@
|
|||
cpuFreqGovernor = "ondemand";
|
||||
};
|
||||
|
||||
hd.desktop.enable = true;
|
||||
|
||||
nix = {
|
||||
buildMachines = [
|
||||
{
|
||||
hostName = "noravm";
|
||||
sshUser = "nixremote";
|
||||
system = "x86_64-linux";
|
||||
protocol = "ssh-ng";
|
||||
maxJobs = 32;
|
||||
speedFactor = 2;
|
||||
supportedFeatures = [
|
||||
"nixos-test"
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
"kvm"
|
||||
];
|
||||
mandatoryFeatures = [ ];
|
||||
}
|
||||
];
|
||||
distributedBuilds = true;
|
||||
extraOptions = ''
|
||||
builders-use-substitutes = true
|
||||
'';
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# ====== DON'T CHANGE ======
|
||||
system.stateVersion = "25.05";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@
|
|||
}:
|
||||
{
|
||||
networking.hostName = "fw";
|
||||
hd = {
|
||||
desktop.enable = true;
|
||||
buildMachines.enable = true;
|
||||
};
|
||||
|
||||
age.identityPaths = [
|
||||
"/root/.ssh/id_ed25519"
|
||||
|
|
@ -34,8 +38,6 @@
|
|||
];
|
||||
|
||||
services.fprintd.enable = true;
|
||||
# services.fprintd.tod.enable = true;
|
||||
# security.pam.enableFscrypt = true;
|
||||
|
||||
boot = {
|
||||
lanzaboote = {
|
||||
|
|
@ -45,15 +47,10 @@
|
|||
loader = {
|
||||
systemd-boot.enable = lib.mkForce false;
|
||||
efi.canTouchEfiVariables = true;
|
||||
# grub = {
|
||||
# enable = false;
|
||||
# efiSupport = true;
|
||||
# };
|
||||
};
|
||||
|
||||
kernelPackages = pkgs.linuxPackages_6_18;
|
||||
kernel.sysctl."kernel.sysrq" = 1;
|
||||
|
||||
initrd.systemd.network.wait-online.enable = false;
|
||||
};
|
||||
|
||||
|
|
@ -62,37 +59,6 @@
|
|||
cpuFreqGovernor = "ondemand";
|
||||
};
|
||||
|
||||
nix = {
|
||||
buildMachines = [
|
||||
{
|
||||
hostName = "noravm";
|
||||
sshUser = "nixremote";
|
||||
system = "x86_64-linux";
|
||||
protocol = "ssh-ng";
|
||||
maxJobs = 32;
|
||||
speedFactor = 2;
|
||||
supportedFeatures = [
|
||||
"nixos-test"
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
"kvm"
|
||||
];
|
||||
mandatoryFeatures = [ ];
|
||||
}
|
||||
];
|
||||
distributedBuilds = true;
|
||||
extraOptions = ''
|
||||
builders-use-substitutes = true
|
||||
'';
|
||||
};
|
||||
|
||||
hd.desktop.enable = true;
|
||||
|
||||
networking = {
|
||||
useDHCP = lib.mkDefault true;
|
||||
firewall.enable = true;
|
||||
};
|
||||
|
||||
# ====== DON'T CHANGE ======
|
||||
system.stateVersion = "25.05";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
};
|
||||
|
||||
kernelPackages = pkgs.linuxPackages_6_12;
|
||||
|
||||
initrd.systemd.network.wait-online.enable = false;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,10 @@
|
|||
{
|
||||
networking = {
|
||||
hostName = "solo";
|
||||
|
||||
useDHCP = false;
|
||||
interfaces.enp4s0.useDHCP = true;
|
||||
|
||||
firewall = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
hd.desktop.enable = true;
|
||||
|
||||
age.identityPaths = [
|
||||
"/root/.ssh/id_ed25519"
|
||||
|
|
@ -30,10 +26,8 @@
|
|||
device = "nodev";
|
||||
};
|
||||
};
|
||||
|
||||
kernelPackages = pkgs.linuxPackages_6_18;
|
||||
kernel.sysctl."kernel.sysrq" = 1;
|
||||
|
||||
initrd.systemd.network.wait-online.enable = false;
|
||||
};
|
||||
|
||||
|
|
@ -42,32 +36,6 @@
|
|||
cpuFreqGovernor = "performance";
|
||||
};
|
||||
|
||||
hd.desktop.enable = true;
|
||||
|
||||
nix = {
|
||||
buildMachines = [
|
||||
{
|
||||
hostName = "noravm";
|
||||
sshUser = "nixremote";
|
||||
system = "x86_64-linux";
|
||||
protocol = "ssh-ng";
|
||||
maxJobs = 32;
|
||||
speedFactor = 2;
|
||||
supportedFeatures = [
|
||||
"nixos-test"
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
"kvm"
|
||||
];
|
||||
mandatoryFeatures = [ ];
|
||||
}
|
||||
];
|
||||
distributedBuilds = true;
|
||||
extraOptions = ''
|
||||
builders-use-substitutes = true
|
||||
'';
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
prismlauncher
|
||||
];
|
||||
|
|
|
|||
30
mod/build-machines.nix
Normal file
30
mod/build-machines.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{ lib, config, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.hd.buildMachines.enable = mkEnableOption "Use standard remote builders";
|
||||
config = mkIf config.hd.buildMachines.enable {
|
||||
nix = {
|
||||
buildMachines = [
|
||||
{
|
||||
hostName = "noravm"; # TODO: do not rely on mutable ssh config
|
||||
sshUser = "nixremote";
|
||||
system = "x86_64-linux";
|
||||
protocol = "ssh-ng";
|
||||
maxJobs = 32;
|
||||
speedFactor = 2;
|
||||
supportedFeatures = [
|
||||
"nixos-test"
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
"kvm"
|
||||
];
|
||||
mandatoryFeatures = [ ];
|
||||
}
|
||||
];
|
||||
distributedBuilds = true;
|
||||
extraOptions = ''
|
||||
builders-use-substitutes = true
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
71
mod/common/default.nix
Normal file
71
mod/common/default.nix
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
var,
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
options.hd.common.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Common options that are used on every host by default.";
|
||||
};
|
||||
|
||||
options.hd.common = {
|
||||
locale = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.common.enable;
|
||||
description = "Enable locale settings";
|
||||
};
|
||||
};
|
||||
|
||||
nix = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.common.enable;
|
||||
description = "Enable Nix-related configuration";
|
||||
};
|
||||
};
|
||||
|
||||
security = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.common.enable;
|
||||
description = "Enable security-related configuration";
|
||||
};
|
||||
};
|
||||
|
||||
shell = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.common.enable;
|
||||
description = "Enable basic shell utilities";
|
||||
};
|
||||
};
|
||||
|
||||
users = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.common.enable;
|
||||
description = "Enable default user accounts";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
inputs.agenix.nixosModules.default
|
||||
./locale.nix
|
||||
./nix.nix
|
||||
./security.nix
|
||||
./shell.nix
|
||||
./users.nix
|
||||
];
|
||||
|
||||
config = mkIf config.hd.common.enable {
|
||||
environment.defaultPackages = [ ];
|
||||
networking.extraHosts = var.lan-dns.hostsFile;
|
||||
};
|
||||
}
|
||||
28
mod/common/locale.nix
Normal file
28
mod/common/locale.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ config, lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
config = mkIf config.hd.common.locale.enable {
|
||||
time.timeZone = "Europe/Berlin";
|
||||
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
i18n.extraLocaleSettings = {
|
||||
LC_ADDRESS = "de_DE.UTF-8";
|
||||
LC_IDENTIFICATION = "de_DE.UTF-8";
|
||||
LC_MEASUREMENT = "de_DE.UTF-8";
|
||||
LC_MONETARY = "de_DE.UTF-8";
|
||||
LC_NAME = "de_DE.UTF-8";
|
||||
LC_NUMERIC = "de_DE.UTF-8";
|
||||
LC_PAPER = "de_DE.UTF-8";
|
||||
LC_TELEPHONE = "de_DE.UTF-8";
|
||||
LC_TIME = "de_DE.UTF-8";
|
||||
};
|
||||
|
||||
console.keyMap = "de";
|
||||
|
||||
# Configure keymap in X11
|
||||
services.xserver.xkb = {
|
||||
layout = "de";
|
||||
variant = "";
|
||||
};
|
||||
};
|
||||
}
|
||||
24
mod/common/nix.nix
Normal file
24
mod/common/nix.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
lib,
|
||||
inputs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
config = mkIf config.hd.common.nix.enable {
|
||||
nix.settings = {
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
trusted-users = [ "root" ];
|
||||
auto-optimise-store = true;
|
||||
};
|
||||
nix.registry = {
|
||||
hd.flake = inputs.self;
|
||||
nixpkgs.flake = inputs.nixpkgs;
|
||||
};
|
||||
nixpkgs.config.allowUnfree = false;
|
||||
};
|
||||
}
|
||||
104
mod/common/security.nix
Normal file
104
mod/common/security.nix
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
config = mkIf config.hd.common.security.enable {
|
||||
boot = {
|
||||
kernel.sysctl = {
|
||||
"net.ipv4.icmp_ignore_bogus_error_responses" = 1;
|
||||
|
||||
"net.ipv4.conf.default.rp_filter" = 1;
|
||||
"net.ipv4.conf.all.rp_filter" = 1;
|
||||
|
||||
"net.ipv4.conf.all.accept_source_route" = 0;
|
||||
"net.ipv6.conf.all.accept_source_route" = 0;
|
||||
"net.ipv4.conf.all.send_redirects" = 0;
|
||||
"net.ipv4.conf.default.send_redirects" = 0;
|
||||
"net.ipv4.conf.all.accept_redirects" = 0;
|
||||
"net.ipv4.conf.default.accept_redirects" = 0;
|
||||
"net.ipv4.conf.all.secure_redirects" = 0;
|
||||
"net.ipv4.conf.default.secure_redirects" = 0;
|
||||
"net.ipv6.conf.all.accept_redirects" = 0;
|
||||
"net.ipv6.conf.default.accept_redirects" = 0;
|
||||
|
||||
"net.ipv4.tcp_syncookies" = 1;
|
||||
"net.ipv4.tcp_rfc1337" = 1;
|
||||
|
||||
"net.ipv4.tcp_fastopen" = 3;
|
||||
|
||||
"kernel.kptr_restrict" = 2;
|
||||
"randomize_kstack_offset" = "on";
|
||||
"spec_store_bypass_disable" = "on";
|
||||
};
|
||||
# otherwise /tmp is on disk. This *may* be problematic as nix
|
||||
# builds in /tmp but I think my swap is large enough...
|
||||
tmp.useTmpfs = lib.mkDefault true;
|
||||
tmp.cleanOnBoot = lib.mkDefault (!config.boot.tmp.useTmpfs);
|
||||
|
||||
kernelParams = [
|
||||
"init_on_free=1" # zero freed pages
|
||||
"page_alloc.shuffle=1"
|
||||
"page_poison=1"
|
||||
"slab_nomerge"
|
||||
# "slub_debug=FZ" # disabled due to https://lore.kernel.org/all/20210601182202.3011020-5-swboyd@chromium.org/T/#u
|
||||
"vsyscall=none" # diable virtual syscalls
|
||||
];
|
||||
|
||||
blacklistedKernelModules = [
|
||||
"ax25"
|
||||
"netrom"
|
||||
"rose"
|
||||
"adfs"
|
||||
"affs"
|
||||
"bfs"
|
||||
"befs"
|
||||
"cramfs"
|
||||
"efs"
|
||||
"erofs"
|
||||
"exofs"
|
||||
"freevxfs"
|
||||
"f2fs"
|
||||
"hfs"
|
||||
"hpfs"
|
||||
"jfs"
|
||||
"minix"
|
||||
"nilfs2"
|
||||
"ntfs"
|
||||
"omfs"
|
||||
"qnx4"
|
||||
"qnx6"
|
||||
"sysv"
|
||||
"ufs"
|
||||
];
|
||||
};
|
||||
|
||||
networking.firewall.enable = true;
|
||||
|
||||
security = {
|
||||
protectKernelImage = true;
|
||||
forcePageTableIsolation = true;
|
||||
|
||||
apparmor.enable = true;
|
||||
apparmor.killUnconfinedConfinables = true;
|
||||
|
||||
sudo.enable = false;
|
||||
|
||||
doas = {
|
||||
enable = true;
|
||||
extraRules = [
|
||||
{
|
||||
groups = [ "wheel" ];
|
||||
persist = true;
|
||||
keepEnv = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
pki.certificateFiles = [ ../../pki/ca.cert ];
|
||||
};
|
||||
};
|
||||
}
|
||||
56
mod/common/shell.nix
Normal file
56
mod/common/shell.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
config = mkIf config.hd.common.shell.enable {
|
||||
environment.shells = with pkgs; [
|
||||
bashInteractive
|
||||
fish
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
colmena
|
||||
dnsutils
|
||||
fd
|
||||
htop
|
||||
killall
|
||||
nettools
|
||||
podman-compose
|
||||
podman-tui
|
||||
ripgrep
|
||||
unison
|
||||
unzip
|
||||
wget
|
||||
];
|
||||
|
||||
programs = {
|
||||
fish.enable = true;
|
||||
tmux = {
|
||||
enable = true;
|
||||
clock24 = true;
|
||||
};
|
||||
neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
};
|
||||
};
|
||||
|
||||
# --- Excludes ---
|
||||
programs.nano.enable = false;
|
||||
|
||||
# Enabled by fish but takes soooo long.
|
||||
# This is apparently used by some of fish's
|
||||
# autocomplete features.
|
||||
documentation.man.generateCaches = false;
|
||||
|
||||
# To stop the annoying error on entering wrong commands
|
||||
programs.command-not-found.enable = false;
|
||||
};
|
||||
}
|
||||
36
mod/common/users.nix
Normal file
36
mod/common/users.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
pkgs,
|
||||
secrets,
|
||||
var,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
config = mkIf config.hd.common.users.enable {
|
||||
age.secrets.hd-password = {
|
||||
file = secrets."hd-password.age";
|
||||
};
|
||||
|
||||
users = {
|
||||
mutableUsers = false;
|
||||
users."hd" = {
|
||||
description = "Henri";
|
||||
isNormalUser = true;
|
||||
createHome = true;
|
||||
home = "/home/hd";
|
||||
extraGroups = [ "wheel" ];
|
||||
shell = pkgs.fish;
|
||||
packages = [ ];
|
||||
openssh.authorizedKeys.keys = var.ssh-keys.trusted;
|
||||
hashedPasswordFile = config.age.secrets.hd-password.path;
|
||||
};
|
||||
users.root = {
|
||||
hashedPassword = "!";
|
||||
openssh.authorizedKeys.keys = var.ssh-keys.root;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./build-machines.nix
|
||||
./common
|
||||
./desktop
|
||||
./nginx.nix
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ let
|
|||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hd.desktop.accounts.enable = mkEnableOption "Accounts";
|
||||
config = mkIf cfg.enable {
|
||||
home = {
|
||||
accounts.email.accounts = {
|
||||
|
|
@ -9,8 +9,6 @@ let
|
|||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hd.desktop.audio.enable = mkEnableOption "Audio";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
pavucontrol
|
||||
126
mod/desktop/default.nix
Normal file
126
mod/desktop/default.nix
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
{
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
options.home = lib.mkOption {
|
||||
# used by /home/default.nix
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
default = { };
|
||||
description = "Home Manager configuration for user `hd`. Has no effect if `/home` is not loaded";
|
||||
};
|
||||
|
||||
options.hd.desktop = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Common NixOS configuration of all desktops.";
|
||||
};
|
||||
|
||||
audio = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.desktop.enable;
|
||||
description = "Enable audio configuration";
|
||||
};
|
||||
};
|
||||
|
||||
gpg = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.desktop.enable;
|
||||
description = "Enable GPG configuration";
|
||||
};
|
||||
};
|
||||
|
||||
network = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.desktop.enable;
|
||||
description = "Enable network configuration";
|
||||
};
|
||||
};
|
||||
|
||||
security = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.desktop.enable;
|
||||
description = "Enable desktop security configuration";
|
||||
};
|
||||
};
|
||||
|
||||
software = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.desktop.enable;
|
||||
description = "Enable software installation";
|
||||
};
|
||||
|
||||
development = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.desktop.software.enable;
|
||||
description = "Enable development software";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
windowManager = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.desktop.enable;
|
||||
description = "Enable window manager configuration";
|
||||
};
|
||||
};
|
||||
|
||||
accounts = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.desktop.enable;
|
||||
description = "Enable desktop user accounts";
|
||||
};
|
||||
};
|
||||
|
||||
fonts = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.desktop.enable;
|
||||
description = "Enable font configuration";
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = config.hd.desktop.enable;
|
||||
description = "Enable desktop services";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
./accounts.nix
|
||||
./audio.nix
|
||||
./fonts.nix
|
||||
./gpg.nix
|
||||
./network.nix
|
||||
./security.nix
|
||||
./services.nix
|
||||
./software
|
||||
./window-manager.nix
|
||||
];
|
||||
|
||||
config = mkIf config.hd.desktop.enable {
|
||||
nixpkgs.config.allowUnfreePredicate =
|
||||
pkg:
|
||||
builtins.elem (lib.getName pkg) [
|
||||
"nvidia-x11"
|
||||
];
|
||||
|
||||
programs.nix-ld.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
@ -9,7 +9,6 @@ let
|
|||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hd.desktop.fonts.enable = mkEnableOption "Fonts";
|
||||
config = mkIf cfg.enable {
|
||||
fonts = {
|
||||
packages = with pkgs; [
|
||||
|
|
@ -9,7 +9,6 @@ let
|
|||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hd.desktop.gpg.enable = mkEnableOption "GPG";
|
||||
config = mkIf cfg.enable {
|
||||
home = {
|
||||
home.packages = with pkgs; [
|
||||
|
|
@ -20,11 +19,11 @@ in
|
|||
enable = true;
|
||||
publicKeys = [
|
||||
{
|
||||
source = ../pgp/id-priv.pgp;
|
||||
source = ../../pgp/id-priv.pgp;
|
||||
trust = 5;
|
||||
}
|
||||
{
|
||||
source = ../pgp/id-uni.pgp;
|
||||
source = ../../pgp/id-uni.pgp;
|
||||
trust = 5;
|
||||
}
|
||||
];
|
||||
|
|
@ -11,10 +11,6 @@ let
|
|||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hd.desktop.network = {
|
||||
enable = mkEnableOption "All Network Options";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
hardware.bluetooth.enable = true;
|
||||
|
|
@ -9,7 +9,6 @@ let
|
|||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hd.desktop.security.enable = mkEnableOption "Security";
|
||||
config = mkIf cfg.enable {
|
||||
security.pam = {
|
||||
services.login.enableGnomeKeyring = true;
|
||||
|
|
@ -9,8 +9,6 @@ let
|
|||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hd.desktop.services.enable = mkEnableOption "Services";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services = {
|
||||
printing.enable = true;
|
||||
|
|
@ -11,8 +11,6 @@ in
|
|||
{
|
||||
imports = [ ./development.nix ];
|
||||
|
||||
options.hd.desktop.software.enable = mkEnableOption "Software";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
hd.desktop.software.development.enable = true;
|
||||
|
||||
|
|
@ -9,8 +9,6 @@ let
|
|||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hd.desktop.software.development.enable = mkEnableOption "Dev Software";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
documentation.dev.enable = true;
|
||||
|
||||
|
|
@ -72,7 +70,7 @@ in
|
|||
which-key
|
||||
yaml-mode
|
||||
];
|
||||
extraConfig = builtins.readFile ../../dotfiles/emacs/init.el;
|
||||
extraConfig = builtins.readFile ../../../dotfiles/emacs/init.el;
|
||||
};
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
|
|
@ -5,12 +5,10 @@
|
|||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.hd.desktop.wm;
|
||||
cfg = config.hd.desktop.windowManager;
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
in
|
||||
{
|
||||
options.hd.desktop.wm.enable = mkEnableOption "Window Manager";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Enable the KDE Plasma Desktop Environment.
|
||||
services.displayManager.sddm = {
|
||||
Loading…
Add table
Add a link
Reference in a new issue