dotfiles.nix/flake.nix

152 lines
4.7 KiB
Nix

{
description = "sloane's nix configs";
inputs = {
# base inputs
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
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";
nixos-flake.url = "github:srid/nixos-flake";
pre-commit.url = "github:cachix/pre-commit-hooks.nix";
pre-commit.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
ghostty.url = "github:clo4/ghostty-hm-module";
mac-app-util.url = "github:hraban/mac-app-util";
mac-app-util.inputs.nixpkgs.follows = "nixpkgs";
# "flag" for toggling homebrew operations
# https://www.mat.services/posts/command-line-flake-arguments/
homebrew-enabled.url = "github:boolean-option/true";
# command line text editor
helix.url = "github:helix-editor/helix";
helix.inputs.nixpkgs.follows = "nixpkgs";
# nix language servers
nil.url = "github:oxalica/nil";
nil.inputs.nixpkgs.follows = "nixpkgs";
nixd.url = "github:nix-community/nixd";
nixd.inputs.nixpkgs.follows = "nixpkgs";
# iA writer fonts
ia-writer-family-src.url = "github:iaolo/iA-Fonts";
ia-writer-family-src.flake = false;
# standard kitty terminal themes
terminal-themes.url = "github:mbadolato/iTerm2-Color-Schemes";
terminal-themes.flake = false;
# shell prompt
starship-src.url = "github:starship/starship";
starship-src.flake = false;
# extra fish shell plugins
fish-plugin-done.url = "github:franciscolourenco/done";
fish-plugin-done.flake = false;
fish-plugin-fish-abbr-tips.url = "github:Gazorby/fish-abbreviation-tips";
fish-plugin-fish-abbr-tips.flake = false;
fish-plugin-autopair.url = "github:jorgebucaran/autopair.fish";
fish-plugin-autopair.flake = false;
fish-plugin-replay.url = "github:jorgebucaran/replay.fish";
fish-plugin-replay.flake = false;
fish-plugin-fish-bang-bang.url = "github:oh-my-fish/plugin-bang-bang";
fish-plugin-fish-bang-bang.flake = false;
fish-plugin-colored-man-pages.url = "github:PatrickF1/colored_man_pages.fish";
fish-plugin-colored-man-pages.flake = false;
};
outputs =
{ self, flake-parts, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"aarch64-darwin"
"aarch64-linux"
];
imports = [
inputs.nixos-flake.flakeModule
inputs.pre-commit.flakeModule
./darwin
./home
./nixos
./templates
./users
];
flake = {
nixosConfigurations = {
# pihole = self.nixos-flake.lib.mkLinuxSystem {
# nixpkgs.hostPlatform = "aarch64-linux";
# imports = [ self.nixosModules.default ./systems/nixos/pihole.nix ];
# };
};
darwinConfigurations = {
matbook = self.nixos-flake.lib.mkMacosSystem {
nixpkgs.hostPlatform = "aarch64-darwin";
imports = [
self.darwinModules.default
./darwin/games.nix
./systems/darwin/m1.nix
];
};
yelpbook-m1 = self.nixos-flake.lib.mkMacosSystem {
nixpkgs.hostPlatform = "aarch64-darwin";
imports = [
self.darwinModules.default
./systems/darwin/m1.nix
./systems/darwin/work.nix
];
};
};
};
perSystem =
{
self',
pkgs,
config,
...
}:
# formatter for this flake
let
formatter = pkgs.nixfmt-rfc-style;
in
{
# controls which flake inputs are updated by `nix run .#update`
nixos-flake.primary-inputs = [
# system inputs
"nixpkgs"
"flake-parts"
"nix-darwin"
"home-manager"
"nixos-flake"
# package inputs
"helix"
"nil"
"nixd"
];
pre-commit.settings.hooks = {
deadnix.enable = true;
nil.enable = true;
# nixfmt.enable = true;
statix.enable = true;
};
# TODO: how to set legacy packages with overrides, etc?
packages.default = self'.packages.activate;
devShells.default = pkgs.mkShell {
shellHook = ''
${config.pre-commit.installationScript}
echo 1>&2 "\(^^)/ welcome to the flake \(^^)/"
'';
buildInputs = [ formatter ];
};
inherit formatter;
};
};
}