From 248170c877d0643e6d8d07ef92f9fcf63f32384c Mon Sep 17 00:00:00 2001 From: Sangmin Kim Date: Wed, 4 Mar 2026 18:02:39 +0900 Subject: [PATCH 01/28] feat: nix-darwin-kickstarter minimal --- .DS_Store | Bin 6148 -> 0 bytes flake.lock | 63 ----------------- flake.nix | 33 ++++----- modules/.DS_Store | Bin 6148 -> 0 bytes modules/apps.nix | 99 ++++---------------------- modules/host-users.nix | 15 +--- modules/nix-core.nix | 32 +++++---- modules/system.nix | 157 +++++++++++++++++------------------------ result | 1 - 9 files changed, 111 insertions(+), 289 deletions(-) delete mode 100644 .DS_Store delete mode 100644 flake.lock delete mode 100644 modules/.DS_Store delete mode 120000 result diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 29d63c76efe089fad48c536e80e79c78124ec02e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmZQzU|@7AO)+F(5MW?n;9!8zEL;p&0Z1N%F(jFwBAg)ez-FW}=rQCmWHMBE=0N2} zsnHM^4S~TM0-(Ih$&kj7!;r|3&484D^OKWu@{^!N!+Hh=2EG4a0QL$yLoP!;LkdGF zLk>eKLvd1haRF5Ij--N|%;FLQgKLaT%q*;I?ChNE-0ZQz8TsYGC5a`a#ZHMu(I8$( zetu38jGdSimYG@}FCgNapI4HYnU`7wQWBh*lA4rQ6ce7Amy%!ZlwX>cQViA$mEh#$ z;EWfLsIE3Kw9rv7H#ex&QK+^wGSE>lu{5f!<>U}m*0&Cd&(6us%kKian}LxLLNo9} zX&BYbz`%g!tCZs8oTU7Ga7l(Hm6L85oSdIq0Mm`BIXBM!k>%}C z-;RdBXb2Dy0-*9i0a~RvKw=SYXC6g8KmsAUTj$5Dn4_qCr|2 z7(pzs8DOmpj8LtN;BE*=AE-+LqQTl37#YCY85kMB+Tj&ABSbp`Bh+R_Xb*)EqMd;e zqMd;eq8;YEQF=54MneD^0?ZIv0960GGBDuk|3g%blA|Fo8Un*I1Q=Odf?b@zl`?k! zf$CaNeVPE32G#zc>X;E!Peb&9lz?TKAOngLU=BnMq!m={gR5dj21rdl+7N(+&?r3` I0`w070QpRe&Hw-a diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 70619e6..0000000 --- a/flake.lock +++ /dev/null @@ -1,63 +0,0 @@ -{ - "nodes": { - "darwin": { - "inputs": { - "nixpkgs": [ - "nixpkgs-darwin" - ] - }, - "locked": { - "lastModified": 1758102940, - "narHash": "sha256-wwqf3+A8EiqwWpcAaPN20QXJLlpGPpwtLTrzgnngI2o=", - "owner": "lnl7", - "repo": "nix-darwin", - "rev": "ebd0bfc11fc2b5cff37401e9b3703881ad5fabbd", - "type": "github" - }, - "original": { - "owner": "lnl7", - "repo": "nix-darwin", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1758262103, - "narHash": "sha256-aBGl3XEOsjWw6W3AHiKibN7FeoG73dutQQEqnd/etR8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "12bd230118a1901a4a5d393f9f56b6ad7e571d01", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs-darwin": { - "locked": { - "lastModified": 1758262103, - "narHash": "sha256-aBGl3XEOsjWw6W3AHiKibN7FeoG73dutQQEqnd/etR8=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "12bd230118a1901a4a5d393f9f56b6ad7e571d01", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "darwin": "darwin", - "nixpkgs": "nixpkgs", - "nixpkgs-darwin": "nixpkgs-darwin" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix index 63f48c5..84db232 100644 --- a/flake.nix +++ b/flake.nix @@ -1,29 +1,21 @@ { - description = "Nix for macOS configuration"; + description = "Nix for Poby's MacOS"; - ################################################################################################################## - # - # Want to know Nix in details? Looking for a beginner-friendly tutorial? - # Check out https://github.com/ryan4yin/nixos-and-flakes-book ! - # - ################################################################################################################## + nixConfig = { + substituters = [ "https://cache.nixos.org" ]; + }; - # This is the standard format for flake.nix. `inputs` are the dependencies of the flake, - # Each item in `inputs` will be passed as a parameter to the `outputs` function after being pulled and built. - inputs = { - nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - # nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin"; + inputs = let + stableVersion = "25.11"; # FIXME to bump to latest stable version + in { + # nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # comment out for unstable version + nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-${stableVersion}-darwin"; darwin = { - url = "github:lnl7/nix-darwin"; + url = "github:lnl7/nix-darwin/nix-darwin-${stableVersion}"; inputs.nixpkgs.follows = "nixpkgs-darwin"; }; }; - # The `outputs` function will return all the build results of the flake. - # A flake can have many use cases and different types of outputs, - # parameters in `outputs` are defined in `inputs` and can be referenced by their names. - # However, `self` is an exception, this special parameter points to the `outputs` itself (self-reference) - # The `@` syntax here is used to alias the attribute set of the inputs's parameter, making it convenient to use inside the function. outputs = inputs @ { self, nixpkgs, @@ -32,7 +24,7 @@ }: let username = "poby"; system = "aarch64-darwin"; - hostname = "pobys-macbook-pro"; + hostname = "fenrir"; # TODO break down to multiple hosts specialArgs = inputs @@ -49,7 +41,6 @@ ./modules/host-users.nix ]; }; - # nix code formatter formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra; }; -} \ No newline at end of file +} diff --git a/modules/.DS_Store b/modules/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmZQzU|@7AO)+F(5MW?n;9!8z45|!R0Z1N%F(jFgL>QrFAPJ2!M?+vV1V%$(Gz3ON zU^D~25V%SxcdJP zRior+2#kinunYl47MEZbCs3t{!+W4QHvuXKVuPw;Mo^s$(F3lEVT}ML$bg~*R5_@+ b2Uo?6kTwK}57Iu`5P${HC_Nei0}uiLNUI8I diff --git a/modules/apps.nix b/modules/apps.nix index e41b251..0881f28 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -1,116 +1,46 @@ { pkgs, ... }: { - ########################################################################## - # - # Install all apps and packages here. - # - ########################################################################## - - # Install packages from nix's official package repository. - # - # The packages installed here are available to all users, and are reproducible across machines, and are rollbackable. - # But on macOS, it's less stable than homebrew. - # - # Related Discussion: https://discourse.nixos.org/t/darwin-again/29331 environment.systemPackages = with pkgs; [ - # CLI git just # use Justfile to simplify nix-darwin's commands - ffmpeg - fzf - bat - fastfetch - gh - lsd - mkalias - python310 - tldr - tmux - tree - zoxide - zsh-powerlevel10k - zsh-fzf-tab - commitizen + vim + curl ]; - environment.variables.EDITOR = "nvim"; - # TODO To make this work, homebrew need to be installed manually, see https://brew.sh - # - # The apps installed by homebrew are not managed by nix, and not reproducible! - # But on macOS, homebrew has a much larger selection of apps than nixpkgs, especially for GUI apps! homebrew = { enable = true; onActivation = { - autoUpdate = true; # Fetch the newest stable branch of Homebrew's git repo - upgrade = true; # Upgrade outdated casks, formulae, and App Store apps - # 'zap': uninstalls all formulae(and related files) not listed in the generated Brewfile + autoUpdate = true; cleanup = "zap"; }; # Applications to install from Mac App Store using mas. - # You need to install all these Apps manually first so that your apple account have records for them. - # otherwise Apple Store will refuse to install them. - # For details, see https://github.com/mas-cli/mas masApps = { KakaoTalk = 869223134; Across = 6444851827; - Flighty = 1358823008; - Numbers = 409203825; - Pages = 409201541; - Keynote = 409183694; Bitwarden = 1352778147; }; taps = [ ]; - # `brew install` + # WARNING only include those not in nixpkgs brews = [ - "wget" - "curl" # do not install curl via nixpkgs, it's not working well on macOS! - "nvm" - "uv" - "openjdk" - "openjdk@21" - "openjdk@17" - "neovim" - "ripgrep" - "tree-sitter" + # "neovim" + # "ripgrep" + # "fd" ]; - # `brew install --cask` casks = [ - "alt-tab" - "bruno" - "discord" - "google-chrome" - "iina" - "intellij-idea" - "jordanbaird-ice" - "keka" - "raycast" - "rectangle" - "slack" - "stats" - "telegram" - "visual-studio-code" - "zoom" - "claude" "batfi" - "docker-desktop" - "cursor" - "daisydisk" - "ghostty" "hammerspoon" - "hancom-docs" - "logi-options+" - "notion" - "onyx" - "shottr" - "arc" - "obsidian" - "antigravity" - "figma" + # "google-chrome" + # "iina" + # "jordanbaird-ice" + # "keka" + # "shottr" + # "raycast" + # "stats" # Fonts "font-fontawesome" @@ -121,6 +51,7 @@ "font-symbols-only-nerd-font" "font-material-design-icons-webfont" "font-pretendard" + "font-maple-mono-nf" ]; }; } diff --git a/modules/host-users.nix b/modules/host-users.nix index 079befd..0276164 100644 --- a/modules/host-users.nix +++ b/modules/host-users.nix @@ -1,23 +1,12 @@ -{ - username, - hostname, - ... -} @ args: -############################################################# -# -# Host & Users configuration -# -############################################################# +{ username, hostname, ... }: { networking.hostName = hostname; networking.computerName = hostname; - system.defaults.smb.NetBIOSName = hostname; - # Define a user account. Don't forget to set a password with ‘passwd’. users.users."${username}" = { home = "/Users/${username}"; description = username; }; - nix.settings.trusted-users = [username]; + nix.settings.trusted-users = [ username ]; } diff --git a/modules/nix-core.nix b/modules/nix-core.nix index 721ee99..5463f09 100644 --- a/modules/nix-core.nix +++ b/modules/nix-core.nix @@ -1,20 +1,22 @@ -{ pkgs, ... }: - +{ pkgs, lib, ... }: { - nix.settings = { - # enable flakes globally - experimental-features = ["nix-command" "flakes"]; + nix = { + enable = true; + package = pkgs.nix; + + settings = { + experimental-features = [ "nix-command" "flakes" ]; + substituters = [ "https://nix-community.cachix.org" ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + builders-user-substitutes = true; + auto-optimise-store = false; # issue https://github.com/NixOS/nix/issues/7273 + }; }; - # Allow unfree packages - nixpkgs.config = { - allowUnfree = true; - allowBroken = true; + gc = { + automatic = lib.mkDefault true; + options = lib.mkDefault "--delete-older-than 7d"; }; - - # Auto upgrade nix package and the daemon service. - nix.package = pkgs.nix; - - # Enable Determinate - nix.enable = false; } diff --git a/modules/system.nix b/modules/system.nix index f41a4d2..70e914f 100644 --- a/modules/system.nix +++ b/modules/system.nix @@ -1,21 +1,10 @@ -{ pkgs, config, username, ... }: +{ pkgs, config, username, hostname, ... }: - ################################################################################### - # - # macOS's System configuration - # - # All the configuration options are documented here: - # https://daiderd.com/nix-darwin/manual/index.html#sec-options - # Incomplete list of macOS `defaults` commands : - # https://github.com/yannbertrand/macos-defaults - # - ################################################################################### { system = { primaryUser = username; stateVersion = 6; - # activationScripts are executed every time you boot the system or run `nixos-rebuild` / `darwin-rebuild`. activationScripts.extraActivation.text = '' # activateSettings -u will reload the settings from the database and apply them to the current session, # so we do not need to logout and login again to make the changes take effect. @@ -30,26 +19,24 @@ }; in pkgs.lib.mkForce '' - # Set up applications. - echo "setting up /Applications..." >&2 - rm -rf /Applications/Nix\ Apps - mkdir -p /Applications/Nix\ Apps - find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + | - while read -r src; do - app_name=$(basename "$src") - echo "copying $src" >&2 - ${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name" - done - ''; + # Set up applications. + echo "setting up /Applications..." >&2 + rm -rf /Applications/Nix\ Apps + mkdir -p /Applications/Nix\ Apps + find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + | + while read -r src; do + app_name=$(basename "$src") + echo "copying $src" >&2 + ${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name" + done + ''; defaults = { - # login window + loginwindow = { - GuestEnabled = false; # disable guest user - SHOWFULLNAME = true; # show full name in login window + GuestEnabled = false; }; - # control center controlcenter = { Sound = false; Bluetooth = false; @@ -58,14 +45,11 @@ NowPlaying = false; }; - # clock menuExtraClock = { Show24Hour = true; - ShowAMPM = false; ShowDayOfWeek = false; }; - - # dock + dock = { autohide = true; autohide-delay = 0.01; @@ -75,38 +59,69 @@ tilesize = 50; magnification = true; largesize = 70; - wvous-bl-corner = 11; + showMissionControlGestureEnabled = true; }; - # finder finder = { AppleShowAllFiles = true; + AppleShowAllExtensions = true; ShowStatusBar = true; ShowPathbar = true; - FXPreferredViewStyle = "Nlsv"; - AppleShowAllExtensions = true; - QuitMenuItem = true; + FXPreferredViewStyle = "clmv"; + FXRemoveOldTrashItems = true; + _FXEnableColumnAutoSizing = true; _FXShowPosixPathInTitle = true; _FXSortFoldersFirst = true; + _FXSortFoldersFirstOnDesktop = true; FXEnableExtensionChangeWarning = false; - NewWindowTarget = "Home"; + FXDefaultSearchScope = "SCcf"; + NewWindowTarget = "Other"; + NewWindowTargetPath = "/Users/${username}/Downloads"; + ShowExternalHardDrivesOnDesktop = true; + ShowHardDrivesOnDesktop = true; + ShowMountedServersOnDesktop = true; + ShowRemovableMediaOnDesktop = true; + QuitMenuItem = true; }; - # trackpad trackpad = { Clicking = true; - TrackpadRightClick = true; # enable two finger right click - TrackpadThreeFingerDrag = true; # enable three finger drag + TrackpadRightClick = true; # two finger right click + TrackpadThreeFingerDrag = true; + TrackpadFourFingerHorizSwipeGesture = 2; # swipe between full-screen applications + TrackpadFourFingerVertSwipeGesture = 2; # down for Mission Control, up for App Expose + TrackpadPinch = true; + TrackpadThreeFingerHorizSwipGesture = 0; # disable for three finger drag + TrackpadThreeFingerVertSwipeGesture = 0; # disable for three finger drag + TrackpadTwoFingerDoubleTapGesture = true; # smart zoom + TrackpadTwoFingerFromRightEdgeSwipeGesture = 0; }; - # customize settings that not supported by nix-darwin directly - # Incomplete list of macOS `defaults` commands : - # https://github.com/yannbertrand/macos-defaults + screensaver = { + askForPassword = true; + askForPasswordDelay = 0; + }; + + smb = { + NetBIOSName = hostname; + ServerDescription = hostname; + }; + + WindowManager = { + AppWindowGroupingBehavior = true; + EnableStandardClickToShowDesktop = false; + EnableTilingByEdgeDrag = false; + EnableTilingOptionAccelerator = false; + EnableTopTilingByEdgeDrag = false; + StandardHideDesktopIcons = true; + StandardHideWidgets = true; + }; + + # Customize settings that not supported by nix-darwin directly + # source: https://github.com/yannbertrand/macos-defaults NSGlobalDomain = { - # `defaults read NSGlobalDomain "xxx"` - "com.apple.swipescrolldirection" = true; AppleInterfaceStyle = "Dark"; - AppleKeyboardUIMode = 3; + AppleKeyboardUIMode = 2; ApplePressAndHoldEnabled = false; InitialKeyRepeat = 15; KeyRepeat = 2; @@ -115,6 +130,7 @@ AppleScrollerPagingBehavior = true; AppleEnableMouseSwipeNavigateWithScrolls = true; AppleEnableSwipeNavigateWithScrolls = true; + AppleSpacesSwitchOnActivate = true; NSAutomaticCapitalizationEnabled = false; NSAutomaticDashSubstitutionEnabled = false; @@ -129,46 +145,11 @@ }; # Customize settings that not supported by nix-darwin directly - # see the source code of this project to get more undocumented options: - # https://github.com/rgcr/m-cli - # - # All custom entries can be found by running `defaults read` command. - # or `defaults read xxx` to read a specific domain. - CustomUserPreferences = { - ".GlobalPreferences" = { - # automatically switch to a new space when switching to the application - AppleSpacesSwitchOnActivate = true; - }; - NSGlobalDomain = { - # Add a context menu item for showing the Web Inspector in web views - WebKitDeveloperExtras = true; - }; - "com.apple.finder" = { - ShowExternalHardDrivesOnDesktop = true; - ShowHardDrivesOnDesktop = true; - ShowMountedServersOnDesktop = true; - ShowRemovableMediaOnDesktop = true; - _FXSortFoldersFirst = true; - # When performing a search, search the current folder by default - FXDefaultSearchScope = "SCcf"; - }; + CustomSystemPreferences = { "com.apple.desktopservices" = { - # Avoid creating .DS_Store files on network or USB volumes DSDontWriteNetworkStores = true; DSDontWriteUSBStores = true; }; - "com.apple.WindowManager" = { - EnableStandardClickToShowDesktop = 0; # Click wallpaper to reveal desktop - StandardHideDesktopIcons = 0; # Show items on desktop - HideDesktop = 0; # Do not hide items on desktop & stage manager - StageManagerHideWidgets = 0; - StandardHideWidgets = 0; - }; - "com.apple.screensaver" = { - # Require password immediately after sleep or screen saver begins - askForPassword = 1; - askForPasswordDelay = 0; - }; "com.apple.AdLib" = { allowApplePersonalizedAdvertising = false; }; @@ -182,15 +163,8 @@ }; }; - # keyboard settings is not very useful on macOS - # the most important thing is to remap option key to alt key globally, - # but it's not supported by macOS yet. keyboard = { enableKeyMapping = true; # enable key mapping so that we can use `option` as `control` - - # NOTE: do NOT support remap capslock to both control and escape at the same time - remapCapsLockToControl = false; # remap caps lock to control, useful for emac users - remapCapsLockToEscape = false; # remap caps lock to escape, useful for vim users }; }; @@ -208,9 +182,8 @@ enableFzfGit = true; enableFzfHistory = true; promptInit = '' - fastfetch - source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme - source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh + source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme + source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh ''; }; diff --git a/result b/result deleted file mode 120000 index 6007f38..0000000 --- a/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/wqavdqq4f3j9gwymsj724hz9jkjwa3gf-darwin-system-25.05.73d5958 \ No newline at end of file From 54297f94fda1b4fba6306496f6fdcba4135fbdbf Mon Sep 17 00:00:00 2001 From: Poby Date: Wed, 4 Mar 2026 21:53:28 +0900 Subject: [PATCH 02/28] feat: home-manager config files implemented build not tested --- .gitignore | 1 + Justfile | 86 ++++++++++++++++++++++ flake.nix | 33 +++++++-- home/core.nix | 58 +++++++++++++++ home/default.nix | 41 +++++++++++ home/eza.nix | 10 +++ home/fd.nix | 7 ++ home/fzf.nix | 7 ++ home/gh.nix | 3 + home/git.nix | 15 ++++ home/jq.nix | 3 + home/nvf/appearance/theme.nix | 6 ++ home/nvf/core/augroups.nix | 11 +++ home/nvf/core/autocmds.nix | 33 +++++++++ home/nvf/core/clipboard.nix | 8 +++ home/nvf/core/keymaps.nix | 81 +++++++++++++++++++++ home/nvf/core/options.nix | 12 ++++ home/nvf/core/spellcheck.nix | 5 ++ home/nvf/core/undoFile.nix | 4 ++ home/nvf/default.nix | 43 +++++++++++ home/nvf/lsp/autocomplete.nix | 22 ++++++ home/nvf/lsp/languages/bash.nix | 17 +++++ home/nvf/lsp/languages/default.nix | 19 +++++ home/nvf/lsp/languages/html.nix | 23 ++++++ home/nvf/lsp/languages/lua.nix | 17 +++++ home/nvf/lsp/languages/markdown.nix | 30 ++++++++ home/nvf/lsp/languages/nix.nix | 23 ++++++ home/nvf/lsp/languages/python.nix | 13 ++++ home/nvf/lsp/languages/yaml.nix | 9 +++ home/nvf/lsp/lsp.nix | 7 ++ home/nvf/lsp/treesitter.nix | 9 +++ home/nvf/plugins/binds.nix | 10 +++ home/nvf/plugins/fzf-lua.nix | 6 ++ home/nvf/plugins/mini.nix | 14 ++++ home/nvf/plugins/terminal.nix | 21 ++++++ home/nvf/plugins/utility.nix | 11 +++ home/ripgrep.nix | 3 + home/starship.nix | 14 ++++ home/zoxide.nix | 8 +++ home/zsh.nix | 36 ++++++++++ modules/apps.nix | 9 +-- modules/host-users.nix | 7 +- modules/nix-core.nix | 11 +-- modules/system.nix | 106 ++++++++++++++++------------ 44 files changed, 852 insertions(+), 60 deletions(-) create mode 100644 .gitignore create mode 100644 Justfile create mode 100644 home/core.nix create mode 100755 home/default.nix create mode 100644 home/eza.nix create mode 100755 home/fd.nix create mode 100755 home/fzf.nix create mode 100755 home/gh.nix create mode 100755 home/git.nix create mode 100644 home/jq.nix create mode 100755 home/nvf/appearance/theme.nix create mode 100755 home/nvf/core/augroups.nix create mode 100755 home/nvf/core/autocmds.nix create mode 100755 home/nvf/core/clipboard.nix create mode 100755 home/nvf/core/keymaps.nix create mode 100755 home/nvf/core/options.nix create mode 100755 home/nvf/core/spellcheck.nix create mode 100755 home/nvf/core/undoFile.nix create mode 100755 home/nvf/default.nix create mode 100755 home/nvf/lsp/autocomplete.nix create mode 100755 home/nvf/lsp/languages/bash.nix create mode 100755 home/nvf/lsp/languages/default.nix create mode 100755 home/nvf/lsp/languages/html.nix create mode 100755 home/nvf/lsp/languages/lua.nix create mode 100755 home/nvf/lsp/languages/markdown.nix create mode 100755 home/nvf/lsp/languages/nix.nix create mode 100755 home/nvf/lsp/languages/python.nix create mode 100755 home/nvf/lsp/languages/yaml.nix create mode 100755 home/nvf/lsp/lsp.nix create mode 100755 home/nvf/lsp/treesitter.nix create mode 100755 home/nvf/plugins/binds.nix create mode 100755 home/nvf/plugins/fzf-lua.nix create mode 100755 home/nvf/plugins/mini.nix create mode 100755 home/nvf/plugins/terminal.nix create mode 100755 home/nvf/plugins/utility.nix create mode 100755 home/ripgrep.nix create mode 100755 home/starship.nix create mode 100755 home/zoxide.nix create mode 100755 home/zsh.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..c810611 --- /dev/null +++ b/Justfile @@ -0,0 +1,86 @@ +# just is a command runner, Justfile is very similar to Makefile, but simpler. + +# TODO update hostname here! +hostname := "fenrir" + +# List all the just commands +default: + @just --list + +############################################################################ +# +# Darwin related commands +# +############################################################################ + +# TODO Feel free to remove this target if you don't need a proxy to speed up the build process +[group('desktop')] +darwin-set-proxy: + sudo python3 scripts/darwin_set_proxy.py + +[group('desktop')] +darwin: darwin-set-proxy + nix build .#darwinConfigurations.{{hostname}}.system \ + --extra-experimental-features 'nix-command flakes' + + sudo -E ./result/sw/bin/darwin-rebuild switch --flake .#{{hostname}} + +[group('desktop')] +darwin-debug: darwin-set-proxy + nix build .#darwinConfigurations.{{hostname}}.system --show-trace --verbose \ + --extra-experimental-features 'nix-command flakes' + + sudo -E ./result/sw/bin/darwin-rebuild switch --flake .#{{hostname}} --show-trace --verbose + +############################################################################ +# +# nix related commands +# +############################################################################ + +# Update all the flake inputs +[group('nix')] +up: + nix flake update + +# Update specific input +# Usage: just upp nixpkgs +[group('nix')] +upp input: + nix flake update {{input}} + +# List all generations of the system profile +[group('nix')] +history: + nix profile history --profile /nix/var/nix/profiles/system + +# Open a nix shell with the flake +[group('nix')] +repl: + nix repl -f flake:nixpkgs + +# remove all generations older than 7 days +# on darwin, you may need to switch to root user to run this command +[group('nix')] +clean: + sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d + +# Garbage collect all unused nix store entries +[group('nix')] +gc: + # garbage collect all unused nix store entries(system-wide) + sudo nix-collect-garbage --delete-older-than 7d + # garbage collect all unused nix store entries(for the user - home-manager) + # https://github.com/NixOS/nix/issues/8508 + nix-collect-garbage --delete-older-than 7d + +[group('nix')] +fmt: + # format the nix files in this repo + nix fmt + +# Show all the auto gc roots in the nix store +[group('nix')] +gcroot: + ls -al /nix/var/nix/gcroots/auto/ + diff --git a/flake.nix b/flake.nix index 84db232..50e4403 100644 --- a/flake.nix +++ b/flake.nix @@ -2,34 +2,47 @@ description = "Nix for Poby's MacOS"; nixConfig = { - substituters = [ "https://cache.nixos.org" ]; + substituters = ["https://cache.nixos.org"]; }; inputs = let - stableVersion = "25.11"; # FIXME to bump to latest stable version + stableVersion = "25.11"; # FIXME to bump to latest stable version in { # nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # comment out for unstable version nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-${stableVersion}-darwin"; + home-manager = { + url = "github:nix-community/home-manager/release-25.11"; + inputs.nixpkgs.follows = "nixpkgs-darwin"; + }; darwin = { url = "github:lnl7/nix-darwin/nix-darwin-${stableVersion}"; inputs.nixpkgs.follows = "nixpkgs-darwin"; }; + + # NVF for neovim + nvf = { + url = "github:notashelf/nvf"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs @ { self, nixpkgs, darwin, + home-manager, + nvf, ... }: let - username = "poby"; system = "aarch64-darwin"; - hostname = "fenrir"; # TODO break down to multiple hosts + username = "poby"; + useremail = "smg981024@gmail.com"; + hostname = "fenrir"; # TODO break down to multiple hosts specialArgs = inputs // { - inherit username hostname; + inherit username useremail hostname; }; in { darwinConfigurations."${hostname}" = darwin.lib.darwinSystem { @@ -39,6 +52,16 @@ ./modules/system.nix ./modules/apps.nix ./modules/host-users.nix + + nvf.darwinModules.default + + home-manager.darwinModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = specialArgs; + home-manager.users.${username} = import ./home; + } ]; }; formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra; diff --git a/home/core.nix b/home/core.nix new file mode 100644 index 0000000..460ac07 --- /dev/null +++ b/home/core.nix @@ -0,0 +1,58 @@ +{pkgs, ...}: { + home.packages = with pkgs; [ + # archives + zip + xz + unzip + p7zip + (pkgs.writeShellApplication { + name = "ns"; + runtimeInputs = with pkgs; [ + fzf + nix-search-tv + ]; + text = builtins.readFile "${pkgs.nix-search-tv.src}/nixpkgs.sh"; + }) + # utils + + aria2 # A lightweight multi-protocol & multi-source command-line download utility + socat # replacement of openbsd-netcat + nmap # A utility for network discovery and security auditing + + # misc + cowsay + file + which + tree + gnused + gnutar + gawk + zstd + caddy + gnupg + + # productivity + glow # markdown previewer in terminal + ]; + + programs = { + # terminal file manager + yazi = { + enable = true; + enableZshIntegration = true; + settings = { + manager = { + show_hidden = true; + sort_dir_first = true; + }; + }; + }; + + # skim provides a single executable: sk. + # Basically anywhere you would want to use grep, try sk instead. + skim = { + enable = true; + enableBashIntegration = true; + }; + }; +} diff --git a/home/default.nix b/home/default.nix new file mode 100755 index 0000000..d2039f0 --- /dev/null +++ b/home/default.nix @@ -0,0 +1,41 @@ +{ + pkgs, + username, + ... +}: { + imports = [ + ./fd.nix + ./fzf.nix + ./gh.nix + ./git.nix + ./nvf + ./ripgrep.nix + ./starship.nix + ./zoxide.nix + ./zsh.nix + ./eza.nix + ./jq.nix + ]; + + home = { + username = username; + homeDirectory = "/Users/${username}"; + stateVersion = "25.11"; + + packages = with pkgs; [ + tree + yq-go + # nix-search-tv + (writeShellApplication { + name = "ns"; + runtimeInputs = with pkgs; [ + fzf + nix-search-tv + ]; + text = builtins.readFile "${pkgs.nix-search-tv.src}/nixpkgs.sh"; + }) + ]; + }; + + programs.home-manager.enable = true; +} diff --git a/home/eza.nix b/home/eza.nix new file mode 100644 index 0000000..02ca600 --- /dev/null +++ b/home/eza.nix @@ -0,0 +1,10 @@ +{ + programs.eza = { + enable = true; + color = "auto"; + git = true; + icons = "auto"; + enableZshIntegration = true; + enableBashIntegration = true; + }; +} diff --git a/home/fd.nix b/home/fd.nix new file mode 100755 index 0000000..dd938e4 --- /dev/null +++ b/home/fd.nix @@ -0,0 +1,7 @@ +{ + programs.fd = { + enable = true; + ignores = [ ".git/" ]; + hidden = true; + }; +} diff --git a/home/fzf.nix b/home/fzf.nix new file mode 100755 index 0000000..b79ed72 --- /dev/null +++ b/home/fzf.nix @@ -0,0 +1,7 @@ +{ + programs.fzf = { + enable = true; + enableZshIntegration = true; + enableBashIntegration = true; + }; +} diff --git a/home/gh.nix b/home/gh.nix new file mode 100755 index 0000000..b922f10 --- /dev/null +++ b/home/gh.nix @@ -0,0 +1,3 @@ +{ + programs.gh.enable = true; +} diff --git a/home/git.nix b/home/git.nix new file mode 100755 index 0000000..dad9f9b --- /dev/null +++ b/home/git.nix @@ -0,0 +1,15 @@ +{ + programs.git = { + enable = true; + settings = { + user = { + name = "Poby"; + email = "87608318+smg1024@users.noreply.github.com"; + }; + init.defaultBranch = "master"; + push = { + autoSetupRemote = true; + }; + }; + }; +} diff --git a/home/jq.nix b/home/jq.nix new file mode 100644 index 0000000..825fbf2 --- /dev/null +++ b/home/jq.nix @@ -0,0 +1,3 @@ +{ + programs.jq.enable = true; +} diff --git a/home/nvf/appearance/theme.nix b/home/nvf/appearance/theme.nix new file mode 100755 index 0000000..ce1b691 --- /dev/null +++ b/home/nvf/appearance/theme.nix @@ -0,0 +1,6 @@ +{ + # theme + enable = true; + name = "tokyonight"; + style = "night"; +} diff --git a/home/nvf/core/augroups.nix b/home/nvf/core/augroups.nix new file mode 100755 index 0000000..36fd071 --- /dev/null +++ b/home/nvf/core/augroups.nix @@ -0,0 +1,11 @@ +[ + # augroups + { + enable = true; + name = "LastCursorGroup"; + } + { + enable = true; + name = "HighlightYank"; + } +] diff --git a/home/nvf/core/autocmds.nix b/home/nvf/core/autocmds.nix new file mode 100755 index 0000000..ff9fdda --- /dev/null +++ b/home/nvf/core/autocmds.nix @@ -0,0 +1,33 @@ +{lib, ...}: [ + # autocmds + { + enable = true; + event = ["BufReadPost"]; + desc = "Return to last cursor position"; + group = "LastCursorGroup"; + callback = lib.generators.mkLuaInline '' + function() + local mark = vim.api.nvim_buf_get_mark(0, '"') + local line_count = vim.api.nvim_buf_line_count(0) + if mark[1] > 0 and mark[1] <= line_count then + pcall(vim.api.nvim_win_set_cursor, 0, mark) + end + end + ''; + } + { + enable = true; + event = ["TextYankPost"]; + desc = "Highlight yanks on copy"; + group = "HighlightYank"; + pattern = ["*"]; + callback = lib.generators.mkLuaInline '' + function() + vim.hl.on_yank({ + higroup = "IncSearch", + timeout = 250, + }) + end + ''; + } +] diff --git a/home/nvf/core/clipboard.nix b/home/nvf/core/clipboard.nix new file mode 100755 index 0000000..2fe1a81 --- /dev/null +++ b/home/nvf/core/clipboard.nix @@ -0,0 +1,8 @@ +{ + # clipboard + enable = true; + registers = "unnamedplus"; + providers = { + wl-copy.enable = true; + }; +} diff --git a/home/nvf/core/keymaps.nix b/home/nvf/core/keymaps.nix new file mode 100755 index 0000000..9af6a8b --- /dev/null +++ b/home/nvf/core/keymaps.nix @@ -0,0 +1,81 @@ +[ + # Keymaps + { + key = "ff"; + mode = "n"; + action = "FzfLua files"; + desc = "[F]ind files"; + } + { + key = "fg"; + mode = "n"; + action = "FzfLua live_grep_native"; + desc = "Live [G]rep"; + } + { + key = ""; + mode = "n"; + action = "FzfLua buffers"; + desc = "Buffers"; + } + { + key = "fh"; + mode = "n"; + action = "FzfLua help_tags"; + desc = "[H]elp Tags"; + } + { + key = "fx"; + mode = "n"; + action = "FzfLua diagnostics_document"; + desc = "Diagnostics Document"; + } + { + key = "fX"; + mode = "n"; + action = "FzfLua diagnostics_workspace"; + desc = "Diagnostics Workspace"; + } + { + key = "fs"; + mode = "n"; + action = "FzfLua lsp_document_symbols"; + desc = "Document [S]ymbols"; + } + { + key = "fS"; + mode = "n"; + action = "FzfLua lsp_workspace_symbols"; + desc = "Workspace [S]ymbols"; + } + { + key = "fk"; + mode = "n"; + action = "FzfLua keymaps"; + desc = "[K]eymaps"; + } + { + key = "fb"; + mode = "n"; + action = "FzfLua builtin"; + desc = "[B]uiltin FZF"; + } + { + key = "fr"; + mode = "n"; + action = "FzfLua resume"; + desc = "[R]esume"; + } + { + key = "fo"; + mode = "n"; + action = "FzfLua oldfiles"; + desc = "[O]ld Files"; + } + { + key = "-"; + mode = "n"; + action = "Oil --float"; + desc = "Open Current Directory"; + } +] diff --git a/home/nvf/core/options.nix b/home/nvf/core/options.nix new file mode 100755 index 0000000..705da07 --- /dev/null +++ b/home/nvf/core/options.nix @@ -0,0 +1,12 @@ +{ + # options + cursorlineopt = "line"; + wrap = false; + cmdheight = 1; + tabstop = 2; + shiftwidth = 2; + autoindent = true; + termguicolors = true; + splitbelow = true; + splitright = true; +} diff --git a/home/nvf/core/spellcheck.nix b/home/nvf/core/spellcheck.nix new file mode 100755 index 0000000..ff77048 --- /dev/null +++ b/home/nvf/core/spellcheck.nix @@ -0,0 +1,5 @@ +{ + # spellcheck + enable = true; + languages = [ "en" ]; +} diff --git a/home/nvf/core/undoFile.nix b/home/nvf/core/undoFile.nix new file mode 100755 index 0000000..4c5dbd1 --- /dev/null +++ b/home/nvf/core/undoFile.nix @@ -0,0 +1,4 @@ +{ + # undoFile + enable = true; +} diff --git a/home/nvf/default.nix b/home/nvf/default.nix new file mode 100755 index 0000000..29a34dd --- /dev/null +++ b/home/nvf/default.nix @@ -0,0 +1,43 @@ +{lib, ...}: let + options = import ./core/options.nix; + autocmds = import ./core/autocmds.nix {inherit lib;}; + augroups = import ./core/augroups.nix; + keymaps = import ./core/keymaps.nix; + fzf-lua = import ./plugins/fzf-lua.nix; + mini = import ./plugins/mini.nix; + utility = import ./plugins/utility.nix; + binds = import ./plugins/binds.nix; + terminal = import ./plugins/terminal.nix; + theme = import ./appearance/theme.nix; + lsp = import ./lsp/lsp.nix; + treesitter = import ./lsp/treesitter.nix; + autocomplete = import ./lsp/autocomplete.nix; + languages = import ./lsp/languages; +in { + programs.nvf = { + enable = true; + + settings = { + vim = { + inherit + options + autocmds + augroups + keymaps + fzf-lua + mini + utility + binds + terminal + theme + lsp + treesitter + autocomplete + languages + ; + searchCase = "smart"; + hideSearchHighlight = true; + }; + }; + }; +} diff --git a/home/nvf/lsp/autocomplete.nix b/home/nvf/lsp/autocomplete.nix new file mode 100755 index 0000000..3c467f5 --- /dev/null +++ b/home/nvf/lsp/autocomplete.nix @@ -0,0 +1,22 @@ +{ + # autocomplete + blink-cmp = { + enable = true; + friendly-snippets.enable = true; + setupOpts = { + keymap.preset = "default"; + cmdline = { + keymap.preset = "default"; + }; + completion = { + documentation = { + auto_show = true; + auto_show_delay_ms = 1000; + }; + }; + }; + sourcePlugins = { + emoji.enable = true; + }; + }; +} diff --git a/home/nvf/lsp/languages/bash.nix b/home/nvf/lsp/languages/bash.nix new file mode 100755 index 0000000..2205f03 --- /dev/null +++ b/home/nvf/lsp/languages/bash.nix @@ -0,0 +1,17 @@ +{ + # bash + enable = true; + extraDiagnostics = { + enable = true; + types = ["shellcheck"]; + }; + format = { + enable = true; + type = ["shfmt"]; + }; + lsp = { + enable = true; + servers = ["bash-ls"]; + }; + treesitter.enable = true; +} diff --git a/home/nvf/lsp/languages/default.nix b/home/nvf/lsp/languages/default.nix new file mode 100755 index 0000000..b67cb8b --- /dev/null +++ b/home/nvf/lsp/languages/default.nix @@ -0,0 +1,19 @@ +let + nix = import ./nix.nix; + python = import ./python.nix; + lua = import ./lua.nix; + bash = import ./bash.nix; + markdown = import ./markdown.nix; + html = import ./html.nix; + yaml = import ./yaml.nix; +in { + inherit + nix + python + lua + bash + markdown + html + yaml + ; +} diff --git a/home/nvf/lsp/languages/html.nix b/home/nvf/lsp/languages/html.nix new file mode 100755 index 0000000..c0d3a7b --- /dev/null +++ b/home/nvf/lsp/languages/html.nix @@ -0,0 +1,23 @@ +{ + # html + enable = true; + extraDiagnostics = { + enable = true; + types = ["htmlhint"]; + }; + format = { + enable = true; + type = [ + "superhtml" + "prettierd" + ]; + }; + lsp = { + enable = true; + servers = ["superhtml"]; + }; + treesitter = { + enable = true; + autotagHtml = true; + }; +} diff --git a/home/nvf/lsp/languages/lua.nix b/home/nvf/lsp/languages/lua.nix new file mode 100755 index 0000000..57c7de0 --- /dev/null +++ b/home/nvf/lsp/languages/lua.nix @@ -0,0 +1,17 @@ +{ + # lua + enable = true; + extraDiagnostics = { + enable = true; + types = ["luacheck"]; + }; + format = { + enable = true; + type = ["stylua"]; + }; + lsp = { + enable = true; + servers = ["lua-language-server"]; + }; + treesitter.enable = true; +} diff --git a/home/nvf/lsp/languages/markdown.nix b/home/nvf/lsp/languages/markdown.nix new file mode 100755 index 0000000..958bfff --- /dev/null +++ b/home/nvf/lsp/languages/markdown.nix @@ -0,0 +1,30 @@ +{ + # markdown + enable = true; + extensions = { + render-markdown-nvim = { + enable = true; + setupOpts = { + checkbox = { + checked.scope_highlight = "@markup.strikethrough"; + }; + }; + }; + }; + extraDiagnostics = { + enable = true; + types = ["markdownlint-cli2"]; + }; + format = { + enable = true; + type = [ + "prettierd" + "deno_fmt" + ]; + }; + lsp = { + enable = true; + servers = ["marksman"]; + }; + treesitter.enable = true; +} diff --git a/home/nvf/lsp/languages/nix.nix b/home/nvf/lsp/languages/nix.nix new file mode 100755 index 0000000..8c9976b --- /dev/null +++ b/home/nvf/lsp/languages/nix.nix @@ -0,0 +1,23 @@ +{ + # nix + enable = true; + extraDiagnostics = { + enable = true; + types = [ + "deadnix" + "statix" + ]; + }; + format = { + enable = true; + type = [ + "alejandra" + "nixfmt" + ]; + }; + lsp = { + enable = true; + servers = ["nil"]; + }; + treesitter.enable = true; +} diff --git a/home/nvf/lsp/languages/python.nix b/home/nvf/lsp/languages/python.nix new file mode 100755 index 0000000..13bcf1b --- /dev/null +++ b/home/nvf/lsp/languages/python.nix @@ -0,0 +1,13 @@ +{ + # python + enable = true; + format = { + enable = true; + type = ["ruff"]; + }; + lsp = { + enable = true; + servers = ["pyright"]; + }; + treesitter.enable = true; +} diff --git a/home/nvf/lsp/languages/yaml.nix b/home/nvf/lsp/languages/yaml.nix new file mode 100755 index 0000000..43fb599 --- /dev/null +++ b/home/nvf/lsp/languages/yaml.nix @@ -0,0 +1,9 @@ +{ + # yaml + enable = true; + lsp = { + enable = true; + servers = ["yaml-language-server"]; + }; + treesitter.enable = true; +} diff --git a/home/nvf/lsp/lsp.nix b/home/nvf/lsp/lsp.nix new file mode 100755 index 0000000..adfac12 --- /dev/null +++ b/home/nvf/lsp/lsp.nix @@ -0,0 +1,7 @@ +{ + # lsp + enable = true; + inlayHints.enable = true; + lspconfig.enable = true; + formatOnSave = true; +} diff --git a/home/nvf/lsp/treesitter.nix b/home/nvf/lsp/treesitter.nix new file mode 100755 index 0000000..41e9087 --- /dev/null +++ b/home/nvf/lsp/treesitter.nix @@ -0,0 +1,9 @@ +{ + # treesitter + enable = true; + fold = true; + highlight = { + enable = true; + }; + indent.enable = true; +} diff --git a/home/nvf/plugins/binds.nix b/home/nvf/plugins/binds.nix new file mode 100755 index 0000000..b169725 --- /dev/null +++ b/home/nvf/plugins/binds.nix @@ -0,0 +1,10 @@ +{ + # binds + whichKey = { + enable = true; + register = { + "f" = "+FZF"; + "l" = "+Language"; + }; + }; +} diff --git a/home/nvf/plugins/fzf-lua.nix b/home/nvf/plugins/fzf-lua.nix new file mode 100755 index 0000000..f463c4a --- /dev/null +++ b/home/nvf/plugins/fzf-lua.nix @@ -0,0 +1,6 @@ +{ + # fzf-lua + enable = true; + profile = "default"; + setupOpts = {}; +} diff --git a/home/nvf/plugins/mini.nix b/home/nvf/plugins/mini.nix new file mode 100755 index 0000000..2606209 --- /dev/null +++ b/home/nvf/plugins/mini.nix @@ -0,0 +1,14 @@ +{ + # mini + statusline.enable = true; + ai.enable = true; + bufremove.enable = true; + comment.enable = true; + pairs.enable = true; + cursorword.enable = true; + icons.enable = true; + move.enable = true; + surround.enable = true; + indentscope.enable = true; + trailspace.enable = true; +} diff --git a/home/nvf/plugins/terminal.nix b/home/nvf/plugins/terminal.nix new file mode 100755 index 0000000..10910cd --- /dev/null +++ b/home/nvf/plugins/terminal.nix @@ -0,0 +1,21 @@ +{ + # terminal + toggleterm = { + enable = true; + setupOpts = { + direction = "horizontal"; + size = 6; + }; + mappings = { + open = "tt"; + }; + + # lazygit + lazygit = { + enable = true; + mappings = { + open = "gg"; + }; + }; + }; +} diff --git a/home/nvf/plugins/utility.nix b/home/nvf/plugins/utility.nix new file mode 100755 index 0000000..421e29c --- /dev/null +++ b/home/nvf/plugins/utility.nix @@ -0,0 +1,11 @@ +{ + # utility + oil-nvim = { + enable = true; + gitStatus.enable = true; + setupOpts = { + view_options.show_hidden = true; + }; + }; + sleuth.enable = true; +} diff --git a/home/ripgrep.nix b/home/ripgrep.nix new file mode 100755 index 0000000..34cc7c5 --- /dev/null +++ b/home/ripgrep.nix @@ -0,0 +1,3 @@ +{ + programs.ripgrep.enable = true; +} diff --git a/home/starship.nix b/home/starship.nix new file mode 100755 index 0000000..2b977ab --- /dev/null +++ b/home/starship.nix @@ -0,0 +1,14 @@ +{ + programs.starship = { + enable = true; + enableZshIntegration = true; + enableBashIntegration = true; + + settings = { + character = { + success_symbol = "[›](bold green)"; + error_symbol = "[›](bold red)"; + }; + }; + }; +} diff --git a/home/zoxide.nix b/home/zoxide.nix new file mode 100755 index 0000000..ac54e8f --- /dev/null +++ b/home/zoxide.nix @@ -0,0 +1,8 @@ +{ + programs.zoxide = { + enable = true; + enableZshIntegration = true; + enableBashIntegration = true; + options = ["--cmd j"]; + }; +} diff --git a/home/zsh.nix b/home/zsh.nix new file mode 100755 index 0000000..40edcdb --- /dev/null +++ b/home/zsh.nix @@ -0,0 +1,36 @@ +{ + programs.zsh = { + enable = true; + + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + + history = { + size = 10000; + save = 10000; + }; + + shellAliases = { + poby = "echo my name is poby"; + nrs = "sudo nixos-rebuild switch --flake ~/nixos#$(hostname)"; + nrt = "sudo nixos-rebuild test --flake ~/nixos#$(hostname)"; + hms = "home-manager switch -b backup --flake ~/nixos#$(whoami)"; + }; + + sessionVariables = { + EDITOR = "nvim"; + }; + + oh-my-zsh = { + enable = true; + theme = "robbyrussell"; + plugins = [ + "git" + "history" + "zoxide" + "eza" + ]; + }; + }; +} diff --git a/modules/apps.nix b/modules/apps.nix index 0881f28..77b5802 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -1,11 +1,12 @@ -{ pkgs, ... }: { +{pkgs, ...}: { + nixpkgs.config.allowUnfree = true; environment.systemPackages = with pkgs; [ git + neovim just # use Justfile to simplify nix-darwin's commands - vim - curl ]; + environment.variables.EDITOR = "nvim"; homebrew = { enable = true; @@ -22,7 +23,7 @@ Bitwarden = 1352778147; }; - taps = [ ]; + taps = []; # WARNING only include those not in nixpkgs brews = [ diff --git a/modules/host-users.nix b/modules/host-users.nix index 0276164..c29c73b 100644 --- a/modules/host-users.nix +++ b/modules/host-users.nix @@ -1,5 +1,8 @@ -{ username, hostname, ... }: { + username, + hostname, + ... +}: { networking.hostName = hostname; networking.computerName = hostname; @@ -8,5 +11,5 @@ description = username; }; - nix.settings.trusted-users = [ username ]; + nix.settings.trusted-users = [username]; } diff --git a/modules/nix-core.nix b/modules/nix-core.nix index 5463f09..d85af49 100644 --- a/modules/nix-core.nix +++ b/modules/nix-core.nix @@ -1,17 +1,20 @@ -{ pkgs, lib, ... }: { + pkgs, + lib, + ... +}: { nix = { enable = true; package = pkgs.nix; settings = { - experimental-features = [ "nix-command" "flakes" ]; - substituters = [ "https://nix-community.cachix.org" ]; + experimental-features = ["nix-command" "flakes"]; + substituters = ["https://nix-community.cachix.org"]; trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; builders-user-substitutes = true; - auto-optimise-store = false; # issue https://github.com/NixOS/nix/issues/7273 + auto-optimise-store = false; # issue https://github.com/NixOS/nix/issues/7273 }; }; diff --git a/modules/system.nix b/modules/system.nix index 70e914f..2ce74b2 100644 --- a/modules/system.nix +++ b/modules/system.nix @@ -1,6 +1,12 @@ -{ pkgs, config, username, hostname, ... }: - { + pkgs, + config, + username, + hostname, + ... +}: { + time.timeZone = "Asia/Seoul"; + system = { primaryUser = username; stateVersion = 6; @@ -32,7 +38,6 @@ ''; defaults = { - loginwindow = { GuestEnabled = false; }; @@ -86,12 +91,12 @@ trackpad = { Clicking = true; - TrackpadRightClick = true; # two finger right click + TrackpadRightClick = true; # two finger right click TrackpadThreeFingerDrag = true; - TrackpadFourFingerHorizSwipeGesture = 2; # swipe between full-screen applications + TrackpadFourFingerHorizSwipeGesture = 2; # swipe between full-screen applications TrackpadFourFingerVertSwipeGesture = 2; # down for Mission Control, up for App Expose TrackpadPinch = true; - TrackpadThreeFingerHorizSwipGesture = 0; # disable for three finger drag + TrackpadThreeFingerHorizSwipGesture = 0; # disable for three finger drag TrackpadThreeFingerVertSwipeGesture = 0; # disable for three finger drag TrackpadTwoFingerDoubleTapGesture = true; # smart zoom TrackpadTwoFingerFromRightEdgeSwipeGesture = 0; @@ -142,6 +147,7 @@ NSTableViewDefaultSizeMode = 2; "com.apple.keyboard.fnState" = true; + "com.apple.sound.beep.feedback" = 0; }; # Customize settings that not supported by nix-darwin directly @@ -164,7 +170,7 @@ }; keyboard = { - enableKeyMapping = true; # enable key mapping so that we can use `option` as `control` + enableKeyMapping = true; # enable key mapping so that we can use `option` as `control` }; }; @@ -175,50 +181,60 @@ # this is required if you want to use darwin's default shell - zsh programs.zsh = { enable = true; - enableCompletion = true; - enableAutosuggestions = true; - enableFastSyntaxHighlighting = true; - enableFzfCompletion = true; - enableFzfGit = true; - enableFzfHistory = true; - promptInit = '' - source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme - source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh - ''; + # enableCompletion = true; + # enableAutosuggestions = true; + # enableFastSyntaxHighlighting = true; + # enableFzfCompletion = true; + # enableFzfGit = true; + # enableFzfHistory = true; + # promptInit = '' + # source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme + # source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh + # ''; }; environment = { shells = [ pkgs.zsh ]; - shellAliases = { - ls = "lsd --color=auto"; - l = "lsd -lhG"; - lt = "l --tree"; - ll = "lsd -alhG"; - lh = "lsd -dl .*"; - lsd = "lsd --group-directories-first"; - filecount="find . -type f | wc -l"; - cat = "bat --color=always"; - man = "tldr"; - nixrebuild = "sudo darwin-rebuild switch --flake ~/.config/nix-darwin"; - nixupgrade = "cd ~/.config/nix-darwin && nix flake update"; - nixconfig = "nvim ~/.config/nix-darwin"; - sshconfig = "nvim ~/.ssh/config"; - - # git - g = "git"; - gaa = "git add --all"; - gcm = "git commit -m"; - gca = "git commit --amend"; - gst = "git status"; - gco = "git checkout"; - gl = "git pull"; - gp = "git push"; - glg = "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"; - }; + # shellAliases = { + # ls = "lsd --color=auto"; + # l = "lsd -lhG"; + # lt = "l --tree"; + # ll = "lsd -alhG"; + # lh = "lsd -dl .*"; + # lsd = "lsd --group-directories-first"; + # filecount = "find . -type f | wc -l"; + # cat = "bat --color=always"; + # man = "tldr"; + # nixrebuild = "sudo darwin-rebuild switch --flake ~/.config/nix-darwin"; + # nixupgrade = "cd ~/.config/nix-darwin && nix flake update"; + # nixconfig = "nvim ~/.config/nix-darwin"; + # sshconfig = "nvim ~/.ssh/config"; + # + # # git + # g = "git"; + # gaa = "git add --all"; + # gcm = "git commit -m"; + # gca = "git commit --amend"; + # gst = "git status"; + # gco = "git checkout"; + # gl = "git pull"; + # gp = "git push"; + # glg = "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"; + # }; }; - # Set your time zone. - time.timeZone = "Asia/Seoul"; + fonts = { + packages = with pkgs; [ + material-design-icons + font-awesome + pretendard + nerd-fonts.symbols-only + nerd-fonts.jetbrains-mono + nerd-fonts.d2coding + nerd-fonts.iosevka + nerd-fonts.meslo-lg + ]; + }; } From 88baae6581ebc71d96967ea6b1b17592d3ad1254 Mon Sep 17 00:00:00 2001 From: Poby Date: Wed, 4 Mar 2026 22:30:52 +0900 Subject: [PATCH 03/28] feat: some more home-manager programs --- flake.nix | 2 +- home/core.nix | 58 ---------------------------------------------- home/default.nix | 5 ++-- home/lazygit.nix | 7 ++++++ home/mise.nix | 18 ++++++++++++++ home/zsh.nix | 5 ++-- modules/apps.nix | 19 +++------------ modules/system.nix | 39 +------------------------------ 8 files changed, 35 insertions(+), 118 deletions(-) delete mode 100644 home/core.nix create mode 100644 home/lazygit.nix create mode 100644 home/mise.nix diff --git a/flake.nix b/flake.nix index 50e4403..3c01595 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,7 @@ inputs.nixpkgs.follows = "nixpkgs-darwin"; }; darwin = { - url = "github:lnl7/nix-darwin/nix-darwin-${stableVersion}"; + url = "github:nix-darwin/nix-darwin/nix-darwin-${stableVersion}"; inputs.nixpkgs.follows = "nixpkgs-darwin"; }; diff --git a/home/core.nix b/home/core.nix deleted file mode 100644 index 460ac07..0000000 --- a/home/core.nix +++ /dev/null @@ -1,58 +0,0 @@ -{pkgs, ...}: { - home.packages = with pkgs; [ - # archives - zip - xz - unzip - p7zip - (pkgs.writeShellApplication { - name = "ns"; - runtimeInputs = with pkgs; [ - fzf - nix-search-tv - ]; - text = builtins.readFile "${pkgs.nix-search-tv.src}/nixpkgs.sh"; - }) - # utils - - aria2 # A lightweight multi-protocol & multi-source command-line download utility - socat # replacement of openbsd-netcat - nmap # A utility for network discovery and security auditing - - # misc - cowsay - file - which - tree - gnused - gnutar - gawk - zstd - caddy - gnupg - - # productivity - glow # markdown previewer in terminal - ]; - - programs = { - # terminal file manager - yazi = { - enable = true; - enableZshIntegration = true; - settings = { - manager = { - show_hidden = true; - sort_dir_first = true; - }; - }; - }; - - # skim provides a single executable: sk. - # Basically anywhere you would want to use grep, try sk instead. - skim = { - enable = true; - enableBashIntegration = true; - }; - }; -} diff --git a/home/default.nix b/home/default.nix index d2039f0..c01bc07 100755 --- a/home/default.nix +++ b/home/default.nix @@ -15,6 +15,8 @@ ./zsh.nix ./eza.nix ./jq.nix + ./lazygit.nix + ./mise.nix ]; home = { @@ -22,9 +24,8 @@ homeDirectory = "/Users/${username}"; stateVersion = "25.11"; + # packages that are not available via programs packages = with pkgs; [ - tree - yq-go # nix-search-tv (writeShellApplication { name = "ns"; diff --git a/home/lazygit.nix b/home/lazygit.nix new file mode 100644 index 0000000..c24f855 --- /dev/null +++ b/home/lazygit.nix @@ -0,0 +1,7 @@ +{ + programs.lazygit = { + enable = true; + enableZshIntegration = true; + enableBashIntegration = true; + }; +} diff --git a/home/mise.nix b/home/mise.nix new file mode 100644 index 0000000..c6e424f --- /dev/null +++ b/home/mise.nix @@ -0,0 +1,18 @@ +{ + progrmas.mise = { + enable = true; + enableZshIntegration = true; + enableBashIntegration = true; + + globalConfig = { + tools = { + node = "lts"; + uv = "latest"; + }; + settings = { + experimental = true; + env_file = ".env"; + }; + }; + }; +} diff --git a/home/zsh.nix b/home/zsh.nix index 40edcdb..99f0b7b 100755 --- a/home/zsh.nix +++ b/home/zsh.nix @@ -13,9 +13,8 @@ shellAliases = { poby = "echo my name is poby"; - nrs = "sudo nixos-rebuild switch --flake ~/nixos#$(hostname)"; - nrt = "sudo nixos-rebuild test --flake ~/nixos#$(hostname)"; - hms = "home-manager switch -b backup --flake ~/nixos#$(whoami)"; + drs = "sudo darwin-rebuild switch --flake ~/nix-darwin#$(hostname)"; + drt = "sudo darwin-rebuild test --flake ~/nix-darwin#$(hostname)"; }; sessionVariables = { diff --git a/modules/apps.nix b/modules/apps.nix index 77b5802..1896353 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -5,6 +5,7 @@ git neovim just # use Justfile to simplify nix-darwin's commands + tree ]; environment.variables.EDITOR = "nvim"; @@ -26,15 +27,12 @@ taps = []; # WARNING only include those not in nixpkgs - brews = [ - # "neovim" - # "ripgrep" - # "fd" - ]; + brews = []; casks = [ "batfi" "hammerspoon" + # TODO use nixpkgs when possible # "google-chrome" # "iina" # "jordanbaird-ice" @@ -42,17 +40,6 @@ # "shottr" # "raycast" # "stats" - - # Fonts - "font-fontawesome" - "font-jetbrains-mono-nerd-font" - "font-meslo-lg-nerd-font" - "font-d2coding" - "font-fira-code-nerd-font" - "font-symbols-only-nerd-font" - "font-material-design-icons-webfont" - "font-pretendard" - "font-maple-mono-nf" ]; }; } diff --git a/modules/system.nix b/modules/system.nix index 2ce74b2..feed9c6 100644 --- a/modules/system.nix +++ b/modules/system.nix @@ -11,6 +11,7 @@ primaryUser = username; stateVersion = 6; + # symlink /Applications/Nix Apps to /Applications for Spotlight activationScripts.extraActivation.text = '' # activateSettings -u will reload the settings from the database and apply them to the current session, # so we do not need to logout and login again to make the changes take effect. @@ -177,52 +178,14 @@ # Add ability to used TouchID for sudo authentication security.pam.services.sudo_local.touchIdAuth = true; - # Create /etc/zshrc that loads the nix-darwin environment. - # this is required if you want to use darwin's default shell - zsh programs.zsh = { enable = true; - # enableCompletion = true; - # enableAutosuggestions = true; - # enableFastSyntaxHighlighting = true; - # enableFzfCompletion = true; - # enableFzfGit = true; - # enableFzfHistory = true; - # promptInit = '' - # source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme - # source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh - # ''; }; environment = { shells = [ pkgs.zsh ]; - # shellAliases = { - # ls = "lsd --color=auto"; - # l = "lsd -lhG"; - # lt = "l --tree"; - # ll = "lsd -alhG"; - # lh = "lsd -dl .*"; - # lsd = "lsd --group-directories-first"; - # filecount = "find . -type f | wc -l"; - # cat = "bat --color=always"; - # man = "tldr"; - # nixrebuild = "sudo darwin-rebuild switch --flake ~/.config/nix-darwin"; - # nixupgrade = "cd ~/.config/nix-darwin && nix flake update"; - # nixconfig = "nvim ~/.config/nix-darwin"; - # sshconfig = "nvim ~/.ssh/config"; - # - # # git - # g = "git"; - # gaa = "git add --all"; - # gcm = "git commit -m"; - # gca = "git commit --amend"; - # gst = "git status"; - # gco = "git checkout"; - # gl = "git pull"; - # gp = "git push"; - # glg = "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"; - # }; }; fonts = { From 8e551579bc272c79c15338427071f53375b4fbeb Mon Sep 17 00:00:00 2001 From: Poby Date: Wed, 4 Mar 2026 22:39:36 +0900 Subject: [PATCH 04/28] fix: remove just target for proxy setup --- Justfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Justfile b/Justfile index c810611..2217b11 100644 --- a/Justfile +++ b/Justfile @@ -13,11 +13,6 @@ default: # ############################################################################ -# TODO Feel free to remove this target if you don't need a proxy to speed up the build process -[group('desktop')] -darwin-set-proxy: - sudo python3 scripts/darwin_set_proxy.py - [group('desktop')] darwin: darwin-set-proxy nix build .#darwinConfigurations.{{hostname}}.system \ From 40f8c39946a87fc394892f7b4dd9ec3b9589dbbc Mon Sep 17 00:00:00 2001 From: Poby Date: Wed, 4 Mar 2026 22:53:57 +0900 Subject: [PATCH 05/28] feat: bat ghostty programs --- home/bat.nix | 5 +++++ home/default.nix | 3 +++ home/ghostty.nix | 14 ++++++++++++++ home/zsh.nix | 4 ++++ 4 files changed, 26 insertions(+) create mode 100644 home/bat.nix create mode 100644 home/ghostty.nix diff --git a/home/bat.nix b/home/bat.nix new file mode 100644 index 0000000..4cb0b03 --- /dev/null +++ b/home/bat.nix @@ -0,0 +1,5 @@ +{ + programs.bat = { + enable = true; + }; +} diff --git a/home/default.nix b/home/default.nix index c01bc07..b436385 100755 --- a/home/default.nix +++ b/home/default.nix @@ -17,6 +17,9 @@ ./jq.nix ./lazygit.nix ./mise.nix + ./ghostty.nix + ./bat.nix + # TODO ./aerospace.nix ]; home = { diff --git a/home/ghostty.nix b/home/ghostty.nix new file mode 100644 index 0000000..6e851ed --- /dev/null +++ b/home/ghostty.nix @@ -0,0 +1,14 @@ +{ + programs.ghostty = { + enable = true; + enableZshIntegration = true; + enableBashIntegration = true; + + settings = { + theme = "catppuccin-mocha"; + font-family = "D2Coding"; + font-size = 15; + macos-icon = "xray"; + }; + }; +} diff --git a/home/zsh.nix b/home/zsh.nix index 99f0b7b..7a9278c 100755 --- a/home/zsh.nix +++ b/home/zsh.nix @@ -9,6 +9,10 @@ history = { size = 10000; save = 10000; + share = true; + ignoreAllDups = true; + ignoreDups = true; + ignoreSpace = true; }; shellAliases = { From 36f63aedf17355f6653dd706f47cfa189dc5a0c0 Mon Sep 17 00:00:00 2001 From: Sangmin Kim Date: Thu, 5 Mar 2026 08:44:34 +0900 Subject: [PATCH 06/28] fix: remove proxy target from Justfile --- Justfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Justfile b/Justfile index 2217b11..2155836 100644 --- a/Justfile +++ b/Justfile @@ -14,14 +14,14 @@ default: ############################################################################ [group('desktop')] -darwin: darwin-set-proxy +darwin: nix build .#darwinConfigurations.{{hostname}}.system \ --extra-experimental-features 'nix-command flakes' sudo -E ./result/sw/bin/darwin-rebuild switch --flake .#{{hostname}} [group('desktop')] -darwin-debug: darwin-set-proxy +darwin-debug: nix build .#darwinConfigurations.{{hostname}}.system --show-trace --verbose \ --extra-experimental-features 'nix-command flakes' From 0b1984fad51c90b6130259faf7ece779a22c4580 Mon Sep 17 00:00:00 2001 From: Sangmin Kim Date: Thu, 5 Mar 2026 08:45:00 +0900 Subject: [PATCH 07/28] feat(home): aerospace --- home/aerospace.nix | 82 ++++++++++++++++++++++++++++++++++++++++++++++ home/default.nix | 2 +- 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 home/aerospace.nix diff --git a/home/aerospace.nix b/home/aerospace.nix new file mode 100644 index 0000000..d0e69a9 --- /dev/null +++ b/home/aerospace.nix @@ -0,0 +1,82 @@ +{ + programs.aerospace = { + enable = true; + userSettings = { + start-at-login = true; + accordion-padding = 10; + default-root-container-layout = "tiles"; + default-root-container-orientation = "auto"; + on-focus-monitor-changed = ["move-mouse monitor-lazy-center"]; + automatically-unhide-macos-hidden-apps = false; + persistent-workspaces = ["1" "2" "3" "4" "5" "6" "7" "8" "9"]; + + keymapping = { + preset = "qwerty"; + }; + + gaps = { + inner.horizontal = 0; + inner.vertical = 0; + outer.left = 3; + outer.bottom = 3; + outer.top = 3; + outer.right = 3; + }; + + mode.main.binding = { + alt-slash = "layout tiles horizontal vertical"; + alt-comma = "layout accordion horizontal vertical"; + + alt-h = "focus left"; + alt-j = "focus down"; + alt-k = "focus up"; + alt-l = "focus right"; + + alt-shift-h = "move left"; + alt-shift-j = "move down"; + alt-shift-k = "move up"; + alt-shift-l = "move right"; + + alt-minus = "resize smart -50"; + alt-equal = "resize smart +50"; + + alt-1 = "workspace 1"; + alt-2 = "workspace 2"; + alt-3 = "workspace 3"; + alt-4 = "workspace 4"; + alt-5 = "workspace 5"; + alt-6 = "workspace 6"; + alt-7 = "workspace 7"; + alt-8 = "workspace 8"; + alt-9 = "workspace 9"; + + alt-shift-1 = "move-node-to-workspace 1"; + alt-shift-2 = "move-node-to-workspace 2"; + alt-shift-3 = "move-node-to-workspace 3"; + alt-shift-4 = "move-node-to-workspace 4"; + alt-shift-5 = "move-node-to-workspace 5"; + alt-shift-6 = "move-node-to-workspace 6"; + alt-shift-7 = "move-node-to-workspace 7"; + alt-shift-8 = "move-node-to-workspace 8"; + alt-shift-9 = "move-node-to-workspace 9"; + + alt-tab = "workspace-back-and-forth"; + alt-shift-tab = "move-workspace-to-monitor --wrap-around next"; + + alt-shift-semicolon = "mode service"; + }; + + mode.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"]; + + alt-shift-h = ["join-with left" "mode main"]; + alt-shift-j = ["join-with down" "mode main"]; + alt-shift-k = ["join-with up" "mode main"]; + alt-shift-l = ["join-with right" "mode main"]; + }; + }; + }; +} diff --git a/home/default.nix b/home/default.nix index b436385..8717271 100755 --- a/home/default.nix +++ b/home/default.nix @@ -19,7 +19,7 @@ ./mise.nix ./ghostty.nix ./bat.nix - # TODO ./aerospace.nix + ./aerospace.nix ]; home = { From 2c941797dc8ab36dd71ee7a5790fd7ff66d7bfae Mon Sep 17 00:00:00 2001 From: Sangmin Kim Date: Thu, 5 Mar 2026 10:59:34 +0900 Subject: [PATCH 08/28] feat(apps): fastfetch --- modules/apps.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/apps.nix b/modules/apps.nix index 1896353..118d1f4 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -6,6 +6,7 @@ neovim just # use Justfile to simplify nix-darwin's commands tree + fastfetchMinimal ]; environment.variables.EDITOR = "nvim"; From 6e73c7e5a86d6ef538f108bbe15253596d7fb2ff Mon Sep 17 00:00:00 2001 From: Sangmin Kim Date: Thu, 5 Mar 2026 11:06:24 +0900 Subject: [PATCH 09/28] feat(home): zsh plugins --- home/default.nix | 1 + home/zsh.nix | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/home/default.nix b/home/default.nix index 8717271..4e11147 100755 --- a/home/default.nix +++ b/home/default.nix @@ -20,6 +20,7 @@ ./ghostty.nix ./bat.nix ./aerospace.nix + # TODO ./pass.nix ]; home = { diff --git a/home/zsh.nix b/home/zsh.nix index 7a9278c..8e11bdb 100755 --- a/home/zsh.nix +++ b/home/zsh.nix @@ -6,6 +6,8 @@ autosuggestion.enable = true; syntaxHighlighting.enable = true; + defaultKeymap = "viins"; + history = { size = 10000; save = 10000; @@ -17,8 +19,8 @@ shellAliases = { poby = "echo my name is poby"; - drs = "sudo darwin-rebuild switch --flake ~/nix-darwin#$(hostname)"; - drt = "sudo darwin-rebuild test --flake ~/nix-darwin#$(hostname)"; + drs = "sudo darwin-rebuild switch --flake ~/nix-darwin#$(hostname)"; # TODO change to just script + drt = "sudo darwin-rebuild test --flake ~/nix-darwin#$(hostname)"; # TODO change to just script }; sessionVariables = { @@ -30,9 +32,10 @@ theme = "robbyrussell"; plugins = [ "git" + "gitignore" "history" - "zoxide" - "eza" + "sudo" + "vi-mode" ]; }; }; From 3cce7a1884fca40f0a2b34adf5880735d8d50297 Mon Sep 17 00:00:00 2001 From: Sangmin Kim Date: Thu, 5 Mar 2026 17:37:22 +0900 Subject: [PATCH 10/28] refactor(secret): agenix wip --- flake.nix | 30 ++++++++++++++++++++++-------- modules/host-users.nix | 8 ++++++-- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index 3c01595..1dfb213 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,10 @@ description = "Nix for Poby's MacOS"; nixConfig = { - substituters = ["https://cache.nixos.org"]; + substituters = [ + "https://nix-community.cachix.org" + "https://cache.nixos.org" + ]; }; inputs = let @@ -10,10 +13,12 @@ in { # nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # comment out for unstable version nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-${stableVersion}-darwin"; + home-manager = { - url = "github:nix-community/home-manager/release-25.11"; + url = "github:nix-community/home-manager/release-${stableVersion}"; inputs.nixpkgs.follows = "nixpkgs-darwin"; }; + darwin = { url = "github:nix-darwin/nix-darwin/nix-darwin-${stableVersion}"; inputs.nixpkgs.follows = "nixpkgs-darwin"; @@ -24,6 +29,12 @@ url = "github:notashelf/nvf"; inputs.nixpkgs.follows = "nixpkgs"; }; + + # agenix for secrets + agenix = { + url = "github:ryantm/agenix"; + inputs.nixpkgs.follows = "nixpkgs-darwin"; + } }; outputs = inputs @ { @@ -32,6 +43,7 @@ darwin, home-manager, nvf, + agenix, ... }: let system = "aarch64-darwin"; @@ -52,15 +64,17 @@ ./modules/system.nix ./modules/apps.nix ./modules/host-users.nix - nvf.darwinModules.default - + agenix.darwinModules.default home-manager.darwinModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = specialArgs; - home-manager.users.${username} = import ./home; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "backup"; + extraSpecialArgs = specialArgs; + users.${username} = import ./home; + }; } ]; }; diff --git a/modules/host-users.nix b/modules/host-users.nix index c29c73b..5d258d6 100644 --- a/modules/host-users.nix +++ b/modules/host-users.nix @@ -3,10 +3,14 @@ hostname, ... }: { - networking.hostName = hostname; - networking.computerName = hostname; + networking = { + hostName = hostname; + computerName = hostname; + localHostName = hostname; + } users.users."${username}" = { + description = "Sangmin Kim"; home = "/Users/${username}"; description = username; }; From 99de0d4f2a0e58dd393e45e5353a6df6d49229ae Mon Sep 17 00:00:00 2001 From: Sangmin Kim Date: Thu, 12 Mar 2026 15:20:16 +0900 Subject: [PATCH 11/28] fix: nvf as home-manager module --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 1dfb213..e07504f 100644 --- a/flake.nix +++ b/flake.nix @@ -64,7 +64,6 @@ ./modules/system.nix ./modules/apps.nix ./modules/host-users.nix - nvf.darwinModules.default agenix.darwinModules.default home-manager.darwinModules.home-manager { @@ -73,6 +72,7 @@ useUserPackages = true; backupFileExtension = "backup"; extraSpecialArgs = specialArgs; + sharedModules = [ nvf.homeManagerModules.nvf ]; users.${username} = import ./home; }; } From 006eaf33be876342c1adcf95dd2aa1afc1c11f15 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Fri, 13 Mar 2026 23:50:30 +0900 Subject: [PATCH 12/28] fix: typo for config and temporarily disable dependencies --- .gitignore | 1 + flake.lock | 353 +++++++++++++++++++++++++++++++++++++++++ flake.nix | 57 +++++-- home/aerospace.nix | 54 +++++-- home/default.nix | 19 +-- home/eza.nix | 2 +- home/mise.nix | 2 +- modules/host-users.nix | 3 +- modules/nix-core.nix | 10 +- modules/system.nix | 20 +-- 10 files changed, 471 insertions(+), 50 deletions(-) create mode 100644 flake.lock diff --git a/.gitignore b/.gitignore index e43b0f9..d5fec98 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .DS_Store +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..1fc81ad --- /dev/null +++ b/flake.lock @@ -0,0 +1,353 @@ +{ + "nodes": { + "agenix": { + "inputs": { + "darwin": "darwin", + "home-manager": "home-manager", + "nixpkgs": [ + "nixpkgs-darwin" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1770165109, + "narHash": "sha256-9VnK6Oqai65puVJ4WYtCTvlJeXxMzAp/69HhQuTdl/I=", + "owner": "ryantm", + "repo": "agenix", + "rev": "b027ee29d959fda4b60b57566d64c98a202e0feb", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "brew-src": { + "flake": false, + "locked": { + "lastModified": 1769363988, + "narHash": "sha256-BiGPeulrDVetXP+tjxhMcGLUROZAtZIhU5m4MqawCfM=", + "owner": "Homebrew", + "repo": "brew", + "rev": "d01011cac6d72032c75fd2cd9489909e95d9faf2", + "type": "github" + }, + "original": { + "owner": "Homebrew", + "ref": "5.0.12", + "repo": "brew", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1744478979, + "narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "43975d782b418ebf4969e9ccba82466728c2851b", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "darwin_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs-darwin" + ] + }, + "locked": { + "lastModified": 1772129556, + "narHash": "sha256-Utk0zd8STPsUJPyjabhzPc5BpPodLTXrwkpXBHYnpeg=", + "owner": "nix-darwin", + "repo": "nix-darwin", + "rev": "ebec37af18215214173c98cf6356d0aca24a2585", + "type": "github" + }, + "original": { + "owner": "nix-darwin", + "ref": "nix-darwin-25.11", + "repo": "nix-darwin", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1751685974, + "narHash": "sha256-NKw96t+BgHIYzHUjkTK95FqYRVKB8DHpVhefWSz/kTw=", + "ref": "refs/heads/main", + "rev": "549f2762aebeff29a2e5ece7a7dc0f955281a1d1", + "revCount": 92, + "type": "git", + "url": "https://git.lix.systems/lix-project/flake-compat.git" + }, + "original": { + "type": "git", + "url": "https://git.lix.systems/lix-project/flake-compat.git" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nvf", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1769996383, + "narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "57928607ea566b5db3ad13af0e57e921e6b12381", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1745494811, + "narHash": "sha256-YZCh2o9Ua1n9uCvrvi5pRxtuVNml8X2a03qIFfRKpFs=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "abfad3d2958c9e6300a883bd443512c55dfeb1be", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs-darwin" + ] + }, + "locked": { + "lastModified": 1773264488, + "narHash": "sha256-rK0507bDuWBrZo+0zts9bCs/+RRUEHuvFE5DHWPxX/Q=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "5c0f63f8d55040a7eed69df7e3fcdd15dfb5a04c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.11", + "repo": "home-manager", + "type": "github" + } + }, + "homebrew-cask": { + "flake": false, + "locked": { + "lastModified": 1773410126, + "narHash": "sha256-3a9X78TmrHH9eNhj87TBL5HWQaAzD5z8/YcF/5Hpf+8=", + "owner": "homebrew", + "repo": "homebrew-cask", + "rev": "c94484c7d98b6442d80524eca84968bf8558075a", + "type": "github" + }, + "original": { + "owner": "homebrew", + "repo": "homebrew-cask", + "type": "github" + } + }, + "homebrew-core": { + "flake": false, + "locked": { + "lastModified": 1773409445, + "narHash": "sha256-3/WrGHe9vdH98DXzD4ZYQkEEonKeCOKj0Bkq3WFKxbk=", + "owner": "homebrew", + "repo": "homebrew-core", + "rev": "7a2962491e67edec68819e691817349558618d31", + "type": "github" + }, + "original": { + "owner": "homebrew", + "repo": "homebrew-core", + "type": "github" + } + }, + "mnw": { + "locked": { + "lastModified": 1770419553, + "narHash": "sha256-b1XqsH7AtVf2dXmq2iyRr2NC1yG7skY7Z6N2MpWHlK4=", + "owner": "Gerg-L", + "repo": "mnw", + "rev": "2aaffa8030d0b262176146adbb6b0e6374ce2957", + "type": "github" + }, + "original": { + "owner": "Gerg-L", + "repo": "mnw", + "type": "github" + } + }, + "ndg": { + "inputs": { + "nixpkgs": [ + "nvf", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1768214250, + "narHash": "sha256-hnBZDQWUxJV3KbtvyGW5BKLO/fAwydrxm5WHCWMQTbw=", + "owner": "feel-co", + "repo": "ndg", + "rev": "a6bd3c1ce2668d096e4fdaaa03ad7f03ba1fbca8", + "type": "github" + }, + "original": { + "owner": "feel-co", + "ref": "refs/tags/v2.6.0", + "repo": "ndg", + "type": "github" + } + }, + "nix-homebrew": { + "inputs": { + "brew-src": "brew-src" + }, + "locked": { + "lastModified": 1769437432, + "narHash": "sha256-8d7KnCpT2LweRvSzZYEGd9IM3eFX+A78opcnDM0+ndk=", + "owner": "zhaofengli", + "repo": "nix-homebrew", + "rev": "a5409abd0d5013d79775d3419bcac10eacb9d8c5", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "repo": "nix-homebrew", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1773231277, + "narHash": "sha256-Xy3WEpUAbpsz8ydgvVAQAGGB/WB+8cNA5cshiL0McTI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "75690239f08f885ca9b0267580101f60d10fbe62", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs-darwin": { + "locked": { + "lastModified": 1773282714, + "narHash": "sha256-at2PNNVNoTfXBe3bA6pgff+CKOwdBWUZCUBIfXGrXsU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a8556879c286b4a40a717a416ae61818c26d1ac8", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-25.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nvf": { + "inputs": { + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "mnw": "mnw", + "ndg": "ndg", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2" + }, + "locked": { + "lastModified": 1773343795, + "narHash": "sha256-0+HEuOytpwyPt7i1jj6v2QJ+NXXisCYnL2XNwPBltvg=", + "owner": "notashelf", + "repo": "nvf", + "rev": "83b44eaf50b96bd5d06b1a56a3a51f1b2362db52", + "type": "github" + }, + "original": { + "owner": "notashelf", + "repo": "nvf", + "type": "github" + } + }, + "root": { + "inputs": { + "agenix": "agenix", + "darwin": "darwin_2", + "home-manager": "home-manager_2", + "homebrew-cask": "homebrew-cask", + "homebrew-core": "homebrew-core", + "nix-homebrew": "nix-homebrew", + "nixpkgs": "nixpkgs", + "nixpkgs-darwin": "nixpkgs-darwin", + "nvf": "nvf" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index e07504f..1b48fa4 100644 --- a/flake.nix +++ b/flake.nix @@ -1,29 +1,41 @@ { description = "Nix for Poby's MacOS"; - nixConfig = { - substituters = [ - "https://nix-community.cachix.org" - "https://cache.nixos.org" - ]; - }; + # TODO: is this necessary? + # nixConfig = { + # substituters = [ + # "https://nix-community.cachix.org" + # "https://cache.nixos.org" + # ]; + # }; - inputs = let - stableVersion = "25.11"; # FIXME to bump to latest stable version - in { + inputs = { # nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # comment out for unstable version - nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-${stableVersion}-darwin"; + nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-25.11-darwin"; home-manager = { - url = "github:nix-community/home-manager/release-${stableVersion}"; + url = "github:nix-community/home-manager/release-25.11"; inputs.nixpkgs.follows = "nixpkgs-darwin"; }; darwin = { - url = "github:nix-darwin/nix-darwin/nix-darwin-${stableVersion}"; + url = "github:nix-darwin/nix-darwin/nix-darwin-25.11"; inputs.nixpkgs.follows = "nixpkgs-darwin"; }; + # Homebrew + nix-homebrew.url = "github:zhaofengli/nix-homebrew"; + + # Optional: Declarative tap management + homebrew-core = { + url = "github:homebrew/homebrew-core"; + flake = false; + }; + homebrew-cask = { + url = "github:homebrew/homebrew-cask"; + flake = false; + }; + # NVF for neovim nvf = { url = "github:notashelf/nvf"; @@ -34,7 +46,7 @@ agenix = { url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgs-darwin"; - } + }; }; outputs = inputs @ { @@ -44,6 +56,9 @@ home-manager, nvf, agenix, + nix-homebrew, + homebrew-core, + homebrew-cask, ... }: let system = "aarch64-darwin"; @@ -64,6 +79,22 @@ ./modules/system.nix ./modules/apps.nix ./modules/host-users.nix + nix-homebrew.darwinModules.nix-homebrew + { + nix-homebrew = { + enable = true; + enableRosetta = true; + user = username; + taps = { + "homebrew/homebrew-core" = homebrew-core; + "homebrew/homebrew-cask" = homebrew-cask; + }; + mutableTaps = false; + }; + } + ({config, ...}: { + homebrew.taps = builtins.attrNames config.nix-homebrew.taps; + }) agenix.darwinModules.default home-manager.darwinModules.home-manager { diff --git a/home/aerospace.nix b/home/aerospace.nix index d0e69a9..f97b5ba 100644 --- a/home/aerospace.nix +++ b/home/aerospace.nix @@ -6,9 +6,19 @@ accordion-padding = 10; default-root-container-layout = "tiles"; default-root-container-orientation = "auto"; - on-focus-monitor-changed = ["move-mouse monitor-lazy-center"]; + on-focus-monitor-changed = [ "move-mouse monitor-lazy-center" ]; automatically-unhide-macos-hidden-apps = false; - persistent-workspaces = ["1" "2" "3" "4" "5" "6" "7" "8" "9"]; + persistent-workspaces = [ + "1" + "2" + "3" + "4" + "5" + "6" + "7" + "8" + "9" + ]; keymapping = { preset = "qwerty"; @@ -67,15 +77,39 @@ }; mode.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"]; + 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" + ]; - alt-shift-h = ["join-with left" "mode main"]; - alt-shift-j = ["join-with down" "mode main"]; - alt-shift-k = ["join-with up" "mode main"]; - alt-shift-l = ["join-with right" "mode main"]; + alt-shift-h = [ + "join-with left" + "mode main" + ]; + alt-shift-j = [ + "join-with down" + "mode main" + ]; + alt-shift-k = [ + "join-with up" + "mode main" + ]; + alt-shift-l = [ + "join-with right" + "mode main" + ]; }; }; }; diff --git a/home/default.nix b/home/default.nix index 4e11147..c22be8f 100755 --- a/home/default.nix +++ b/home/default.nix @@ -17,7 +17,7 @@ ./jq.nix ./lazygit.nix ./mise.nix - ./ghostty.nix + # ./ghostty.nix # FIXME: ghostty home-manager program not available in aarch64-darwin ./bat.nix ./aerospace.nix # TODO ./pass.nix @@ -31,14 +31,15 @@ # packages that are not available via programs packages = with pkgs; [ # nix-search-tv - (writeShellApplication { - name = "ns"; - runtimeInputs = with pkgs; [ - fzf - nix-search-tv - ]; - text = builtins.readFile "${pkgs.nix-search-tv.src}/nixpkgs.sh"; - }) + # FIXME: NIX_SHELL_CMD='nix-shell --run $SHELL -p $(echo "{}" | sed "s:nixpkgs/::g"' ^-- SC2016 (info): Expressions don't expand in single quotes, use double quotes for that. + # (writeShellApplication { + # name = "ns"; + # runtimeInputs = with pkgs; [ + # fzf + # nix-search-tv + # ]; + # text = builtins.readFile "${pkgs.nix-search-tv.src}/nixpkgs.sh"; + # }) ]; }; diff --git a/home/eza.nix b/home/eza.nix index 02ca600..348e54a 100644 --- a/home/eza.nix +++ b/home/eza.nix @@ -1,7 +1,7 @@ { programs.eza = { enable = true; - color = "auto"; + colors = "auto"; git = true; icons = "auto"; enableZshIntegration = true; diff --git a/home/mise.nix b/home/mise.nix index c6e424f..8e9456f 100644 --- a/home/mise.nix +++ b/home/mise.nix @@ -1,5 +1,5 @@ { - progrmas.mise = { + programs.mise = { enable = true; enableZshIntegration = true; enableBashIntegration = true; diff --git a/modules/host-users.nix b/modules/host-users.nix index 5d258d6..9df535e 100644 --- a/modules/host-users.nix +++ b/modules/host-users.nix @@ -7,10 +7,9 @@ hostName = hostname; computerName = hostname; localHostName = hostname; - } + }; users.users."${username}" = { - description = "Sangmin Kim"; home = "/Users/${username}"; description = username; }; diff --git a/modules/nix-core.nix b/modules/nix-core.nix index d85af49..ed71a0d 100644 --- a/modules/nix-core.nix +++ b/modules/nix-core.nix @@ -13,13 +13,13 @@ trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; - builders-user-substitutes = true; + builders-use-substitutes = true; auto-optimise-store = false; # issue https://github.com/NixOS/nix/issues/7273 }; - }; - gc = { - automatic = lib.mkDefault true; - options = lib.mkDefault "--delete-older-than 7d"; + gc = { + automatic = lib.mkDefault true; + options = lib.mkDefault "--delete-older-than 7d"; + }; }; } diff --git a/modules/system.nix b/modules/system.nix index feed9c6..98b5a83 100644 --- a/modules/system.nix +++ b/modules/system.nix @@ -4,7 +4,8 @@ username, hostname, ... -}: { +}: +{ time.timeZone = "Asia/Seoul"; system = { @@ -18,13 +19,14 @@ sudo -u ${username} /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u ''; - activationScripts.applications.text = let - env = pkgs.buildEnv { - name = "system-applications"; - paths = config.environment.systemPackages; - pathsToLink = "/Applications"; - }; - in + activationScripts.applications.text = + let + env = pkgs.buildEnv { + name = "system-applications"; + paths = config.environment.systemPackages; + pathsToLink = [ "/Applications" ]; + }; + in pkgs.lib.mkForce '' # Set up applications. echo "setting up /Applications..." >&2 @@ -97,7 +99,7 @@ TrackpadFourFingerHorizSwipeGesture = 2; # swipe between full-screen applications TrackpadFourFingerVertSwipeGesture = 2; # down for Mission Control, up for App Expose TrackpadPinch = true; - TrackpadThreeFingerHorizSwipGesture = 0; # disable for three finger drag + TrackpadThreeFingerHorizSwipeGesture = 0; # disable for three finger drag TrackpadThreeFingerVertSwipeGesture = 0; # disable for three finger drag TrackpadTwoFingerDoubleTapGesture = true; # smart zoom TrackpadTwoFingerFromRightEdgeSwipeGesture = 0; From 4b76b2294276460bd32c1a84b679611821f53e52 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sat, 14 Mar 2026 01:06:03 +0900 Subject: [PATCH 13/28] feat: wezterm as default terminal --- home/default.nix | 20 ++++++++------------ home/ghostty.nix | 14 -------------- home/nvf/lsp/treesitter.nix | 1 + home/terminal.nix | 7 +++++++ modules/apps.nix | 14 +++++--------- modules/system.nix | 6 ++++-- 6 files changed, 25 insertions(+), 37 deletions(-) delete mode 100644 home/ghostty.nix create mode 100644 home/terminal.nix diff --git a/home/default.nix b/home/default.nix index c22be8f..46b05ed 100755 --- a/home/default.nix +++ b/home/default.nix @@ -2,7 +2,8 @@ pkgs, username, ... -}: { +}: +{ imports = [ ./fd.nix ./fzf.nix @@ -17,7 +18,7 @@ ./jq.nix ./lazygit.nix ./mise.nix - # ./ghostty.nix # FIXME: ghostty home-manager program not available in aarch64-darwin + ./terminal.nix ./bat.nix ./aerospace.nix # TODO ./pass.nix @@ -30,16 +31,11 @@ # packages that are not available via programs packages = with pkgs; [ - # nix-search-tv - # FIXME: NIX_SHELL_CMD='nix-shell --run $SHELL -p $(echo "{}" | sed "s:nixpkgs/::g"' ^-- SC2016 (info): Expressions don't expand in single quotes, use double quotes for that. - # (writeShellApplication { - # name = "ns"; - # runtimeInputs = with pkgs; [ - # fzf - # nix-search-tv - # ]; - # text = builtins.readFile "${pkgs.nix-search-tv.src}/nixpkgs.sh"; - # }) + raycast + ice-bar + keka + stats + iina ]; }; diff --git a/home/ghostty.nix b/home/ghostty.nix deleted file mode 100644 index 6e851ed..0000000 --- a/home/ghostty.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - programs.ghostty = { - enable = true; - enableZshIntegration = true; - enableBashIntegration = true; - - settings = { - theme = "catppuccin-mocha"; - font-family = "D2Coding"; - font-size = 15; - macos-icon = "xray"; - }; - }; -} diff --git a/home/nvf/lsp/treesitter.nix b/home/nvf/lsp/treesitter.nix index 41e9087..f5f8657 100755 --- a/home/nvf/lsp/treesitter.nix +++ b/home/nvf/lsp/treesitter.nix @@ -1,6 +1,7 @@ { # treesitter enable = true; + addDefaultGrammars = true; fold = true; highlight = { enable = true; diff --git a/home/terminal.nix b/home/terminal.nix new file mode 100644 index 0000000..a1894c4 --- /dev/null +++ b/home/terminal.nix @@ -0,0 +1,7 @@ +{ + programs.wezterm = { + enable = true; + enableZshIntegration = true; + enableBashIntegration = true; + }; +} diff --git a/modules/apps.nix b/modules/apps.nix index 118d1f4..a43d478 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ nixpkgs.config.allowUnfree = true; environment.systemPackages = with pkgs; [ @@ -25,22 +26,17 @@ Bitwarden = 1352778147; }; - taps = []; + taps = [ ]; # WARNING only include those not in nixpkgs - brews = []; + brews = [ ]; casks = [ "batfi" "hammerspoon" # TODO use nixpkgs when possible # "google-chrome" - # "iina" - # "jordanbaird-ice" - # "keka" - # "shottr" - # "raycast" - # "stats" + "shottr" ]; }; } diff --git a/modules/system.nix b/modules/system.nix index 98b5a83..267234a 100644 --- a/modules/system.nix +++ b/modules/system.nix @@ -46,11 +46,13 @@ }; controlcenter = { - Sound = false; - Bluetooth = false; AirDrop = false; + BatteryShowPercentage = false; + Bluetooth = false; Display = false; + FocusModes = false; NowPlaying = false; + Sound = false; }; menuExtraClock = { From 7ceb15745764c99f7b1980e7d187a0635b0d9f78 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sat, 14 Mar 2026 01:09:29 +0900 Subject: [PATCH 14/28] feat: oh my zsh plugin for zoxide and eza --- home/zsh.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/home/zsh.nix b/home/zsh.nix index 8e11bdb..c9e2d73 100755 --- a/home/zsh.nix +++ b/home/zsh.nix @@ -19,8 +19,8 @@ shellAliases = { poby = "echo my name is poby"; - drs = "sudo darwin-rebuild switch --flake ~/nix-darwin#$(hostname)"; # TODO change to just script - drt = "sudo darwin-rebuild test --flake ~/nix-darwin#$(hostname)"; # TODO change to just script + drs = "sudo darwin-rebuild switch --flake ~/nix-darwin#$(hostname)"; # TODO change to just script + drt = "sudo darwin-rebuild test --flake ~/nix-darwin#$(hostname)"; # TODO change to just script }; sessionVariables = { @@ -36,6 +36,8 @@ "history" "sudo" "vi-mode" + "zoxide" + "eza" ]; }; }; From 26b1412b824b2737a6537e4f2c6646d9697e87d9 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sat, 14 Mar 2026 01:25:38 +0900 Subject: [PATCH 15/28] style: nix format --- Justfile | 2 +- flake.nix | 120 ++++++++++++++-------------- home/default.nix | 6 +- home/nvf/core/autocmds.nix | 9 ++- home/nvf/default.nix | 8 +- home/nvf/lsp/languages/bash.nix | 6 +- home/nvf/lsp/languages/default.nix | 3 +- home/nvf/lsp/languages/html.nix | 4 +- home/nvf/lsp/languages/lua.nix | 6 +- home/nvf/lsp/languages/markdown.nix | 4 +- home/nvf/lsp/languages/nix.nix | 2 +- home/nvf/lsp/languages/python.nix | 4 +- home/nvf/lsp/languages/yaml.nix | 2 +- home/nvf/plugins/fzf-lua.nix | 2 +- home/terminal.nix | 1 + home/zoxide.nix | 2 +- modules/apps.nix | 4 +- modules/host-users.nix | 5 +- modules/nix-core.nix | 10 ++- 19 files changed, 108 insertions(+), 92 deletions(-) diff --git a/Justfile b/Justfile index 2155836..13dc23b 100644 --- a/Justfile +++ b/Justfile @@ -1,6 +1,6 @@ # just is a command runner, Justfile is very similar to Makefile, but simpler. -# TODO update hostname here! +# FIXME update hostname here! hostname := "fenrir" # List all the just commands diff --git a/flake.nix b/flake.nix index 1b48fa4..295890c 100644 --- a/flake.nix +++ b/flake.nix @@ -42,73 +42,77 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - # agenix for secrets + # TODO: agenix for secrets agenix = { url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgs-darwin"; }; }; - outputs = inputs @ { - self, - nixpkgs, - darwin, - home-manager, - nvf, - agenix, - nix-homebrew, - homebrew-core, - homebrew-cask, - ... - }: let - system = "aarch64-darwin"; - username = "poby"; - useremail = "smg981024@gmail.com"; - hostname = "fenrir"; # TODO break down to multiple hosts + outputs = + inputs@{ + self, + nixpkgs, + darwin, + home-manager, + nvf, + agenix, + nix-homebrew, + homebrew-core, + homebrew-cask, + ... + }: + let + system = "aarch64-darwin"; + username = "poby"; + useremail = "smg981024@gmail.com"; + hostname = "fenrir"; # TODO break down to multiple hosts - specialArgs = - inputs - // { + specialArgs = inputs // { inherit username useremail hostname; }; - in { - darwinConfigurations."${hostname}" = darwin.lib.darwinSystem { - inherit system specialArgs; - modules = [ - ./modules/nix-core.nix - ./modules/system.nix - ./modules/apps.nix - ./modules/host-users.nix - nix-homebrew.darwinModules.nix-homebrew - { - nix-homebrew = { - enable = true; - enableRosetta = true; - user = username; - taps = { - "homebrew/homebrew-core" = homebrew-core; - "homebrew/homebrew-cask" = homebrew-cask; + in + { + darwinConfigurations."${hostname}" = darwin.lib.darwinSystem { + inherit system specialArgs; + modules = [ + ./modules/nix-core.nix + ./modules/system.nix + ./modules/apps.nix + ./modules/host-users.nix + nix-homebrew.darwinModules.nix-homebrew + { + nix-homebrew = { + enable = true; + enableRosetta = true; + user = username; + taps = { + "homebrew/homebrew-core" = homebrew-core; + "homebrew/homebrew-cask" = homebrew-cask; + }; + mutableTaps = false; }; - mutableTaps = false; - }; - } - ({config, ...}: { - homebrew.taps = builtins.attrNames config.nix-homebrew.taps; - }) - agenix.darwinModules.default - home-manager.darwinModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - backupFileExtension = "backup"; - extraSpecialArgs = specialArgs; - sharedModules = [ nvf.homeManagerModules.nvf ]; - users.${username} = import ./home; - }; - } - ]; + } + ( + { config, ... }: + { + homebrew.taps = builtins.attrNames config.nix-homebrew.taps; + } + ) + agenix.darwinModules.default + home-manager.darwinModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "backup"; + extraSpecialArgs = specialArgs; + sharedModules = [ nvf.homeManagerModules.nvf ]; + users.${username} = import ./home; + }; + } + ]; + }; + formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra; }; - formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra; - }; } diff --git a/home/default.nix b/home/default.nix index 46b05ed..533eccf 100755 --- a/home/default.nix +++ b/home/default.nix @@ -21,11 +21,15 @@ ./terminal.nix ./bat.nix ./aerospace.nix + # TODO ./browser.nix # TODO ./pass.nix + # TODO ./claude-code.nix + # TODO ./codex.nix + # TODO ./gemini-cli.nix ]; home = { - username = username; + inherit username; homeDirectory = "/Users/${username}"; stateVersion = "25.11"; diff --git a/home/nvf/core/autocmds.nix b/home/nvf/core/autocmds.nix index ff9fdda..2bdba3c 100755 --- a/home/nvf/core/autocmds.nix +++ b/home/nvf/core/autocmds.nix @@ -1,8 +1,9 @@ -{lib, ...}: [ +{ lib, ... }: +[ # autocmds { enable = true; - event = ["BufReadPost"]; + event = [ "BufReadPost" ]; desc = "Return to last cursor position"; group = "LastCursorGroup"; callback = lib.generators.mkLuaInline '' @@ -17,10 +18,10 @@ } { enable = true; - event = ["TextYankPost"]; + event = [ "TextYankPost" ]; desc = "Highlight yanks on copy"; group = "HighlightYank"; - pattern = ["*"]; + pattern = [ "*" ]; callback = lib.generators.mkLuaInline '' function() vim.hl.on_yank({ diff --git a/home/nvf/default.nix b/home/nvf/default.nix index 29a34dd..5430100 100755 --- a/home/nvf/default.nix +++ b/home/nvf/default.nix @@ -1,6 +1,7 @@ -{lib, ...}: let +{ lib, ... }: +let options = import ./core/options.nix; - autocmds = import ./core/autocmds.nix {inherit lib;}; + autocmds = import ./core/autocmds.nix { inherit lib; }; augroups = import ./core/augroups.nix; keymaps = import ./core/keymaps.nix; fzf-lua = import ./plugins/fzf-lua.nix; @@ -13,7 +14,8 @@ treesitter = import ./lsp/treesitter.nix; autocomplete = import ./lsp/autocomplete.nix; languages = import ./lsp/languages; -in { +in +{ programs.nvf = { enable = true; diff --git a/home/nvf/lsp/languages/bash.nix b/home/nvf/lsp/languages/bash.nix index 2205f03..8ace9c5 100755 --- a/home/nvf/lsp/languages/bash.nix +++ b/home/nvf/lsp/languages/bash.nix @@ -3,15 +3,15 @@ enable = true; extraDiagnostics = { enable = true; - types = ["shellcheck"]; + types = [ "shellcheck" ]; }; format = { enable = true; - type = ["shfmt"]; + type = [ "shfmt" ]; }; lsp = { enable = true; - servers = ["bash-ls"]; + servers = [ "bash-ls" ]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/default.nix b/home/nvf/lsp/languages/default.nix index b67cb8b..cb73cc3 100755 --- a/home/nvf/lsp/languages/default.nix +++ b/home/nvf/lsp/languages/default.nix @@ -6,7 +6,8 @@ let markdown = import ./markdown.nix; html = import ./html.nix; yaml = import ./yaml.nix; -in { +in +{ inherit nix python diff --git a/home/nvf/lsp/languages/html.nix b/home/nvf/lsp/languages/html.nix index c0d3a7b..7f31f2c 100755 --- a/home/nvf/lsp/languages/html.nix +++ b/home/nvf/lsp/languages/html.nix @@ -3,7 +3,7 @@ enable = true; extraDiagnostics = { enable = true; - types = ["htmlhint"]; + types = [ "htmlhint" ]; }; format = { enable = true; @@ -14,7 +14,7 @@ }; lsp = { enable = true; - servers = ["superhtml"]; + servers = [ "superhtml" ]; }; treesitter = { enable = true; diff --git a/home/nvf/lsp/languages/lua.nix b/home/nvf/lsp/languages/lua.nix index 57c7de0..1947b1b 100755 --- a/home/nvf/lsp/languages/lua.nix +++ b/home/nvf/lsp/languages/lua.nix @@ -3,15 +3,15 @@ enable = true; extraDiagnostics = { enable = true; - types = ["luacheck"]; + types = [ "luacheck" ]; }; format = { enable = true; - type = ["stylua"]; + type = [ "stylua" ]; }; lsp = { enable = true; - servers = ["lua-language-server"]; + servers = [ "lua-language-server" ]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/markdown.nix b/home/nvf/lsp/languages/markdown.nix index 958bfff..ca1ee03 100755 --- a/home/nvf/lsp/languages/markdown.nix +++ b/home/nvf/lsp/languages/markdown.nix @@ -13,7 +13,7 @@ }; extraDiagnostics = { enable = true; - types = ["markdownlint-cli2"]; + types = [ "markdownlint-cli2" ]; }; format = { enable = true; @@ -24,7 +24,7 @@ }; lsp = { enable = true; - servers = ["marksman"]; + servers = [ "marksman" ]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/nix.nix b/home/nvf/lsp/languages/nix.nix index 8c9976b..d5f8d8e 100755 --- a/home/nvf/lsp/languages/nix.nix +++ b/home/nvf/lsp/languages/nix.nix @@ -17,7 +17,7 @@ }; lsp = { enable = true; - servers = ["nil"]; + servers = [ "nil" ]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/python.nix b/home/nvf/lsp/languages/python.nix index 13bcf1b..840716b 100755 --- a/home/nvf/lsp/languages/python.nix +++ b/home/nvf/lsp/languages/python.nix @@ -3,11 +3,11 @@ enable = true; format = { enable = true; - type = ["ruff"]; + type = [ "ruff" ]; }; lsp = { enable = true; - servers = ["pyright"]; + servers = [ "pyright" ]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/yaml.nix b/home/nvf/lsp/languages/yaml.nix index 43fb599..35f914e 100755 --- a/home/nvf/lsp/languages/yaml.nix +++ b/home/nvf/lsp/languages/yaml.nix @@ -3,7 +3,7 @@ enable = true; lsp = { enable = true; - servers = ["yaml-language-server"]; + servers = [ "yaml-language-server" ]; }; treesitter.enable = true; } diff --git a/home/nvf/plugins/fzf-lua.nix b/home/nvf/plugins/fzf-lua.nix index f463c4a..d6ff206 100755 --- a/home/nvf/plugins/fzf-lua.nix +++ b/home/nvf/plugins/fzf-lua.nix @@ -2,5 +2,5 @@ # fzf-lua enable = true; profile = "default"; - setupOpts = {}; + setupOpts = { }; } diff --git a/home/terminal.nix b/home/terminal.nix index a1894c4..89c3118 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -3,5 +3,6 @@ enable = true; enableZshIntegration = true; enableBashIntegration = true; + # TODO wezterm config }; } diff --git a/home/zoxide.nix b/home/zoxide.nix index ac54e8f..2e51d3c 100755 --- a/home/zoxide.nix +++ b/home/zoxide.nix @@ -3,6 +3,6 @@ enable = true; enableZshIntegration = true; enableBashIntegration = true; - options = ["--cmd j"]; + options = [ "--cmd j" ]; }; } diff --git a/modules/apps.nix b/modules/apps.nix index a43d478..3a258ed 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -34,9 +34,7 @@ casks = [ "batfi" "hammerspoon" - # TODO use nixpkgs when possible - # "google-chrome" - "shottr" + "shottr" # stable version dmg link not found ]; }; } diff --git a/modules/host-users.nix b/modules/host-users.nix index 9df535e..5192d36 100644 --- a/modules/host-users.nix +++ b/modules/host-users.nix @@ -2,7 +2,8 @@ username, hostname, ... -}: { +}: +{ networking = { hostName = hostname; computerName = hostname; @@ -14,5 +15,5 @@ description = username; }; - nix.settings.trusted-users = [username]; + nix.settings.trusted-users = [ username ]; } diff --git a/modules/nix-core.nix b/modules/nix-core.nix index ed71a0d..c4da2d3 100644 --- a/modules/nix-core.nix +++ b/modules/nix-core.nix @@ -2,14 +2,18 @@ pkgs, lib, ... -}: { +}: +{ nix = { enable = true; package = pkgs.nix; settings = { - experimental-features = ["nix-command" "flakes"]; - substituters = ["https://nix-community.cachix.org"]; + experimental-features = [ + "nix-command" + "flakes" + ]; + substituters = [ "https://nix-community.cachix.org" ]; trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; From d780bab0b166b64e659ea4aa39175028afa86551 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sat, 14 Mar 2026 01:38:44 +0900 Subject: [PATCH 16/28] fix: aerospace hotkeys --- home/aerospace.nix | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/home/aerospace.nix b/home/aerospace.nix index f97b5ba..9a389e2 100644 --- a/home/aerospace.nix +++ b/home/aerospace.nix @@ -60,15 +60,42 @@ alt-8 = "workspace 8"; alt-9 = "workspace 9"; - alt-shift-1 = "move-node-to-workspace 1"; - alt-shift-2 = "move-node-to-workspace 2"; - alt-shift-3 = "move-node-to-workspace 3"; - alt-shift-4 = "move-node-to-workspace 4"; - alt-shift-5 = "move-node-to-workspace 5"; - alt-shift-6 = "move-node-to-workspace 6"; - alt-shift-7 = "move-node-to-workspace 7"; - alt-shift-8 = "move-node-to-workspace 8"; - alt-shift-9 = "move-node-to-workspace 9"; + alt-shift-1 = [ + "move-node-to-workspace 1" + "workspace 1" + ]; + alt-shift-2 = [ + "move-node-to-workspace 2" + "workspace 2" + ]; + alt-shift-3 = [ + "move-node-to-workspace 3" + "workspace 3" + ]; + alt-shift-4 = [ + "move-node-to-workspace 4" + "workspace 4" + ]; + alt-shift-5 = [ + "move-node-to-workspace 5" + "workspace 5" + ]; + alt-shift-6 = [ + "move-node-to-workspace 6" + "workspace 6" + ]; + alt-shift-7 = [ + "move-node-to-workspace 7" + "workspace 7" + ]; + alt-shift-8 = [ + "move-node-to-workspace 8" + "workspace 8" + ]; + alt-shift-9 = [ + "move-node-to-workspace 9" + "workspace 9" + ]; alt-tab = "workspace-back-and-forth"; alt-shift-tab = "move-workspace-to-monitor --wrap-around next"; From b8ce09548903b303bf467d259a28ce19d67d65a3 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sat, 14 Mar 2026 16:54:34 +0900 Subject: [PATCH 17/28] feat: wezterm and starship config --- home/starship.nix | 221 +++++++++++++++++++++++++++++++++++++++++++++- home/terminal.nix | 1 + home/wezterm.lua | 33 +++++++ home/zsh.nix | 4 +- 4 files changed, 255 insertions(+), 4 deletions(-) create mode 100644 home/wezterm.lua diff --git a/home/starship.nix b/home/starship.nix index 2b977ab..9af15a1 100755 --- a/home/starship.nix +++ b/home/starship.nix @@ -1,3 +1,4 @@ +{ lib, ... }: { programs.starship = { enable = true; @@ -5,9 +6,225 @@ enableBashIntegration = true; settings = { + add_newline = true; + continuation_prompt = "[▸▹ ](dimmed white)"; + + format = lib.concatStrings [ + "($nix_shell$container$fill\n)$cmd_duration" + "$hostname" + "$localip" + "$shell" + "$env_var" + "$jobs" + "$sudo" + "$username" + "$character" + ]; + + right_format = lib.concatStrings [ + "$directory" + "$git_branch" + "$git_commit" + "$git_state" + "$git_status" + "$docker_context" + "$c" + "$cpp" + "$deno" + "$helm" + "$java" + "$kotlin" + "$gradle" + "$lua" + "$nodejs" + "$python" + "$ruby" + "$rust" + "$terraform" + "$conda" + "$pixi" + ]; + + fill = { + symbol = " "; + }; + + line_break = { + disabled = false; + }; + character = { - success_symbol = "[›](bold green)"; - error_symbol = "[›](bold red)"; + format = "$symbol "; + success_symbol = "[◎](bold italic bright-yellow)"; + error_symbol = "[○](italic purple)"; + vimcmd_symbol = "[■](italic dimmed green)"; + }; + + env_var.VIMSHELL = { + format = "[$env_value]($style)"; + style = "green italic"; + }; + + sudo = { + format = "[$symbol]($style)"; + style = "bold italic bright-purple"; + symbol = "⋈┈"; + disabled = false; + }; + + username = { + style_user = "bright-yellow bold italic"; + style_root = "purple bold italic"; + format = "[⭘ $user]($style) "; + disabled = false; + show_always = false; + }; + + directory = { + home_symbol = "⌂"; + truncation_length = 2; + truncation_symbol = "□ "; + read_only = " ◈"; + use_os_path_sep = true; + style = "italic blue"; + format = "[$path]($style)[$read_only]($read_only_style)"; + repo_root_style = "bold blue"; + repo_root_format = "[$before_root_path]($before_repo_root_style)[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) [△](bold bright-blue)"; + }; + + cmd_duration = { + format = "[◄ $duration ](italic white)"; + }; + + jobs = { + format = "[$symbol$number]($style) "; + style = "white"; + symbol = "[▶](blue italic)"; + }; + + localip = { + ssh_only = true; + format = " ◯[$localipv4](bold magenta)"; + disabled = false; + }; + + git_branch = { + format = " [$branch(:$remote_branch)]($style)"; + symbol = "[△](bold italic bright-blue)"; + style = "italic bright-blue"; + truncation_symbol = "⋯"; + truncation_length = 11; + ignore_branches = [ + "main" + "master" + ]; + only_attached = true; + }; + + git_metrics = { + format = "([▴$added]($added_style))([▿$deleted]($deleted_style))"; + added_style = "italic dimmed green"; + deleted_style = "italic dimmed red"; + ignore_submodules = true; + disabled = false; + }; + + git_status = { + style = "bold italic bright-blue"; + format = "([⎪$ahead_behind$staged$modified$untracked$renamed$deleted$conflicted$stashed⎥]($style))"; + conflicted = "[◪◦](italic bright-magenta)"; + ahead = "[▴│[\${count}](bold white)│](italic green)"; + behind = "[▿│[\${count}](bold white)│](italic red)"; + diverged = "[◇ ▴┤[\${ahead_count}](regular white)│▿┤[\${behind_count}](regular white)│](italic bright-magenta)"; + untracked = "[◌◦](italic bright-yellow)"; + stashed = "[◃◈](italic white)"; + modified = "[●◦](italic yellow)"; + staged = "[▪┤[$count](bold white)│](italic bright-cyan)"; + renamed = "[◎◦](italic bright-blue)"; + deleted = "[✕](italic red)"; + }; + + deno = { + format = " [deno](italic) [∫ $version](green bold)"; + version_format = "\${raw}"; + }; + + lua = { + format = " [lua](italic) [\${symbol}\${version}]($style)"; + version_format = "\${raw}"; + symbol = "⨀ "; + style = "bold bright-yellow"; + }; + + nodejs = { + format = " [node](italic) [◫ ($version)](bold bright-green)"; + version_format = "\${raw}"; + detect_files = [ + "package-lock.json" + "yarn.lock" + ]; + detect_folders = [ "node_modules" ]; + detect_extensions = [ ]; + }; + + python = { + format = " [py](italic) [\${symbol}\${version}]($style)"; + symbol = "[⌉](bold bright-blue)⌊ "; + version_format = "\${raw}"; + style = "bold bright-yellow"; + }; + + ruby = { + format = " [rb](italic) [\${symbol}\${version}]($style)"; + symbol = "◆ "; + version_format = "\${raw}"; + style = "bold red"; + }; + + rust = { + format = " [rs](italic) [$symbol$version]($style)"; + symbol = "⊃ "; + version_format = "\${raw}"; + style = "bold red"; + }; + + c = { + symbol = "ℂ "; + format = " [$symbol($version(-$name))]($style)"; + }; + + cpp = { + symbol = "ℂ "; + format = " [$symbol($version(-$name))]($style)"; + }; + + conda = { + symbol = "◯ "; + format = " conda [$symbol$environment]($style)"; + }; + + pixi = { + symbol = "■ "; + format = " pixi [$symbol$version ($environment )]($style)"; + }; + + docker_context = { + symbol = "◧ "; + format = " docker [$symbol$context]($style)"; + }; + + java = { + symbol = "∪ "; + format = " java [\${symbol}(\${version} )]($style)"; + }; + + nix_shell = { + style = "bold italic dimmed blue"; + symbol = "✶"; + format = "[$symbol nix⎪$state⎪]($style) [$name](italic dimmed white)"; + impure_msg = "[⌽](bold dimmed red)"; + pure_msg = "[⌾](bold dimmed green)"; + unknown_msg = "[◌](bold dimmed yellow)"; }; }; }; diff --git a/home/terminal.nix b/home/terminal.nix index 89c3118..f6dffc4 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -4,5 +4,6 @@ enableZshIntegration = true; enableBashIntegration = true; # TODO wezterm config + extraConfig = builtins.readFile ./wezterm.lua; }; } diff --git a/home/wezterm.lua b/home/wezterm.lua new file mode 100644 index 0000000..f369e24 --- /dev/null +++ b/home/wezterm.lua @@ -0,0 +1,33 @@ +local wezterm = require("wezterm") + +config = wezterm.config_builder() + +config = { + -- Windows + automatically_reload_config = true, + enable_tab_bar = false, + window_close_confirmation = "NeverPrompt", + window_decorations = "RESIZE", -- disable title bar, enable resize + default_cursor_style = "BlinkingBar", + + -- Appearance + color_scheme = "Tokyo Night", + font = wezterm.font("D2CodingLigature Nerd Font"), + font_size = 16, + background = { + { + source = { Color = "#282c35" }, + width = "100%", + height = "100%", + opacity = 0.95, + }, + }, + window_padding = { + left = 2, + right = 2, + top = 0, + bottom = 0, + }, +} + +return config diff --git a/home/zsh.nix b/home/zsh.nix index c9e2d73..9e58e71 100755 --- a/home/zsh.nix +++ b/home/zsh.nix @@ -19,8 +19,8 @@ shellAliases = { poby = "echo my name is poby"; - drs = "sudo darwin-rebuild switch --flake ~/nix-darwin#$(hostname)"; # TODO change to just script - drt = "sudo darwin-rebuild test --flake ~/nix-darwin#$(hostname)"; # TODO change to just script + nixconfig = "cd ~/nix-darwin && vim flake.nix"; + just-darwin = "cd ~/nix-darwin && just darwin"; }; sessionVariables = { From f86b032c4c8709ce96da6f0b38ff346debf466cf Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sat, 14 Mar 2026 18:43:34 +0900 Subject: [PATCH 18/28] feat: brew arc browser --- modules/apps.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/apps.nix b/modules/apps.nix index 3a258ed..5cd1a34 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -35,6 +35,7 @@ "batfi" "hammerspoon" "shottr" # stable version dmg link not found + "arc" ]; }; } From 63a3bb6e98a405141aedc9a616fa0bce37eecad6 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sat, 14 Mar 2026 21:22:56 +0900 Subject: [PATCH 19/28] feat: sops-nix configuration encrypt personal ssh key for git --- .sops.yaml | 7 +++ flake.lock | 99 +++++++------------------------------ flake.nix | 14 +++--- home/default.nix | 4 +- home/gh.nix | 7 ++- home/nvf/default.nix | 8 ++- home/nvf/lsp/treesitter.nix | 6 +++ home/sops.nix | 12 +++++ home/ssh.nix | 16 ++++++ secrets/poby.yaml | 16 ++++++ 10 files changed, 98 insertions(+), 91 deletions(-) create mode 100644 .sops.yaml create mode 100644 home/sops.nix create mode 100644 home/ssh.nix create mode 100644 secrets/poby.yaml diff --git a/.sops.yaml b/.sops.yaml new file mode 100644 index 0000000..85d5427 --- /dev/null +++ b/.sops.yaml @@ -0,0 +1,7 @@ +keys: + - &poby age1qeyrh6e40nek3da4mnj298cy2l3aswe7432us30d2p93akcvp9zqext63j +creation_rules: + - path_regex: secrets/.*\.yaml$ + key_groups: + - age: + - *poby diff --git a/flake.lock b/flake.lock index 1fc81ad..921aba9 100644 --- a/flake.lock +++ b/flake.lock @@ -1,28 +1,5 @@ { "nodes": { - "agenix": { - "inputs": { - "darwin": "darwin", - "home-manager": "home-manager", - "nixpkgs": [ - "nixpkgs-darwin" - ], - "systems": "systems" - }, - "locked": { - "lastModified": 1770165109, - "narHash": "sha256-9VnK6Oqai65puVJ4WYtCTvlJeXxMzAp/69HhQuTdl/I=", - "owner": "ryantm", - "repo": "agenix", - "rev": "b027ee29d959fda4b60b57566d64c98a202e0feb", - "type": "github" - }, - "original": { - "owner": "ryantm", - "repo": "agenix", - "type": "github" - } - }, "brew-src": { "flake": false, "locked": { @@ -41,28 +18,6 @@ } }, "darwin": { - "inputs": { - "nixpkgs": [ - "agenix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1744478979, - "narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=", - "owner": "lnl7", - "repo": "nix-darwin", - "rev": "43975d782b418ebf4969e9ccba82466728c2851b", - "type": "github" - }, - "original": { - "owner": "lnl7", - "ref": "master", - "repo": "nix-darwin", - "type": "github" - } - }, - "darwin_2": { "inputs": { "nixpkgs": [ "nixpkgs-darwin" @@ -121,27 +76,6 @@ } }, "home-manager": { - "inputs": { - "nixpkgs": [ - "agenix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1745494811, - "narHash": "sha256-YZCh2o9Ua1n9uCvrvi5pRxtuVNml8X2a03qIFfRKpFs=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "abfad3d2958c9e6300a883bd443512c55dfeb1be", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "home-manager_2": { "inputs": { "nixpkgs": [ "nixpkgs-darwin" @@ -288,7 +222,7 @@ "nixpkgs": [ "nixpkgs" ], - "systems": "systems_2" + "systems": "systems" }, "locked": { "lastModified": 1773343795, @@ -306,33 +240,38 @@ }, "root": { "inputs": { - "agenix": "agenix", - "darwin": "darwin_2", - "home-manager": "home-manager_2", + "darwin": "darwin", + "home-manager": "home-manager", "homebrew-cask": "homebrew-cask", "homebrew-core": "homebrew-core", "nix-homebrew": "nix-homebrew", "nixpkgs": "nixpkgs", "nixpkgs-darwin": "nixpkgs-darwin", - "nvf": "nvf" + "nvf": "nvf", + "sops-nix": "sops-nix" } }, - "systems": { + "sops-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs-darwin" + ] + }, "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1773096132, + "narHash": "sha256-M3zEnq9OElB7zqc+mjgPlByPm1O5t2fbUrH3t/Hm5Ag=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "d1ff3b1034d5bab5d7d8086a7803c5a5968cd784", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "Mic92", + "repo": "sops-nix", "type": "github" } }, - "systems_2": { + "systems": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", diff --git a/flake.nix b/flake.nix index 295890c..1007bc9 100644 --- a/flake.nix +++ b/flake.nix @@ -42,9 +42,9 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - # TODO: agenix for secrets - agenix = { - url = "github:ryantm/agenix"; + # sops-nix for secrets + sops-nix = { + url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs-darwin"; }; }; @@ -56,7 +56,7 @@ darwin, home-manager, nvf, - agenix, + sops-nix, nix-homebrew, homebrew-core, homebrew-cask, @@ -99,7 +99,6 @@ homebrew.taps = builtins.attrNames config.nix-homebrew.taps; } ) - agenix.darwinModules.default home-manager.darwinModules.home-manager { home-manager = { @@ -107,7 +106,10 @@ useUserPackages = true; backupFileExtension = "backup"; extraSpecialArgs = specialArgs; - sharedModules = [ nvf.homeManagerModules.nvf ]; + sharedModules = [ + nvf.homeManagerModules.nvf + sops-nix.homeManagerModules.sops + ]; users.${username} = import ./home; }; } diff --git a/home/default.nix b/home/default.nix index 533eccf..c3c4b9e 100755 --- a/home/default.nix +++ b/home/default.nix @@ -21,8 +21,8 @@ ./terminal.nix ./bat.nix ./aerospace.nix - # TODO ./browser.nix - # TODO ./pass.nix + ./sops.nix + ./ssh.nix # TODO ./claude-code.nix # TODO ./codex.nix # TODO ./gemini-cli.nix diff --git a/home/gh.nix b/home/gh.nix index b922f10..9120613 100755 --- a/home/gh.nix +++ b/home/gh.nix @@ -1,3 +1,8 @@ { - programs.gh.enable = true; + programs.gh = { + enable = true; + settings = { + git_protocol = "ssh"; + }; + }; } diff --git a/home/nvf/default.nix b/home/nvf/default.nix index 5430100..05bc14b 100755 --- a/home/nvf/default.nix +++ b/home/nvf/default.nix @@ -1,4 +1,8 @@ -{ lib, ... }: +{ + lib, + pkgs, + ... +}: let options = import ./core/options.nix; autocmds = import ./core/autocmds.nix { inherit lib; }; @@ -11,7 +15,7 @@ let terminal = import ./plugins/terminal.nix; theme = import ./appearance/theme.nix; lsp = import ./lsp/lsp.nix; - treesitter = import ./lsp/treesitter.nix; + treesitter = import ./lsp/treesitter.nix { inherit pkgs; }; autocomplete = import ./lsp/autocomplete.nix; languages = import ./lsp/languages; in diff --git a/home/nvf/lsp/treesitter.nix b/home/nvf/lsp/treesitter.nix index f5f8657..c831cf8 100755 --- a/home/nvf/lsp/treesitter.nix +++ b/home/nvf/lsp/treesitter.nix @@ -1,7 +1,13 @@ +{ pkgs, ... }: { # treesitter enable = true; addDefaultGrammars = true; + grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ + nix + lua + yaml + ]; fold = true; highlight = { enable = true; diff --git a/home/sops.nix b/home/sops.nix new file mode 100644 index 0000000..017e123 --- /dev/null +++ b/home/sops.nix @@ -0,0 +1,12 @@ +{ config, ... }: +{ + sops = { + age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt"; + + defaultSopsFile = ../secrets/poby.yaml; + + secrets = { + "github_ssh_key" = { }; + }; + }; +} diff --git a/home/ssh.nix b/home/ssh.nix new file mode 100644 index 0000000..142acae --- /dev/null +++ b/home/ssh.nix @@ -0,0 +1,16 @@ +{ config, ... }: +{ + programs.ssh = { + enable = true; + enableDefaultConfig = false; + matchBlocks = { + "*" = { }; + "github.com" = { + host = "github.com"; + user = "git"; + identitiesOnly = true; + identityFile = [ config.sops.secrets."github_ssh_key".path ]; + }; + }; + }; +} diff --git a/secrets/poby.yaml b/secrets/poby.yaml new file mode 100644 index 0000000..a336b31 --- /dev/null +++ b/secrets/poby.yaml @@ -0,0 +1,16 @@ +github_ssh_key: ENC[AES256_GCM,data:nlZoOfyEMRj2U+P2ANao+ATS90zr8h4c+mVCu1JVoNpC50DBjyMl3eZDCDERISLHf0JWbg0wAZZbPI0Xp2KvZ9D4g+59Dd+F2csgAxUbTL0QPNkgFzSWQNINPR+pabf8phfWKFBJpBD66R8CGY0g8qM9oCJVGM2sGevdAKlhEHk5qsKZ48N0XdSzwXDxYpAeSt0Lz5mcuu8ndUZq+VJs744pLNd6Br6X6wgYJ8HpOXnzyequRer/Tp/EiX5Wel+Nu4JnlXa74ziv/AVqVdZS+mLylT1Cr+fnT3rASMHtA3KFokKlnoBzmJKlqKOcC9hCg7JApLn9s/iyWaC9AbFqZzEolwB0C9TkY3UHD6f5Eph0jaZemsI8DA1+CB39La48snLy0FraQ2yBdjQB/SwcO34OwqZaNHy6FaK5vNSMnDmlhC+FZkdHt6XkUMv8EZewLSA4WxkTuDE2fgF+NVoBNiSe4G9Fpmrl4h6Adp5pIxivthJPVEmudkTB1Q8TNp2yS2NLlWarUrgELNbGBgG0KocF3F6CXJKC8KNwI3x5cgW8GOB02h3EQGOmazTBUAOwjkZZ0V/8jzbEhRyEcou0LyhY6Ls/ltLaAAo6mtBaOB0=,iv:PNdvBAlSLsW2SxoiajXD6nCgl9EXFzR2SRfo6Ynj4iQ=,tag:qGMtoaigw1iEMET99PVSbw==,type:str] +sops: + age: + - recipient: age1qeyrh6e40nek3da4mnj298cy2l3aswe7432us30d2p93akcvp9zqext63j + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBQaUt1Y1hFS1N0djNEU3NQ + QjFIMk9GZkxoeks2WUx0WlBNblR6dEpSZ2tBCkl3Wk1xaDlXWEFnYkIzZ2J3bUxw + bTltMDJtWEMrZ0NsbzFtTEQyelJsODQKLS0tIHFCYlZGalp2UVpIWTBRdUVob3JM + QXQ3YUkxWnk2U0hacjBMZDQ5WlNFQTAKzzzcoCZg7iNg5QoajxSpP1ka5qIIfaNE + 5VMXcX4qL0OszsO3j3ShYIT02m3XqkSeaOMSz+uty2BWtPCDZoLHrg== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2026-03-14T09:54:27Z" + mac: ENC[AES256_GCM,data:ynguXXBCddmM69U3GMBG6PdLksbljJa2MT3MuQMUVGb7ENQcSc/r9DUrq3XNlV12szK6L1uIf2qhIkLTzN8V2HulfgWZU0l4FY+Ityc0C4NUEVVQrmZPArnWjZ+/p2sUMzZjhUoOWwL7crlUQo1jLzU7s5+p2CsAZGuFppuRfOU=,iv:J+PUT9iFijdNJYpvwamr8q8hYDUxi/hLVs/W+4k/v9o=,tag:znv5HhzpI3TqRso/UDNTQw==,type:str] + unencrypted_suffix: _unencrypted + version: 3.12.1 From d653b39a56e692ae45f0f1bb5a13b3d6f6ac1394 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sat, 14 Mar 2026 22:03:50 +0900 Subject: [PATCH 20/28] feat: add github_cli_token as sops secret mise activate zsh via oh-my-zsh plugin --- home/mise.nix | 2 -- home/sops.nix | 1 + home/zsh.nix | 6 ++++++ secrets/poby.yaml | 5 +++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/home/mise.nix b/home/mise.nix index 8e9456f..5faacfa 100644 --- a/home/mise.nix +++ b/home/mise.nix @@ -1,8 +1,6 @@ { programs.mise = { enable = true; - enableZshIntegration = true; - enableBashIntegration = true; globalConfig = { tools = { diff --git a/home/sops.nix b/home/sops.nix index 017e123..d8a932b 100644 --- a/home/sops.nix +++ b/home/sops.nix @@ -7,6 +7,7 @@ secrets = { "github_ssh_key" = { }; + "github_cli_token" = { }; }; }; } diff --git a/home/zsh.nix b/home/zsh.nix index 9e58e71..7c0916f 100755 --- a/home/zsh.nix +++ b/home/zsh.nix @@ -1,3 +1,4 @@ +{ config, ... }: { programs.zsh = { enable = true; @@ -27,6 +28,10 @@ EDITOR = "nvim"; }; + initContent = '' + export GH_TOKEN="$(cat ${config.sops.secrets."github_cli_token".path})" + ''; + oh-my-zsh = { enable = true; theme = "robbyrussell"; @@ -38,6 +43,7 @@ "vi-mode" "zoxide" "eza" + "mise" ]; }; }; diff --git a/secrets/poby.yaml b/secrets/poby.yaml index a336b31..57f8f7d 100644 --- a/secrets/poby.yaml +++ b/secrets/poby.yaml @@ -1,4 +1,5 @@ github_ssh_key: ENC[AES256_GCM,data:nlZoOfyEMRj2U+P2ANao+ATS90zr8h4c+mVCu1JVoNpC50DBjyMl3eZDCDERISLHf0JWbg0wAZZbPI0Xp2KvZ9D4g+59Dd+F2csgAxUbTL0QPNkgFzSWQNINPR+pabf8phfWKFBJpBD66R8CGY0g8qM9oCJVGM2sGevdAKlhEHk5qsKZ48N0XdSzwXDxYpAeSt0Lz5mcuu8ndUZq+VJs744pLNd6Br6X6wgYJ8HpOXnzyequRer/Tp/EiX5Wel+Nu4JnlXa74ziv/AVqVdZS+mLylT1Cr+fnT3rASMHtA3KFokKlnoBzmJKlqKOcC9hCg7JApLn9s/iyWaC9AbFqZzEolwB0C9TkY3UHD6f5Eph0jaZemsI8DA1+CB39La48snLy0FraQ2yBdjQB/SwcO34OwqZaNHy6FaK5vNSMnDmlhC+FZkdHt6XkUMv8EZewLSA4WxkTuDE2fgF+NVoBNiSe4G9Fpmrl4h6Adp5pIxivthJPVEmudkTB1Q8TNp2yS2NLlWarUrgELNbGBgG0KocF3F6CXJKC8KNwI3x5cgW8GOB02h3EQGOmazTBUAOwjkZZ0V/8jzbEhRyEcou0LyhY6Ls/ltLaAAo6mtBaOB0=,iv:PNdvBAlSLsW2SxoiajXD6nCgl9EXFzR2SRfo6Ynj4iQ=,tag:qGMtoaigw1iEMET99PVSbw==,type:str] +github_cli_token: ENC[AES256_GCM,data:yaJZb5MUeiyBu2LJIgfJ6nX0TL2XdPvZn0IuSMIaxdy5LMyg4NQZkg==,iv:Q+dGU0bPznY5cexiailAzPKgsm0YuOKpGXIAaPh3hNs=,tag:tZKAUVK3H04xD8FMZ2KBsA==,type:str] sops: age: - recipient: age1qeyrh6e40nek3da4mnj298cy2l3aswe7432us30d2p93akcvp9zqext63j @@ -10,7 +11,7 @@ sops: QXQ3YUkxWnk2U0hacjBMZDQ5WlNFQTAKzzzcoCZg7iNg5QoajxSpP1ka5qIIfaNE 5VMXcX4qL0OszsO3j3ShYIT02m3XqkSeaOMSz+uty2BWtPCDZoLHrg== -----END AGE ENCRYPTED FILE----- - lastmodified: "2026-03-14T09:54:27Z" - mac: ENC[AES256_GCM,data:ynguXXBCddmM69U3GMBG6PdLksbljJa2MT3MuQMUVGb7ENQcSc/r9DUrq3XNlV12szK6L1uIf2qhIkLTzN8V2HulfgWZU0l4FY+Ityc0C4NUEVVQrmZPArnWjZ+/p2sUMzZjhUoOWwL7crlUQo1jLzU7s5+p2CsAZGuFppuRfOU=,iv:J+PUT9iFijdNJYpvwamr8q8hYDUxi/hLVs/W+4k/v9o=,tag:znv5HhzpI3TqRso/UDNTQw==,type:str] + lastmodified: "2026-03-14T12:35:18Z" + mac: ENC[AES256_GCM,data:HUZRdHhmybKofm8xI44Q95b9oizFsvRO+SkJ742KO31rFfYhTp9/PYw3+7JxROY7mMyQKrEvRLYcWB97gv3zaDXhevIdBM+wEp9xvpLJ732G9jccarmYqHaAzPsyVUof/I6fyQMFLCcdCmniPR/UihOcmuQpMWjxJ5xr0rerRFA=,iv:o67tqpx4YfvwFNEuXK9ZWIp/b4GXuzWlRbbHw/kEQHQ=,tag:PZyk2G9reLy15yiw8LV/eA==,type:str] unencrypted_suffix: _unencrypted version: 3.12.1 From 316032bab6ebcd735dc63cd4773823ed37051d55 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sat, 14 Mar 2026 22:44:31 +0900 Subject: [PATCH 21/28] refactor: wezterm and aerospace config --- home/aerospace.nix | 20 +++++--------------- home/wezterm.lua | 7 ++++--- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/home/aerospace.nix b/home/aerospace.nix index 9a389e2..6f48864 100644 --- a/home/aerospace.nix +++ b/home/aerospace.nix @@ -6,27 +6,17 @@ accordion-padding = 10; default-root-container-layout = "tiles"; default-root-container-orientation = "auto"; - on-focus-monitor-changed = [ "move-mouse monitor-lazy-center" ]; + on-focused-monitor-changed = [ "move-mouse monitor-lazy-center" ]; automatically-unhide-macos-hidden-apps = false; - persistent-workspaces = [ - "1" - "2" - "3" - "4" - "5" - "6" - "7" - "8" - "9" - ]; + # persistent-workspaces = [ "1" "2" "3" "4" "5" "6" "7" "8" "9" ]; - keymapping = { + key-mapping = { preset = "qwerty"; }; gaps = { - inner.horizontal = 0; - inner.vertical = 0; + inner.horizontal = 3; + inner.vertical = 3; outer.left = 3; outer.bottom = 3; outer.top = 3; diff --git a/home/wezterm.lua b/home/wezterm.lua index f369e24..fb9ec1e 100644 --- a/home/wezterm.lua +++ b/home/wezterm.lua @@ -5,7 +5,8 @@ config = wezterm.config_builder() config = { -- Windows automatically_reload_config = true, - enable_tab_bar = false, + use_fancy_tab_bar = true, + hide_tab_bar_if_only_one_tab = true, window_close_confirmation = "NeverPrompt", window_decorations = "RESIZE", -- disable title bar, enable resize default_cursor_style = "BlinkingBar", @@ -23,8 +24,8 @@ config = { }, }, window_padding = { - left = 2, - right = 2, + left = 0, + right = 0, top = 0, bottom = 0, }, From ae3c83f936e80592926a502a905a46aa52cd6cdf Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sat, 14 Mar 2026 23:02:24 +0900 Subject: [PATCH 22/28] refactor: modularize nix-homebrew --- flake.nix | 18 ------------------ modules/apps.nix | 22 ++++++++++++++++++++-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/flake.nix b/flake.nix index 1007bc9..f9c24d9 100644 --- a/flake.nix +++ b/flake.nix @@ -81,24 +81,6 @@ ./modules/apps.nix ./modules/host-users.nix nix-homebrew.darwinModules.nix-homebrew - { - nix-homebrew = { - enable = true; - enableRosetta = true; - user = username; - taps = { - "homebrew/homebrew-core" = homebrew-core; - "homebrew/homebrew-cask" = homebrew-cask; - }; - mutableTaps = false; - }; - } - ( - { config, ... }: - { - homebrew.taps = builtins.attrNames config.nix-homebrew.taps; - } - ) home-manager.darwinModules.home-manager { home-manager = { diff --git a/modules/apps.nix b/modules/apps.nix index 5cd1a34..459ba0c 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -1,4 +1,11 @@ -{ pkgs, ... }: +{ + pkgs, + config, + username, + homebrew-core, + homebrew-cask, + ... +}: { nixpkgs.config.allowUnfree = true; @@ -11,6 +18,17 @@ ]; environment.variables.EDITOR = "nvim"; + nix-homebrew = { + enable = true; + enableRosetta = true; + user = username; + taps = { + "homebrew/homebrew-core" = homebrew-core; + "homebrew/homebrew-cask" = homebrew-cask; + }; + mutableTaps = false; + }; + homebrew = { enable = true; @@ -26,7 +44,7 @@ Bitwarden = 1352778147; }; - taps = [ ]; + taps = builtins.attrNames config.nix-homebrew.taps; # WARNING only include those not in nixpkgs brews = [ ]; From 37439baf9d213c8de8b431ba0d9f11bab8c54581 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sat, 14 Mar 2026 23:39:23 +0900 Subject: [PATCH 23/28] feat: add ai agent cli tools --- home/default.nix | 3 --- modules/apps.nix | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/home/default.nix b/home/default.nix index c3c4b9e..1e869ec 100755 --- a/home/default.nix +++ b/home/default.nix @@ -23,9 +23,6 @@ ./aerospace.nix ./sops.nix ./ssh.nix - # TODO ./claude-code.nix - # TODO ./codex.nix - # TODO ./gemini-cli.nix ]; home = { diff --git a/modules/apps.nix b/modules/apps.nix index 459ba0c..60af7b0 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -47,13 +47,17 @@ taps = builtins.attrNames config.nix-homebrew.taps; # WARNING only include those not in nixpkgs - brews = [ ]; + brews = [ + "gemini-cli" + ]; casks = [ "batfi" "hammerspoon" "shottr" # stable version dmg link not found "arc" + "codex" + "claude-code" ]; }; } From 4cf65ab6310971ee7df95973f6d658732b5067d8 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sat, 14 Mar 2026 23:56:56 +0900 Subject: [PATCH 24/28] feat: add AGENTS.md --- AGENTS.md | 69 ++++++++++++++++++++++++++++++++++ Justfile | 11 ++---- home/nvf/lsp/languages/nix.nix | 5 +-- 3 files changed, 74 insertions(+), 11 deletions(-) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..8b218e8 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,69 @@ +# Repository Guidelines + +## Project Structure & Module Organization + +This repository is a declarative macOS setup built with Nix flakes. + +- `flake.nix` and `flake.lock`: entrypoint and pinned inputs. +- `modules/`: system-level nix-darwin modules (`nix-core.nix`, `system.nix`, + `apps.nix`, `host-users.nix`). +- `home/`: Home Manager user configuration, with feature modules such as + `git.nix`, `zsh.nix`, and `nvf/`. +- `secrets/`: encrypted SOPS files (for example `secrets/poby.yaml`). +- `Justfile`: day-to-day contributor commands. + +Prefer adding new configuration as small focused modules, then importing them +from `home/default.nix` or `flake.nix`. + +## Build, Test, and Development Commands + +Use `just` as the primary interface: + +- `just darwin `: build and switch to the current host (ex: `fenrir`). +- `just darwin-debug `: same as above with verbose trace output. +- `just fmt`: format all Nix files via `nix fmt` (Alejandra). +- `just up`: update all flake inputs. +- `just upp `: update one input (example: `just upp nixpkgs-darwin`). +- `just history`, `just gc`, `just clean`: inspect and prune Nix + generations/store. + +For validation without switching, run: +`nix build .#darwinConfigurations.fenrir.system --extra-experimental-features 'nix-command flakes'`. + +## Coding Style & Naming Conventions + +- Use 2-space indentation in `.nix` files and keep attribute sets readable. +- Run `just fmt` before committing; formatter is defined in `flake.nix` + (`alejandra`). +- Name module files in lowercase kebab-case (example: `host-users.nix`). +- Keep modules single-purpose and compose through `imports`. + +## Testing Guidelines + +There is no dedicated unit-test suite in this repo. Treat evaluation/build as +the test gate: + +- Run `just fmt`. +- Run `nix build .#darwinConfigurations.fenrir.system`. +- Use `just darwin-debug` when diagnosing evaluation/runtime issues. + +Document manual verification for user-facing changes (shell, terminal, window +manager, app defaults). + +## Commit & Pull Request Guidelines + +Commit history follows Conventional Commit style: `feat:`, `fix:`, `refactor:`, +`style:`. + +- Keep subject lines imperative and concise. +- Scope each commit to one logical change. +- In PRs, include: summary, affected modules/paths, command output used for + validation, and any relevant screenshots for UI changes (for example + WezTerm/AeroSpace behavior). + +## Security & Configuration Tips + +- Never commit plaintext secrets. +- Store secrets only in `secrets/*.yaml` and manage keys/rules in `.sops.yaml`. +- If adding new secret files, ensure `path_regex` coverage and encrypted content + before pushing. diff --git a/Justfile b/Justfile index 13dc23b..bb030f3 100644 --- a/Justfile +++ b/Justfile @@ -1,8 +1,5 @@ # just is a command runner, Justfile is very similar to Makefile, but simpler. -# FIXME update hostname here! -hostname := "fenrir" - # List all the just commands default: @just --list @@ -14,14 +11,14 @@ default: ############################################################################ [group('desktop')] -darwin: +darwin hostname: nix build .#darwinConfigurations.{{hostname}}.system \ --extra-experimental-features 'nix-command flakes' sudo -E ./result/sw/bin/darwin-rebuild switch --flake .#{{hostname}} [group('desktop')] -darwin-debug: +darwin-debug hostname: nix build .#darwinConfigurations.{{hostname}}.system --show-trace --verbose \ --extra-experimental-features 'nix-command flakes' @@ -70,9 +67,9 @@ gc: nix-collect-garbage --delete-older-than 7d [group('nix')] -fmt: +fmt range: # format the nix files in this repo - nix fmt + nix fmt {{range}} # Show all the auto gc roots in the nix store [group('nix')] diff --git a/home/nvf/lsp/languages/nix.nix b/home/nvf/lsp/languages/nix.nix index d5f8d8e..c9ea615 100755 --- a/home/nvf/lsp/languages/nix.nix +++ b/home/nvf/lsp/languages/nix.nix @@ -10,10 +10,7 @@ }; format = { enable = true; - type = [ - "alejandra" - "nixfmt" - ]; + type = [ "alejandra" ]; }; lsp = { enable = true; From fed3a5226afe034b8c5856c41031242d48d80011 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sun, 15 Mar 2026 01:05:00 +0900 Subject: [PATCH 25/28] feat: add python 3.13 as mise global format with alejandra --- flake.nix | 91 ++++++++++++++--------------- home/aerospace.nix | 2 +- home/default.nix | 3 +- home/fd.nix | 2 +- home/mise.nix | 1 + home/nvf/core/autocmds.nix | 9 ++- home/nvf/core/spellcheck.nix | 2 +- home/nvf/default.nix | 10 ++-- home/nvf/lsp/languages/bash.nix | 6 +- home/nvf/lsp/languages/default.nix | 3 +- home/nvf/lsp/languages/html.nix | 4 +- home/nvf/lsp/languages/lua.nix | 6 +- home/nvf/lsp/languages/markdown.nix | 4 +- home/nvf/lsp/languages/nix.nix | 4 +- home/nvf/lsp/languages/python.nix | 4 +- home/nvf/lsp/languages/yaml.nix | 2 +- home/nvf/lsp/treesitter.nix | 3 +- home/nvf/plugins/fzf-lua.nix | 2 +- home/sops.nix | 7 +-- home/ssh.nix | 7 +-- home/starship.nix | 7 +-- home/zoxide.nix | 2 +- home/zsh.nix | 5 +- modules/apps.nix | 3 +- modules/host-users.nix | 5 +- modules/nix-core.nix | 5 +- modules/system.nix | 18 +++--- 27 files changed, 101 insertions(+), 116 deletions(-) diff --git a/flake.nix b/flake.nix index f9c24d9..cfc6764 100644 --- a/flake.nix +++ b/flake.nix @@ -49,54 +49,53 @@ }; }; - outputs = - inputs@{ - self, - nixpkgs, - darwin, - home-manager, - nvf, - sops-nix, - nix-homebrew, - homebrew-core, - homebrew-cask, - ... - }: - let - system = "aarch64-darwin"; - username = "poby"; - useremail = "smg981024@gmail.com"; - hostname = "fenrir"; # TODO break down to multiple hosts + outputs = inputs @ { + self, + nixpkgs, + darwin, + home-manager, + nvf, + sops-nix, + nix-homebrew, + homebrew-core, + homebrew-cask, + ... + }: let + system = "aarch64-darwin"; + username = "poby"; + useremail = "smg981024@gmail.com"; + hostname = "fenrir"; # TODO break down to multiple hosts - specialArgs = inputs // { + specialArgs = + inputs + // { inherit username useremail hostname; }; - in - { - darwinConfigurations."${hostname}" = darwin.lib.darwinSystem { - inherit system specialArgs; - modules = [ - ./modules/nix-core.nix - ./modules/system.nix - ./modules/apps.nix - ./modules/host-users.nix - nix-homebrew.darwinModules.nix-homebrew - home-manager.darwinModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - backupFileExtension = "backup"; - extraSpecialArgs = specialArgs; - sharedModules = [ - nvf.homeManagerModules.nvf - sops-nix.homeManagerModules.sops - ]; - users.${username} = import ./home; - }; - } - ]; - }; - formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra; + in { + darwinConfigurations."${hostname}" = darwin.lib.darwinSystem { + inherit system specialArgs; + modules = [ + ./modules/nix-core.nix + ./modules/system.nix + ./modules/apps.nix + ./modules/host-users.nix + nix-homebrew.darwinModules.nix-homebrew + home-manager.darwinModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "backup"; + extraSpecialArgs = specialArgs; + sharedModules = [ + nvf.homeManagerModules.nvf + sops-nix.homeManagerModules.sops + ]; + users.${username} = import ./home; + }; + } + ]; }; + formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra; + }; } diff --git a/home/aerospace.nix b/home/aerospace.nix index 6f48864..b5c37f3 100644 --- a/home/aerospace.nix +++ b/home/aerospace.nix @@ -6,7 +6,7 @@ accordion-padding = 10; default-root-container-layout = "tiles"; default-root-container-orientation = "auto"; - on-focused-monitor-changed = [ "move-mouse monitor-lazy-center" ]; + on-focused-monitor-changed = ["move-mouse monitor-lazy-center"]; automatically-unhide-macos-hidden-apps = false; # persistent-workspaces = [ "1" "2" "3" "4" "5" "6" "7" "8" "9" ]; diff --git a/home/default.nix b/home/default.nix index 1e869ec..8ae1be7 100755 --- a/home/default.nix +++ b/home/default.nix @@ -2,8 +2,7 @@ pkgs, username, ... -}: -{ +}: { imports = [ ./fd.nix ./fzf.nix diff --git a/home/fd.nix b/home/fd.nix index dd938e4..79dadf7 100755 --- a/home/fd.nix +++ b/home/fd.nix @@ -1,7 +1,7 @@ { programs.fd = { enable = true; - ignores = [ ".git/" ]; + ignores = [".git/"]; hidden = true; }; } diff --git a/home/mise.nix b/home/mise.nix index 5faacfa..d5fa8ce 100644 --- a/home/mise.nix +++ b/home/mise.nix @@ -6,6 +6,7 @@ tools = { node = "lts"; uv = "latest"; + python = "3.13"; }; settings = { experimental = true; diff --git a/home/nvf/core/autocmds.nix b/home/nvf/core/autocmds.nix index 2bdba3c..ff9fdda 100755 --- a/home/nvf/core/autocmds.nix +++ b/home/nvf/core/autocmds.nix @@ -1,9 +1,8 @@ -{ lib, ... }: -[ +{lib, ...}: [ # autocmds { enable = true; - event = [ "BufReadPost" ]; + event = ["BufReadPost"]; desc = "Return to last cursor position"; group = "LastCursorGroup"; callback = lib.generators.mkLuaInline '' @@ -18,10 +17,10 @@ } { enable = true; - event = [ "TextYankPost" ]; + event = ["TextYankPost"]; desc = "Highlight yanks on copy"; group = "HighlightYank"; - pattern = [ "*" ]; + pattern = ["*"]; callback = lib.generators.mkLuaInline '' function() vim.hl.on_yank({ diff --git a/home/nvf/core/spellcheck.nix b/home/nvf/core/spellcheck.nix index ff77048..4966b3c 100755 --- a/home/nvf/core/spellcheck.nix +++ b/home/nvf/core/spellcheck.nix @@ -1,5 +1,5 @@ { # spellcheck enable = true; - languages = [ "en" ]; + languages = ["en"]; } diff --git a/home/nvf/default.nix b/home/nvf/default.nix index 05bc14b..43292a8 100755 --- a/home/nvf/default.nix +++ b/home/nvf/default.nix @@ -2,10 +2,9 @@ lib, pkgs, ... -}: -let +}: let options = import ./core/options.nix; - autocmds = import ./core/autocmds.nix { inherit lib; }; + autocmds = import ./core/autocmds.nix {inherit lib;}; augroups = import ./core/augroups.nix; keymaps = import ./core/keymaps.nix; fzf-lua = import ./plugins/fzf-lua.nix; @@ -15,11 +14,10 @@ let terminal = import ./plugins/terminal.nix; theme = import ./appearance/theme.nix; lsp = import ./lsp/lsp.nix; - treesitter = import ./lsp/treesitter.nix { inherit pkgs; }; + treesitter = import ./lsp/treesitter.nix {inherit pkgs;}; autocomplete = import ./lsp/autocomplete.nix; languages = import ./lsp/languages; -in -{ +in { programs.nvf = { enable = true; diff --git a/home/nvf/lsp/languages/bash.nix b/home/nvf/lsp/languages/bash.nix index 8ace9c5..2205f03 100755 --- a/home/nvf/lsp/languages/bash.nix +++ b/home/nvf/lsp/languages/bash.nix @@ -3,15 +3,15 @@ enable = true; extraDiagnostics = { enable = true; - types = [ "shellcheck" ]; + types = ["shellcheck"]; }; format = { enable = true; - type = [ "shfmt" ]; + type = ["shfmt"]; }; lsp = { enable = true; - servers = [ "bash-ls" ]; + servers = ["bash-ls"]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/default.nix b/home/nvf/lsp/languages/default.nix index cb73cc3..b67cb8b 100755 --- a/home/nvf/lsp/languages/default.nix +++ b/home/nvf/lsp/languages/default.nix @@ -6,8 +6,7 @@ let markdown = import ./markdown.nix; html = import ./html.nix; yaml = import ./yaml.nix; -in -{ +in { inherit nix python diff --git a/home/nvf/lsp/languages/html.nix b/home/nvf/lsp/languages/html.nix index 7f31f2c..c0d3a7b 100755 --- a/home/nvf/lsp/languages/html.nix +++ b/home/nvf/lsp/languages/html.nix @@ -3,7 +3,7 @@ enable = true; extraDiagnostics = { enable = true; - types = [ "htmlhint" ]; + types = ["htmlhint"]; }; format = { enable = true; @@ -14,7 +14,7 @@ }; lsp = { enable = true; - servers = [ "superhtml" ]; + servers = ["superhtml"]; }; treesitter = { enable = true; diff --git a/home/nvf/lsp/languages/lua.nix b/home/nvf/lsp/languages/lua.nix index 1947b1b..57c7de0 100755 --- a/home/nvf/lsp/languages/lua.nix +++ b/home/nvf/lsp/languages/lua.nix @@ -3,15 +3,15 @@ enable = true; extraDiagnostics = { enable = true; - types = [ "luacheck" ]; + types = ["luacheck"]; }; format = { enable = true; - type = [ "stylua" ]; + type = ["stylua"]; }; lsp = { enable = true; - servers = [ "lua-language-server" ]; + servers = ["lua-language-server"]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/markdown.nix b/home/nvf/lsp/languages/markdown.nix index ca1ee03..958bfff 100755 --- a/home/nvf/lsp/languages/markdown.nix +++ b/home/nvf/lsp/languages/markdown.nix @@ -13,7 +13,7 @@ }; extraDiagnostics = { enable = true; - types = [ "markdownlint-cli2" ]; + types = ["markdownlint-cli2"]; }; format = { enable = true; @@ -24,7 +24,7 @@ }; lsp = { enable = true; - servers = [ "marksman" ]; + servers = ["marksman"]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/nix.nix b/home/nvf/lsp/languages/nix.nix index c9ea615..e03681a 100755 --- a/home/nvf/lsp/languages/nix.nix +++ b/home/nvf/lsp/languages/nix.nix @@ -10,11 +10,11 @@ }; format = { enable = true; - type = [ "alejandra" ]; + type = ["alejandra"]; }; lsp = { enable = true; - servers = [ "nil" ]; + servers = ["nil"]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/python.nix b/home/nvf/lsp/languages/python.nix index 840716b..13bcf1b 100755 --- a/home/nvf/lsp/languages/python.nix +++ b/home/nvf/lsp/languages/python.nix @@ -3,11 +3,11 @@ enable = true; format = { enable = true; - type = [ "ruff" ]; + type = ["ruff"]; }; lsp = { enable = true; - servers = [ "pyright" ]; + servers = ["pyright"]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/yaml.nix b/home/nvf/lsp/languages/yaml.nix index 35f914e..43fb599 100755 --- a/home/nvf/lsp/languages/yaml.nix +++ b/home/nvf/lsp/languages/yaml.nix @@ -3,7 +3,7 @@ enable = true; lsp = { enable = true; - servers = [ "yaml-language-server" ]; + servers = ["yaml-language-server"]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/treesitter.nix b/home/nvf/lsp/treesitter.nix index c831cf8..da824a3 100755 --- a/home/nvf/lsp/treesitter.nix +++ b/home/nvf/lsp/treesitter.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { # treesitter enable = true; addDefaultGrammars = true; diff --git a/home/nvf/plugins/fzf-lua.nix b/home/nvf/plugins/fzf-lua.nix index d6ff206..f463c4a 100755 --- a/home/nvf/plugins/fzf-lua.nix +++ b/home/nvf/plugins/fzf-lua.nix @@ -2,5 +2,5 @@ # fzf-lua enable = true; profile = "default"; - setupOpts = { }; + setupOpts = {}; } diff --git a/home/sops.nix b/home/sops.nix index d8a932b..c8b52cf 100644 --- a/home/sops.nix +++ b/home/sops.nix @@ -1,13 +1,12 @@ -{ config, ... }: -{ +{config, ...}: { sops = { age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt"; defaultSopsFile = ../secrets/poby.yaml; secrets = { - "github_ssh_key" = { }; - "github_cli_token" = { }; + "github_ssh_key" = {}; + "github_cli_token" = {}; }; }; } diff --git a/home/ssh.nix b/home/ssh.nix index 142acae..378be6e 100644 --- a/home/ssh.nix +++ b/home/ssh.nix @@ -1,15 +1,14 @@ -{ config, ... }: -{ +{config, ...}: { programs.ssh = { enable = true; enableDefaultConfig = false; matchBlocks = { - "*" = { }; + "*" = {}; "github.com" = { host = "github.com"; user = "git"; identitiesOnly = true; - identityFile = [ config.sops.secrets."github_ssh_key".path ]; + identityFile = [config.sops.secrets."github_ssh_key".path]; }; }; }; diff --git a/home/starship.nix b/home/starship.nix index 9af15a1..2d50ffc 100755 --- a/home/starship.nix +++ b/home/starship.nix @@ -1,5 +1,4 @@ -{ lib, ... }: -{ +{lib, ...}: { programs.starship = { enable = true; enableZshIntegration = true; @@ -163,8 +162,8 @@ "package-lock.json" "yarn.lock" ]; - detect_folders = [ "node_modules" ]; - detect_extensions = [ ]; + detect_folders = ["node_modules"]; + detect_extensions = []; }; python = { diff --git a/home/zoxide.nix b/home/zoxide.nix index 2e51d3c..ac54e8f 100755 --- a/home/zoxide.nix +++ b/home/zoxide.nix @@ -3,6 +3,6 @@ enable = true; enableZshIntegration = true; enableBashIntegration = true; - options = [ "--cmd j" ]; + options = ["--cmd j"]; }; } diff --git a/home/zsh.nix b/home/zsh.nix index 7c0916f..2a5dc0a 100755 --- a/home/zsh.nix +++ b/home/zsh.nix @@ -1,5 +1,4 @@ -{ config, ... }: -{ +{config, ...}: { programs.zsh = { enable = true; @@ -21,7 +20,7 @@ shellAliases = { poby = "echo my name is poby"; nixconfig = "cd ~/nix-darwin && vim flake.nix"; - just-darwin = "cd ~/nix-darwin && just darwin"; + just-darwin = "cd ~/nix-darwin && just darwin $(hostname)"; }; sessionVariables = { diff --git a/modules/apps.nix b/modules/apps.nix index 60af7b0..29553b0 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -5,8 +5,7 @@ homebrew-core, homebrew-cask, ... -}: -{ +}: { nixpkgs.config.allowUnfree = true; environment.systemPackages = with pkgs; [ diff --git a/modules/host-users.nix b/modules/host-users.nix index 5192d36..9df535e 100644 --- a/modules/host-users.nix +++ b/modules/host-users.nix @@ -2,8 +2,7 @@ username, hostname, ... -}: -{ +}: { networking = { hostName = hostname; computerName = hostname; @@ -15,5 +14,5 @@ description = username; }; - nix.settings.trusted-users = [ username ]; + nix.settings.trusted-users = [username]; } diff --git a/modules/nix-core.nix b/modules/nix-core.nix index c4da2d3..cee556b 100644 --- a/modules/nix-core.nix +++ b/modules/nix-core.nix @@ -2,8 +2,7 @@ pkgs, lib, ... -}: -{ +}: { nix = { enable = true; package = pkgs.nix; @@ -13,7 +12,7 @@ "nix-command" "flakes" ]; - substituters = [ "https://nix-community.cachix.org" ]; + substituters = ["https://nix-community.cachix.org"]; trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; diff --git a/modules/system.nix b/modules/system.nix index 267234a..3936253 100644 --- a/modules/system.nix +++ b/modules/system.nix @@ -4,8 +4,7 @@ username, hostname, ... -}: -{ +}: { time.timeZone = "Asia/Seoul"; system = { @@ -19,14 +18,13 @@ sudo -u ${username} /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u ''; - activationScripts.applications.text = - let - env = pkgs.buildEnv { - name = "system-applications"; - paths = config.environment.systemPackages; - pathsToLink = [ "/Applications" ]; - }; - in + activationScripts.applications.text = let + env = pkgs.buildEnv { + name = "system-applications"; + paths = config.environment.systemPackages; + pathsToLink = ["/Applications"]; + }; + in pkgs.lib.mkForce '' # Set up applications. echo "setting up /Applications..." >&2 From 2366d38fbf9617c57b44a825b890e18fdcf33329 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sun, 15 Mar 2026 01:16:07 +0900 Subject: [PATCH 26/28] feat(codex): add readme codex skill --- .codex/skills/readme/SKILL.md | 64 +++++++++++++++++++++++++ .codex/skills/readme/agents/openai.yaml | 4 ++ 2 files changed, 68 insertions(+) create mode 100644 .codex/skills/readme/SKILL.md create mode 100644 .codex/skills/readme/agents/openai.yaml diff --git a/.codex/skills/readme/SKILL.md b/.codex/skills/readme/SKILL.md new file mode 100644 index 0000000..428aead --- /dev/null +++ b/.codex/skills/readme/SKILL.md @@ -0,0 +1,64 @@ +--- +name: readme +description: Write and update README.md and README-ko.md for the nix-darwin repository. Use when asked to create new repository documentation, refresh outdated setup/usage instructions, summarize the current project structure, or produce Korean README content. +--- + +# README Writer + +## Overview + +Generate high-quality README files for this repository based on current code and +configuration. Create missing READMEs or update existing ones while preserving +useful, project-specific content. + +## Workflow + +1. Inspect repository facts before writing. Use targeted reads of `flake.nix`, + `Justfile`, `home/`, `modules/`, and `secrets/` plus recent git history. Do + not invent commands, tools, or directory names. + +2. Select target file and language. Default target is `README.md` in English. If + user asks for Korean or explicitly requests `README-ko.md`, write Korean + content to `README-ko.md`. If target is ambiguous, ask one concise + clarification question. + +3. Draft content before mutating files. Always show a draft summary (or full + draft when requested) and request explicit confirmation before writing. Use + concise, actionable prose and include concrete commands that work in this + repository. + +4. Create or update safely. If the target README does not exist, create it. If + it exists, retain useful custom sections and update stale technical details. + Avoid deleting user-authored content unless it is clearly obsolete and + replaced by accurate content. + +5. Validate the result. Re-check that all commands and paths referenced in the + README exist in the repository. Ensure headings are clear, markdown is valid, + and tone is professional. + +## Recommended README Structure + +- Title and short description +- Prerequisites (Nix/macOS assumptions when relevant) +- Repository layout (`home/`, `modules/`, `secrets/`, root files) +- Key commands (`just darwin`, `just darwin-debug`, `just fmt`, update/cleanup + commands) +- Configuration and secrets notes (`.sops.yaml`, `secrets/*.yaml`) +- Common workflows (apply config, update flake inputs, debug build issues) + +Adapt section names if user requests a different format, but keep the content +repository-specific. + +## Output Rules + +- Prefer concise explanations over long tutorials. +- Keep examples runnable from repository root. +- Use Markdown headings and fenced code blocks for commands. +- Do not include placeholders like "TODO" in final README output. +- For bilingual requests, keep language consistent per file (no mixed-language + sections unless requested). + +## Confirmation Requirement + +Never write or overwrite `README.md` or `README-ko.md` without explicit user +confirmation in the current conversation. diff --git a/.codex/skills/readme/agents/openai.yaml b/.codex/skills/readme/agents/openai.yaml new file mode 100644 index 0000000..caa5292 --- /dev/null +++ b/.codex/skills/readme/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "README Writer" + short_description: "Draft and update repository README files" + default_prompt: "Use $readme to create or update README.md for this repository after showing a draft and requesting confirmation." From 9ee6a07368034f6ec3ea0d85d8537ad10da4af3d Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sun, 15 Mar 2026 01:22:40 +0900 Subject: [PATCH 27/28] docs: add README.md for this project --- README.md | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..635c8ab --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ +# nix-darwin + +Declarative macOS setup for host `fenrir` using `nix-darwin`, `home-manager`, +`nix-homebrew`, and `sops-nix`. + +## What This Repo Manages + +- System-level macOS configuration (`modules/`) +- User-level tooling and shell/editor setup (`home/`) +- Declarative Homebrew taps/apps/casks +- Encrypted secrets via SOPS (`secrets/` + `.sops.yaml`) + +## Prerequisites + +- macOS on Apple Silicon (`aarch64-darwin`) +- Nix with flakes (`nix-command` + `flakes`) +- `just` (command runner) +- SOPS age key at: + +```bash +~/.config/sops/age/keys.txt +``` + +## Repository Layout + +- `flake.nix`: flake inputs/outputs and `darwinConfigurations` +- `Justfile`: daily commands (`darwin`, `darwin-debug`, `fmt`, `up`, `gc`, etc.) +- `modules/`: system modules (`nix-core.nix`, `system.nix`, `apps.nix`, + `host-users.nix`) +- `home/`: Home Manager modules (shell, git, nvf, terminal, tools) +- `secrets/`: encrypted secret files (`poby.yaml`) + +## Common Commands + +```bash +# List available tasks +just + +# Build and switch for a host +just darwin $(hostname) + +# Build and switch with full trace +just darwin-debug $(hostname) + +# Format Nix files (example: whole repo) +just fmt . + +# Update all flake inputs +just up + +# Update one input +just upp nixpkgs-darwin + +# Inspect system profile history +just history + +# Clean old generations / garbage collect +just clean +just gc +``` + +## Secrets + +- Secrets are encrypted in `secrets/*.yaml`. +- `.sops.yaml` enforces age-based encryption rules. +- Home Manager reads secrets from `secrets/poby.yaml` and exposes: + - `github_ssh_key` + - `github_cli_token` + +## Customization Notes + +- Update `hostname`, `username`, and `useremail` in `flake.nix` for your + machine. +- Add new system behavior in `modules/*.nix`. +- Add user tooling in `home/*.nix` and import it from `home/default.nix`. + +## Troubleshooting + +- Use `just darwin-debug ` for verbose evaluation/build output. +- If a build succeeds but behavior is stale, re-run switch and verify active + host/config values. From 357ef7f6482a452fd15b4eabfd5b12e6cf5299c7 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sun, 15 Mar 2026 02:28:38 +0900 Subject: [PATCH 28/28] feat(git): git signing with ssh --- .gitignore | 4 ++++ home/git.nix | 24 ++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index d5fec98..d547f7c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ +# MacOS .DS_Store + +# Nix result +.cache diff --git a/home/git.nix b/home/git.nix index dad9f9b..cd67e6d 100755 --- a/home/git.nix +++ b/home/git.nix @@ -1,10 +1,30 @@ -{ +{config, ...}: let + signingPrincipal = "87608318+smg1024@users.noreply.github.com"; + signingPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFuQ4STNnixjNDo38AyI0yABKAVfF3hupo66613IgfC7"; + signingKeyPath = "${config.home.homeDirectory}/.config/sops-nix/secrets/github_ssh_key"; + allowedSignersPath = "${config.home.homeDirectory}/.config/git/allowed_signers"; +in { + home.file.".config/git/allowed_signers".text = '' + ${signingPrincipal} ${signingPublicKey} + ''; + programs.git = { enable = true; + signing = { + format = "ssh"; + key = signingKeyPath; + signByDefault = true; + signer = "ssh-keygen"; + }; settings = { user = { name = "Poby"; - email = "87608318+smg1024@users.noreply.github.com"; + email = signingPrincipal; + }; + gpg = { + ssh = { + allowedSignersFile = allowedSignersPath; + }; }; init.defaultBranch = "master"; push = {