feat: massive refactor

This commit is contained in:
2025-12-20 12:57:47 +08:00
parent f4c1b313ce
commit 454ad5885d
97 changed files with 1023 additions and 960 deletions

49
profiles/base.nix Normal file
View File

@@ -0,0 +1,49 @@
{
config,
hostname,
...
}:
{
# I prefer this to the default issue text
# ported from ArchLinux IIRC
environment.etc.issue.text = "\\e{lightcyan}\\S\\e{reset} Login (\\l)\n\n";
networking.hostName = hostname;
# don't change this unless you know what you are doing!
# for further information, see wiki.nixos.org
system.stateVersion = "24.11";
# disable this since we already have machine-id persisted
systemd.services."systemd-machine-id-commit".enable = !config.my.persist.enable;
# Enable core modules (user, nix, xdg, time are enabled by default)
my = {
user.enable = true;
nix.enable = true;
xdg.enable = true;
time.enable = true;
};
# Base persistence configuration
my.persist = {
nixosDirs = [
"/root"
"/var"
"/etc/ssh"
];
nixosFiles = [
"/etc/machine-id"
];
homeDirs = [
{
directory = ".ssh";
mode = "0700";
}
];
};
# Home Manager base configuration
my.hm = {
# nicely reload system units when changing configs
systemd.user.startServices = "sd-switch";
home.stateVersion = "24.11";
};
}

47
profiles/desktop.nix Normal file
View File

@@ -0,0 +1,47 @@
{ lib, ... }:
{
# Boot loader configuration
boot.loader = {
efi.canTouchEfiVariables = true;
systemd-boot = {
enable = true;
configurationLimit = 10;
};
grub.enable = false;
timeout = 0;
};
security.pam.loginLimits = [
{
domain = "*";
type = "soft";
item = "nofile";
value = "524288";
}
];
# Graphics support
hardware.graphics = {
enable = true;
enable32Bit = true;
};
# Printing service
services.printing.enable = true;
# GVFS for virtual filesystems
services.gvfs.enable = true;
# Enable desktop-related modules by default
my = {
audio.enable = true;
bluetooth.enable = true;
fonts.enable = true;
};
# Desktop persistence
my.persist = {
enable = lib.mkDefault true;
location = lib.mkDefault "/nix/persist";
};
}

26
profiles/server.nix Normal file
View File

@@ -0,0 +1,26 @@
{ lib, ... }:
{
# Boot loader configuration
boot.loader = {
efi.canTouchEfiVariables = true;
systemd-boot = {
enable = true;
configurationLimit = 10;
};
grub.enable = false;
timeout = 0;
};
# Disable desktop features on servers
my = {
audio.enable = false;
bluetooth.enable = false;
fonts.enable = false;
};
# Server persistence
my.persist = {
enable = lib.mkDefault true;
location = lib.mkDefault "/nix/persist";
};
}

24
profiles/wsl.nix Normal file
View File

@@ -0,0 +1,24 @@
{ username, lib, ... }:
{
# WSL-specific configuration
wsl = {
enable = true;
defaultUser = username;
};
# Fix VSCode remote
programs.nix-ld.enable = true;
# Force platform (WSL is always x86_64-linux)
nixpkgs.hostPlatform = lib.mkForce "x86_64-linux";
# Disable desktop features
my = {
audio.enable = false;
bluetooth.enable = false;
fonts.enable = false;
};
# Disable persistence for WSL
my.persist.enable = false;
}