Complete overhaul

This commit is contained in:
SebastianStork 2024-03-12 21:10:35 +01:00
commit d30d11566d
38 changed files with 1373 additions and 0 deletions

View file

@ -0,0 +1,15 @@
{
config,
lib,
...
}: {
options.myConfig.auto-gc.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.auto-gc.enable {
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
}

View file

@ -0,0 +1,16 @@
{
config,
lib,
...
}: {
options.myConfig.bluetooth.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.bluetooth.enable {
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
services.blueman.enable = true;
hardware.logitech.wireless.enable = true;
};
}

20
modules/system/boot.nix Normal file
View file

@ -0,0 +1,20 @@
{
config,
lib,
...
}: {
options.myConfig.boot.systemd.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.boot.systemd.enable {
boot.tmp.cleanOnBoot = true;
boot.loader = {
systemd-boot = {
enable = true;
editor = false;
configurationLimit = 50;
};
efi.canTouchEfiVariables = true;
timeout = 3;
};
};
}

16
modules/system/comma.nix Normal file
View file

@ -0,0 +1,16 @@
{
inputs,
config,
lib,
...
}: {
imports = [inputs.nix-index-database.nixosModules.nix-index];
options.myConfig.comma.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.comma.enable {
programs.command-not-found.enable = false;
programs.nix-index.enable = true;
programs.nix-index-database.comma.enable = true;
};
}

18
modules/system/de.nix Normal file
View file

@ -0,0 +1,18 @@
{
config,
lib,
...
}: {
options.myConfig.de.qtile.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.de.qtile.enable {
services.xserver = {
enable = true;
windowManager.qtile.enable = true;
desktopManager.wallpaper.mode = "fill";
};
myConfig.x-input.enable = true;
};
}

View file

@ -0,0 +1,19 @@
{
imports = [
./flatpak.nix
./vm.nix
./wlan.nix
./doas.nix
./vpn.nix
./comma.nix
./auto-gc.nix
./sops.nix
./bluetooth.nix
./powersave.nix
./x-input.nix
./de.nix
./dm.nix
./sound.nix
./boot.nix
];
}

20
modules/system/dm.nix Normal file
View file

@ -0,0 +1,20 @@
{
config,
lib,
...
}: {
options.myConfig.dm.lightdm.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.dm.lightdm.enable {
services.xserver = {
enable = true;
displayManager.lightdm = {
enable = true;
greeters.slick.enable = true;
};
};
myConfig.x-input.enable = true;
};
}

25
modules/system/doas.nix Normal file
View file

@ -0,0 +1,25 @@
{
config,
lib,
...
}: {
options.myConfig.doas.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.doas.enable {
security.sudo.enable = false;
security.doas = {
enable = true;
extraRules = [
{
groups = ["wheel"];
keepEnv = true;
persist = true;
}
];
};
environment.shellAliases.sudo = "doas";
programs.bash.interactiveShellInit = lib.mkIf config.myConfig.shell.bash.enable "complete -F _command doas";
};
}

View file

@ -0,0 +1,30 @@
{
config,
pkgs,
lib,
...
}: {
options.myConfig.flatpak.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.flatpak.enable {
services.flatpak.enable = true;
xdg.portal = {
enable = true;
extraPortals = [pkgs.xdg-desktop-portal-gtk];
config.common.default = "*";
};
home-manager.sharedModules = [
{
xdg = {
enable = true;
systemDirs.data = [
"/var/lib/flatpak/exports/share"
"/home/seb/.local/share/flatpak/exports/share"
];
};
}
];
};
}

View file

@ -0,0 +1,25 @@
{
config,
lib,
...
}: {
options.myConfig.powersave.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.powersave.enable {
services.auto-cpufreq = {
enable = true;
settings = {
charger = {
governor = "powersave";
turbo = "never";
energy_performance_preference = "power";
};
battery = {
governor = "powersave";
turbo = "never";
energy_performance_preference = "power";
};
};
};
};
}

17
modules/system/sops.nix Normal file
View file

@ -0,0 +1,17 @@
{
inputs,
config,
lib,
...
}: {
imports = [inputs.sops-nix.nixosModules.sops];
options.myConfig.sops.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.sops.enable {
sops = {
age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];
defaultSopsFile = ../../hosts/dell-laptop/secrets.yaml;
};
};
}

