dotfiles/flake.nix

441 lines
13 KiB
Nix
Raw Permalink Normal View History

2022-04-27 01:36:16 +00:00
{
description = "My system";
2022-05-08 20:02:13 +00:00
# Other flakes that we want to pull from
2022-04-27 01:36:16 +00:00
inputs = {
2022-05-08 20:02:13 +00:00
# Used for system packages
2022-04-27 01:36:16 +00:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2022-05-08 20:02:13 +00:00
# Used for caddy plugins
nixpkgs-caddy.url = "github:jpds/nixpkgs/caddy-external-plugins";
2022-06-12 21:46:26 +00:00
# Used for MacOS system config
darwin = {
url = "github:lnl7/nix-darwin/master";
2022-06-12 21:46:26 +00:00
inputs.nixpkgs.follows = "nixpkgs";
};
2022-07-08 01:31:00 +00:00
# Used for Windows Subsystem for Linux compatibility
2024-01-07 13:51:21 +00:00
wsl = {
url = "github:nix-community/NixOS-WSL";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-07-08 01:31:00 +00:00
# Used for user packages and dotfiles
2022-04-27 01:36:16 +00:00
home-manager = {
url = "github:nix-community/home-manager/master";
2024-04-14 12:08:57 +00:00
inputs.nixpkgs.follows = "nixpkgs"; # Use system packages list for their inputs
2022-04-27 01:36:16 +00:00
};
2022-05-08 20:02:13 +00:00
# Community packages; used for Firefox extensions
2022-05-07 18:24:00 +00:00
nur.url = "github:nix-community/nur";
2022-04-27 01:36:16 +00:00
# Use official Firefox binary for macOS
2023-07-05 20:23:19 +00:00
firefox-darwin = {
url = "github:bandithedoge/nixpkgs-firefox-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-06-19 00:22:05 +00:00
# Better App install management in macOS
mac-app-util = {
url = "github:hraban/mac-app-util";
inputs.nixpkgs.follows = "nixpkgs"; # Use system packages list for their inputs
2024-06-19 00:22:05 +00:00
};
# Manage disk format and partitioning
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# Wallpapers
wallpapers = {
url = "gitlab:exorcist365/wallpapers";
flake = false;
};
2022-09-20 04:01:45 +00:00
# Used to generate NixOS images for other platforms
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-11-27 19:29:45 +00:00
# Convert Nix to Neovim config
nix2vim = {
url = "github:gytis-ivaskevicius/nix2vim";
inputs.nixpkgs.follows = "nixpkgs";
};
# Neovim plugins
base16-nvim-src = {
url = "github:RRethy/base16-nvim";
flake = false;
};
2022-11-27 19:29:45 +00:00
nvim-lspconfig-src = {
# https://github.com/neovim/nvim-lspconfig/tags
2024-05-28 11:50:14 +00:00
url = "github:neovim/nvim-lspconfig/v0.1.8";
2022-11-27 19:29:45 +00:00
flake = false;
};
cmp-nvim-lsp-src = {
url = "github:hrsh7th/cmp-nvim-lsp";
flake = false;
};
baleia-nvim-src = {
2024-01-02 00:47:54 +00:00
# https://github.com/m00qek/baleia.nvim/tags
url = "github:m00qek/baleia.nvim";
flake = false;
};
2022-11-27 19:29:45 +00:00
nvim-treesitter-src = {
# https://github.com/nvim-treesitter/nvim-treesitter/tags
url = "github:nvim-treesitter/nvim-treesitter/master";
2022-11-27 19:29:45 +00:00
flake = false;
};
telescope-nvim-src = {
# https://github.com/nvim-telescope/telescope.nvim/releases
2024-05-28 11:50:14 +00:00
url = "github:nvim-telescope/telescope.nvim/0.1.8";
2022-11-27 19:29:45 +00:00
flake = false;
};
telescope-project-nvim-src = {
url = "github:nvim-telescope/telescope-project.nvim";
flake = false;
};
toggleterm-nvim-src = {
# https://github.com/akinsho/toggleterm.nvim/tags
2024-05-28 11:50:14 +00:00
url = "github:akinsho/toggleterm.nvim/v2.11.0";
2022-11-27 19:29:45 +00:00
flake = false;
};
bufferline-nvim-src = {
# https://github.com/akinsho/bufferline.nvim/releases
2024-05-28 11:50:14 +00:00
url = "github:akinsho/bufferline.nvim/v4.6.1";
2022-11-27 19:29:45 +00:00
flake = false;
};
nvim-tree-lua-src = {
url = "github:kyazdani42/nvim-tree.lua";
flake = false;
};
hmts-nvim-src = {
url = "github:calops/hmts.nvim";
flake = false;
};
fidget-nvim-src = {
2024-01-02 00:47:54 +00:00
# https://github.com/j-hui/fidget.nvim/tags
2024-05-28 11:50:14 +00:00
url = "github:j-hui/fidget.nvim/v1.4.5";
flake = false;
};
nvim-lint-src = {
url = "github:mfussenegger/nvim-lint";
flake = false;
};
2022-11-27 19:29:45 +00:00
# Tree-Sitter Grammars
tree-sitter-bash = {
url = "github:tree-sitter/tree-sitter-bash/master";
flake = false;
};
tree-sitter-python = {
url = "github:tree-sitter/tree-sitter-python/master";
flake = false;
};
tree-sitter-lua = {
url = "github:MunifTanjim/tree-sitter-lua/main";
flake = false;
};
tree-sitter-ini = {
url = "github:justinmk/tree-sitter-ini";
flake = false;
};
tree-sitter-puppet = {
url = "github:amaanq/tree-sitter-puppet";
flake = false;
};
tree-sitter-rasi = {
url = "github:Fymyte/tree-sitter-rasi";
flake = false;
};
tree-sitter-vimdoc = {
url = "github:neovim/tree-sitter-vimdoc";
flake = false;
};
# MPV Scripts
zenyd-mpv-scripts = {
url = "github:zenyd/mpv-scripts";
flake = false;
};
2024-02-04 15:33:33 +00:00
# Ren and rep - CLI find and replace
rep = {
url = "github:robenkleene/rep-grep";
flake = false;
};
ren = {
url = "github:robenkleene/ren-find";
flake = false;
};
# Nextcloud Apps
nextcloud-news = {
# https://github.com/nextcloud/news/releases
2024-04-14 12:08:57 +00:00
url = "https://github.com/nextcloud/news/releases/download/25.0.0-alpha3/news.tar.gz";
flake = false;
};
nextcloud-external = {
# https://github.com/nextcloud-releases/external/releases
2024-04-14 12:08:57 +00:00
url = "https://github.com/nextcloud-releases/external/releases/download/v5.3.1/external-v5.3.1.tar.gz";
flake = false;
};
nextcloud-cookbook = {
# https://github.com/christianlupus-nextcloud/cookbook-releases/releases/
2024-04-14 12:08:57 +00:00
url = "https://github.com/christianlupus-nextcloud/cookbook-releases/releases/download/v0.11.0/cookbook-0.11.0.tar.gz";
flake = false;
};
2024-01-21 02:12:57 +00:00
nextcloud-snappymail = {
# https://github.com/the-djmaze/snappymail/releases
# https://snappymail.eu/repository/nextcloud
2024-06-19 16:33:11 +00:00
url = "file+https://github.com/nmasur/snappymail-nextcloud/releases/download/v2.36.1/snappymail-2.36.1-nextcloud.tar.gz";
2024-01-21 02:12:57 +00:00
flake = false;
};
2022-04-27 01:36:16 +00:00
};
2024-04-14 12:08:57 +00:00
outputs =
{ nixpkgs, ... }@inputs:
2022-05-16 00:46:17 +00:00
2022-04-27 01:36:16 +00:00
let
2022-05-08 20:02:13 +00:00
# Global configuration for my systems
2024-04-14 12:08:57 +00:00
globals =
let
baseName = "masu.rs";
in
rec {
user = "noah";
fullName = "Noah Masur";
gitName = fullName;
gitEmail = "7386960+nmasur@users.noreply.github.com";
mail.server = "noahmasur.com";
mail.imapHost = "imap.purelymail.com";
mail.smtpHost = "smtp.purelymail.com";
dotfilesRepo = "https://github.com/nmasur/dotfiles";
hostnames = {
git = "git.${baseName}";
influxdb = "influxdb.${baseName}";
irc = "irc.${baseName}";
metrics = "metrics.${baseName}";
minecraft = "minecraft.${baseName}";
2024-05-09 19:07:51 +00:00
n8n = "n8n2.${baseName}";
2024-04-14 12:08:57 +00:00
prometheus = "prom.${baseName}";
paperless = "paper.${baseName}";
secrets = "vault.${baseName}";
stream = "stream.${baseName}";
content = "cloud.${baseName}";
books = "books.${baseName}";
download = "download.${baseName}";
transmission = "transmission.${baseName}";
};
2023-07-07 16:16:07 +00:00
};
2022-05-08 20:02:13 +00:00
# Common overlays to always use
overlays = [
inputs.nur.overlay
inputs.nix2vim.overlay
2023-02-21 01:00:54 +00:00
(import ./overlays/neovim-plugins.nix inputs)
(import ./overlays/calibre-web.nix)
(import ./overlays/disko.nix inputs)
2023-07-09 23:22:41 +00:00
(import ./overlays/tree-sitter.nix inputs)
(import ./overlays/mpv-scripts.nix inputs)
(import ./overlays/nextcloud-apps.nix inputs)
(import ./overlays/betterlockscreen.nix)
2023-12-17 00:32:44 +00:00
(import ./overlays/gh-collaborators.nix)
2024-02-04 15:33:33 +00:00
(import ./overlays/ren-rep.nix inputs)
];
2022-05-16 00:46:17 +00:00
# System types to support.
2024-04-14 12:08:57 +00:00
supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
2022-05-16 00:46:17 +00:00
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
2024-04-14 12:08:57 +00:00
in
rec {
2022-05-08 20:02:13 +00:00
# Contains my full system builds, including home-manager
# nixos-rebuild switch --flake .#tempest
nixosConfigurations = {
2024-03-24 17:16:20 +00:00
arrow = import ./hosts/arrow { inherit inputs globals overlays; };
2023-02-11 14:35:38 +00:00
tempest = import ./hosts/tempest { inherit inputs globals overlays; };
hydra = import ./hosts/hydra { inherit inputs globals overlays; };
flame = import ./hosts/flame { inherit inputs globals overlays; };
2023-02-18 15:24:54 +00:00
swan = import ./hosts/swan { inherit inputs globals overlays; };
2022-04-27 01:36:16 +00:00
};
2022-05-08 20:02:13 +00:00
# Contains my full Mac system builds, including home-manager
# darwin-rebuild switch --flake .#lookingglass
darwinConfigurations = {
2024-04-14 12:08:57 +00:00
lookingglass = import ./hosts/lookingglass { inherit inputs globals overlays; };
};
2023-07-05 20:23:19 +00:00
# For quickly applying home-manager settings with:
2023-02-11 14:35:38 +00:00
# home-manager switch --flake .#tempest
homeConfigurations = {
2024-04-14 12:08:57 +00:00
tempest = nixosConfigurations.tempest.config.home-manager.users.${globals.user}.home;
lookingglass = darwinConfigurations.lookingglass.config.home-manager.users."Noah.Masur".home;
2022-06-12 21:46:26 +00:00
};
# Disk formatting, only used once
2024-04-14 12:08:57 +00:00
diskoConfigurations = {
root = import ./disks/root.nix;
};
packages =
let
staff =
system:
import ./hosts/staff {
inherit
inputs
globals
overlays
system
;
};
neovim =
system:
let
pkgs = import nixpkgs { inherit system overlays; };
in
import ./modules/common/neovim/package {
inherit pkgs;
colors = (import ./colorscheme/gruvbox-dark).dark;
};
in
{
x86_64-linux.staff = staff "x86_64-linux";
2024-05-08 00:09:51 +00:00
x86_64-linux.arrow = inputs.nixos-generators.nixosGenerate rec {
2024-04-14 12:28:39 +00:00
system = "x86_64-linux";
format = "iso";
2024-05-08 00:09:51 +00:00
specialArgs = {
pkgs-caddy = import inputs.nixpkgs-caddy { inherit system; };
};
2024-04-14 12:28:39 +00:00
modules = import ./hosts/arrow/modules.nix { inherit inputs globals overlays; };
2024-03-24 17:16:20 +00:00
};
x86_64-linux.arrow-aws = inputs.nixos-generators.nixosGenerate rec {
2024-05-05 03:05:55 +00:00
system = "x86_64-linux";
format = "amazon";
specialArgs = {
pkgs-caddy = import inputs.nixpkgs-caddy { inherit system; };
};
2024-05-05 03:05:55 +00:00
modules = import ./hosts/arrow/modules.nix { inherit inputs globals overlays; } ++ [
(
{ ... }:
{
boot.kernelPackages = inputs.nixpkgs.legacyPackages.x86_64-linux.linuxKernel.packages.linux_6_6;
amazonImage.sizeMB = 16 * 1024;
permitRootLogin = "prohibit-password";
boot.loader.systemd-boot.enable = inputs.nixpkgs.lib.mkForce false;
boot.loader.efi.canTouchEfiVariables = inputs.nixpkgs.lib.mkForce false;
2024-05-06 20:18:28 +00:00
services.amazon-ssm-agent.enable = true;
2024-05-07 21:52:48 +00:00
users.users.ssm-user.extraGroups = [ "wheel" ];
2024-05-05 03:05:55 +00:00
}
)
];
};
2022-11-27 19:29:45 +00:00
2024-04-14 12:08:57 +00:00
# Package Neovim config into standalone package
x86_64-linux.neovim = neovim "x86_64-linux";
x86_64-darwin.neovim = neovim "x86_64-darwin";
aarch64-linux.neovim = neovim "aarch64-linux";
aarch64-darwin.neovim = neovim "aarch64-darwin";
};
2022-10-18 12:21:22 +00:00
# Programs that can be run by calling this flake
2024-04-14 12:08:57 +00:00
apps = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system overlays; };
in
import ./apps { inherit pkgs; }
);
2022-06-05 13:24:46 +00:00
# Development environments
2024-04-14 12:08:57 +00:00
devShells = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system overlays; };
in
{
2022-08-21 21:27:47 +00:00
# Used to run commands and edit files in this repo
2022-05-01 15:16:48 +00:00
default = pkgs.mkShell {
buildInputs = with pkgs; [
git
stylua
nixfmt-rfc-style
shfmt
shellcheck
];
2022-05-01 15:16:48 +00:00
};
}
);
checks = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system overlays; };
in
{
neovim =
pkgs.runCommand "neovim-check-health" { buildInputs = [ inputs.self.packages.${system}.neovim ]; }
''
mkdir -p $out
export HOME=$TMPDIR
nvim -c "checkhealth" -c "write $out/health.log" -c "quitall"
# Check for errors inside the health log
if $(grep "ERROR" $out/health.log); then
cat $out/health.log
exit 1
fi
'';
}
);
formatter = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system overlays; };
in
pkgs.nixfmt-rfc-style
);
2023-07-29 19:20:14 +00:00
2022-06-21 03:34:24 +00:00
# Templates for starting other projects quickly
2022-08-08 00:37:19 +00:00
templates = rec {
default = basic;
2022-08-07 18:52:00 +00:00
basic = {
path = ./templates/basic;
description = "Basic program template";
};
2022-06-21 03:34:24 +00:00
poetry = {
path = ./templates/poetry;
description = "Poetry template";
};
python = {
path = ./templates/python;
description = "Legacy Python template";
};
2022-07-04 23:17:58 +00:00
haskell = {
path = ./templates/haskell;
description = "Haskell template";
};
rust = {
path = ./templates/rust;
description = "Rust template";
};
2022-06-21 03:34:24 +00:00
};
2022-04-27 01:36:16 +00:00
};
}