common: move to modules, move some files out, modules: adjust dir structure

This commit is contained in:
wo2wz 2025-10-04 18:32:46 -04:00
parent ed5f8c3ae6
commit 0bc9abc4c0
43 changed files with 86 additions and 83 deletions

14
modules/common/boot.nix Executable file
View file

@ -0,0 +1,14 @@
{ config, ... }:
{
boot = {
loader = {
systemd-boot = {
enable = true;
editor = false;
configurationLimit = 5;
};
efi.canTouchEfiVariables = true;
};
};
}

View file

@ -0,0 +1,5 @@
{ config, lib, ... }:
{
environment.defaultPackages = lib.mkForce [];
}

View file

@ -1,8 +1,12 @@
{ config, ... }:
{ config, pkgs, lib, ... }:
{
imports = [
./stylix.nix
./yubikey.nix
./boot.nix
./default-packages.nix
./locales.nix
./networking.nix
./nix.nix
./users.nix
];
}

20
modules/common/locales.nix Executable file
View file

@ -0,0 +1,20 @@
{ config, ... }:
{
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
};
time.timeZone = "America/New_York";
}

5
modules/common/networking.nix Executable file
View file

@ -0,0 +1,5 @@
{ hostName, config, ... }:
{
networking.hostName = "${hostName}";
}

18
modules/common/nix.nix Executable file
View file

@ -0,0 +1,18 @@
{ config, ... }:
{
nix = {
channel.enable = false;
gc.automatic = true;
optimise = {
automatic = true;
dates = [ "weekly" ];
};
settings = {
experimental-features = [ "nix-command" "flakes" ];
download-buffer-size = 524288000;
};
};
nixpkgs.config.allowUnfree = true;
}

12
modules/common/users.nix Executable file
View file

@ -0,0 +1,12 @@
{ hostName, config, ... }:
{
users.users.wo2w = {
isNormalUser = true;
description = "${hostName}";
extraGroups = [ "networkmanager" "wheel" ];
# make new user logins (iso/vm/new machine) use a default password
initialPassword = "1234";
};
}

View file

@ -2,10 +2,8 @@
{
imports = [
./bash.nix
./gaming.nix
./kde.nix
# ./niri.nix
./tailscale.nix
./programs
./services
./system
];
}

View file

@ -0,0 +1,11 @@
{ config, ... }:
{
imports = [
./bash.nix
./gaming.nix
./git.nix
./kde.nix
./ssh.nix
];
}

26
modules/nixos/programs/ssh.nix Executable file
View file

@ -0,0 +1,26 @@
{ config, pkgs, ... }:
{
programs.ssh = {
startAgent = true;
enableAskPassword = true;
extraConfig = "
IdentityFile /home/wo2w/.ssh/ssh-key
User wo2w
Host gameserver
Hostname 192.168.2.221
Port 22
Host Swordsmachine
Hostname 192.168.2.84
Port 8743
Host Earthmover
Hostname 192.168.2.87
Port 8743
";
};
environment = {
systemPackages = if config.services.desktopManager.plasma6.enable then with pkgs; [ kdePackages.ksshaskpass ] else [];
variables.SSH_ASKPASS_REQUIRE = "prefer";
};
}

View file

@ -0,0 +1,9 @@
{ config, ... }:
{
imports = [
./mumble.nix
./openssh.nix
./tailscale.nix
];
}

View file

@ -0,0 +1,14 @@
{ config, ... }:
{
services.openssh = {
enable = true;
ports = [ 8743 ];
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
PermitRootLogin = "no";
AllowUsers = [ "wo2w" ];
};
};
}

View file

@ -0,0 +1,12 @@
{ config, ... }:
{
imports = [
./desktop.nix
./home-manager.nix
./scx.nix
./stylix.nix
./swap.nix
./yubikey.nix
];
}

View file

@ -0,0 +1,40 @@
{ config, pkgs, ... }:
{
networking.networkmanager.enable = true;
hardware = {
bluetooth = {
enable = true;
powerOnBoot = true;
};
# mesa graphics library
graphics.enable = true;
};
# audio
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
security.rtkit.enable = true;
# CUPS
services.printing.enable = true;
# enable native wayland in chromium/electron
environment.sessionVariables.NIXOS_OZONE_WL = "1";
environment.systemPackages = with pkgs; [
bitwarden
krita
vlc
gpu-screen-recorder-gtk
];
# needed alongside the GUI app for promptless recording
programs.gpu-screen-recorder.enable = true;
}

View file

@ -0,0 +1,18 @@
{ inputs, config, ... }:
{
imports = [ inputs.home-manager.nixosModules.home-manager ];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "bak";
extraSpecialArgs = { inherit inputs; };
users.wo2w = {
home = {
username = "wo2w";
homeDirectory = "/home/wo2w";
};
};
};
}

View file

@ -0,0 +1,10 @@
{ config, pkgs, ... }:
{
services.scx = {
enable = true;
package = pkgs.scx.rustscheds;
# use gaming performance scheduler
scheduler = "scx_lavd";
};
}

8
modules/nixos/system/swap.nix Executable file
View file

@ -0,0 +1,8 @@
{ config, ... }:
{
swapDevices = [ {
device = "/var/swapfile";
size = 16*1024;
} ];
}