restructure

This commit is contained in:
Henri Dohmen 2025-07-14 14:45:55 +02:00
parent 4922f8f7cb
commit ffe40ca5e7
25 changed files with 84 additions and 66 deletions

22
common/boot.nix Normal file
View file

@ -0,0 +1,22 @@
{ pkgs, ... }:
{
boot = {
loader = {
efi.canTouchEfiVariables = true;
grub = {
enable = true;
efiSupport = true;
device = "nodev";
};
};
# otherwise /tmp is on disk. This *may* be problematic as nix
# builds in /tmp but I think my swap is large enough...
tmp.useTmpfs = true;
kernelPackages = pkgs.linuxPackages_6_12;
kernel.sysctl."kernel.sysrq" = 1;
initrd.systemd.network.wait-online.enable = false;
};
}

15
common/default.nix Normal file
View file

@ -0,0 +1,15 @@
{ var, ... }:
{
imports = [
../mod
../desktop
./boot.nix
./locale.nix
./nix.nix
./security.nix
./shell.nix
./users.nix
];
networking.extraHosts = var.lan-dns.hostsFile;
}

25
common/locale.nix Normal file
View file

@ -0,0 +1,25 @@
{ ... }:
{
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 = "";
};
}

17
common/nix.nix Normal file
View file

@ -0,0 +1,17 @@
{
lib,
inputs,
config,
...
}:
{
nix.settings = {
experimental-features = [
"nix-command"
"flakes"
];
trusted-users = [ "root" ];
auto-optimise-store = true;
};
nixpkgs.config.allowUnfree = false;
}

22
common/security.nix Normal file
View file

@ -0,0 +1,22 @@
{
config,
lib,
pkgs,
...
}:
{
security = {
protectKernelImage = true;
sudo.enable = false;
doas = {
enable = true;
extraRules = [
{
groups = [ "wheel" ];
persist = true;
keepEnv = true;
}
];
};
};
}

45
common/shell.nix Normal file
View file

@ -0,0 +1,45 @@
{ pkgs, inputs, ... }:
{
environment.shells = with pkgs; [
bashInteractive
fish
];
environment.systemPackages = with pkgs; [
docker-compose
fd
htop
killall
ripgrep
unzip
wget
colmena
unison
dnsutils
];
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;
}

27
common/users.nix Normal file
View file

@ -0,0 +1,27 @@
{
pkgs,
lib,
options,
var,
...
}:
{
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.unprivileged;
hashedPassword = "$y$jDT$dhvO.xqs8mopz.sFFul.q/$ud5642o7CnVetU6QEu0ctiVMFh7ngZznDf0wp4cXos8";
};
users.root = {
hashedPassword = "!";
openssh.authorizedKeys.keys = var.ssh-keys.priviliged;
};
};
}