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

@ -8,7 +8,7 @@ Custom packages live in `packages/` and are exported via `packages/default.nix`.
## Build, Test, and Development Commands
Use `nix develop` to enter the project shell with `git`, `nixfmt-classic`, and SOPS ready. Run `nix fmt` before committing to format all Nix sources. `XDG_CACHE_HOME=$PWD/.cache nix flake check` validates every host without polluting the global cache. For macOS changes, run `darwin-rebuild --dry-run --flake .#macbook-pro` and follow with `darwin-rebuild switch --flake .#macbook-pro`. Validate the Linux VM closure via `nix build .#nixosConfigurations.dev-vm.config.system.build.toplevel`.
Use `nix develop` to enter the project shell with `git`, `nixfmt`, and SOPS ready. Run `nix fmt` before committing to format all Nix sources. `XDG_CACHE_HOME=$PWD/.cache nix flake check` validates every host without polluting the global cache. For macOS changes, run `darwin-rebuild --dry-run --flake .#macbook-pro` and follow with `darwin-rebuild switch --flake .#macbook-pro`. Validate the Linux VM closure via `nix build .#nixosConfigurations.dev-vm.config.system.build.toplevel`.
## AI Agent Workflow with Beads

132
flake.nix
View file

@ -18,8 +18,7 @@
llm-agents.url = "github:numtide/llm-agents.nix";
# Pinned llm-agents for Claude Code 2.0.64 (uses its own nixpkgs for compatibility)
llm-agents-pinned.url =
"github:numtide/llm-agents.nix/4a12b5bef5a82b71da765603df5192c511a60cc2";
llm-agents-pinned.url = "github:numtide/llm-agents.nix/4a12b5bef5a82b71da765603df5192c511a60cc2";
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
@ -30,14 +29,32 @@
try.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nixpkgs, darwin, home-manager, ghostty, llm-agents
, llm-agents-pinned, sops-nix, chaotic, try, ... }:
outputs =
inputs@{
self,
nixpkgs,
darwin,
home-manager,
ghostty,
llm-agents,
llm-agents-pinned,
sops-nix,
chaotic,
try,
...
}:
let
inherit (nixpkgs.lib) genAttrs;
lib = nixpkgs.lib;
darwinSystems = [ "aarch64-darwin" "x86_64-darwin" ];
linuxSystems = [ "x86_64-linux" "aarch64-linux" ];
darwinSystems = [
"aarch64-darwin"
"x86_64-darwin"
];
linuxSystems = [
"x86_64-linux"
"aarch64-linux"
];
systems = darwinSystems ++ linuxSystems;
forEachSystem = f: genAttrs systems (system: f system);
@ -48,7 +65,8 @@
# - chaotic: removed - only needed for NixOS, was causing nix to rebuild with failing tests
overlaysList = [ ];
mkPkgs = system:
mkPkgs =
system:
import nixpkgs {
inherit system;
overlays = overlaysList;
@ -56,21 +74,31 @@
};
sharedDarwinModules = [ ./modules/darwin/system.nix ];
sharedNixosModules =
[ ./modules/nixos/system.nix chaotic.nixosModules.default ];
sharedNixosModules = [
./modules/nixos/system.nix
chaotic.nixosModules.default
];
user = "rasyidanakbar";
mkDarwin = { system ? "aarch64-darwin", extraModules ? [ ]
, homeFile ? ./modules/darwin/home/default.nix, }:
mkDarwin =
{
system ? "aarch64-darwin",
extraModules ? [ ],
homeFile ? ./modules/darwin/home/default.nix,
}:
let
pkgs = mkPkgs system;
customPkgs = import ./packages { inherit pkgs lib llm-agents; };
in darwin.lib.darwinSystem {
in
darwin.lib.darwinSystem {
inherit pkgs;
system = pkgs.stdenv.hostPlatform.system;
specialArgs = { inherit inputs overlaysList user; };
modules = sharedDarwinModules ++ extraModules ++ [
modules =
sharedDarwinModules
++ extraModules
++ [
home-manager.darwinModules.home-manager
{
nix.registry.self.flake = self;
@ -80,22 +108,35 @@
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
home-manager.extraSpecialArgs = {
inherit inputs user try customPkgs;
inherit
inputs
user
try
customPkgs
;
};
home-manager.users.${user} = import homeFile;
}
];
};
mkNixos = { system ? "x86_64-linux", extraModules ? [ ]
, homeFile ? ./modules/nixos/home/default.nix, }:
mkNixos =
{
system ? "x86_64-linux",
extraModules ? [ ],
homeFile ? ./modules/nixos/home/default.nix,
}:
let
pkgs = mkPkgs system;
customPkgs = import ./packages { inherit pkgs lib llm-agents; };
in lib.nixosSystem {
in
lib.nixosSystem {
inherit pkgs;
system = pkgs.stdenv.hostPlatform.system;
specialArgs = { inherit inputs overlaysList user; };
modules = sharedNixosModules ++ extraModules ++ [
modules =
sharedNixosModules
++ extraModules
++ [
home-manager.nixosModules.home-manager
{
nix.registry.self.flake = self;
@ -104,14 +145,22 @@
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {
inherit inputs user try customPkgs;
inherit
inputs
user
try
customPkgs
;
};
home-manager.users.${user} = import homeFile;
}
];
};
in {
darwinConfigurations = { macbook-pro = mkDarwin { }; };
in
{
darwinConfigurations = {
macbook-pro = mkDarwin { };
};
nixosConfigurations = {
# Temporarily disabled for testing
# dev-vm = mkNixos {
@ -128,24 +177,30 @@
# };
};
devShells = forEachSystem (system:
devShells = forEachSystem (
system:
let
pkgs = mkPkgs system;
python = if builtins.hasAttr "python312" pkgs then
pkgs.python312
else
pkgs.python3;
python = if builtins.hasAttr "python312" pkgs then pkgs.python312 else pkgs.python3;
# Custom packages
customPkgs = import ./packages { inherit pkgs lib llm-agents; };
# Common arguments passed to all devshell imports
shellArgs = { inherit pkgs lib python customPkgs; };
shellArgs = {
inherit
pkgs
lib
python
customPkgs
;
};
# Import all shells from shells/ directory
importShell = name: import (./shells + "/${name}.nix") shellArgs;
in {
in
{
default = importShell "default";
python-uv = importShell "python-uv";
ai-notebook = importShell "ai-notebook";
@ -155,20 +210,29 @@
rust = importShell "rust";
ai-agent = importShell "ai-agent";
effect-ts = importShell "effect-ts";
});
}
);
formatter = forEachSystem (system: (mkPkgs system).nixfmt-classic);
formatter = forEachSystem (system: (mkPkgs system).nixfmt);
packages = forEachSystem (system:
packages = forEachSystem (
system:
let
pkgs = mkPkgs system;
customPkgs = import ./packages { inherit pkgs lib llm-agents; };
in customPkgs // { inherit (pkgs) git; });
in
customPkgs // { inherit (pkgs) git; }
);
checks = forEachSystem (system:
checks = forEachSystem (
system:
let
pkgs = mkPkgs system;
customPkgs = import ./packages { inherit pkgs lib llm-agents; };
in { inherit (customPkgs) opencode; });
in
{
inherit (customPkgs) opencode;
}
);
};
}

View file

@ -1,12 +1,11 @@
{ lib, pkgs, ... }:
let
hardwareConfigPath = builtins.toString ./.
+ "/../modules/nixos/desktops/hardware-configuration.nix";
hardwareModule = if builtins.pathExists hardwareConfigPath then
import hardwareConfigPath
else
(_: { });
in {
hardwareConfigPath =
builtins.toString ./. + "/../modules/nixos/desktops/hardware-configuration.nix";
hardwareModule =
if builtins.pathExists hardwareConfigPath then import hardwareConfigPath else (_: { });
in
{
# Unified desktop configuration for gaming and development
# Includes both KDE Plasma and Hyprland - switch at login screen

View file

@ -1,4 +1,5 @@
{ lib, pkgs, ... }: {
{ lib, pkgs, ... }:
{
networking.hostName = "dev-vm";
# Set the baseline NixOS release used for stateful data; bump on rebuilds.
system.stateVersion = lib.mkDefault "24.05";

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: {
workspaceFocusBindings = listToAttrs (
map (ws: {
name = "alt-${ws}";
value = "workspace ${ws}";
}) workspaceNumbers);
}) workspaceNumbers
);
workspaceSendBindings = listToAttrs (map (ws: {
workspaceSendBindings = listToAttrs (
map (ws: {
name = "alt-shift-${ws}";
value = "move-node-to-workspace ${ws}";
}) workspaceNumbers);
in { inherit workspaceNumbers workspaceFocusBindings workspaceSendBindings; }
}) 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,15 +22,19 @@ 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
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 [
in
[
(pkgs.writeShellApplication {
name = commandName;
text = ''
@ -38,20 +54,19 @@ let
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,12 +11,13 @@
# Copy the custom logo file
xdg.configFile."fastfetch/oguri-logo.txt".source = ./oguri-logo.txt;
xdg.configFile."fastfetch/config.jsonc".text = let
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";
in
builtins.toJSON {
"$schema" = "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json";
logo = {
type = "file";
@ -26,7 +32,9 @@
display = {
separator = " ";
key = { width = 16; };
key = {
width = 16;
};
};
modules = [
@ -35,8 +43,7 @@
# Hardware Section
{
type = "custom";
format =
"${esc}[32m Hardware${esc}[0m";
format = "${esc}[32m Hardware${esc}[0m";
}
{
type = "host";
@ -80,15 +87,13 @@
# Software Section
{
type = "custom";
format =
"${esc}[34m Software${esc}[0m";
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";
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";
@ -130,16 +135,14 @@
# Uptime / Age Section
{
type = "custom";
format =
"${esc}[35m Uptime / Age${esc}[0m";
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"'';
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";

View file

@ -1,4 +1,5 @@
{ pkgs, lib, ... }: {
{ pkgs, lib, ... }:
{
programs.helix = {
enable = lib.mkDefault true;
settings = {
@ -18,10 +19,12 @@
};
};
};
languages.language = [{
languages.language = [
{
name = "nix";
auto-format = true;
formatter.command = "${pkgs.nixfmt-classic}/bin/nixfmt";
}];
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,8 +62,7 @@
};
# Copy lazy-lock.json as writable (not symlinked to read-only Nix store)
home.activation.makeNvimLockWritable =
config.lib.dag.entryAfter [ "linkGeneration" ] ''
home.activation.makeNvimLockWritable = config.lib.dag.entryAfter [ "linkGeneration" ] ''
lockFile="${config.xdg.configHome}/nvim/lazy-lock.json"
sourceLock="${./nvim/lazy-lock.json}"

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,12 +75,12 @@ 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" ] ''
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 ]
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 [
macosSystemPaths =
if pkgs.stdenv.hostPlatform.isDarwin then
[
"/usr/local/bin"
"/usr/bin"
"/bin"
"/usr/sbin"
"/sbin"
] else
]
else
[ ];
formatPathList = paths:
lib.concatMapStrings (path: " \"${path}\"\n") paths;
in {
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;

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 [{
subUidRanges = mkDefault [
{
startUid = 100000;
count = 65536;
}];
subGidRanges = mkDefault [{
}
];
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,8 +10,7 @@
dedicatedServer.openFirewall = true;
# Enable Proton compatibility layer
extraCompatPackages = with pkgs;
[
extraCompatPackages = with pkgs; [
proton-ge-bin # GloriousEggroll's Proton builds
];
};
@ -19,7 +19,9 @@
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,13 +61,14 @@
border_size = 2;
};
decoration = { rounding = 8; };
decoration = {
rounding = 8;
};
};
};
# User packages: Hyprland utilities
home.packages = with pkgs;
[
home.packages = with pkgs; [
# Uncomment as needed:
# wofi # Launcher
# waybar # Status bar

View file

@ -1,4 +1,10 @@
{ lib, pkgs, user, ... }: {
{
lib,
pkgs,
user,
...
}:
{
imports = [ ./base.nix ];
# System-level: KDE Plasma 6
@ -11,8 +17,7 @@
};
# System packages: KDE applications
environment.systemPackages = with pkgs;
[
environment.systemPackages = with pkgs; [
# KDE applications (uncomment as needed)
# kdePackages.kate # Text editor
# kdePackages.dolphin # File manager
@ -34,8 +39,7 @@
# };
# User packages for KDE environment
home.packages = with pkgs;
[
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 ''

View file

@ -1,6 +1,13 @@
{ pkgs, lib, llm-agents }:
{
pkgs,
lib,
llm-agents,
}:
let
system = pkgs.stdenv.hostPlatform.system;
llmPkgs = llm-agents.packages.${system};
in { opencode = llmPkgs.opencode; }
in
{
opencode = llmPkgs.opencode;
}

View file

@ -15,7 +15,7 @@ nix develop # or: nix develop .#default
**Includes:**
- Git
- nixfmt-classic
- nixfmt
- uv (for `uvx` commands)
**MCP helper:**

View file

@ -1,4 +1,9 @@
{ pkgs, lib, customPkgs, ... }:
{
pkgs,
lib,
customPkgs,
...
}:
pkgs.mkShell {
name = "ai-agent";

View file

@ -1,7 +1,13 @@
{ pkgs, lib, python ? pkgs.python312, ... }:
{
pkgs,
lib,
python ? pkgs.python312,
...
}:
let
pythonWithAI = python.withPackages (ps:
pythonWithAI = python.withPackages (
ps:
let
basePackages = with ps; [
accelerate
@ -25,12 +31,28 @@ let
tokenizers
transformers
];
linuxOnlyPackages = lib.optionals pkgs.stdenv.isLinux
(with ps; [ sentencepiece torch torchaudio torchvision ]);
in basePackages ++ linuxOnlyPackages);
in pkgs.mkShell {
linuxOnlyPackages = lib.optionals pkgs.stdenv.isLinux (
with ps;
[
sentencepiece
torch
torchaudio
torchvision
]
);
in
basePackages ++ linuxOnlyPackages
);
in
pkgs.mkShell {
name = "ai-notebook";
packages = with pkgs; [ pythonWithAI uv git-lfs ruff pyright ];
packages = with pkgs; [
pythonWithAI
uv
git-lfs
ruff
pyright
];
shellHook = ''
export UV_PYTHON="${pythonWithAI}/bin/python3"

View file

@ -8,7 +8,8 @@ let
'';
# Generate MCP configs for GUI applications
mcpConfigForGUI = pkgs.writeText "mcp_settings.json" (builtins.toJSON {
mcpConfigForGUI = pkgs.writeText "mcp_settings.json" (
builtins.toJSON {
mcpServers = {
nixos = {
type = "stdio";
@ -16,7 +17,8 @@ let
args = [ ];
};
};
});
}
);
# Script to install MCP configs for Claude Code and Codex
installMcpConfigs = pkgs.writeShellScriptBin "install-mcp-configs" ''
@ -83,12 +85,13 @@ let
"$out_link/bin/nvim" "$@"
'';
in pkgs.mkShell {
in
pkgs.mkShell {
name = "default";
packages = with pkgs; [
git
nix
nixfmt-classic
nixfmt
uv
python3
mcpNixosWrapper

View file

@ -93,7 +93,8 @@ let
echo " bun es list - Browse Effect patterns"
'';
in pkgs.mkShell {
in
pkgs.mkShell {
name = "effect-ts";
packages = with pkgs; [
bun

View file

@ -2,7 +2,13 @@
pkgs.mkShell {
name = "go";
packages = with pkgs; [ go gopls golangci-lint delve git ];
packages = with pkgs; [
go
gopls
golangci-lint
delve
git
];
shellHook = ''
mkdir -p "$PWD/.cache/go" "$PWD/.cache/gomod"
export GOPATH="$PWD/.cache/go"

View file

@ -1,9 +1,13 @@
{ pkgs, python ? pkgs.python312, ... }:
{
pkgs,
python ? pkgs.python312,
...
}:
let
# Python environment with notebook tooling and core data-science libs
pythonWithNotebook = python.withPackages (ps:
with ps; [
pythonWithNotebook = python.withPackages (
ps: with ps; [
altair
ipykernel
jupyterlab
@ -15,10 +19,17 @@ let
scipy
scikit-learn
seaborn
]);
in pkgs.mkShell {
]
);
in
pkgs.mkShell {
name = "jupyter-notebook";
packages = [ pythonWithNotebook pkgs.ruff pkgs.pyright pkgs.git ];
packages = [
pythonWithNotebook
pkgs.ruff
pkgs.pyright
pkgs.git
];
shellHook = ''
export PYTHONNOUSERSITE=1
export JUPYTER_CONFIG_DIR="''${XDG_CONFIG_HOME:-$HOME/.config}/jupyter"

View file

@ -1,8 +1,17 @@
{ pkgs, python ? pkgs.python312, ... }:
{
pkgs,
python ? pkgs.python312,
...
}:
pkgs.mkShell {
name = "python-uv";
packages = [ python pkgs.uv pkgs.ruff pkgs.pyright ];
packages = [
python
pkgs.uv
pkgs.ruff
pkgs.pyright
];
shellHook = ''
export UV_PYTHON="${python}/bin/python3"
export UV_LINK_MODE=copy

View file

@ -2,7 +2,13 @@
pkgs.mkShell {
name = "rust";
packages = with pkgs; [ cargo rustc rust-analyzer rustfmt clippy ];
packages = with pkgs; [
cargo
rustc
rust-analyzer
rustfmt
clippy
];
shellHook = ''
mkdir -p "$PWD/.cache/cargo"
export CARGO_HOME="$PWD/.cache/cargo"