commit 8b9d3c114d235ef3b057efdf48a76b52789a2045 Author: 0xrsydn Date: Fri Sep 26 15:50:10 2025 +0700 v0.1 config diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b06be2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.cache +.lib +.config +.env +AGENTS.md +# Personal secrets +.config/zsh/secrets.zsh diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..851e898 --- /dev/null +++ b/flake.nix @@ -0,0 +1,112 @@ +{ + description = "Rasyid's nix-darwin dotfiles"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; + + darwin.url = "github:LnL7/nix-darwin"; + darwin.inputs.nixpkgs.follows = "nixpkgs"; + + home-manager.url = "github:nix-community/home-manager/release-24.05"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + + ghostty.url = "github:ghostty-org/ghostty"; + ghostty.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, darwin, home-manager, ghostty, ... }: + let + inherit (nixpkgs.lib) genAttrs; + + systems = [ + "aarch64-darwin" + "x86_64-darwin" + ]; + + forEachSystem = f: genAttrs systems (system: f system); + + overlaysList = + [ ghostty.overlays.default ]; + + mkPkgs = system: + import nixpkgs { + inherit system; + overlays = overlaysList; + config.allowUnfree = true; + }; + + mkPkgsUnstable = system: + import nixpkgs-unstable { + inherit system; + overlays = overlaysList; + config.allowUnfree = true; + }; + + sharedModules = [ + ./modules/darwin/system.nix + ]; + + user = "rsydn"; + + mkDarwin = { hostname, system ? "aarch64-darwin", extraModules ? [ ], homeFile ? ./modules/home/rsydn/base.nix }: + let + pkgs = mkPkgs system; + pkgsUnstable = mkPkgsUnstable system; + in + darwin.lib.darwinSystem { + inherit system pkgs; + specialArgs = { + inherit inputs overlaysList pkgsUnstable user; + }; + modules = + sharedModules + ++ extraModules + ++ [ + home-manager.darwinModules.home-manager + { + nix.registry.self.flake = self; + nixpkgs.overlays = overlaysList; + + users.users.${user}.home = "/Users/${user}"; + + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { + inherit inputs pkgsUnstable user; + }; + home-manager.users.${user} = import homeFile; + } + ]; + }; + in { + darwinConfigurations = { + macbook-pro = mkDarwin { + hostname = "macbook-pro"; + }; + }; + + devShells = forEachSystem (system: + let + pkgs = mkPkgs system; + pkgsUnstable = mkPkgsUnstable system; + in { + default = pkgs.mkShell { + packages = with pkgs; [ + git + nixfmt-classic + ]; + shellHook = '' + echo "Loaded default shell for ${system}" + ''; + }; + + }); + + formatter = forEachSystem (system: (mkPkgs system).nixfmt-classic); + + packages = forEachSystem (system: { + inherit (mkPkgs system) git; + }); + }; +} diff --git a/modules/home/rsydn/base.nix b/modules/home/rsydn/base.nix new file mode 100644 index 0000000..36e8cb2 --- /dev/null +++ b/modules/home/rsydn/base.nix @@ -0,0 +1,72 @@ +{ config, pkgs, lib, ... }: +{ + imports = [ + ./programs/helix.nix + ./shell/zsh.nix + ./devtools/default.nix + ]; + + rsydn.shell.zsh = { + enable = true; + plugins = []; + extraAfter = '' + # Source personal secrets + [ -f ~/.config/zsh/secrets.zsh ] && source ~/.config/zsh/secrets.zsh + + # Custom PATH additions + export PATH="$HOME/.local/bin:$PATH" + export PATH="$PATH:$HOME/.composer/vendor/bin" + export PATH="$HOME/.claude/local/bin:$PATH" + export PATH="$HOME/go/bin:$PATH" + export PATH="/usr/local/texlive/2024/bin/universal-darwin:$PATH" + + # NVM setup + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" + + # Bun setup + export BUN_INSTALL="$HOME/.bun" + export PATH="$BUN_INSTALL/bin:$PATH" + + # pnpm setup + export PNPM_HOME="$HOME/Library/pnpm" + case ":$PATH:" in + *":$PNPM_HOME:"*) ;; + *) export PATH="$PNPM_HOME:$PATH" ;; + esac + + # LM Studio + export PATH="$PATH:$HOME/.lmstudio/bin" + + # opencode + export PATH="$HOME/.opencode/bin:$PATH" + + # Custom aliases + alias runopenwebui='DATA_DIR=~/.open-webui uvx --python 3.11 open-webui@latest serve' + + # Vi mode + bindkey -v + + # Conda setup (managed by conda init) + # >>> conda initialize >>> + __conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" + if [ $? -eq 0 ]; then + eval "$__conda_setup" + else + if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then + . "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" + else + export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH" + fi + fi + unset __conda_setup + # <<< conda initialize <<< + ''; + }; + + rsydn.devTools = { + enable = lib.mkDefault false; + packages = []; + }; +}