dotfiles/flake.nix

256 lines
7.2 KiB
Nix
Raw Normal View History

2022-04-26 21:36:16 -04:00
{
description = "My system";
2022-05-08 16:02:13 -04:00
# Other flakes that we want to pull from
2022-04-26 21:36:16 -04:00
inputs = {
2022-05-08 16:02:13 -04:00
# Used for system packages
2022-04-26 21:36:16 -04:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2022-05-08 16:02:13 -04:00
2022-06-12 17:46:26 -04:00
# Used for MacOS system config
darwin = {
url = "github:/lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-07-08 01:31:00 +00:00
# Used for Windows Subsystem for Linux compatibility
wsl.url = "github:nix-community/NixOS-WSL";
# Used for user packages and dotfiles
2022-04-26 21:36:16 -04:00
home-manager = {
url = "github:nix-community/home-manager/master";
2022-05-08 16:02:13 -04:00
inputs.nixpkgs.follows =
"nixpkgs"; # Use system packages list where available
2022-04-26 21:36:16 -04:00
};
2022-05-08 16:02:13 -04:00
# Community packages; used for Firefox extensions
2022-05-07 14:24:00 -04:00
nur.url = "github:nix-community/nur";
2022-04-26 21:36:16 -04:00
# Use official Firefox binary for macOS
firefox-darwin.url = "github:bandithedoge/nixpkgs-firefox-darwin";
# 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 12:29:45 -07:00
# Convert Nix to Neovim config
nix2vim = {
url = "github:gytis-ivaskevicius/nix2vim";
inputs.nixpkgs.follows = "nixpkgs";
};
# Nix language server
nil.url = "github:oxalica/nil";
# Neovim plugins
nvim-lspconfig-src = {
url = "github:neovim/nvim-lspconfig";
flake = false;
};
cmp-nvim-lsp-src = {
url = "github:hrsh7th/cmp-nvim-lsp";
flake = false;
};
null-ls-nvim-src = {
url = "github:jose-elias-alvarez/null-ls.nvim";
flake = false;
};
Comment-nvim-src = {
url = "github:numToStr/Comment.nvim";
flake = false;
};
nvim-treesitter-src = {
url = "github:nvim-treesitter/nvim-treesitter/v0.8.5.2";
2022-11-27 12:29:45 -07:00
flake = false;
};
telescope-nvim-src = {
url = "github:nvim-telescope/telescope.nvim";
flake = false;
};
telescope-project-nvim-src = {
url = "github:nvim-telescope/telescope-project.nvim";
flake = false;
};
toggleterm-nvim-src = {
url = "github:akinsho/toggleterm.nvim";
flake = false;
};
bufferline-nvim-src = {
url = "github:akinsho/bufferline.nvim";
flake = false;
};
nvim-tree-lua-src = {
url = "github:kyazdani42/nvim-tree.lua";
flake = false;
};
2022-04-26 21:36:16 -04:00
};
2023-02-20 20:45:56 -05:00
outputs = { nixpkgs, ... }@inputs:
2022-05-15 20:46:17 -04:00
2022-04-26 21:36:16 -04:00
let
2022-05-08 16:02:13 -04:00
# Global configuration for my systems
2022-09-09 22:16:45 -04:00
globals = rec {
2022-04-30 12:07:58 -04:00
user = "noah";
fullName = "Noah Masur";
2022-09-09 22:16:45 -04:00
gitName = fullName;
2022-04-30 12:07:58 -04:00
gitEmail = "7386960+nmasur@users.noreply.github.com";
2022-12-21 14:18:03 -07:00
mail.server = "noahmasur.com";
2023-03-12 17:07:41 -04:00
mail.imapHost = "imap.purelymail.com";
mail.smtpHost = "smtp.purelymail.com";
2022-10-01 18:28:03 +00:00
dotfilesRepo = "git@github.com:nmasur/dotfiles";
2022-04-28 20:54:37 -04:00
};
2022-05-08 16:02:13 -04:00
# Common overlays to always use
overlays = [
inputs.nur.overlay
inputs.nix2vim.overlay
2023-02-20 20:00:54 -05:00
(import ./overlays/neovim-plugins.nix inputs)
(import ./overlays/lib.nix)
2023-02-20 20:00:54 -05:00
(import ./overlays/calibre-web.nix)
];
2022-05-15 20:46:17 -04:00
# System types to support.
supportedSystems =
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in rec {
2022-05-08 16:02:13 -04:00
# Contains my full system builds, including home-manager
# nixos-rebuild switch --flake .#tempest
nixosConfigurations = {
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 10:24:54 -05:00
swan = import ./hosts/swan { inherit inputs globals overlays; };
2022-04-26 21:36:16 -04:00
};
2022-05-08 16:02:13 -04:00
# Contains my full Mac system builds, including home-manager
# darwin-rebuild switch --flake .#lookingglass
darwinConfigurations = {
2023-02-11 14:35:38 +00:00
lookingglass =
2023-02-12 21:26:12 -05:00
import ./hosts/lookingglass { inherit inputs globals overlays; };
};
# For quickly applying local settings with:
2023-02-11 14:35:38 +00:00
# home-manager switch --flake .#tempest
homeConfigurations = {
2023-02-11 14:35:38 +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 17:46:26 -04:00
};
# Disk formatting, only used once
diskoConfigurations = { root = import ./disks/root.nix; };
# Other packages, such as system images or programs
2022-11-27 12:29:45 -07:00
packages = forAllSystems (system: {
# Package servers into images with a generator
2022-11-27 12:29:45 -07:00
aws = {
"${system}" =
2023-02-18 10:24:54 -05:00
import ./generators/aws { inherit inputs globals system overlays; };
};
staff = {
"${system}" = import ./generators/staff {
inherit inputs globals system overlays;
};
2022-11-27 12:29:45 -07:00
};
# Package Neovim config into standalone package
neovim = let pkgs = import nixpkgs { inherit system overlays; };
in import ./modules/common/neovim/package {
inherit pkgs;
2022-12-21 14:18:03 -07:00
colors =
import ./colorscheme/gruvbox/neovim-gruvbox.nix { inherit pkgs; };
2022-11-27 13:08:33 -07:00
};
2022-11-27 12:29:45 -07:00
});
2022-10-18 12:21:22 +00:00
# Programs that can be run by calling this flake
2022-06-05 09:24:46 -04:00
apps = forAllSystems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = overlays ++ [
(final: prev: {
disko-packaged = inputs.disko.packages.${system}.disko;
})
];
};
in import ./apps { inherit pkgs; });
2022-06-05 09:24:46 -04:00
# Development environments
2022-05-15 20:46:17 -04:00
devShells = forAllSystems (system:
let pkgs = import nixpkgs { inherit system overlays; };
2022-05-01 11:16:48 -04:00
in {
2022-08-21 15:27:47 -06:00
# Used to run commands and edit files in this repo
2022-05-01 11:16:48 -04:00
default = pkgs.mkShell {
2022-05-06 08:58:44 -04:00
buildInputs = with pkgs; [ git stylua nixfmt shfmt shellcheck ];
2022-05-01 11:16:48 -04:00
};
2022-08-21 15:27:47 -06:00
2023-03-22 16:20:30 -04:00
test = pkgs.mkShell { buildInputs = with pkgs; [ age ]; };
2022-08-21 15:27:47 -06:00
# Used for cloud and systems development and administration
2022-08-19 19:10:08 -06:00
devops = pkgs.mkShell {
buildInputs = with pkgs; [
git
terraform
consul
vault
awscli2
google-cloud-sdk
2022-09-21 16:58:04 -04:00
ansible
2022-09-10 16:14:30 -04:00
kubectl
kubernetes-helm
2022-08-19 19:10:08 -06:00
kustomize
fluxcd
];
};
2022-08-21 15:27:47 -06:00
2022-05-15 20:46:17 -04:00
});
2022-04-27 09:23:26 -04:00
2022-06-20 23:34:24 -04:00
# Templates for starting other projects quickly
2022-08-07 18:37:19 -06:00
templates = rec {
default = basic;
2022-08-07 12:52:00 -06:00
basic = {
path = ./templates/basic;
description = "Basic program template";
};
2022-06-20 23:34:24 -04:00
poetry = {
path = ./templates/poetry;
description = "Poetry template";
};
python = {
path = ./templates/python;
description = "Legacy Python template";
};
2022-07-04 19:17:58 -04:00
haskell = {
path = ./templates/haskell;
description = "Haskell template";
};
2022-06-20 23:34:24 -04:00
};
2022-04-26 21:36:16 -04:00
};
}