commit 8c320f1a9f0a55d407f06ce9172ca9eeadc58979 Author: sloane <git@sloanelybutsurely.com> Date: Fri Feb 14 17:00:49 2025 -0500 initial commit Includes setup for MBTA machine and user only diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..adf77e6 --- /dev/null +++ b/flake.lock @@ -0,0 +1,350 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1735644329, + "narHash": "sha256-tO3HrHriyLvipc4xr+Ewtdlo7wM1OjXNjlWRgmM7peY=", + "owner": "numtide", + "repo": "devshell", + "rev": "f7795ede5b02664b57035b3b757876703e2c3eac", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-compat": { + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "revCount": 69, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.1.0/01948eb7-9cba-704f-bbf3-3fa956735b52/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1738453229, + "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "nixvim", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1737465171, + "narHash": "sha256-R10v2hoJRLq8jcL4syVFag7nIGE7m13qO48wRIukWNg=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "9364dc02281ce2d37a1f55b6e51f7c0f65a75f17", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1739470101, + "narHash": "sha256-NxNe32VB4XI/xIXrsKmIfrcgtEx5r/5s52pL3CpEcA4=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "5031c6d2978109336637977c165f82aa49fa16a7", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1738878603, + "narHash": "sha256-fmhq8B3MvQLawLbMO+LWLcdC2ftLMmwSk+P29icJ3tE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "433799271274c9f2ab520a49527ebfe2992dcfbd", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "ixx": { + "inputs": { + "flake-utils": [ + "nixvim", + "nuschtosSearch", + "flake-utils" + ], + "nixpkgs": [ + "nixvim", + "nuschtosSearch", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729958008, + "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "ref": "v0.0.6", + "repo": "ixx", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1739302241, + "narHash": "sha256-NXQXFU6HOschZ+8ZKrNOlwlHelez8vPl+dCiUaJ82/U=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "a6746213b138fe7add88b19bafacd446de574ca7", + "type": "github" + }, + "original": { + "owner": "LnL7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "nix-darwin_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1738743987, + "narHash": "sha256-O3bnAfsObto6l2tQOmQlrO6Z2kD6yKwOWfs7pA0CpOc=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "ae406c04577ff9a64087018c79b4fdc02468c87c", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1739138025, + "narHash": "sha256-M4ilIfGxzbBZuURokv24aqJTbdjPA9K+DtKUzrJaES4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b2243f41e860ac85c0b446eadc6930359b294e79", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "git-hooks": "git-hooks", + "home-manager": "home-manager_2", + "nix-darwin": "nix-darwin_2", + "nixpkgs": [ + "nixpkgs" + ], + "nuschtosSearch": "nuschtosSearch", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1739527837, + "narHash": "sha256-dsb5iSthp5zCWhdV0aXPunFSCkS0pCvRXMMgTEFjzew=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "a39e0a651657046f3b936d842147fa51523b6818", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "nuschtosSearch": { + "inputs": { + "flake-utils": "flake-utils", + "ixx": "ixx", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1738508923, + "narHash": "sha256-4DaDrQDAIxlWhTjH6h/+xfG05jt3qDZrZE/7zDLQaS4=", + "owner": "NuschtOS", + "repo": "search", + "rev": "86e2038290859006e05ca7201425ea5b5de4aecb", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs", + "nixvim": "nixvim" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1738680491, + "narHash": "sha256-8X7tR3kFGkE7WEF5EXVkt4apgaN85oHZdoTGutCFs6I=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "64dbb922d51a42c0ced6a7668ca008dded61c483", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e082e12 --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +{ + description = "Example nix-darwin system flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + nix-darwin.url = "github:LnL7/nix-darwin/master"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows ="nixpkgs"; + nixvim.url = "github:nix-community/nixvim"; + nixvim.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager, nixvim }: + { + # Build darwin flake using: + # $ darwin-rebuild build --flake .#tid27880sperrau + darwinConfigurations."tid27880sperrau" = nix-darwin.lib.darwinSystem { + modules = [ + { + system.configurationRevision = self.rev or self.dirtyRev or null; + } + ./nix-darwin + home-manager.darwinModules.home-manager + { + users.users.sperrault.home = "/Users/sperrault"; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "before-home-manager"; + extraSpecialArgs = { + inherit nixvim; + }; + users.sperrault = import ./home-manager; + }; + } + ]; + }; + }; +} diff --git a/home-manager/default.nix b/home-manager/default.nix new file mode 100644 index 0000000..b41c492 --- /dev/null +++ b/home-manager/default.nix @@ -0,0 +1,243 @@ +{ pkgs, nixvim, ... }: +{ + imports = [ + nixvim.homeManagerModules.nixvim + ]; + + home = { + username = "sperrault"; + homeDirectory = "/Users/sperrault"; + stateVersion = "24.11"; + + sessionVariables = { + SSH_AUTH_SOCK = "$HOME/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"; + }; + + packages = with pkgs; [ + watchman + difftastic + ]; + }; + + programs.fish = { + enable = true; + interactiveShellInit = '' + fish_vi_key_bindings + ''; + shellAbbrs = { + j = "jj"; + }; + }; + + programs.zoxide = { + enable = true; + enableFishIntegration = true; + }; + + programs.direnv.enable = true; + + programs.mise = { + enable = true; + enableFishIntegration = true; + }; + + programs.nixvim = { + enable = true; + + globals = { + mapleader = " "; + }; + + globalOpts = { + number = true; + relativenumber = true; + shiftwidth = 2; + expandtab = true; + tabstop = 2; + }; + + colorschemes.catppuccin.enable = true; + + keymaps = [ + { + key = ";"; + action = ":"; + mode = ["n" "v"]; + } + { + key = "<leader>y"; + action = ''"+y''; + mode = ["n" "v"]; + } + { + key = "<leader>Y"; + action = ''"+Y''; + mode = ["n" "v"]; + } + { + key = "<leader>p"; + action = ''"+p''; + mode = ["n" "v"]; + } + { + key = "<leader>P"; + action = ''"+P''; + mode = ["n" "v"]; + } + { + key = "<leader>w"; + action = "<cmd>w<cr>"; + mode = ["n"]; + } + { + key = "<leader>q"; + action = "<cmd>q<cr>"; + mode = ["n"]; + } + { + key = "<esc>"; + action = "<cmd>nohlsearch<cr>"; + mode = ["n"]; + } + { + key = ''<leader>"''; + action = "<cmd>split<cr>"; + mode = ["n"]; + } + { + key = "<leader>%"; + action = "<cmd>vsplit<cr>"; + mode = ["n"]; + } + { + key = "<leader><tab>"; + action = "<cmd>NERDTreeToggle<cr>"; + mode = ["n"]; + } + { + key = "<leader>fl"; + action = "<cmd>NERDTreeFind<cr>"; + mode = ["n"]; + } + { + key = "<leader><space>"; + action = "<cmd>Telescope find_files theme=dropdown<cr>"; + mode = ["n"]; + } + { + key = "<leader>/"; + action = "<cmd>Telescope live_grep<cr>"; + mode = ["n"]; + } + ]; + + extraPlugins = with pkgs.vimPlugins; [ + vim-abolish + nerdtree + vim-rhubarb + ]; + + plugins.commentary.enable = true; + plugins.repeat.enable = true; + plugins.fugitive.enable = true; + + plugins.nvim-autopairs.enable = true; + plugins.nvim-surround.enable = true; + + plugins.web-devicons.enable = true; + + plugins.treesitter = { + enable = true; + settings.indent.enable = true; + settings.highlight.enable = true; + grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ + bash + json + lua + markdown + nix + toml + vim + yaml + elixir + javascript + typescript + css + html + ]; + }; + + plugins.lsp = { + enable = true; + servers = { + elixirls.enable = true; + fish_lsp.enable = true; + html.enable = true; + nixd.enable = true; + tailwindcss.enable = true; + terraform_lsp.enable = true; + }; + }; + + plugins.telescope.enable = true; + + plugins.cmp = { + enable = true; + autoEnableSources = true; + settings.sources = [ + { name = "nvim_lsp"; } + { name = "luasnip"; } + { name = "path"; } + { name = "buffer"; } + ]; + }; + }; + + programs.zellij = { + enable = true; + enableFishIntegration = false; + }; + + programs.ssh = { + enable = true; + matchBlocks = { + "*" = { + extraOptions.IdentityAgent = ''"~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"''; + }; + }; + }; + + programs.jujutsu = { + enable = true; + settings = { + core.fsmonitor = "watchman"; + user = { + name = "sloane"; + email = "git@sloanelybutsurely.com"; + }; + signing = { + sign-all = true; + backend = "ssh"; + key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID0TH2GezEx8+zlKBqUb7rBsbmghnd1u4nX6YpQr28Zw"; + backends.ssh.program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"; + }; + ui = { + paginate = "never"; + default-command = "log"; + editor = "nvim"; + diff.tool = ["difft" "--color=always" "$left" "$right"]; + }; + revsets.log = "trunk() | ancestors(reachable(@ | mine(), mutable()), 2) | @"; + git = { + push-bookmark-prefix = "sloane/push-"; + private-commits = "wip | nocommit | dev-only"; + }; + revset-aliases = { + wip = ''description(regex:"^\\[(wip|WIP|todo|TODO)\\]|(wip|WIP|todo|TODO):?")''; + nocommit = ''description(regex:"^\\[(nocommit|NOCOMMIT)\\]|(nocommit|NOCOMMIT):?")''; + dev-only = ''description(regex:"^\\[(dev-only|DEV-ONLY)\\]|(dev-only|DEV-ONLY):?")''; + current = ''(bookmarks() | wip | dev-only) & mine()''; + }; + }; + }; +} diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix new file mode 100644 index 0000000..7c3c22d --- /dev/null +++ b/nix-darwin/default.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: +{ + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = []; + + # Necessary for using flakes on this system. + nix.settings.experimental-features = "nix-command flakes"; + + # Enable alternative shell support in nix-darwin. + # programs.fish.enable = true; + + # Set Git commit hash for darwin-version. + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 6; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = "aarch64-darwin"; + + environment.shells = [ pkgs.fish ]; + programs.fish.enable = true; +}