refactor(nixos): simplify shared defaults

This commit is contained in:
2026-09-08 18:39:07 -04:00
parent 3a3c612a83
commit e40652b1a0
2 changed files with 128 additions and 44 deletions

View File

@@ -7,54 +7,33 @@
}:
# The shared foundation for every host and guest.
let
inherit (lib) mkOption types;
user = config.user;
pinArgs = prev: {
inherit (prev.stdenv.hostPlatform) system;
config.allowUnfree = true;
};
stateVersion = "26.05";
in
{
imports = [ inputs.home-manager.nixosModules.home-manager ];
options.user = {
name = mkOption {
type = types.str;
name = lib.mkOption {
type = lib.types.str;
default = "alexion";
description = ''
Primary interactive user for this system.
This drives the system account and Home Manager user together.
'';
};
description = mkOption {
type = types.str;
default = "Alexion";
description = "Human-readable description for the primary user.";
};
};
config = {
nixpkgs.overlays = [
(_final: prev: {
unstable = import inputs.nixpkgs-unstable (pinArgs prev);
stable = import inputs.nixpkgs-stable (pinArgs prev);
})
];
nixpkgs.config.allowUnfree = true;
system.stateVersion = stateVersion;
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
system.stateVersion = "26.05";
time.timeZone = "America/New_York";
i18n.defaultLocale = "en_GB.UTF-8";
users.users.${user.name} = {
users.users.${config.user.name} = {
isNormalUser = true;
description = user.description;
extraGroups = [
"wheel"
"storage"
@@ -63,16 +42,16 @@ in
users.groups.storage.gid = 10000;
time.timeZone = "America/New_York";
i18n.defaultLocale = "en_GB.UTF-8";
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs;
};
users.${user.name} = {
home.username = user.name;
home.homeDirectory = "/home/${user.name}";
home.stateVersion = "26.05";
users.${config.user.name} = {
home.username = config.user.name;
home.homeDirectory = "/home/${config.user.name}";
home.stateVersion = stateVersion;
home.packages = with pkgs; [
eza
wget
@@ -85,10 +64,6 @@ in
command = "eza -alg --color=always --group-directories-first --icons=always";
abbreviation = false;
};
la = {
command = "eza -a --color=always --group-directories-first --icons=always";
abbreviation = false;
};
ll = {
command = "eza -lg --color=always --group-directories-first --icons=always";
abbreviation = false;
@@ -97,11 +72,6 @@ in
command = "eza -aT -I '.git' --color=always --group-directories-first --icons=always";
abbreviation = false;
};
"l." = {
command = "eza -a | grep -e '^\\.'";
abbreviation = false;
};
".." = "cd ..";
"..." = "cd ../..";
"...." = "cd ../../..";