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 ## 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 ## AI Agent Workflow with Beads

132
flake.nix
View file

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

View file

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

View file

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

View file

@ -1,8 +1,14 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let let
inherit (lib) mkIf mkOption types; inherit (lib) mkIf mkOption types;
cfg = config.rsydn.systemPackages; cfg = config.rsydn.systemPackages;
in { in
{
options.rsydn.systemPackages = { options.rsydn.systemPackages = {
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;
@ -13,8 +19,7 @@ in {
packages = mkOption { packages = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
default = with pkgs; [ tailscale ]; default = with pkgs; [ tailscale ];
description = description = "System packages that must be available globally across macOS.";
"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 # Import shared cross-platform home configuration
imports = [ imports = [
../../home/base.nix ../../home/base.nix

View file

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

View file

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

View file

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

View file

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

View file

@ -2,7 +2,8 @@
let let
inherit (lib) mkIf mkOption types; inherit (lib) mkIf mkOption types;
cfg = config.rsydn.homebrew; cfg = config.rsydn.homebrew;
in { in
{
options.rsydn.homebrew = { options.rsydn.homebrew = {
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;
@ -16,7 +17,12 @@ in {
}; };
brews = mkOption { brews = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ "curl" "yt-dlp" "infisical" "mole" ]; default = [
"curl"
"yt-dlp"
"infisical"
"mole"
];
description = "Homebrew formulae to install."; description = "Homebrew formulae to install.";
}; };
casks = mkOption { 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 = { nix = {
# Use default nix version from nixpkgs (don't pin to avoid rebuild issues) # Use default nix version from nixpkgs (don't pin to avoid rebuild issues)
@ -8,12 +18,14 @@
keep-outputs = true keep-outputs = true
''; '';
settings = { settings = {
experimental-features = [ "nix-command" "flakes" ]; experimental-features = [
"nix-command"
"flakes"
];
warn-dirty = false; warn-dirty = false;
# Numtide binary cache for llm-agents.nix packages # Numtide binary cache for llm-agents.nix packages
extra-substituters = [ "https://cache.numtide.com" ]; extra-substituters = [ "https://cache.numtide.com" ];
extra-trusted-public-keys = extra-trusted-public-keys = [ "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ber8L+2z9FqRZJ+KBKGE4NNsT0=" ];
[ "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ber8L+2z9FqRZJ+KBKGE4NNsT0=" ];
}; };
optimise.automatic = true; optimise.automatic = true;
gc = { 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 # Set XDG Base Directory environment variables globally
# This ensures nushell and other XDG-compliant tools use ~/.config # This ensures nushell and other XDG-compliant tools use ~/.config

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
home.packages = [ pkgs.fastfetch ]; home.packages = [ pkgs.fastfetch ];
@ -6,12 +11,13 @@
# Copy the custom logo file # Copy the custom logo file
xdg.configFile."fastfetch/oguri-logo.txt".source = ./oguri-logo.txt; 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"''; esc = builtins.fromJSON ''"\u001b"'';
osIcon = if pkgs.stdenv.isDarwin then "" else ""; osIcon = if pkgs.stdenv.isDarwin then "" else "";
in builtins.toJSON { in
"$schema" = builtins.toJSON {
"https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json"; "$schema" = "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json";
logo = { logo = {
type = "file"; type = "file";
@ -26,7 +32,9 @@
display = { display = {
separator = " "; separator = " ";
key = { width = 16; }; key = {
width = 16;
};
}; };
modules = [ modules = [
@ -35,8 +43,7 @@
# Hardware Section # Hardware Section
{ {
type = "custom"; type = "custom";
format = format = "${esc}[32m Hardware${esc}[0m";
"${esc}[32m Hardware${esc}[0m";
} }
{ {
type = "host"; type = "host";
@ -80,15 +87,13 @@
# Software Section # Software Section
{ {
type = "custom"; type = "custom";
format = format = "${esc}[34m Software${esc}[0m";
"${esc}[34m Software${esc}[0m";
} }
{ {
type = "command"; type = "command";
key = "${osIcon} OS"; key = "${osIcon} OS";
keyColor = "blue"; keyColor = "blue";
text = 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";
"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"; type = "kernel";
@ -130,16 +135,14 @@
# Uptime / Age Section # Uptime / Age Section
{ {
type = "custom"; type = "custom";
format = format = "${esc}[35m Uptime / Age${esc}[0m";
"${esc}[35m Uptime / Age${esc}[0m";
} }
{ {
type = "command"; type = "command";
key = "󱦟 OS Age"; key = "󱦟 OS Age";
keyColor = "magenta"; keyColor = "magenta";
# macOS compatible stat command # macOS compatible stat command
text = '' 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"'';
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"; type = "uptime";

View file

@ -1,4 +1,5 @@
{ pkgs, lib, ... }: { { pkgs, lib, ... }:
{
programs.helix = { programs.helix = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
settings = { settings = {
@ -18,10 +19,12 @@
}; };
}; };
}; };
languages.language = [{ languages.language = [
{
name = "nix"; name = "nix";
auto-format = true; 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 = { programs.neovim = {
enable = true; enable = true;
viAlias = true; viAlias = true;
@ -27,7 +28,7 @@
# Formatters # Formatters
stylua # Lua stylua # Lua
nixfmt-classic # Nix (matches your fmt command) nixfmt # Nix
ruff # Python (formatter + linter) ruff # Python (formatter + linter)
prettierd # JS/TS/JSON/YAML/Markdown prettierd # JS/TS/JSON/YAML/Markdown
rustfmt # Rust rustfmt # Rust
@ -61,8 +62,7 @@
}; };
# Copy lazy-lock.json as writable (not symlinked to read-only Nix store) # Copy lazy-lock.json as writable (not symlinked to read-only Nix store)
home.activation.makeNvimLockWritable = home.activation.makeNvimLockWritable = config.lib.dag.entryAfter [ "linkGeneration" ] ''
config.lib.dag.entryAfter [ "linkGeneration" ] ''
lockFile="${config.xdg.configHome}/nvim/lazy-lock.json" lockFile="${config.xdg.configHome}/nvim/lazy-lock.json"
sourceLock="${./nvim/lazy-lock.json}" sourceLock="${./nvim/lazy-lock.json}"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }:
{
# Gaming configuration module # Gaming configuration module
# Steam, Proton, Vulkan, Wine, and gaming optimizations # Steam, Proton, Vulkan, Wine, and gaming optimizations
@ -9,8 +10,7 @@
dedicatedServer.openFirewall = true; dedicatedServer.openFirewall = true;
# Enable Proton compatibility layer # Enable Proton compatibility layer
extraCompatPackages = with pkgs; extraCompatPackages = with pkgs; [
[
proton-ge-bin # GloriousEggroll's Proton builds proton-ge-bin # GloriousEggroll's Proton builds
]; ];
}; };
@ -19,7 +19,9 @@
programs.gamemode = { programs.gamemode = {
enable = true; enable = true;
settings = { settings = {
general = { renice = 10; }; general = {
renice = 10;
};
custom = { custom = {
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'"; start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'"; end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
@ -72,5 +74,7 @@
# ]; # ];
# Increase file watchers for game modding tools # 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 # Generated by running: nixos-generate-config --show-hardware-config
# This file contains hardware-specific settings that should be adjusted for your actual hardware # 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") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
# Kernel modules needed during boot # Kernel modules needed during boot
# Adjust based on your hardware (NVMe, SATA, USB, etc.) # Adjust based on your hardware (NVMe, SATA, USB, etc.)
boot.initrd.availableKernelModules = boot.initrd.availableKernelModules = [
[ "nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; "nvme"
"xhci_pci"
"ahci"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ]; # Change to "kvm-intel" for Intel CPUs boot.kernelModules = [ "kvm-amd" ]; # Change to "kvm-intel" for Intel CPUs
@ -24,7 +34,10 @@
fileSystems."/boot" = { fileSystems."/boot" = {
device = "/dev/disk/by-uuid/REPLACE-WITH-YOUR-BOOT-UUID"; device = "/dev/disk/by-uuid/REPLACE-WITH-YOUR-BOOT-UUID";
fsType = "vfat"; fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ]; options = [
"fmask=0022"
"dmask=0022"
];
}; };
# Swap configuration (optional) # Swap configuration (optional)
@ -34,8 +47,7 @@
# ]; # ];
# CPU microcode updates # CPU microcode updates
hardware.cpu.amd.updateMicrocode = hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
lib.mkDefault config.hardware.enableRedistributableFirmware;
# For Intel CPUs, use this instead: # For Intel CPUs, use this instead:
# hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; # hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

View file

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

View file

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

View file

@ -1,4 +1,10 @@
{ lib, pkgs, user, ... }: { {
lib,
pkgs,
user,
...
}:
{
# Catppuccin theme configuration # Catppuccin theme configuration
# Soothing pastel theme for both GTK and Qt applications # Soothing pastel theme for both GTK and Qt applications
# Works with KDE Plasma, Hyprland, and other desktop environments # 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 # Default theme configuration for desktop
# Simple Adwaita-dark theme that works across all desktop environments # Simple Adwaita-dark theme that works across all desktop environments
# Switch to catppuccin.nix or create your own for custom themes # Switch to catppuccin.nix or create your own for custom themes

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,13 @@
{ pkgs, lib, llm-agents }: {
pkgs,
lib,
llm-agents,
}:
let let
system = pkgs.stdenv.hostPlatform.system; system = pkgs.stdenv.hostPlatform.system;
llmPkgs = llm-agents.packages.${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:** **Includes:**
- Git - Git
- nixfmt-classic - nixfmt
- uv (for `uvx` commands) - uv (for `uvx` commands)
**MCP helper:** **MCP helper:**

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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