2024-06-01 10:10:32 -04:00

364 lines
11 KiB
Nix

{
inputs = {
# Default to sane nixpkgs versions
nixpkgs.url = "github:nixos/nixpkgs/23.11";
unstable.url = "nixpkgs";
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.11-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";
};
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";
};
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";
};
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";
};
outputs = {
darwin,
sile-flake,
runwhen-flake,
durnitisp-flake,
rust-overlay-flake,
agenix-flake,
nil-flake,
nurl-flake,
harpoon-src,
neogit-src,
d2-vim-src,
treesitter-context,
roslyn-lsp,
#lean4-flake,
unstable,
heracles-flake,
neovim-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;
in
{ config, pkgs, ...}: let
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 = pkgs.vimUtils.buildVimPlugin {
pname = "neogit";
version = "2024-05-16";
src = neogit-src;
};
d2-vim = pkgs.vimUtils.buildVimPlugin {
pname = "d2-nvim";
version = "2024-01-28";
src = d2-vim-src;
};
nvim-treesitter-context = pkgs.vimUtils.buildVimPlugin {
name = "nvim-treesitter-context";
src = treesitter-context;
};
roslyn-nvim = pkgs.vimUtils.buildVimPlugin {
name = "roslyn-nvim";
src = roslyn-lsp;
};
nvim = neovim-flake.packages."${system}".neovim;
# 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;
#};
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;
})
];
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; [
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
#neogit
hoon-vim
nvim-treesitter
lean-nvim
roslyn-nvim
nvim-treesitter-context
nvim-treesitter-textobjects
nvim-treesitter-parsers.ini
nvim-treesitter-parsers.rust
nvim-treesitter-parsers.c
nvim-treesitter-parsers.c_sharp
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.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
]) ++ [ possession-nvim harpoon-nvim d2-vim neogit-nvim ];
};
};
};
environment.systemPackages = (with pkgs; [
terraform-ls
nodePackages.typescript-language-server
nodePackages.jsdoc
# 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
omnisharp-roslyn
dbeaver
]);
};
};
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};
age = agenix-flake.packages."${system}".default;
nurl = nurl-flake.packages."${system}".default;
unstablePkgs = import unstable { inherit system; };
#lean4Pkg = lean4-flake.defaultPackage."${system}";
in { config, pkgs, ... }: let
d2-lang = pkgs.callPackage ./d2.nix {};
in {
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;
})
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; [
# TODO(jwall): This appears to be broken due to: https://github.com/NixOS/nixpkgs/issues/166205
# Should be fixed by: https://github.com/NixOS/nixpkgs/pull/282624
#isabelle
# TODO(jwall): This appears to be broken due to: https://github.com/NixOS/nixpkgs/issues/166205
# Should be fixed by: https://github.com/NixOS/nixpkgs/pull/282624
(lean4.override { stdenv = stdenv.override { allowedRequisites = null; cc = llvmPackages_11.clang; }; })
terraform # TODO(jeremy): Replace with opentofu when that is an option.
consul
consul-template
nomad
oha
nodejs
gnumake
# TODO find a version of the julia package that will install
# on darwin and add it as an overlay
python310
python310Packages.pip
python310Packages.virtualenv
emacs
git
mercurial
curl
wget
jq
trippy
coreutils
watch
iterm2
go
htop
colima
ghidra
#podman-desktop # Broken on darwin right now with electron build issues.
# Note that podman expects qemu to be installed in order to use the podman machine setup.
qemu
lima
rlwrap
docker-client
google-cloud-sdk
awscli2
alloy6
tlaplus
jdk
d2-lang
plantuml-c4
nssTools
nomad
mkcert
kubo
#dotnet-sdk_7
#dotnet-sdk_8
#netcoredbg
powershell
unstablePkgs.ocaml
unstablePkgs.opam
unstablePkgs.ocamlformat
# TODO(jwall): I include these initially for nvim telescope
ripgrep
fd
# TODO add sonic-pi here if it supports the arch
])
++ (with pkgs.ocamlPackages; [
dune_3
odoc
ocaml-lsp
merlin
utop
])
++ [
sile
runwhen
durnitisp
age
nurl
];
};
};
darwinConfigurations."jeremys-mbp" = darwin.lib.darwinSystem rec {
system = "aarch64-darwin";
modules = [
(systemModule system)
(vimModule system)
./modules/darwin-monitor.nix
./modules/victoria-logs.nix
./darwin-configuration.nix
];
};
};
}