dotfiles.nix/flake.nix

140 lines
4.3 KiB
Nix

{
description = "mat'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:squirmy/nixos-flake";
# 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";
# "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";
# trigger some action when switching between dark and light mode on macOS
dark-mode-notify-src.url = "github:bouk/dark-mode-notify";
dark-mode-notify-src.flake = false;
# modify custom macOS file icons
fileicon-src.url = "github:mklement0/fileicon";
fileicon-src.flake = false;
# iA writer fonts
ia-writer-family-src.url = "github:iaolo/iA-Fonts";
ia-writer-family-src.flake = false;
# alternate kitty terminal icon
kitty-icon.url = "github:DinkDonk/kitty-icon";
kitty-icon.flake = false;
# standard kitty terminal themes
kitty-themes.url = "github:kovidgoyal/kitty-themes";
kitty-themes.flake = false;
# fish shell package manager
fisher-src.url = "github:jorgebucaran/fisher";
fisher-src.flake = false;
# shell prompt
starship-src.url = "github:starship/starship";
starship-src.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
./people
./templates
];
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";
people.me = "mess";
imports = [
self.darwinModules.default
./systems/darwin/m1.nix
./systems/darwin/work.nix
];
};
};
};
perSystem = { self', pkgs, config, ... }:
# formatter for this flake
let formatter = pkgs.nixfmt;
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 hook configuration
pre-commit.settings.hooks = {
deadnix.enable = true;
nil.enable = true;
nixfmt.enable = true;
statix.enable = true;
};
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;
};
};
}