This commit is contained in:
Rasyidan Akbar F. 2025-09-26 15:50:15 +07:00
commit bcbd699c4c
11 changed files with 786 additions and 124 deletions

View file

@ -0,0 +1,48 @@
{ config, pkgs, lib, ... }:
let
inherit (lib) mkIf mkOption types;
cfg = config.rsydn.systemPackages;
in {
options.rsydn.systemPackages = {
enable = mkOption {
type = types.bool;
default = true;
description = "Enable system-wide development packages.";
};
packages = mkOption {
type = types.listOf types.package;
default = with pkgs; [
ast-grep
duckdb
ffmpeg
fzf
go
htop
jetbrains-mono
jq
lazydocker
lazygit
lorri
neovim
pandoc
postgresql_18
python312
python312Packages.uv
ripgrep
rustc
rustup
tree
vim
yq
tmux
tailscale
sqlite
wget
];
description = "System packages to install for development tooling.";
};
};
config = mkIf cfg.enable { environment.systemPackages = cfg.packages; };
}

View file

@ -0,0 +1,66 @@
{ config, lib, ... }:
let
inherit (lib) mkIf mkOption types;
cfg = config.rsydn.homebrew;
in {
options.rsydn.homebrew = {
enable = mkOption {
type = types.bool;
default = true;
description = "Whether to manage Homebrew declaratively.";
};
taps = mkOption {
type = types.listOf types.str;
default = [ ];
description = "Homebrew taps to add.";
};
brews = mkOption {
type = types.listOf types.str;
default = [
"curl"
"yt-dlp"
"nodejs"
"charmbracelet/tap/crush"
"sst/tap/opencode"
"ruff"
"libmagic"
"ghostscript"
"infisical"
"fastfetch"
];
description = "Homebrew formulae to install.";
};
casks = mkOption {
type = types.listOf types.str;
default = [
"bitwarden"
"chromium"
"dbngin"
"pgadmin14"
"docker-desktop"
"spotify"
"discord"
"obs"
"neohtop"
"orbstack"
"visual-studio-code"
"google-chrome@canary"
"mactex"
];
description = "Homebrew casks to install.";
};
};
config = mkIf cfg.enable {
homebrew = {
enable = true;
global.autoUpdate = false;
onActivation = {
autoUpdate = false;
cleanup = "zap";
upgrade = false;
};
inherit (cfg) taps brews casks;
};
};
}

50
modules/darwin/system.nix Normal file
View file

@ -0,0 +1,50 @@
{ config, pkgs, lib, ... }: {
imports = [ ./homebrew.nix ./devtools.nix ];
services.nix-daemon.enable = true;
nix = {
package = pkgs.nix;
extraOptions = ''
keep-derivations = true
keep-outputs = true
'';
settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
warn-dirty = false;
};
gc = {
automatic = true;
interval = {
Weekday = 0;
Hour = 3;
Minute = 30;
};
options = "--delete-older-than 30d";
};
};
system = {
stateVersion = "24.05";
defaults = {
NSGlobalDomain = {
ApplePressAndHoldEnabled = false;
KeyRepeat = 2;
InitialKeyRepeat = 15;
};
dock = {
autohide = true;
show-recents = false;
tilesize = 48;
};
finder = {
AppleShowAllExtensions = true;
AppleShowAllFiles = true;
};
};
};
security.pam.enableSudoTouchIdAuth = true;
}

View file

@ -1,72 +1,24 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
imports = [
./programs/helix.nix
./programs/neovim.nix
./shell/zsh.nix
./shell/tmux.nix
./devtools/default.nix
];
rsydn.shell.zsh = {
enable = true;
plugins = [];
extraAfter = ''
# Source personal secrets
[ -f ~/.config/zsh/secrets.zsh ] && source ~/.config/zsh/secrets.zsh
# Custom PATH additions
export PATH="$HOME/.local/bin:$PATH"
export PATH="$PATH:$HOME/.composer/vendor/bin"
export PATH="$HOME/.claude/local/bin:$PATH"
export PATH="$HOME/go/bin:$PATH"
export PATH="/usr/local/texlive/2024/bin/universal-darwin:$PATH"
# NVM setup
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
# Bun setup
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
# pnpm setup
export PNPM_HOME="$HOME/Library/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# LM Studio
export PATH="$PATH:$HOME/.lmstudio/bin"
# opencode
export PATH="$HOME/.opencode/bin:$PATH"
# Custom aliases
alias runopenwebui='DATA_DIR=~/.open-webui uvx --python 3.11 open-webui@latest serve'
# Vi mode
bindkey -v
# Conda setup (managed by conda init)
# >>> conda initialize >>>
__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then
. "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh"
else
export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
'';
plugins = [ ];
enableVimMode = true;
};
programs.git.enable = true;
home.packages = with pkgs; [ docker docker-compose ];
rsydn.devTools = {
enable = lib.mkDefault false;
packages = [];
packages = [ ];
};
}