19
modules/system/sound.nix Normal file
View file

@ -0,0 +1,19 @@
{
config,
lib,
...
}: {
options.myConfig.sound.pipewire.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.sound.pipewire.enable {
security.rtkit.enable = true;
hardware.pulseaudio.enable = false;
services.pipewire = {
enable = true;
wireplumber.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
};
}

28
modules/system/vm.nix Normal file
View file

@ -0,0 +1,28 @@
{
config,
pkgs,
lib,
...
}: {
options.myConfig.vm.qemu.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.vm.qemu.enable {
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
environment.systemPackages = [
pkgs.quickemu
pkgs.quickgui
];
home-manager.sharedModules = [
{
dconf.settings."org/virt-manager/virt-manager/connections" = {
autoconnect = ["qemu:///system"];
uris = ["qemu:///system"];
};
}
];
};
}

37
modules/system/vpn.nix Normal file
View file

@ -0,0 +1,37 @@
{
config,
lib,
...
}: {
options.myConfig.vpn.lgs.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.vpn.lgs.enable {
sops.secrets = {
"vpn/lgs/crt" = {};
"vpn/lgs/key" = {};
};
services.openvpn.servers.lgs = {
autoStart = false;
config = ''
dev tap
persist-tun
persist-key
data-ciphers AES-128-GCM:AES-256-CBC
data-ciphers-fallback AES-256-CBC
auth SHA1
tls-client
client
resolv-retry infinite
remote 194.9.190.11 1194 udp4
nobind
auth-user-pass
ca ${config.sops.secrets."vpn/lgs/crt".path}
tls-auth ${config.sops.secrets."vpn/lgs/key".path} 1
remote-cert-tls server
explicit-exit-notify
'';
};
};
}

96
modules/system/wlan.nix Normal file
View file

@ -0,0 +1,96 @@
{
config,
lib,
...
}: {
options.myConfig.wlan.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.wlan.enable {
sops.secrets."wlan.env" = {};
networking.networkmanager = {
enable = true;
ensureProfiles = {
environmentFiles = [config.sops.secrets."wlan.env".path];
profiles = {
home = {
connection = {
id = "home";
uuid = "24b856a6-27eb-4c4f-b85c-f59ab0824965";
type = "wifi";
interface-name = "wlp2s0";
};
wifi = {
mode = "infrastructure";
ssid = "$HOME_SSID";
};
wifi-security = {
auth-alg = "open";
key-mgmt = "wpa-psk";
psk = "$HOME_PSK";
};
ipv4 = {method = "auto";};
ipv6 = {
addr-gen-mode = "default";
method = "auto";
};
};
mobile = {
connection = {
id = "mobile";
uuid = "e3a749cf-a103-4e1e-a50c-4a4898bafcf6";
type = "wifi";
interface-name = "wlp2s0";
};
wifi = {
mode = "infrastructure";
ssid = "$MOBILE_SSID";
};
wifi-security = {
auth-alg = "open";
key-mgmt = "wpa-psk";
psk = "$MOBILE_PSK";
};
ipv4 = {method = "auto";};
ipv6 = {
addr-gen-mode = "default";
method = "auto";
};
};
school = {
connection = {
id = "school";
uuid = "bfdf4e7f-d2c4-4ab6-b833-37ecd5199b22";
type = "wifi";
interface-name = "wlp2s0";
};
wifi = {
mode = "infrastructure";
ssid = "$SCHOOL_SSID";
};
wifi-security = {
auth-alg = "open";
key-mgmt = "wpa-eap";
};
"802-1x" = {
domain-suffix-match = "lgs-hu.eu";
eap = "ttls;";
identity = "$SCHOOL_ID";
password = "$SCHOOL_PSK";
phase2-auth = "pap";
};
ipv4 = {method = "auto";};
ipv6 = {
addr-gen-mode = "default";
method = "auto";
};
};
};
};
};
};
}

View file

@ -0,0 +1,29 @@
{
config,
lib,
...
}: {
options.myConfig.x-input.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.x-input.enable {
services.xserver = {
enable = true;
xkb = {
layout = "de";
variant = "nodeadkeys";
};
libinput = {
enable = true;
touchpad = {
accelProfile = "adaptive";
naturalScrolling = true;
disableWhileTyping = true;
};
mouse.accelProfile = "flat";
};
};
};
}