refactor: nix fmt classic to nix fmt

This commit is contained in:
Rasyidan Akbar F. 2026-01-30 15:59:48 +07:00
commit f9614371a3
57 changed files with 923 additions and 493 deletions

View file

@ -1,8 +1,14 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
inherit (lib) mkIf mkOption types;
cfg = config.rsydn.systemPackages;
in {
in
{
options.rsydn.systemPackages = {
enable = mkOption {
type = types.bool;
@ -13,8 +19,7 @@ in {
packages = mkOption {
type = types.listOf types.package;
default = with pkgs; [ tailscale ];
description =
"System packages that must be available globally across macOS.";
description = "System packages that must be available globally across macOS.";
};
};

View file

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: {
{
config,
pkgs,
lib,
...
}:
{
# Import shared cross-platform home configuration
imports = [
../../home/base.nix

View file

@ -7,7 +7,8 @@ let
};
userSettings = import ./user-settings.nix { modes = modes; };
in {
in
{
programs.aerospace = {
enable = true;
package = pkgs.aerospace;

View file

@ -1,4 +1,5 @@
{ workspaceFocusBindings, workspaceSendBindings }: {
{ workspaceFocusBindings, workspaceSendBindings }:
{
main.binding = {
"alt-h" = "focus left";
"alt-j" = "focus down";
@ -27,7 +28,9 @@
"alt-r" = "mode resize";
"alt-f" = "mode float";
"alt-shift-semicolon" = "mode service";
} // workspaceFocusBindings // workspaceSendBindings;
}
// workspaceFocusBindings
// workspaceSendBindings;
float.binding = {
enter = ''exec-and-forget open -na "Ghostty" && aerospace layout floating'';
@ -36,8 +39,11 @@
"layout floating"
"mode main"
];
g =
[ ''exec-and-forget open -na "Ghostty"'' "layout floating" "mode main" ];
g = [
''exec-and-forget open -na "Ghostty"''
"layout floating"
"mode main"
];
esc = "mode main";
};
@ -52,13 +58,37 @@
};
service.binding = {
esc = [ "reload-config" "mode main" ];
r = [ "flatten-workspace-tree" "mode main" ];
f = [ "layout floating tiling" "mode main" ];
backspace = [ "close-all-windows-but-current" "mode main" ];
h = [ "join-with left" "mode main" ];
j = [ "join-with down" "mode main" ];
k = [ "join-with up" "mode main" ];
l = [ "join-with right" "mode main" ];
esc = [
"reload-config"
"mode main"
];
r = [
"flatten-workspace-tree"
"mode main"
];
f = [
"layout floating tiling"
"mode main"
];
backspace = [
"close-all-windows-but-current"
"mode main"
];
h = [
"join-with left"
"mode main"
];
j = [
"join-with down"
"mode main"
];
k = [
"join-with up"
"mode main"
];
l = [
"join-with right"
"mode main"
];
};
}

View file

@ -1,4 +1,5 @@
{ modes }: {
{ modes }:
{
enable-normalization-flatten-containers = true;
enable-normalization-opposite-orientation-for-nested-containers = true;
default-root-container-layout = "tiles";

View file

@ -4,13 +4,20 @@ let
workspaceNumbers = map toString (lib.range 1 9);
workspaceFocusBindings = listToAttrs (map (ws: {
name = "alt-${ws}";
value = "workspace ${ws}";
}) workspaceNumbers);
workspaceFocusBindings = listToAttrs (
map (ws: {
name = "alt-${ws}";
value = "workspace ${ws}";
}) workspaceNumbers
);
workspaceSendBindings = listToAttrs (map (ws: {
name = "alt-shift-${ws}";
value = "move-node-to-workspace ${ws}";
}) workspaceNumbers);
in { inherit workspaceNumbers workspaceFocusBindings workspaceSendBindings; }
workspaceSendBindings = listToAttrs (
map (ws: {
name = "alt-shift-${ws}";
value = "move-node-to-workspace ${ws}";
}) workspaceNumbers
);
in
{
inherit workspaceNumbers workspaceFocusBindings workspaceSendBindings;
}

View file

@ -1,4 +1,5 @@
{ config, ... }: {
{ config, ... }:
{
programs.ghostty = {
enable = true;
package = null;

View file

@ -2,7 +2,8 @@
let
inherit (lib) mkIf mkOption types;
cfg = config.rsydn.homebrew;
in {
in
{
options.rsydn.homebrew = {
enable = mkOption {
type = types.bool;
@ -16,7 +17,12 @@ in {
};
brews = mkOption {
type = types.listOf types.str;
default = [ "curl" "yt-dlp" "infisical" "mole" ];
default = [
"curl"
"yt-dlp"
"infisical"
"mole"
];
description = "Homebrew formulae to install.";
};
casks = mkOption {

View file

@ -1,5 +1,15 @@
{ config, pkgs, lib, user, ... }: {
imports = [ ./homebrew.nix ./devtools.nix ];
{
config,
pkgs,
lib,
user,
...
}:
{
imports = [
./homebrew.nix
./devtools.nix
];
nix = {
# Use default nix version from nixpkgs (don't pin to avoid rebuild issues)
@ -8,12 +18,14 @@
keep-outputs = true
'';
settings = {
experimental-features = [ "nix-command" "flakes" ];
experimental-features = [
"nix-command"
"flakes"
];
warn-dirty = false;
# Numtide binary cache for llm-agents.nix packages
extra-substituters = [ "https://cache.numtide.com" ];
extra-trusted-public-keys =
[ "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ber8L+2z9FqRZJ+KBKGE4NNsT0=" ];
extra-trusted-public-keys = [ "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ber8L+2z9FqRZJ+KBKGE4NNsT0=" ];
};
optimise.automatic = true;
gc = {
@ -27,7 +39,10 @@
};
};
environment.shells = [ pkgs.nushell "/etc/profiles/per-user/${user}/bin/nu" ];
environment.shells = [
pkgs.nushell
"/etc/profiles/per-user/${user}/bin/nu"
];
# Set XDG Base Directory environment variables globally
# This ensures nushell and other XDG-compliant tools use ~/.config

View file

@ -1,4 +1,10 @@
{ pkgs, lib, customPkgs, ... }: {
{
pkgs,
lib,
customPkgs,
...
}:
{
imports = [
./programs/fastfetch
./programs/helix.nix
@ -23,7 +29,10 @@
programs.git.enable = true;
home.packages = with pkgs; [ docker docker-compose ];
home.packages = with pkgs; [
docker
docker-compose
];
rsydn.aiTools = {
enable = lib.mkDefault true;

View file

@ -1,6 +1,18 @@
{ config, lib, pkgs, inputs, ... }:
{
config,
lib,
pkgs,
inputs,
...
}:
let
inherit (lib) mkEnableOption mkOption types mkIf escapeShellArg;
inherit (lib)
mkEnableOption
mkOption
types
mkIf
escapeShellArg
;
cfg = config.rsydn.aiTools;
system = pkgs.stdenv.hostPlatform.system;
@ -10,48 +22,51 @@ let
llmPkgsPinned = inputs.llm-agents-pinned.packages.${system};
# Z.AI Gateway wrapper for Claude Code
zaiWrapperPackages = let zaiCfg = cfg.zai;
in if zaiCfg.enable then
zaiWrapperPackages =
let
claudeExe = lib.getExe llmPkgsPinned.claude-code;
commandName = zaiCfg.commandName;
baseUrl = zaiCfg.baseUrl;
model = zaiCfg.model;
tokenEnvVar = zaiCfg.tokenEnvVar;
in [
(pkgs.writeShellApplication {
name = commandName;
text = ''
if [ -z "''${${tokenEnvVar}:-}" ]; then
echo "${commandName}: environment variable ${tokenEnvVar} is not set" >&2
exit 1
fi
zaiCfg = cfg.zai;
in
if zaiCfg.enable then
let
claudeExe = lib.getExe llmPkgsPinned.claude-code;
commandName = zaiCfg.commandName;
baseUrl = zaiCfg.baseUrl;
model = zaiCfg.model;
tokenEnvVar = zaiCfg.tokenEnvVar;
in
[
(pkgs.writeShellApplication {
name = commandName;
text = ''
if [ -z "''${${tokenEnvVar}:-}" ]; then
echo "${commandName}: environment variable ${tokenEnvVar} is not set" >&2
exit 1
fi
export ANTHROPIC_BASE_URL=${escapeShellArg baseUrl}
export ANTHROPIC_AUTH_TOKEN="''${${tokenEnvVar}}"
export ANTHROPIC_MODEL=${escapeShellArg model}
export ANTHROPIC_BASE_URL=${escapeShellArg baseUrl}
export ANTHROPIC_AUTH_TOKEN="''${${tokenEnvVar}}"
export ANTHROPIC_MODEL=${escapeShellArg model}
exec ${claudeExe} "$@"
'';
})
]
else
[ ];
exec ${claudeExe} "$@"
'';
})
]
else
[ ];
in {
in
{
options.rsydn.aiTools = {
enable = mkEnableOption "AI CLI tools from llm-agents.nix";
zai = mkOption {
type = types.submodule {
options = {
enable = mkEnableOption
"Expose the Z.AI Gateway wrapper command for Claude.";
enable = mkEnableOption "Expose the Z.AI Gateway wrapper command for Claude.";
commandName = mkOption {
type = types.str;
default = "glm";
description =
"Name of the wrapper command that launches Claude via Z.AI.";
description = "Name of the wrapper command that launches Claude via Z.AI.";
};
baseUrl = mkOption {
type = types.str;
@ -66,8 +81,7 @@ in {
tokenEnvVar = mkOption {
type = types.str;
default = "ZAI_API_KEY";
description =
"Environment variable that stores the Z.AI API token.";
description = "Environment variable that stores the Z.AI API token.";
};
};
};
@ -78,15 +92,13 @@ in {
model = "glm-4.7";
tokenEnvVar = "ZAI_API_KEY";
};
description =
"Configuration for the Claude wrapper that targets the Z.AI gateway.";
description = "Configuration for the Claude wrapper that targets the Z.AI gateway.";
};
extraPackages = mkOption {
type = types.listOf types.package;
default = [ ];
description =
"Additional AI tooling packages to add alongside the defaults.";
description = "Additional AI tooling packages to add alongside the defaults.";
};
};
@ -98,6 +110,8 @@ in {
llmPkgs.ccstatusline # latest
llmPkgs.ccusage # latest
llmPkgs.codex
] ++ zaiWrapperPackages ++ cfg.extraPackages;
]
++ zaiWrapperPackages
++ cfg.extraPackages;
};
}

View file

@ -1,8 +1,14 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) mkOption types mkIf;
cfg = config.rsydn.devTools;
in {
in
{
options.rsydn.devTools = {
enable = mkOption {
type = types.bool;

View file

@ -2,13 +2,13 @@
let
inherit (lib) mkOption types mkIf;
cfg = config.rsydn.direnv;
in {
in
{
options.rsydn.direnv = {
enable = mkOption {
type = types.bool;
default = false;
description =
"Enable direnv with nix-direnv for automatic devshell activation.";
description = "Enable direnv with nix-direnv for automatic devshell activation.";
};
silent = mkOption {
type = types.bool;

View file

@ -1,12 +1,29 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) mkEnableOption mkOption mkIf types warn unique;
inherit (lib)
mkEnableOption
mkOption
mkIf
types
warn
unique
;
cfg = config.rsydn.languages;
hasPkg = name: builtins.hasAttr name pkgs;
getPkg = name: if hasPkg name then pkgs.${name} else null;
mkToolOption = { name, defaultPackage, description }:
mkToolOption =
{
name,
defaultPackage,
description,
}:
mkOption {
type = types.submodule {
options = {
@ -18,8 +35,7 @@ let
package = mkOption {
type = types.nullOr types.package;
default = defaultPackage;
description =
"Package derivation to install for ${name}. Set to null to skip.";
description = "Package derivation to install for ${name}. Set to null to skip.";
};
};
};
@ -30,23 +46,25 @@ let
description = description;
};
mkToolPackages = specs:
builtins.concatMap (tool:
let toolCfg = tool.cfg;
in if toolCfg.enable then
mkToolPackages =
specs:
builtins.concatMap (
tool:
let
toolCfg = tool.cfg;
in
if toolCfg.enable then
if toolCfg.package != null then
[ toolCfg.package ]
else
warn "rsydn.languages.${tool.name}: package is null, skipping" [ ]
else
[ ]) specs;
[ ]
) specs;
uvPackage = getPkg "uv";
goPackage = getPkg "go";
nodePackage = if builtins.hasAttr "nodejs_20" pkgs then
pkgs.nodejs_20
else
getPkg "nodejs";
nodePackage = if builtins.hasAttr "nodejs_20" pkgs then pkgs.nodejs_20 else getPkg "nodejs";
cargoPackage = getPkg "cargo";
bunPackage = getPkg "bun";
@ -80,7 +98,8 @@ let
languagePackages = mkToolPackages toolSpecs;
in {
in
{
options.rsydn.languages = {
enable = mkEnableOption "Language tooling packages for everyday workflows";

View file

@ -1,8 +1,20 @@
{ config, lib, pkgs, try, ... }:
{
config,
lib,
pkgs,
try,
...
}:
let
inherit (lib) mkEnableOption mkOption types mkIf;
inherit (lib)
mkEnableOption
mkOption
types
mkIf
;
cfg = config.rsydn.try;
in {
in
{
imports = [ try.homeModules.default ];
options.rsydn.try = {

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
home.packages = [ pkgs.fastfetch ];
@ -6,147 +11,145 @@
# Copy the custom logo file
xdg.configFile."fastfetch/oguri-logo.txt".source = ./oguri-logo.txt;
xdg.configFile."fastfetch/config.jsonc".text = let
esc = builtins.fromJSON ''"\u001b"'';
osIcon = if pkgs.stdenv.isDarwin then "" else "";
in builtins.toJSON {
"$schema" =
"https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json";
xdg.configFile."fastfetch/config.jsonc".text =
let
esc = builtins.fromJSON ''"\u001b"'';
osIcon = if pkgs.stdenv.isDarwin then "" else "";
in
builtins.toJSON {
"$schema" = "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json";
logo = {
type = "file";
source = "~/.config/fastfetch/oguri-logo.txt";
color."1" = "green";
padding = {
top = 2;
right = 6;
left = 2;
logo = {
type = "file";
source = "~/.config/fastfetch/oguri-logo.txt";
color."1" = "green";
padding = {
top = 2;
right = 6;
left = 2;
};
};
display = {
separator = " ";
key = {
width = 16;
};
};
modules = [
"break"
# Hardware Section
{
type = "custom";
format = "${esc}[32m Hardware${esc}[0m";
}
{
type = "host";
key = " PC";
keyColor = "green";
}
{
type = "cpu";
key = " CPU";
showPeCoreCount = true;
keyColor = "green";
}
{
type = "gpu";
key = " GPU";
detectionMethod = "pci";
keyColor = "green";
}
{
type = "display";
key = "󱄄 Display";
keyColor = "green";
}
{
type = "disk";
key = "󰋊 Disk";
keyColor = "green";
}
{
type = "memory";
key = " Memory";
keyColor = "green";
}
{
type = "swap";
key = "󰓡 Swap";
keyColor = "green";
}
"break"
# Software Section
{
type = "custom";
format = "${esc}[34m Software${esc}[0m";
}
{
type = "command";
key = "${osIcon} OS";
keyColor = "blue";
text = "if [ $(uname) = 'Darwin' ]; then ver=$(sw_vers -productVersion); major=$(echo $ver | cut -d. -f1); case $major in 15) name='Sequoia';; 14) name='Sonoma';; 13) name='Ventura';; 12) name='Monterey';; 11) name='Big Sur';; *) name=''';; esac; echo \"macOS $name $major\"; else echo \"$(cat /etc/os-release | grep PRETTY_NAME | cut -d'\\\"' -f2)\"; fi";
}
{
type = "kernel";
key = " Kernel";
keyColor = "blue";
}
{
type = "wm";
key = " WM";
keyColor = "blue";
}
{
type = "de";
key = " DE";
keyColor = "blue";
}
{
type = "terminal";
key = " Terminal";
keyColor = "blue";
}
{
type = "packages";
key = "󰏖 Packages";
keyColor = "blue";
}
{
type = "wmtheme";
key = "󰉼 WM Theme";
keyColor = "blue";
}
{
type = "terminalfont";
key = " Font";
keyColor = "blue";
}
"break"
# Uptime / Age Section
{
type = "custom";
format = "${esc}[35m Uptime / Age${esc}[0m";
}
{
type = "command";
key = "󱦟 OS Age";
keyColor = "magenta";
# macOS compatible stat command
text = ''if [ $(uname) = 'Darwin' ]; then birth=$(stat -f %B /); else birth=$(stat -c %W /); fi; current=$(date +%s); days=$(( (current - birth) / 86400 )); echo "$days days"'';
}
{
type = "uptime";
key = "󱫐 Uptime";
keyColor = "magenta";
}
"break"
];
};
display = {
separator = " ";
key = { width = 16; };
};
modules = [
"break"
# Hardware Section
{
type = "custom";
format =
"${esc}[32m Hardware${esc}[0m";
}
{
type = "host";
key = " PC";
keyColor = "green";
}
{
type = "cpu";
key = " CPU";
showPeCoreCount = true;
keyColor = "green";
}
{
type = "gpu";
key = " GPU";
detectionMethod = "pci";
keyColor = "green";
}
{
type = "display";
key = "󱄄 Display";
keyColor = "green";
}
{
type = "disk";
key = "󰋊 Disk";
keyColor = "green";
}
{
type = "memory";
key = " Memory";
keyColor = "green";
}
{
type = "swap";
key = "󰓡 Swap";
keyColor = "green";
}
"break"
# Software Section
{
type = "custom";
format =
"${esc}[34m Software${esc}[0m";
}
{
type = "command";
key = "${osIcon} OS";
keyColor = "blue";
text =
"if [ $(uname) = 'Darwin' ]; then ver=$(sw_vers -productVersion); major=$(echo $ver | cut -d. -f1); case $major in 15) name='Sequoia';; 14) name='Sonoma';; 13) name='Ventura';; 12) name='Monterey';; 11) name='Big Sur';; *) name=''';; esac; echo \"macOS $name $major\"; else echo \"$(cat /etc/os-release | grep PRETTY_NAME | cut -d'\\\"' -f2)\"; fi";
}
{
type = "kernel";
key = " Kernel";
keyColor = "blue";
}
{
type = "wm";
key = " WM";
keyColor = "blue";
}
{
type = "de";
key = " DE";
keyColor = "blue";
}
{
type = "terminal";
key = " Terminal";
keyColor = "blue";
}
{
type = "packages";
key = "󰏖 Packages";
keyColor = "blue";
}
{
type = "wmtheme";
key = "󰉼 WM Theme";
keyColor = "blue";
}
{
type = "terminalfont";
key = " Font";
keyColor = "blue";
}
"break"
# Uptime / Age Section
{
type = "custom";
format =
"${esc}[35m Uptime / Age${esc}[0m";
}
{
type = "command";
key = "󱦟 OS Age";
keyColor = "magenta";
# macOS compatible stat command
text = ''
if [ $(uname) = 'Darwin' ]; then birth=$(stat -f %B /); else birth=$(stat -c %W /); fi; current=$(date +%s); days=$(( (current - birth) / 86400 )); echo "$days days"'';
}
{
type = "uptime";
key = "󱫐 Uptime";
keyColor = "magenta";
}
"break"
];
};
}

View file

@ -1,4 +1,5 @@
{ pkgs, lib, ... }: {
{ pkgs, lib, ... }:
{
programs.helix = {
enable = lib.mkDefault true;
settings = {
@ -18,10 +19,12 @@
};
};
};
languages.language = [{
name = "nix";
auto-format = true;
formatter.command = "${pkgs.nixfmt-classic}/bin/nixfmt";
}];
languages.language = [
{
name = "nix";
auto-format = true;
formatter.command = "${pkgs.nixfmt}/bin/nixfmt";
}
];
};
}

View file

@ -1,4 +1,5 @@
{ pkgs, config, ... }: {
{ pkgs, config, ... }:
{
programs.neovim = {
enable = true;
viAlias = true;
@ -27,7 +28,7 @@
# Formatters
stylua # Lua
nixfmt-classic # Nix (matches your fmt command)
nixfmt # Nix
ruff # Python (formatter + linter)
prettierd # JS/TS/JSON/YAML/Markdown
rustfmt # Rust
@ -61,15 +62,14 @@
};
# Copy lazy-lock.json as writable (not symlinked to read-only Nix store)
home.activation.makeNvimLockWritable =
config.lib.dag.entryAfter [ "linkGeneration" ] ''
lockFile="${config.xdg.configHome}/nvim/lazy-lock.json"
sourceLock="${./nvim/lazy-lock.json}"
home.activation.makeNvimLockWritable = config.lib.dag.entryAfter [ "linkGeneration" ] ''
lockFile="${config.xdg.configHome}/nvim/lazy-lock.json"
sourceLock="${./nvim/lazy-lock.json}"
if [ -L "$lockFile" ]; then
rm "$lockFile"
cp "$sourceLock" "$lockFile"
chmod 644 "$lockFile"
fi
'';
if [ -L "$lockFile" ]; then
rm "$lockFile"
cp "$sourceLock" "$lockFile"
chmod 644 "$lockFile"
fi
'';
}

View file

@ -1,24 +1,43 @@
{ config, lib, inputs, ... }:
{
config,
lib,
inputs,
...
}:
let
inherit (lib) mkEnableOption mkOption mkIf types;
inherit (lib)
mkEnableOption
mkOption
mkIf
types
;
cfg = config.rsydn.secrets;
sanitizeSecret = name: secret:
sanitizeSecret =
name: secret:
let
sopsFile = secret.sopsFile or cfg.defaultSopsFile;
extra =
lib.filterAttrs (k: _: !(builtins.elem k [ "path" "mode" "sopsFile" ]))
secret;
in {
extra = lib.filterAttrs (
k: _:
!(builtins.elem k [
"path"
"mode"
"sopsFile"
])
) secret;
in
{
path = secret.path or "${config.xdg.configHome}/secrets/${name}";
mode = secret.mode or "0400";
} // (lib.optionalAttrs (sopsFile != null) { inherit sopsFile; }) // extra;
in {
}
// (lib.optionalAttrs (sopsFile != null) { inherit sopsFile; })
// extra;
in
{
imports = [ inputs.sops-nix.homeManagerModules.sops ];
options.rsydn.secrets = {
enable =
mkEnableOption "sops-nix integration for managing decrypted secrets";
enable = mkEnableOption "sops-nix integration for managing decrypted secrets";
ageKeyFile = mkOption {
type = types.str;
@ -29,15 +48,13 @@ in {
defaultSopsFile = mkOption {
type = types.nullOr types.path;
default = null;
description =
"Optional default SOPS file used when a secret definition omits `sopsFile`.";
description = "Optional default SOPS file used when a secret definition omits `sopsFile`.";
};
secrets = mkOption {
type = types.attrsOf types.attrs;
default = { };
description =
"Secret entries forwarded to `sops.secrets` with sensible defaults.";
description = "Secret entries forwarded to `sops.secrets` with sensible defaults.";
example = lib.literalExpression ''
{
"api-key" = {
@ -58,14 +75,14 @@ in {
};
secrets = lib.mapAttrs sanitizeSecret cfg.secrets;
} // (lib.optionalAttrs (cfg.defaultSopsFile != null) {
}
// (lib.optionalAttrs (cfg.defaultSopsFile != null) {
defaultSopsFile = cfg.defaultSopsFile;
});
home.activation.ensureSecretDir =
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
mkdir -p "${config.xdg.configHome}/secrets"
chmod 700 "${config.xdg.configHome}/secrets"
'';
home.activation.ensureSecretDir = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
mkdir -p "${config.xdg.configHome}/secrets"
chmod 700 "${config.xdg.configHome}/secrets"
'';
};
}

View file

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: {
{
config,
pkgs,
lib,
...
}:
{
programs.fish = {
enable = true;
interactiveShellInit = ''

View file

@ -1,31 +1,40 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
profileBin = "${config.home.profileDirectory}/bin";
# System binaries path - same on both NixOS and Darwin
systemBin = "/run/current-system/sw/bin";
defaultBin = "/nix/var/nix/profiles/default/bin";
darwinHomebrewDir = if pkgs.stdenv.hostPlatform.isAarch64 then
"/opt/homebrew"
else
"/usr/local";
darwinHomebrewDir = if pkgs.stdenv.hostPlatform.isAarch64 then "/opt/homebrew" else "/usr/local";
homebrewBin = "${darwinHomebrewDir}/bin";
homebrewSbin = "${darwinHomebrewDir}/sbin";
homebrewPaths = if pkgs.stdenv.hostPlatform.isDarwin then
lib.unique [ homebrewBin homebrewSbin ]
else
[ ];
homebrewPaths =
if pkgs.stdenv.hostPlatform.isDarwin then
lib.unique [
homebrewBin
homebrewSbin
]
else
[ ];
# Add common macOS system paths that may contain user-installed CLIs
macosSystemPaths = if pkgs.stdenv.hostPlatform.isDarwin then [
"/usr/local/bin"
"/usr/bin"
"/bin"
"/usr/sbin"
"/sbin"
] else
[ ];
formatPathList = paths:
lib.concatMapStrings (path: " \"${path}\"\n") paths;
in {
macosSystemPaths =
if pkgs.stdenv.hostPlatform.isDarwin then
[
"/usr/local/bin"
"/usr/bin"
"/bin"
"/usr/sbin"
"/sbin"
]
else
[ ];
formatPathList = paths: lib.concatMapStrings (path: " \"${path}\"\n") paths;
in
{
imports = [ ./starship ];
programs.nushell.enable = lib.mkDefault true;
@ -141,7 +150,13 @@ in {
$env.XDG_CACHE_HOME = "${config.xdg.cacheHome}"
let nix_paths = [
${formatPathList [ profileBin systemBin defaultBin ]} ]
${
formatPathList [
profileBin
systemBin
defaultBin
]
} ]
let homebrew_paths = [
${formatPathList homebrewPaths} ]

View file

@ -1,4 +1,5 @@
{ lib, ... }: {
{ lib, ... }:
{
programs.starship = {
enable = lib.mkDefault true;
enableFishIntegration = true;

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, ... }: {
{
config,
lib,
pkgs,
...
}:
{
programs.tmux = {
enable = lib.mkDefault true;
clock24 = true;
@ -8,7 +14,7 @@
prefix = "C-a";
escapeTime = 0;
aggressiveResize = true;
plugins = [{ plugin = pkgs.tmuxPlugins.gruvbox; }];
plugins = [ { plugin = pkgs.tmuxPlugins.gruvbox; } ];
extraConfig = ''
# Terminal configuration for proper colors and features
set-option -g default-terminal "screen-256color"

View file

@ -1,4 +1,5 @@
{ lib, ... }: {
{ lib, ... }:
{
# Modern audio stack - PipeWire replaces PulseAudio + JACK + ALSA
services.pipewire = {
enable = lib.mkDefault true;

View file

@ -1,4 +1,5 @@
{ lib, ... }: {
{ lib, ... }:
{
hardware.bluetooth = {
enable = lib.mkDefault false; # Enable when needed
powerOnBoot = lib.mkDefault true;

View file

@ -1,37 +1,51 @@
{ config, lib, pkgs, user, ... }:
{
config,
lib,
pkgs,
user,
...
}:
let
inherit (lib)
mkEnableOption mkOption mkIf types mkMerge mkAfter optionals mkDefault;
mkEnableOption
mkOption
mkIf
types
mkMerge
mkAfter
optionals
mkDefault
;
cfg = config.rsydn.containerization;
in {
in
{
options.rsydn.containerization = {
podman = {
enable = mkOption {
type = types.bool;
default = true;
description =
"Enable Podman for rootless containers as the primary engine.";
description = "Enable Podman for rootless containers as the primary engine.";
};
dockerCompat = mkOption {
type = types.bool;
default = true;
description =
"Expose the Docker-compatible socket for CLI compatibility.";
description = "Expose the Docker-compatible socket for CLI compatibility.";
};
enableDnsnamePlugin = mkOption {
type = types.bool;
default = true;
description =
"Enable the dnsname CNI plugin so containers can resolve each other.";
description = "Enable the dnsname CNI plugin so containers can resolve each other.";
};
extraPackages = mkOption {
type = types.listOf types.package;
default = with pkgs; [ podman-compose podman-tui ];
description =
"Additional Podman-related packages to install system-wide.";
default = with pkgs; [
podman-compose
podman-tui
];
description = "Additional Podman-related packages to install system-wide.";
};
};
@ -39,8 +53,7 @@ in {
enable = mkOption {
type = types.bool;
default = false;
description =
"Enable the Docker daemon alongside Podman when explicitly requested.";
description = "Enable the Docker daemon alongside Podman when explicitly requested.";
};
autoPrune = mkOption {
@ -49,18 +62,19 @@ in {
enable = mkOption {
type = types.bool;
default = true;
description =
"Automatically prune unused Docker data on a schedule.";
description = "Automatically prune unused Docker data on a schedule.";
};
dates = mkOption {
type = types.str;
default = "weekly";
description =
"Systemd calendar expression for docker system prune.";
description = "Systemd calendar expression for docker system prune.";
};
flags = mkOption {
type = types.listOf types.str;
default = [ "--all" "--volumes" ];
default = [
"--all"
"--volumes"
];
description = "Extra flags passed to docker system prune.";
};
};
@ -71,11 +85,13 @@ in {
};
k3s = {
enable =
mkEnableOption "Run a lightweight Kubernetes control plane with k3s.";
enable = mkEnableOption "Run a lightweight Kubernetes control plane with k3s.";
role = mkOption {
type = types.enum [ "server" "agent" ];
type = types.enum [
"server"
"agent"
];
default = "server";
description = "Choose whether this node runs as a k3s server or agent.";
};
@ -99,14 +115,18 @@ in {
environment.systemPackages = mkAfter cfg.podman.extraPackages;
users.users.${user} = {
subUidRanges = mkDefault [{
startUid = 100000;
count = 65536;
}];
subGidRanges = mkDefault [{
startGid = 100000;
count = 65536;
}];
subUidRanges = mkDefault [
{
startUid = 100000;
count = 65536;
}
];
subGidRanges = mkDefault [
{
startGid = 100000;
count = 65536;
}
];
};
})
@ -130,8 +150,7 @@ in {
extraFlags = cfg.k3s.extraFlags;
};
networking.firewall.allowedTCPPorts =
mkAfter (optionals (cfg.k3s.role == "server") [ 6443 ]);
networking.firewall.allowedTCPPorts = mkAfter (optionals (cfg.k3s.role == "server") [ 6443 ]);
})
];
}

View file

@ -1,4 +1,5 @@
{ pkgs, user, ... }: {
{ pkgs, user, ... }:
{
# Browser configurations for desktop users
home-manager.users.${user} = {

View file

@ -1,4 +1,10 @@
{ lib, pkgs, user, ... }: {
{
lib,
pkgs,
user,
...
}:
{
# Terminal emulator configurations for desktop users
home-manager.users.${user} = {

View file

@ -1,4 +1,5 @@
{ lib, pkgs, ... }: {
{ lib, pkgs, ... }:
{
# Shared desktop settings (imported by all DEs)
# XDG portals for desktop integration

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
# Gaming configuration module
# Steam, Proton, Vulkan, Wine, and gaming optimizations
@ -9,17 +10,18 @@
dedicatedServer.openFirewall = true;
# Enable Proton compatibility layer
extraCompatPackages = with pkgs;
[
proton-ge-bin # GloriousEggroll's Proton builds
];
extraCompatPackages = with pkgs; [
proton-ge-bin # GloriousEggroll's Proton builds
];
};
# GameMode for performance optimization
programs.gamemode = {
enable = true;
settings = {
general = { renice = 10; };
general = {
renice = 10;
};
custom = {
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
@ -72,5 +74,7 @@
# ];
# Increase file watchers for game modding tools
boot.kernel.sysctl = { "fs.inotify.max_user_watches" = 524288; };
boot.kernel.sysctl = {
"fs.inotify.max_user_watches" = 524288;
};
}

View file

@ -2,15 +2,25 @@
# Generated by running: nixos-generate-config --show-hardware-config
# This file contains hardware-specific settings that should be adjusted for your actual hardware
{ config, lib, modulesPath, ... }:
{
config,
lib,
modulesPath,
...
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
# Kernel modules needed during boot
# Adjust based on your hardware (NVMe, SATA, USB, etc.)
boot.initrd.availableKernelModules =
[ "nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" ];
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ]; # Change to "kvm-intel" for Intel CPUs
@ -24,7 +34,10 @@
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/REPLACE-WITH-YOUR-BOOT-UUID";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
options = [
"fmask=0022"
"dmask=0022"
];
};
# Swap configuration (optional)
@ -34,8 +47,7 @@
# ];
# CPU microcode updates
hardware.cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# For Intel CPUs, use this instead:
# hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

View file

@ -1,4 +1,10 @@
{ pkgs, lib, user, ... }: {
{
pkgs,
lib,
user,
...
}:
{
imports = [ ../base.nix ];
# System-level: Enable Hyprland
@ -55,17 +61,18 @@
border_size = 2;
};
decoration = { rounding = 8; };
decoration = {
rounding = 8;
};
};
};
# User packages: Hyprland utilities
home.packages = with pkgs;
[
# Uncomment as needed:
# wofi # Launcher
# waybar # Status bar
# dunst # Notifications
];
home.packages = with pkgs; [
# Uncomment as needed:
# wofi # Launcher
# waybar # Status bar
# dunst # Notifications
];
};
}

View file

@ -1,4 +1,10 @@
{ lib, pkgs, user, ... }: {
{
lib,
pkgs,
user,
...
}:
{
imports = [ ./base.nix ];
# System-level: KDE Plasma 6
@ -11,16 +17,15 @@
};
# System packages: KDE applications
environment.systemPackages = with pkgs;
[
# KDE applications (uncomment as needed)
# kdePackages.kate # Text editor
# kdePackages.dolphin # File manager
# kdePackages.konsole # Terminal
# kdePackages.okular # Document viewer
# kdePackages.gwenview # Image viewer
# kdePackages.spectacle # Screenshot tool
];
environment.systemPackages = with pkgs; [
# KDE applications (uncomment as needed)
# kdePackages.kate # Text editor
# kdePackages.dolphin # File manager
# kdePackages.konsole # Terminal
# kdePackages.okular # Document viewer
# kdePackages.gwenview # Image viewer
# kdePackages.spectacle # Screenshot tool
];
# User-level: KDE Plasma settings (optional)
home-manager.users.${user} = {
@ -34,9 +39,8 @@
# };
# User packages for KDE environment
home.packages = with pkgs;
[
# Add user-specific apps here
];
home.packages = with pkgs; [
# Add user-specific apps here
];
};
}

View file

@ -1,4 +1,10 @@
{ lib, pkgs, user, ... }: {
{
lib,
pkgs,
user,
...
}:
{
# Catppuccin theme configuration
# Soothing pastel theme for both GTK and Qt applications
# Works with KDE Plasma, Hyprland, and other desktop environments

View file

@ -1,4 +1,10 @@
{ lib, pkgs, user, ... }: {
{
lib,
pkgs,
user,
...
}:
{
# Default theme configuration for desktop
# Simple Adwaita-dark theme that works across all desktop environments
# Switch to catppuccin.nix or create your own for custom themes

View file

@ -1,10 +1,17 @@
{ lib, pkgs, ... }: {
{ lib, pkgs, ... }:
{
fonts = {
enableDefaultPackages = lib.mkDefault true;
packages = with pkgs; [
# Nerd Fonts for terminal icons
(nerdfonts.override { fonts = [ "FiraCode" "JetBrainsMono" "Iosevka" ]; })
(nerdfonts.override {
fonts = [
"FiraCode"
"JetBrainsMono"
"Iosevka"
];
})
# Core fonts
noto-fonts
@ -20,7 +27,10 @@
fontconfig = {
enable = lib.mkDefault true;
defaultFonts = {
monospace = [ "JetBrains Mono" "FiraCode Nerd Font" ];
monospace = [
"JetBrains Mono"
"FiraCode Nerd Font"
];
sansSerif = [ "Noto Sans" ];
serif = [ "Noto Serif" ];
emoji = [ "Noto Color Emoji" ];

View file

@ -1,4 +1,5 @@
{ lib, pkgs, ... }: {
{ lib, pkgs, ... }:
{
# Hardware acceleration (OpenGL/Vulkan)
hardware.graphics = {
enable = lib.mkDefault true;

View file

@ -1,4 +1,10 @@
{ config, pkgs, lib, ... }: {
{
config,
pkgs,
lib,
...
}:
{
# Minimal CLI-only Home Manager configuration
# Used for servers, VMs, and headless systems
# Desktop configs are handled directly in nixos/desktops/* modules

View file

@ -1,4 +1,5 @@
{ lib, ... }: {
{ lib, ... }:
{
networking.useDHCP = lib.mkDefault true;
networking.networkmanager.enable = lib.mkDefault true;
}

View file

@ -1,4 +1,5 @@
{ lib, ... }: {
{ lib, ... }:
{
services.openssh = {
enable = lib.mkDefault true;
openFirewall = lib.mkDefault true;

View file

@ -1,10 +1,22 @@
{ lib, user, ... }: {
imports = [ ./users.nix ./network.nix ./ssh.nix ./containerization.nix ];
{ lib, user, ... }:
{
imports = [
./users.nix
./network.nix
./ssh.nix
./containerization.nix
];
nix = {
settings.auto-optimise-store = lib.mkDefault true;
settings.experimental-features = lib.mkDefault [ "nix-command" "flakes" ];
settings.trusted-users = lib.mkDefault [ "root" user ];
settings.experimental-features = lib.mkDefault [
"nix-command"
"flakes"
];
settings.trusted-users = lib.mkDefault [
"root"
user
];
optimise.automatic = lib.mkDefault true;
gc = {
automatic = lib.mkDefault true;

View file

@ -1,7 +1,17 @@
{ lib, pkgs, user, ... }: {
{
lib,
pkgs,
user,
...
}:
{
users.users.${user} = {
isNormalUser = lib.mkDefault true;
extraGroups = lib.mkDefault [ "wheel" "networkmanager" "docker" ];
extraGroups = lib.mkDefault [
"wheel"
"networkmanager"
"docker"
];
home = lib.mkDefault "/home/${user}";
shell = pkgs.fish;
};

View file

@ -1,4 +1,5 @@
{ lib, pkgs, ... }: {
{ lib, pkgs, ... }:
{
# QEMU guest agent provides graceful shutdowns and metadata exchange.
# Disabled by default - enable in host overlay if needed.
services.qemuGuest.enable = lib.mkDefault false;
@ -18,8 +19,11 @@
"virtio_mmio"
];
boot.kernelModules =
lib.mkDefault [ "virtio_balloon" "virtio_console" "virtio_rng" ];
boot.kernelModules = lib.mkDefault [
"virtio_balloon"
"virtio_console"
"virtio_rng"
];
# Provide udev rules to improve virtio device behaviour.
services.udev.extraRules = lib.mkDefault ''