View file

@ -0,0 +1,20 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkOption types mkIf;
cfg = config.rsydn.devTools;
in {
options.rsydn.devTools = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable per-user development tooling packages.";
};
packages = mkOption {
type = types.listOf types.package;
default = [ ];
description = "Extra user-scoped packages to install.";
};
};
config = mkIf cfg.enable { home.packages = cfg.packages; };
}

View file

@ -0,0 +1,20 @@
{ pkgs, lib, ... }: {
programs.helix = {
enable = lib.mkDefault true;
settings = {
theme = "gruber-darker";
editor = {
cursor-shape = {
normal = "block";
insert = "bar";
select = "underline";
};
};
};
languages.language = [{
name = "nix";
auto-format = true;
formatter.command = "${pkgs.nixfmt-classic}/bin/nixfmt";
}];
};
}

View file

@ -0,0 +1,12 @@
{ inputs, pkgs, ... }:
let
system = pkgs.stdenv.hostPlatform.system;
lazyvim = inputs."nvim-bundle".packages.${system}.neovim;
in {
programs.neovim = {
enable = true;
package = lazyvim;
withNodeJs = true;
withPython3 = true;
};
}

View file

@ -0,0 +1,33 @@
{ lib, pkgs, ... }: {
programs.tmux = {
enable = lib.mkDefault true;
clock24 = true;
historyLimit = 20000;
mouse = true;
baseIndex = 1;
prefix = "C-a";
escapeTime = 0;
aggressiveResize = true;
plugins = [{
plugin = pkgs.tmuxPlugins.dracula;
extraConfig = ''
set -g @dracula-pane-border-style "fg=#44475a"
set -g @dracula-plugins "cpu-usage battery network-bandwidth time"
set -g @dracula-show-empty-plugins off
set -g @dracula-refresh-rate 5
'';
}];
extraConfig = ''
set-option -g status-style "bg=#282a36 fg=#f8f8f2"
set -g status-interval 5
setw -g automatic-rename on
set -g renumber-windows on
bind r source-file ~/.tmux.conf \; display-message "tmux reloaded"
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
set -g display-panes-time 1500
'';
};
}

View file

@ -0,0 +1,83 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.rsydn.shell.zsh;
in {
options.rsydn.shell.zsh = {
enable = mkEnableOption "user zsh configuration managed by Home Manager";
theme = mkOption {
type = types.str;
default = "powerlevel10k/powerlevel10k";
description = "Oh My Zsh theme name.";
};
plugins = mkOption {
type = types.listOf types.str;
default = [ ];
description = "Oh My Zsh plugins to load.";
};
aliases = mkOption {
type = types.attrsOf types.str;
default = { };
description = "Zsh command aliases.";
};
extraBeforeCompInit = mkOption {
type = types.lines;
default = ''
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
fi
'';
description =
"Extra script executed before compinit (useful for instant prompt).";
};
extraAfter = mkOption {
type = types.lines;
default = "";
description = "Additional script appended after Oh My Zsh loads.";
};
enableAutoSuggestion = mkOption {
type = types.bool;
default = true;
description = "Enable zsh-autosuggestions.";
};
enableSyntaxHighlighting = mkOption {
type = types.bool;
default = true;
description = "Enable zsh-syntax-highlighting.";
};
enableVimMode = mkOption {
type = types.bool;
default = false;
description = "Enable vi keybindings by running bindkey -v.";
};
};
config = mkIf cfg.enable {
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = cfg.enableAutoSuggestion;
syntaxHighlighting.enable = cfg.enableSyntaxHighlighting;
shellAliases = cfg.aliases;
initExtraBeforeCompInit = cfg.extraBeforeCompInit;
initExtraFirst = lib.optionalString cfg.enableVimMode ''
bindkey -v
'';
initExtra = cfg.extraAfter;
oh-my-zsh = {
enable = true;
theme = cfg.theme;
plugins = cfg.plugins;
};
};
};
}