diff --git a/.direnv/bin/nix-direnv-reload b/.direnv/bin/nix-direnv-reload new file mode 100755 index 0000000..860660e --- /dev/null +++ b/.direnv/bin/nix-direnv-reload @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -e +if [[ ! -d "/Users/suri/Nyx" ]]; then + echo "Cannot find source directory; Did you move it?" + echo "(Looking for "/Users/suri/Nyx")" + echo 'Cannot force reload with this script - use "direnv reload" manually and then try again' + exit 1 +fi + +# rebuild the cache forcefully +_nix_direnv_force_reload=1 direnv exec "/Users/suri/Nyx" true + +# Update the mtime for .envrc. +# This will cause direnv to reload again - but without re-building. +touch "/Users/suri/Nyx/.envrc" + +# Also update the timestamp of whatever profile_rc we have. +# This makes sure that we know we are up to date. +touch -r "/Users/suri/Nyx/.envrc" "/Users/suri/Nyx/.direnv"/*.rc diff --git a/.envrc b/.envrc deleted file mode 100644 index 3550a30..0000000 --- a/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake diff --git a/hosts/Daedalus/default.nix b/hosts/Daedalus/default.nix index 35970dd..ddaa4b4 100644 --- a/hosts/Daedalus/default.nix +++ b/hosts/Daedalus/default.nix @@ -1,4 +1,6 @@ -{ pkgs, config, outputs, ... }: { +{ pkgs, outputs, ... }: { + + imports = [ ../../modules/system/fonts.nix ]; # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget @@ -7,45 +9,35 @@ system.primaryUser = "suri"; - fonts.packages = [ pkgs.monaspace ]; - homebrew = { enable = true; brews = [ "sketchybar" "mas" - "borders" + # terminal handling stuff "libiconv" + # nmcli kinda "ifstat" - "libiconv" - # for twizzler + # spicetify stuff + "spicetify-cli" + + # TODO: for twizzler, make a flake for ts "qemu" "e2fsprogs" - "spicetify-cli" "ninja" ]; casks = [ "ghostty@tip" - "google-chrome" "db-browser-for-sqlite" - - "notion" - "orbstack" "zen" "discord" "slack" "zulip" "raycast" - "blender" - "godot" "zoom" "soduto" - "font-hack-nerd-font" - "font-sf-pro" - "font-fira-code-nerd-font" "spotify" - "obsidian" "mac-mouse-fix" ]; masApps = { "whatsapp" = 310633997; }; @@ -74,17 +66,17 @@ nixpkgs.config.allowUnfree = true; - # Used for backwards compatibility, please read the changelog before changing. - # $ darwin-rebuild changelog - system.stateVersion = 6; - security.pam.services.sudo_local.touchIdAuth = true; - # The platform the configuration will be used on. - nixpkgs.hostPlatform = "aarch64-darwin"; - users.users.suri = { name = "suri"; home = "/Users/suri"; }; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = "aarch64-darwin"; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 6; } diff --git a/modules/home/apps/default.nix b/modules/home/apps/default.nix new file mode 100644 index 0000000..8bf0194 --- /dev/null +++ b/modules/home/apps/default.nix @@ -0,0 +1,5 @@ +{ + + imports = [./orbstack.nix]; + +} diff --git a/modules/home/apps/orbstack.nix b/modules/home/apps/orbstack.nix new file mode 100644 index 0000000..9e52102 --- /dev/null +++ b/modules/home/apps/orbstack.nix @@ -0,0 +1,13 @@ +{ lib, pkgs, config, ... }: +with lib; +let cfg = config.nyx.orbstack; +in { + options.nyx.orbstack = { enable = mkEnableOption "Orbstack "; }; + + config = mkIf (cfg.enable) { + + home.packages = [ pkgs.orbstack ]; + + }; + +} diff --git a/modules/home/default.nix b/modules/home/default.nix index c02630b..9062b73 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -1,6 +1,7 @@ { imports = [ + ./apps ./tools ./prompts ./shells diff --git a/modules/home/shells/zsh/default.nix b/modules/home/shells/zsh/default.nix index ebdbdd6..75fed00 100644 --- a/modules/home/shells/zsh/default.nix +++ b/modules/home/shells/zsh/default.nix @@ -55,6 +55,8 @@ in { eval "$(zoxide init zsh)" # eval "$(starship init zsh)" + # + eval "$(/opt/homebrew/bin/brew shellenv)" function y() { local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" @@ -83,10 +85,11 @@ in { export PATH="/Users/suri/.cargo/bin:$PATH" if [ "$TERM_PROGRAM" != "Apple_Terminal" ]; then - # eval "$(oh-my-posh init zsh --config $(brew --prefix oh-my-posh)/themes/di4am0nd.omp.json)" - # eval "$(oh-my-posh init zsh --config $(brew --prefix oh-my-posh)/themes/pure.omp.json)" - eval "$(oh-my-posh init zsh --config ~/.config/oh-my-posh/theme.toml)" - fi + # WE USE ${pkgs.oh-my-posh} HERE + # This ensures we use the exact binary installed by Nix + eval "$(${pkgs.oh-my-posh}/bin/oh-my-posh init zsh --config ${config.home.homeDirectory}/.config/oh-my-posh/theme.toml)" + fi + ''; }; diff --git a/modules/home/term/ghostty/default.nix b/modules/home/term/ghostty/default.nix index 87795fe..f246c28 100644 --- a/modules/home/term/ghostty/default.nix +++ b/modules/home/term/ghostty/default.nix @@ -4,16 +4,12 @@ let cfg = config.nyx.ghostty; in { options.nyx.ghostty = { enable = mkEnableOption "Ghostty Terminal"; }; - config = mkIf (cfg.enable && pkgs.stdenv.isDarwin) { - home.packages = [ pkgs.ghostty-bin ]; - + config = mkIf (cfg.enable) { home.file = { - # REMEMBER to lift the config file out, and refacts this after kenric puts his config - # on the public internet, study and refactor my dotfiles! "${config.home.homeDirectory}/.config/ghostty".source = config.lib.file.mkOutOfStoreSymlink - "${config.home.homeDirectory}/Nyx/ghostty"; + "${config.home.homeDirectory}/Nyx/modules/home/term/ghostty/ghostty"; }; }; diff --git a/modules/home/term/ghostty/ghostty/config b/modules/home/term/ghostty/ghostty/config index 8ad8c6d..8801582 100644 --- a/modules/home/term/ghostty/ghostty/config +++ b/modules/home/term/ghostty/ghostty/config @@ -16,12 +16,6 @@ custom-shader = ./shaders/cursor_blaze.glsl # custom-shader = ./shaders/glow.glsl # custom-shader = ./shaders/tunnel.glsl - - - - - - # custom-shader-animation = always font-family = "" diff --git a/modules/home/tools/default.nix b/modules/home/tools/default.nix index 306494e..acd4316 100644 --- a/modules/home/tools/default.nix +++ b/modules/home/tools/default.nix @@ -1,18 +1,17 @@ { pkgs, lib, ... }: { - imports = [ ./helix ./zellij ]; + imports = [ ./helix ./zellij ./git.nix ./btop.nix ]; home.sessionVariables.LIBRARY_PATH = "${lib.makeLibraryPath [ pkgs.libiconv ]}\${LIBRARY_PATH:+:$LIBRARY_PATH}"; home.packages = with pkgs; [ + ripgrep + bat fastfetch - zoxide zstd coreutils-prefixed - lazygit - docker yazi fzf github-cli @@ -21,8 +20,6 @@ just typst tokei - ripgrep - bat ]; diff --git a/modules/home/tools/git.nix b/modules/home/tools/git.nix index eeeab5f..a9dfd53 100644 --- a/modules/home/tools/git.nix +++ b/modules/home/tools/git.nix @@ -1,4 +1,4 @@ -{ +{ pkgs, ... }: { programs.git = { enable = true; settings.user = { @@ -6,7 +6,7 @@ email = "suri312006@gmail.com"; }; - lfs = { enable = true; }; }; + home.packages = [ pkgs.lazygit ]; } diff --git a/modules/home/tools/helix/default.nix b/modules/home/tools/helix/default.nix index 433927f..30c9930 100644 --- a/modules/home/tools/helix/default.nix +++ b/modules/home/tools/helix/default.nix @@ -1,64 +1,40 @@ -{ pkgs, config, ... }: { +{ lib, pkgs, config, ... }: +with lib; +let cfg = config.nyx.helix; +in { - home.file.".config/helix/ignore".text = '' - !.notes/ - !.gitignore - !.gitmodules - !.github/ - !.devcontainer/ - !.env* - !.sqlx/ - !.cargo/ - !.config/ - !puzzles/* - !examples/* - !inputs/* - target/ - ''; + options.nyx.helix = { enable = mkEnableOption "Helix text editor"; }; - # ignore file - "${config.home.homeDirectory}/.config/helix/ignore".source = - config.lib.file.mkOutOfStoreSymLink - "${config.home.homeDirectory}/Nyx/modules/tools/helix/ignore"; + config = mkIf (cfg.enable) { - # theme file - "${config.home.homeDirectory}/.config/helix/nyx-theme.toml".source = - config.lib.file.mkOutOfStoreSymLink - "${config.home.homeDirectory}/Nyx/modules/tools/helix/nyx-theme.toml"; + # symlink files + home.file.".config/helix".source = config.lib.file.mkOutOfStoreSymlink + "${config.home.homeDirectory}/Nyx/modules/home/tools/helix/helix"; - # config.toml - "${config.home.homeDirectory}/.config/helix/config.toml".source = - config.lib.file.mkOutOfStoreSymLink - "${config.home.homeDirectory}/Nyx/modules/tools/helix/config.toml"; - - # languages.toml - "${config.home.homeDirectory}/.config/helix/languages.toml".source = - config.lib.file.mkOutOfStoreSymLink - "${config.home.homeDirectory}/Nyx/modules/tools/helix/languages.toml"; - - programs.helix = { - enable = true; - defaultEditor = true; - extraPackages = with pkgs; [ - # markdown-oxide - gopls - nil - texlab - taplo - lua-language-server - haskell-language-server - python312Packages.python-lsp-server - typescript-language-server - svelte-language-server - tailwindcss-language-server - tinymist - ltex-ls - nixd - nil - codebook - markdown-oxide - ruff - ]; + programs.helix = { + enable = true; + defaultEditor = true; + extraPackages = with pkgs; [ + # markdown-oxide + gopls + nil + texlab + taplo + lua-language-server + haskell-language-server + python312Packages.python-lsp-server + typescript-language-server + svelte-language-server + tailwindcss-language-server + tinymist + ltex-ls + nixd + nil + codebook + markdown-oxide + ruff + ]; + }; }; } diff --git a/modules/home/tools/helix/config.toml b/modules/home/tools/helix/helix/config.toml similarity index 97% rename from modules/home/tools/helix/config.toml rename to modules/home/tools/helix/helix/config.toml index 0142d63..c7a8159 100644 --- a/modules/home/tools/helix/config.toml +++ b/modules/home/tools/helix/helix/config.toml @@ -1,4 +1,4 @@ -theme = "theme-trans" +theme = "nyx" [editor] line-number = "relative" diff --git a/modules/home/tools/helix/ignore b/modules/home/tools/helix/helix/ignore similarity index 100% rename from modules/home/tools/helix/ignore rename to modules/home/tools/helix/helix/ignore diff --git a/modules/home/tools/helix/languages.toml b/modules/home/tools/helix/helix/languages.toml similarity index 100% rename from modules/home/tools/helix/languages.toml rename to modules/home/tools/helix/helix/languages.toml diff --git a/modules/home/tools/helix/theme.toml b/modules/home/tools/helix/helix/themes/nyx.toml similarity index 100% rename from modules/home/tools/helix/theme.toml rename to modules/home/tools/helix/helix/themes/nyx.toml diff --git a/modules/home/tools/zellij/default.nix b/modules/home/tools/zellij/default.nix index 6041a0d..ad85d50 100644 --- a/modules/home/tools/zellij/default.nix +++ b/modules/home/tools/zellij/default.nix @@ -1,30 +1,9 @@ -{ pkgs, ... }: -# let -# suri_zellij_session_helper = -# pkgs.writeShellScriptBin "suri_zellij_session_helper" '' - -# ZELLIJ_SESSIONS=$(zellij ls | sed 's/\x1b\[[0-9;]*m//g' | cut -d ' ' -f 1) -# NUM_SESSIONS=$(echo "''${ZELLIJ_SESSIONS}" | wc -l ) - -# if [ "''${NUM_SESSIONS}" -ge 1 ]; then -# SESSION="$(echo "''${ZELLIJ_SESSIONS}" | fzf)" - -# zellij a ''${SESSION} - -# else -# zellij attach -c -# fi - -# ''; -# in { - -# home = { -# packages = [ pkgs.zellij suri_zellij_session_helper ]; -# file.".config/zellij/config.kdl".source = ./config.kdl; -# }; -# } +{ lib, pkgs, config, ... }: +with lib; let + cfg = config.nyx.zellij; + suri_zellij_session_helper = pkgs.writeShellScriptBin "suri_zellij_session_helper" '' ZELLIJ_SESSIONS=$(${pkgs.zellij}/bin/zellij ls | sed 's/\x1b\[[0-9;]*m//g' | cut -d ' ' -f 1) @@ -37,8 +16,15 @@ let fi ''; in { - home = { - packages = [ pkgs.zellij pkgs.fzf suri_zellij_session_helper ]; - file.".config/zellij/config.kdl".source = ./config.kdl; + + options.nyx.zellij = { enable = mkEnableOption "Zellij"; }; + + config = mkIf (cfg.enable) { + home.file.".config/zellij/config.kdl".source = + config.lib.file.mkOutOfStoreSymlink + "${config.home.homeDirectory}/Nyx/modules/home/tools/zellij/config.kdl"; + home = { packages = [ pkgs.zellij pkgs.fzf suri_zellij_session_helper ]; }; + }; + } diff --git a/modules/home/wm/aerospace/aerospace.toml b/modules/home/wm/aerospace/aerospace.toml index 8badef9..2605e6f 100644 --- a/modules/home/wm/aerospace/aerospace.toml +++ b/modules/home/wm/aerospace/aerospace.toml @@ -309,7 +309,7 @@ automatically-unhide-macos-hidden-apps = false run = ['move-node-to-workspace 3'] [[on-window-detected]] - if.app-id = 'com.hnc.Discord' + if.window-title-regex-substring = 'Discord' run = ['move-node-to-workspace 7'] [[on-window-detected]] diff --git a/modules/home/wm/aerospace/default.nix b/modules/home/wm/aerospace/default.nix index 439a647..10473b3 100644 --- a/modules/home/wm/aerospace/default.nix +++ b/modules/home/wm/aerospace/default.nix @@ -5,12 +5,10 @@ in { options.nyx.aerospace = { enable = mkEnableOption "AeroSpace window manager"; }; - config = mkIf (cfg.enable && pkgs.stdenv.isDarwin) { home.packages = [ pkgs.aerospace ]; - "${config.home.homeDirectory}/.aerospace.toml".source = - + home.file.".aerospace.toml".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/Nyx/modules/home/wm/aerospace/aerospace.toml"; diff --git a/modules/system/fonts.nix b/modules/system/fonts.nix new file mode 100644 index 0000000..ec10327 --- /dev/null +++ b/modules/system/fonts.nix @@ -0,0 +1 @@ +{ pkgs, ... }: { fonts.packages = [ pkgs.monaspace ]; } diff --git a/users/suri/Daedalus.nix b/users/suri/Daedalus.nix index 68f9795..7b01016 100644 --- a/users/suri/Daedalus.nix +++ b/users/suri/Daedalus.nix @@ -1,10 +1,12 @@ { - imports = [ ./common.nix ../../modules/home/wm/aerospace ]; + imports = [ ./common.nix ]; nyx.aerospace.enable = true; nyx.ghostty.enable = true; - nyx.oh-my-posh.enable = true; - nyx.zsh.enable = true; + nyx.helix.enable = true; + nyx.zellij.enable = true; + nyx.orbstack.enable = true; + } diff --git a/users/suri/common.nix b/users/suri/common.nix index a186f38..4f4e267 100644 --- a/users/suri/common.nix +++ b/users/suri/common.nix @@ -1,22 +1,11 @@ -{ config, ... }: -let +{ ... }: +{ - OOS = path: config.lib.file.mkOutOfStoreSymlink path; + imports = [ ../../modules/home ]; -in { - - # imports = [ ./apps ]; - # - imports = [ - - ../../modules/home - - ../../modules/home/prompts/oh-my-posh - ../../modules/home/shells/zsh - ../../modules/home/term/ghostty - ../../modules/home/tools - - ]; + nyx.oh-my-posh.enable = true; + nyx.zsh.enable = true; + nyx.zellij.enable = true; programs.direnv = { enable = true; @@ -24,16 +13,7 @@ in { nix-direnv.enable = true; }; - home.file = { - # REMEMBER to lift the config file out, and refacts this after kenric puts his config - # on the public internet, study and refactor my dotfiles! - "Library/Application Support/com.mitchellh.ghostty".source = - OOS "${config.home.homeDirectory}/dev/dots/apps/ghostty"; - - }; - # The state version is required and should stay at the version you # originally installed. home.stateVersion = "25.05"; } -