{ inputs = { # Default to sane nixpkgs versions nixpkgs.url = "github:nixos/nixpkgs/release-24.11"; unstable.url = "nixpkgs"; nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin"; #lean4-flake = { # url = "github:leanprover/lean4/v4.4.0"; # inputs.nixpkgs.follows = "nixpkgs"; #}; darwin = { url = "github:lnl7/nix-darwin"; # ensure that darwinSystem uses our nixpkgs version inputs.nixpkgs.follows = "nixpkgs-darwin"; }; sheetsui-flake.url = "github:zaphar/sheetsui"; sile-flake.url = "github:sile-typesetter/sile"; durnitisp-flake.url = "github:zaphar/durnitisp"; runwhen-flake.url = "github:zaphar/runwhen"; agenix-flake.url = "github:ryantm/agenix"; nurl-flake.url = "github:nix-community/nurl"; nil-flake = { url = "github:oxalica/nil"; }; clio-flake = { url = "github:zaphar/clio"; inputs.nixpkgs.follows = "nixpkgs"; }; rust-overlay-flake = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; neovim-flake = { url = "github:neovim/neovim/stable?dir=contrib"; # NOTE(jeremy): Currently this needs a newer nixpkgs version #inputs.nixpkgs.follows = "nixpkgs"; }; jujutsu-flake.url = "github:martinvonz/jj"; custom-flakes = { url = "github:zaphar/nix-flakes"; inputs.nixpkgs.follows = "nixpkgs"; }; harpoon-src = { url = "github:ThePrimeagen/harpoon/harpoon2"; flake = false; }; neogit-src = { url = "github:NeogitOrg/neogit"; flake = false; }; d2-vim-src = { url = "github:terrastruct/d2-vim"; flake = false; }; # We need to pin to this version of treesitter because it breaks after this revision treesitter-context = { url = "github:nvim-treesitter/nvim-treesitter-context/e6b743ccd4e780bc9cd85b707de67df72eea1a23"; flake = false; }; roslyn-lsp = { url = "github:zaphar/roslyn.nvim/main"; flake = false; }; heracles-flake.url = "github:zaphar/Heracles"; mcphub-flake.url = "github:ravitemer/mcphub.nvim/v5.0.1"; }; outputs = { darwin, sile-flake, jujutsu-flake, runwhen-flake, durnitisp-flake, rust-overlay-flake, agenix-flake, nil-flake, nurl-flake, harpoon-src, custom-flakes, unstable, heracles-flake, neovim-flake, clio-flake, sheetsui-flake, mcphub-flake, ... # We don't use the self or nixpkgs args here so we just glob it. }: rec { vimModule = system: let nil-pkg = nil-flake.packages."${system}".default; mcp-hub-binary = custom-flakes.packages."${system}".mcp-hub; in { config, pkgs, ...}: let unstablePkgs = import unstable { inherit system; }; possession-nvim = pkgs.callPackage ./possession-nvim.nix { inherit (pkgs.vimUtils) buildVimPlugin; inherit (pkgs) fetchFromGitHub; }; harpoon-nvim = pkgs.vimUtils.buildVimPlugin { pname = "harpoon"; version = "2024-01-28"; src = harpoon-src; }; neogit-nvim = custom-flakes.packages."${system}".neogit-nvim; d2-vim = custom-flakes.packages."${system}".d2-vim; hunk-nvim = custom-flakes.packages."${system}".hunk-nvim; # TODO(zaphar): Apparently this is a remote plugin so it needs some additional love. #nvim-bnf = custom-flakes.packages."${system}".nvim-bnf; nvim-treesitter-context = custom-flakes.packages."${system}".nvim-treesitter-context; roslyn-nvim = custom-flakes.packages."${system}".roslyn-nvim; ionide-nvim = custom-flakes.packages."${system}".ionide-nvim; nvim = neovim-flake.packages."${system}".neovim; # TODO(zaphar): Until nixpkgs update to a newer version of tree-sitter the queries will be wrong # for csharp #tree-sitter-csharp = pkgs.callPackage ./nvim-treesitter-csharp.nix { # inherit (pkgs.neovimUtils) grammarToPlugin; # inherit (pkgs.tree-sitter) buildGrammar; # inherit (pkgs) fetchFromGitHub; #}; # TODO(jwall): When this actually builds we should use it. #nvim-treesitter-powershell = pkgs.callPackage ./nvim-powershell.nix { # inherit (pkgs.tree-sitter) buildGrammar; # inherit (pkgs) fetchFromGitHub; #}; mcphub-nvim = mcphub-flake.packages."${system}".default; in { imports = [ ./program-neovim.nix ]; config = { environment.variables = { EDITOR="nvim"; PAGER="less -R"; OMNISHARP_BIN = "${pkgs.omnisharp-roslyn}/bin/OmniSharp"; }; nixpkgs.overlays = [ (final: prev: { custom-neovim = nvim; lorri = unstablePkgs.lorri; avante-nvim = unstablePkgs.vimPlugins.avante-nvim; copilot-lua = unstablePkgs.vimPlugins.copilot-lua; }) ]; programs = with pkgs; { neovim.enable = true; neovim.vimAlias = true; neovim.viAlias = true; neovim.package = pkgs.custom-neovim; neovim.configure = { customRC = "lua << EOF ${builtins.readFile ./init.lua} EOF"; packages.myVimPackage = { start = (with pkgs.vimPlugins; [ copilot-lua avante-nvim vim-sile nvim-tree-lua nvim-lspconfig packer-nvim vim-ps1 vim-lsp vim-vsnip nvim-cmp cmp-nvim-lua cmp-nvim-lsp cmp-vsnip cmp-buffer cmp-path cmp-nvim-lsp-signature-help nvim-dap # Debug Adapter Protocol support #nvim-dap-ui hoon-vim nvim-treesitter lualine-nvim lualine-lsp-progress lean-nvim roslyn-nvim ionide-nvim # Fsharp lsp support nvim-treesitter-context nvim-treesitter-textobjects nvim-treesitter-parsers.ini nvim-treesitter-parsers.ebnf nvim-treesitter-parsers.rust nvim-treesitter-parsers.c #nvim-treesitter-parsers.c_sharp # currently broken for some reason nvim-treesitter-parsers.cpp nvim-treesitter-parsers.clojure nvim-treesitter-parsers.latex nvim-treesitter-parsers.terraform nvim-treesitter-parsers.hcl nvim-treesitter-parsers.yaml nvim-treesitter-parsers.lua nvim-treesitter-parsers.vim nvim-treesitter-parsers.go nvim-treesitter-parsers.toml nvim-treesitter-parsers.tlaplus nvim-treesitter-parsers.typescript nvim-treesitter-parsers.starlark nvim-treesitter-parsers.python nvim-treesitter-parsers.sql nvim-treesitter-parsers.javascript nvim-treesitter-parsers.ocaml nvim-treesitter-parsers.haskell nvim-treesitter-parsers.css nvim-treesitter-parsers.promql nvim-treesitter-parsers.nix nvim-treesitter-parsers.zig nvim-treesitter-parsers.hoon #omnisharp-extended-lsp-nvim #neotest-dotnet nix-develop-nvim trouble-nvim nightfox-nvim melange-nvim telescope-nvim telescope-lsp-handlers-nvim plenary-nvim vim-dadbod vim-dadbod-ui vim-dadbod-completion vim-dasht direnv-vim mcphub-nvim ]) ++ [ possession-nvim harpoon-nvim d2-vim hunk-nvim neogit-nvim # tree-sitter-csharp.neovim-plugin # Until nixpkgs updates their nvim-treesitter config the csharp queries will be broken ]; }; }; }; environment.systemPackages = (with pkgs; [ terraform-ls nodePackages.typescript-language-server nodePackages.jsdoc python312Packages.jedi-language-server # TODO find a version of the julia package that will install # on darwin and add it as an overlay nil-pkg lua-language-server rust-analyzer dasht direnv lorri devenv unstablePkgs.fq mcp-hub-binary ]); }; }; systemModule = system: let runwhen = runwhen-flake.defaultPackage."${system}"; durnitisp = durnitisp-flake.defaultPackage."${system}"; rust-overlay = rust-overlay-flake.overlays.default; sile = sile-flake.defaultPackage.${system}; jujutsu = jujutsu-flake.packages.${system}.jujutsu; age = agenix-flake.packages."${system}".default; nurl = nurl-flake.packages."${system}".default; clio = clio-flake.packages."${system}".default; unstablePkgs = import unstable { inherit system; }; sheetsui = sheetsui-flake.packages."${system}".default; #lean4Pkg = lean4-flake.defaultPackage."${system}"; in { config, pkgs, ... }: { imports = [ agenix-flake.nixosModules.default ./program-neovim.nix ]; config = { nixpkgs.overlays = [ (final: prev: { # This is needed because the ccache used by lean4Pkg is broken ccache = prev.ccache.override { doCheck = false; }; heracles = heracles-flake.packages."${system}".default; durnitisp = durnitisp; clio = clio; victoria-logs = pkgs.callPackage ../packages/victoria-logs.nix { }; podman = unstablePkgs.podman; podman-compose = unstablePkgs.podman-compose; sc-im = unstablePkgs.sc-im; gnumeric = prev.gnumeric.overrideAttrs(oldAttrs: { meta.broken = false; }); uv = unstablePkgs.uv; quint = (pkgs.callPackage ../packages/quint/default.nix {})."@informalsystems/quint"; quint-lsp = (pkgs.callPackage ../packages/quint/default.nix {})."@informalsystems/quint-language-server"; ollama = unstablePkgs.ollama; }) rust-overlay ]; # TODO(jwall): This is needed for terraform nixpkgs.config.allowUnfree = true; environment.etc."nvim.lua" = { source = ./init.lua; }; programs = { zsh = { enable = true; # default shell on catalina # This is a total hack but we don't want the default clobbering it which it does if it's an empty string or null promptInit = "#noop"; interactiveShellInit = (builtins.readFile ./zshrc); }; tmux = { enable = true; enableVim = true; extraConfig = (builtins.readFile ./tmux.conf); }; }; environment.systemPackages = (with pkgs; [ isabelle sheetsui lean4 quint quint-lsp terraform # TODO(jeremy): Replace with opentofu when that is an option. nomad oha nodejs gnumake # TODO(zaphar): find a version of the julia package that will install # on darwin and add it as an overlay uv emacs git mercurial curl wget jq trippy coreutils watch iterm2 go htop colima ghidra podman podman-compose qemu lima rlwrap docker-client google-cloud-sdk awscli2 alloy6 tlaplus jdk d2 plantuml-c4 nssTools nomad mkcert kubo #netcoredbg powershell # NOTE(jwall): I include these initially for nvim telescope ripgrep fd sc-im gnumeric wezterm wezterm.terminfo #ocaml #opam unstablePkgs.vector victoriametrics # TODO add sonic-pi here if it supports the arch unstablePkgs.dbeaver-bin postgresql unstablePkgs.ollama ]) #++ (with pkgs.ocamlPackages; [ # dune_3 # odoc # ocaml-lsp # merlin # utop #]) ++ [ sile runwhen durnitisp age nurl jujutsu ]; }; }; darwinConfigurations."jeremys-mbp" = darwin.lib.darwinSystem rec { system = "aarch64-darwin"; modules = [ (systemModule system) (vimModule system) ./modules/darwin-monitor.nix ./modules/victoria-logs.nix ./modules/vector.nix ./modules/lorri.nix ./modules/ollama.nix ./darwin-configuration.nix ]; }; }; }