diff --git a/flake.nix b/flake.nix index 0ac7c2b..5910e50 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,9 @@ nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz"; devenv = { url = "github:cachix/devenv"; - inputs = {nixpkgs.follows = "nixpkgs";}; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; }; }; @@ -12,39 +14,52 @@ extra-substituters = "https://devenv.cachix.org"; }; - outputs = { - nixpkgs, - devenv, - systems, - ... - } @ inputs: let - forEachSystem = nixpkgs.lib.genAttrs (import systems); - in { - formatter = forEachSystem (system: nixpkgs.legacyPackages.${system}.alejandra); - devShells = - forEachSystem - (system: let - pkgs = nixpkgs.legacyPackages.${system}; - in { - default = devenv.lib.mkShell { - inherit inputs pkgs; - modules = [ - { - # https://devenv.sh/reference/options/ - packages = [pkgs.hello pkgs.delta pkgs.difftastic pkgs.alejandra pkgs.nodePackages.bash-language-server pkgs.shellcheck pkgs.shfmt]; + outputs = + { + nixpkgs, + devenv, + systems, + ... + }@inputs: + let + forEachSystem = nixpkgs.lib.genAttrs (import systems); + in + { + formatter = forEachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); + devShells = forEachSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + default = devenv.lib.mkShell { + inherit inputs pkgs; + modules = [ + { + # https://devenv.sh/reference/options/ + packages = [ + pkgs.hello + pkgs.delta + pkgs.difftastic + pkgs.alejandra + pkgs.nodePackages.bash-language-server + pkgs.shellcheck + pkgs.shfmt + ]; - pre-commit.hooks = { - alejandra.enable = true; - black.enable = true; - deadnix.enable = true; - stylua.enable = true; - shellcheck.enable = true; - shfmt.enable = true; - taplo.enable = true; - }; - } - ]; - }; - }); - }; + pre-commit.hooks = { + nixfmt-rfc-style.enable = true; + black.enable = true; + deadnix.enable = true; + stylua.enable = true; + shellcheck.enable = true; + shfmt.enable = true; + taplo.enable = true; + }; + } + ]; + }; + } + ); + }; } diff --git a/nix/home-manager/flake.nix b/nix/home-manager/flake.nix index dee25f7..1737970 100644 --- a/nix/home-manager/flake.nix +++ b/nix/home-manager/flake.nix @@ -16,7 +16,9 @@ inputs = { # Specify the source of Home Manager and Nixpkgs. - nixpkgs = {url = "github:nixos/nixpkgs";}; + nixpkgs = { + url = "github:nixos/nixpkgs"; + }; flake-utils.url = "github:numtide/flake-utils"; # not directly used, but common source for the several flakes that do use it home-manager = { url = "github:nix-community/home-manager"; @@ -59,26 +61,33 @@ }; }; - outputs = { - self, - nixpkgs, - home-manager, - nix-index-database, - nixvim, - fenix, - # wezterm, - nixneovimplugins, - ghostty, - ... - }: let - supportedSystems = ["aarch64-darwin" "x86_64-linux"]; - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + outputs = + { + self, + nixpkgs, + home-manager, + nix-index-database, + nixvim, + fenix, + # wezterm, + nixneovimplugins, + ghostty, + ... + }: + let + supportedSystems = [ + "aarch64-darwin" + "x86_64-linux" + ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - pkgs = forAllSystems ( - system: + pkgs = forAllSystems ( + system: import nixpkgs { inherit system; - config = {allowUnfree = true;}; + config = { + allowUnfree = true; + }; overlays = [ ghostty.overlays.default # (_final: prev: { @@ -95,10 +104,9 @@ fenix.overlays.default ]; } - ); + ); - homeManagerConfigs = forAllSystems ( - system: { + homeManagerConfigs = forAllSystems (system: { pkgs = pkgs.${system}; modules = [ { @@ -109,14 +117,18 @@ nix-index-database.hmModules.nix-index ./home.nix ]; - } - ); - in { - formatter = forAllSystems (system: pkgs.${system}.alejandra); - homeConfigurations.aarch64-darwin-acicchetti = home-manager.lib.homeManagerConfiguration homeManagerConfigs."aarch64-darwin"; - homeConfigurations.x86_64-linux-acicchetti = home-manager.lib.homeManagerConfiguration homeManagerConfigs."x86_64-linux"; + }); + in + { + formatter = forAllSystems (system: pkgs.${system}.nixfmt-rfc-style); + homeConfigurations.aarch64-darwin-acicchetti = + home-manager.lib.homeManagerConfiguration + homeManagerConfigs."aarch64-darwin"; + homeConfigurations.x86_64-linux-acicchetti = + home-manager.lib.homeManagerConfiguration + homeManagerConfigs."x86_64-linux"; - defaultPackage.aarch64-darwin = self.homeConfigurations.aarch64-darwin-acicchetti.activationPackage; - defaultPackage.x86_64-linux = self.homeConfigurations.x86_64-linux-acicchetti.activationPackage; - }; + defaultPackage.aarch64-darwin = self.homeConfigurations.aarch64-darwin-acicchetti.activationPackage; + defaultPackage.x86_64-linux = self.homeConfigurations.x86_64-linux-acicchetti.activationPackage; + }; } diff --git a/nix/home-manager/home.nix b/nix/home-manager/home.nix index 7cf3fa5..845debf 100644 --- a/nix/home-manager/home.nix +++ b/nix/home-manager/home.nix @@ -1,13 +1,12 @@ -{pkgs, ...}: let +{ pkgs, ... }: +let inherit (pkgs.stdenv.hostPlatform) isDarwin; -in { +in +{ home = { username = "acicchetti"; - homeDirectory = - if isDarwin - then "/Users/acicchetti" - else "/home/acicchetti"; + homeDirectory = if isDarwin then "/Users/acicchetti" else "/home/acicchetti"; stateVersion = "24.11"; @@ -100,7 +99,18 @@ in { enable = true; settings = { misc = { - disable = ["node" "nix" "home_manager" "gem" "ruby_gems" "cargo" "vim" "pipx" "pip3" "containers"]; + disable = [ + "node" + "nix" + "home_manager" + "gem" + "ruby_gems" + "cargo" + "vim" + "pipx" + "pip3" + "containers" + ]; run_in_tmux = true; display_time = true; skip_notify = true; diff --git a/nix/home-manager/modules/environment.nix b/nix/home-manager/modules/environment.nix index 324c61a..cddd3d0 100644 --- a/nix/home-manager/modules/environment.nix +++ b/nix/home-manager/modules/environment.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ home.sessionVariables = { EDITOR = "nvim"; PAGE = "page -q 90000 -z 90000"; diff --git a/nix/home-manager/modules/files.nix b/nix/home-manager/modules/files.nix index c8b0ce7..f443c17 100644 --- a/nix/home-manager/modules/files.nix +++ b/nix/home-manager/modules/files.nix @@ -2,19 +2,21 @@ pkgs, config, ... -}: let +}: +let inherit (pkgs.stdenv.hostPlatform) isLinux; repo_root = "../../.."; - nv_fonts_basic = ["TX-02-BerkeleyAC" "Maple Mono NF" "Departure Mono" "Fantasque Sans Mono"]; + nv_fonts_basic = [ + "TX-02-BerkeleyAC" + "Maple Mono NF" + "Departure Mono" + "Fantasque Sans Mono" + ]; nv_fonts_normal = - nv_fonts_basic - ++ ( - if isLinux - then ["Noto Color Emoji"] - else ["Apple Color Emoji"] - ); - nv_fonts_italic = ["Dank Mono"] ++ nv_fonts_basic; -in { + nv_fonts_basic ++ (if isLinux then [ "Noto Color Emoji" ] else [ "Apple Color Emoji" ]); + nv_fonts_italic = [ "Dank Mono" ] ++ nv_fonts_basic; +in +{ home.file = { "/.zsh.d/" = { source = ./${repo_root}/zsh/funcs; @@ -23,7 +25,7 @@ in { text = ""; recursive = true; }; - ".cargo/config.toml".source = (pkgs.formats.toml {}).generate "cargo-config" { + ".cargo/config.toml".source = (pkgs.formats.toml { }).generate "cargo-config" { net = { git-fetch-with-cli = true; }; @@ -34,7 +36,10 @@ in { # Could avoid setting this at all with another `isLinux` but whatever, doesn't truly matter "target.x86_64-unknown-linux-gnu" = { linker = "clang"; - rustflags = ["-C" "link-arg=-fuse-ld=${config.home.profileDirectory}/bin/mold"]; + rustflags = [ + "-C" + "link-arg=-fuse-ld=${config.home.profileDirectory}/bin/mold" + ]; }; "registries.crates-io" = { protocol = "sparse"; @@ -75,7 +80,7 @@ in { "ghostty/config".source = ./${repo_root}/ghostty/config; "kitty/kitty.conf".source = ./${repo_root}/kitty/kitty.conf; "lsd/config.yaml".source = ./${repo_root}/lsd/config.yaml; - "neovide/config.toml".source = (pkgs.formats.toml {}).generate "neovide-config" { + "neovide/config.toml".source = (pkgs.formats.toml { }).generate "neovide-config" { font = { normal = nv_fonts_normal; italic = nv_fonts_italic; diff --git a/nix/home-manager/modules/packages/default.nix b/nix/home-manager/modules/packages/default.nix index 9b487bd..0b3e273 100644 --- a/nix/home-manager/modules/packages/default.nix +++ b/nix/home-manager/modules/packages/default.nix @@ -1,16 +1,35 @@ -{pkgs, ...}: let +{ pkgs, ... }: +let inherit (pkgs.stdenv.hostPlatform) isLinux; - systemSpecificPackages = with pkgs; - if isLinux + systemSpecificPackages = + with pkgs; + if + isLinux # ncdu (well, all zig packages) don't work on macOS nix right now - then [zsh racket mold ncdu ghostty] - else [keka colima neovide aerospace]; - cy = { - pkgs, - fetchFromGitHub, - }: let - ver = "1.3.1"; - in + then + [ + zsh + racket + mold + ncdu + ghostty + xorg.libX11 + ] + else + [ + keka + colima + neovide + aerospace + ]; + cy = + { + pkgs, + fetchFromGitHub, + }: + let + ver = "1.3.1"; + in pkgs.buildGoModule { pname = "cy"; version = "${ver}"; @@ -37,7 +56,8 @@ runHook postInstall ''; }; -in { +in +{ imports = [ ./git.nix ./mise.nix @@ -48,7 +68,8 @@ in { ./zsh.nix # ./cy.nix ]; - home.packages = with pkgs; + home.packages = + with pkgs; [ _1password-cli nerd-fonts._0xproto @@ -57,7 +78,6 @@ in { cargo-workspaces clipboard-jh curl - (callPackage cy {}) departure-mono docker-client dogedns @@ -66,7 +86,13 @@ in { emacs fantasque-sans-mono fd - (fenix.latest.withComponents ["cargo" "clippy" "rustfmt" "rust-src" "rustc"]) + (fenix.latest.withComponents [ + "cargo" + "clippy" + "rustfmt" + "rust-src" + "rustc" + ]) ffmpeg_6 gawkInteractive gnugrep @@ -104,5 +130,13 @@ in { zenith zstd ] - ++ systemSpecificPackages; + ++ systemSpecificPackages + ++ ( + if isLinux then + [ ] + else + [ + (callPackage cy { }) + ] + ); } diff --git a/nix/home-manager/modules/packages/emacs.nix b/nix/home-manager/modules/packages/emacs.nix index 04b5e4c..b858838 100644 --- a/nix/home-manager/modules/packages/emacs.nix +++ b/nix/home-manager/modules/packages/emacs.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ home.file = { ".doom.d/init.el".source = ../../../../emacs/emacs.doom/init.el; ".doom.d/config.el".source = ../../../../emacs/emacs.doom/config.el; diff --git a/nix/home-manager/modules/packages/git.nix b/nix/home-manager/modules/packages/git.nix index 4423b3e..f4f3321 100644 --- a/nix/home-manager/modules/packages/git.nix +++ b/nix/home-manager/modules/packages/git.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ programs.git = { enable = true; # Don't use difftastic on git-diff by default @@ -104,7 +105,7 @@ }; includes = [ - {path = "~/.gitconfig_local";} + { path = "~/.gitconfig_local"; } ]; }; } diff --git a/nix/home-manager/modules/packages/mise.nix b/nix/home-manager/modules/packages/mise.nix index 083a30c..99e94ce 100644 --- a/nix/home-manager/modules/packages/mise.nix +++ b/nix/home-manager/modules/packages/mise.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.mise = { enable = true; enableZshIntegration = true; diff --git a/nix/home-manager/modules/packages/neovim.nix b/nix/home-manager/modules/packages/neovim.nix index 2e21c6b..df133f7 100644 --- a/nix/home-manager/modules/packages/neovim.nix +++ b/nix/home-manager/modules/packages/neovim.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ programs.nixvim = { enable = true; defaultEditor = true; @@ -41,10 +42,16 @@ }; } ]; - lualine_b = ["filename" "branch"]; - lualine_c = ["%="]; - lualine_x = []; - lualine_y = ["filetype" "progress"]; + lualine_b = [ + "filename" + "branch" + ]; + lualine_c = [ "%=" ]; + lualine_x = [ ]; + lualine_y = [ + "filetype" + "progress" + ]; lualine_z = [ { __unkeyed-1 = "location"; @@ -65,23 +72,27 @@ }; lsp = { enable = true; - preConfig = '' - ''; + preConfig = ''''; servers = { bashls.enable = true; gopls.enable = true; jsonls.enable = true; pyright.enable = true; # In preference to attempting to use pylyzer nil_ls.enable = true; - rust_analyzer = let - fenix = fenix.latest.withComponents ["cargo" "rustc"]; - in { - enable = true; - installCargo = false; - installRustc = false; - cargoPackage = fenix.cargo; - rustcPackage = fenix.rustc; - }; + rust_analyzer = + let + fenix = fenix.latest.withComponents [ + "cargo" + "rustc" + ]; + in + { + enable = true; + installCargo = false; + installRustc = false; + cargoPackage = fenix.cargo; + rustcPackage = fenix.rustc; + }; taplo.enable = true; terraformls.enable = true; yamlls.enable = true; @@ -125,12 +136,12 @@ } ]; clues = [ - {__raw = "require('mini.clue').gen_clues.builtin_completion()";} - {__raw = "require('mini.clue').gen_clues.g()";} - {__raw = "require('mini.clue').gen_clues.marks()";} - {__raw = "require('mini.clue').gen_clues.registers()";} - {__raw = "require('mini.clue').gen_clues.windows()";} - {__raw = "require('mini.clue').gen_clues.z()";} + { __raw = "require('mini.clue').gen_clues.builtin_completion()"; } + { __raw = "require('mini.clue').gen_clues.g()"; } + { __raw = "require('mini.clue').gen_clues.marks()"; } + { __raw = "require('mini.clue').gen_clues.registers()"; } + { __raw = "require('mini.clue').gen_clues.windows()"; } + { __raw = "require('mini.clue').gen_clues.z()"; } ]; }; }; @@ -175,14 +186,17 @@ project-nvim = { enable = true; enableTelescope = true; - settings.detection_methods = ["lsp" "pattern"]; + settings.detection_methods = [ + "lsp" + "pattern" + ]; }; telescope = { enable = true; enabledExtensions = [ - "zf-native" #TODO - "projects" #TODO - "egrepify" #TODO + "zf-native" # TODO + "projects" # TODO + "egrepify" # TODO ]; # extraLua = { # post = builtins.readFile ./neovim/telescope.lua; @@ -273,19 +287,17 @@ web-devicons.enable = true; }; extraPlugins = - ( - with pkgs.vimPlugins; [ - rainbow-delimiters-nvim - telescope-symbols-nvim - overseer-nvim - nvim-web-devicons - telescope-zf-native-nvim - vim-ReplaceWithRegister - vim-dispatch-neovim - vim-expand-region - nvim-ufo - ] - ) + (with pkgs.vimPlugins; [ + rainbow-delimiters-nvim + telescope-symbols-nvim + overseer-nvim + nvim-web-devicons + telescope-zf-native-nvim + vim-ReplaceWithRegister + vim-dispatch-neovim + vim-expand-region + nvim-ufo + ]) ++ (with pkgs.awesomeNeovimPlugins; [ linrongbin16-gitlinker-nvim officer-nvim @@ -321,12 +333,18 @@ { key = ""; action = ""; - mode = ["n" "v"]; + mode = [ + "n" + "v" + ]; } { key = ""; action = ""; - mode = ["n" "v"]; + mode = [ + "n" + "v" + ]; } { key = "n"; diff --git a/nix/home-manager/modules/packages/ssh.nix b/nix/home-manager/modules/packages/ssh.nix index 65e9654..766b9e6 100644 --- a/nix/home-manager/modules/packages/ssh.nix +++ b/nix/home-manager/modules/packages/ssh.nix @@ -2,22 +2,24 @@ config, pkgs, ... -}: let +}: +let inherit (pkgs.stdenv.hostPlatform) isDarwin; _1pass_socket = - if isDarwin - then "${config.home.homeDirectory}/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" - else "${config.home.homeDirectory}/.1password/agent.sock"; -in { + if isDarwin then + "${config.home.homeDirectory}/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" + else + "${config.home.homeDirectory}/.1password/agent.sock"; +in +{ programs.ssh = { enable = true; - includes = - if isDarwin - then ["${config.home.homeDirectory}/.colima/ssh_config"] - else []; + includes = if isDarwin then [ "${config.home.homeDirectory}/.colima/ssh_config" ] else [ ]; matchBlocks = { "10.*" = { - setEnv = {"TERM" = "xterm-256color";}; + setEnv = { + "TERM" = "xterm-256color"; + }; }; "acicchetti.dev" = { extraOptions = { diff --git a/nix/home-manager/modules/packages/starship.nix b/nix/home-manager/modules/packages/starship.nix index 3469f2f..d354bd5 100644 --- a/nix/home-manager/modules/packages/starship.nix +++ b/nix/home-manager/modules/packages/starship.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.starship = { enable = true; enableZshIntegration = true; @@ -58,12 +59,12 @@ ) ' ''; - detect_folders = [".jj"]; + detect_folders = [ ".jj" ]; symbol = "jj"; }; custom.jjstatus = { command = ''jj log -r@ -l1 --no-graph -T "" --stat | tail -n1 | sd "(\d+) files? changed, (\d+) insertions?\(\+\), (\d+) deletions?\(-\)" " $${1}m $${2}+ $${3}-" | sd " 0." ""''; - detect_folders = [".jj"]; + detect_folders = [ ".jj" ]; }; dart = { diff --git a/nix/home-manager/modules/packages/zellij.nix b/nix/home-manager/modules/packages/zellij.nix index 6ca49ab..e7cac41 100644 --- a/nix/home-manager/modules/packages/zellij.nix +++ b/nix/home-manager/modules/packages/zellij.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ programs.zellij = { enable = true; enableZshIntegration = false; # automatically sets up a session - I don't want this, I want manual control of my sessions diff --git a/nix/home-manager/modules/packages/zsh.nix b/nix/home-manager/modules/packages/zsh.nix index d976680..4a0ef0d 100644 --- a/nix/home-manager/modules/packages/zsh.nix +++ b/nix/home-manager/modules/packages/zsh.nix @@ -1,6 +1,8 @@ -{pkgs, ...}: let +{ pkgs, ... }: +let inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux; -in { +in +{ programs.zsh = { enable = true; initExtraFirst = '' @@ -15,18 +17,20 @@ in { initExtra = builtins.readFile ../../../../zsh/zshrc; antidote = { enable = true; - plugins = let - ohmyzsh-lib = "ohmyzsh/oh-my-zsh path:lib"; - ohmyzsh-plugin = "ohmyzsh/oh-my-zsh path:plugins"; - extraPlugins = - if isLinux - then [] - else if isDarwin - then [ - "${ohmyzsh-plugin}/brew" - ] - else []; - in + plugins = + let + ohmyzsh-lib = "ohmyzsh/oh-my-zsh path:lib"; + ohmyzsh-plugin = "ohmyzsh/oh-my-zsh path:plugins"; + extraPlugins = + if isLinux then + [ ] + else if isDarwin then + [ + "${ohmyzsh-plugin}/brew" + ] + else + [ ]; + in extraPlugins ++ [ "zdharma-continuum/fast-syntax-highlighting" @@ -82,19 +86,21 @@ in { AGE = "rage"; AGE_KEYPATH = "op://Jellyfish/age-key"; }; - shellAliases = let - platformSpecificAliases = - if isLinux - then { - cp = "cp --reflink=auto"; - } - else { - # exa = "eza -l --git"; - # ls = "exa"; - nv = "neovide --fork"; - }; - in - {zj = "zellij -l welcome";} // platformSpecificAliases; + shellAliases = + let + platformSpecificAliases = + if isLinux then + { + cp = "cp --reflink=auto"; + } + else + { + # exa = "eza -l --git"; + # ls = "exa"; + nv = "neovide --fork"; + }; + in + { zj = "zellij -l welcome"; } // platformSpecificAliases; }; programs.carapace = { enable = true; diff --git a/nix/home-manager/modules/services/default.nix b/nix/home-manager/modules/services/default.nix index 9fa6e2f..c8515ae 100644 --- a/nix/home-manager/modules/services/default.nix +++ b/nix/home-manager/modules/services/default.nix @@ -1,4 +1,5 @@ -{...}: { +{ ... }: +{ imports = [ ./git-sync.nix ]; diff --git a/nix/home-manager/modules/services/git-sync.nix b/nix/home-manager/modules/services/git-sync.nix index 291dc83..86667e9 100644 --- a/nix/home-manager/modules/services/git-sync.nix +++ b/nix/home-manager/modules/services/git-sync.nix @@ -1,4 +1,5 @@ -{config, ...}: { +{ config, ... }: +{ services.git-sync = { enable = true; repositories = {