nix/flake.nix

210 lines
6.6 KiB
Nix
Raw Normal View History

2023-09-04 11:40:30 -05:00
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2024-03-09 10:37:51 -06:00
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
2024-02-29 09:02:36 -06:00
# I have this as a separate input so I don't rebuild the font every time I
# want to upgrade nixpkgs
nixpkgsForIosevka.url = "github:nixos/nixpkgs?rev=5863c27340ba4de8f83e7e3c023b9599c3cb3c80";
2023-11-07 17:09:05 -06:00
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
2024-02-28 09:31:58 -06:00
# pre-commit-hooks.inputs.nixpkgs-unstable.follows = "nixpkgs";
2023-10-03 14:50:00 -05:00
home-manager.url = "github:nix-community/home-manager/master";
2023-11-07 17:09:05 -06:00
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2023-12-04 09:14:13 -06:00
helix.url = "github:helix-editor/helix/master";
2024-02-16 14:57:52 -06:00
# I think if I force this to follow nixpkgs, I won't get caching benefits
# helix.inputs.nixpkgs.follows = "nixpkgs";
2023-11-07 17:09:05 -06:00
disko.url = "github:nix-community/disko/master";
2023-11-07 17:09:05 -06:00
disko.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
2023-11-07 17:09:05 -06:00
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs";
2023-10-03 17:09:12 -05:00
hardware.url = "github:nixos/nixos-hardware";
2023-11-07 17:09:05 -06:00
# hardware.inputs.nixpkgs.follows = "nixpkgs";
2024-03-22 09:54:00 -05:00
hyprland.url = "github:hyprwm/Hyprland";
hyprland.inputs.nixpkgs.follows = "nixpkgs";
2023-10-03 11:52:44 -05:00
api-lyte-dev.url = "git+ssh://gitea@git.lyte.dev/lytedev/api.lyte.dev.git";
2023-11-07 17:09:05 -06:00
api-lyte-dev.inputs.nixpkgs.follows = "nixpkgs";
2023-10-03 11:52:44 -05:00
2024-02-12 17:05:35 -06:00
ssbm.url = "github:lytedev/ssbm-nix";
2024-02-16 14:57:52 -06:00
# I think if I force this to follow nixpkgs, I won't get caching benefits
ssbm.inputs.nixpkgs.follows = "nixpkgs";
2023-10-04 12:39:01 -05:00
2024-02-16 14:57:52 -06:00
# TODO: doesn't (can't?) support the forge mod loader yet
# nix-minecraft.url = "github:Infinidoge/nix-minecraft";
2023-09-04 11:40:30 -05:00
};
2023-10-03 11:52:44 -05:00
outputs = {
self,
2023-10-18 09:14:19 -05:00
nixpkgs,
nixpkgsForIosevka,
2023-10-03 11:52:44 -05:00
home-manager,
2024-02-28 09:31:58 -06:00
hardware,
pre-commit-hooks,
2024-02-21 21:38:42 -06:00
api-lyte-dev,
2023-10-03 11:52:44 -05:00
...
} @ inputs: let
# TODO: make @ inputs unnecessary by making arguments explicit in all modules?
2023-10-03 11:52:44 -05:00
inherit (self) outputs;
2023-10-06 00:49:19 -05:00
systems = [
2023-10-03 11:52:44 -05:00
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
2024-02-02 13:54:20 -06:00
"x86_64-linux"
2023-10-03 11:52:44 -05:00
];
2023-10-18 09:14:19 -05:00
forAllSystems = nixpkgs.lib.genAttrs systems;
2024-01-04 14:45:10 -06:00
in {
colors = (import ./lib/colors.nix {inherit nixpkgs;}).schemes.catppuccin-mocha-sapphire;
2023-10-05 13:43:28 -05:00
# colors = (import ./lib/colors.nix inputs).color-schemes.donokai;
2024-01-04 14:45:10 -06:00
2023-10-05 01:02:31 -05:00
font = {
name = "IosevkaLyteTerm";
size = 12;
};
2023-10-06 01:30:15 -05:00
2023-10-03 11:52:44 -05:00
# Your custom packages
# Acessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system:
import ./pkgs {
pkgs = nixpkgs.legacyPackages.${system};
pkgsForIosevka = nixpkgsForIosevka.legacyPackages.${system};
});
2023-10-03 11:52:44 -05:00
# Formatter for your nix files, available through 'nix fmt'
# Other options beside 'alejandra' include 'nixpkgs-fmt'
2023-10-18 09:14:19 -05:00
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
2023-10-03 11:52:44 -05:00
checks = forAllSystems (system: {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
};
};
});
devShell = forAllSystems (system:
nixpkgs.legacyPackages.${system}.mkShell {
inherit (outputs.checks.${system}.pre-commit-check) shellHook;
});
2023-10-03 11:52:44 -05:00
# Your custom packages and modifications, exported as overlays
overlays = import ./overlays {inherit nixpkgs nixpkgsForIosevka;};
2023-10-03 11:52:44 -05:00
# Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs
nixosModules = import ./modules/nixos;
# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
homeManagerModules = import ./modules/home-manager;
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
2024-01-04 17:20:02 -06:00
nixosConfigurations = builtins.mapAttrs (name: {
system,
modules,
...
}:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
2024-02-28 09:31:58 -06:00
inherit inputs outputs system api-lyte-dev hardware;
2024-01-04 17:20:02 -06:00
};
2024-02-21 21:38:42 -06:00
# extraSpecialArgs = {
# inherit inputs outputs system api-lyte-dev;
# };
2024-01-04 17:20:02 -06:00
modules =
[
self.nixosModules.common
]
++ modules;
}) (import ./nixos);
2023-10-03 11:52:44 -05:00
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
2023-10-05 13:43:28 -05:00
homeConfigurations = {
2023-10-06 00:49:19 -05:00
# TODO: non-system-specific home configurations?
2024-01-19 09:40:57 -06:00
"deck" = let
system = "x86_64-linux";
in
home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
extraSpecialArgs = {
inherit inputs outputs system;
inherit (outputs) colors font;
};
modules = with outputs.homeManagerModules; [
common
{
home.homeDirectory = "/home/deck";
home.username = "deck";
home.stateVersion = "24.05";
}
linux
];
};
2024-02-06 15:37:49 -06:00
workm1 = let
2024-02-09 10:31:21 -06:00
system = "aarch64-darwin";
2024-02-06 15:37:49 -06:00
in
home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
extraSpecialArgs = {
inherit inputs outputs system;
inherit (outputs) colors font;
};
modules = with outputs.homeManagerModules; [
common
{
home.homeDirectory = "/Users/daniel.flanagan";
home.username = "daniel.flanagan";
home.stateVersion = "24.05";
}
macos
];
};
2023-10-03 11:52:44 -05:00
};
# Disk partition schemes and functions
2023-10-03 12:13:30 -05:00
diskoConfigurations = import ./disko;
2023-10-08 02:59:34 -05:00
2023-12-19 10:27:11 -06:00
# Flake templates for easily setting up Nix in a project using common patterns I like
templates = import ./templates/all.nix;
2024-01-04 14:45:10 -06:00
# TODO: nix-on-droid for phone terminal usage?
# TODO: nix-darwin for work?
# TODO: nixos ISO?
2023-12-19 10:27:11 -06:00
};
2023-12-19 10:24:07 -06:00
2023-10-08 02:59:34 -05:00
nixConfig = {
extra-experimental-features = ["nix-command" "flakes"];
extra-substituters = [
"https://cache.nixos.org/"
"https://helix.cachix.org"
2024-02-16 14:57:52 -06:00
"https://ssbm-nix.cachix.org"
2023-10-08 02:59:34 -05:00
"https://nix-community.cachix.org"
"https://nix.h.lyte.dev"
];
extra-trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="
2024-02-16 14:57:52 -06:00
"ssbm-nix.cachix.org-1:YN104LKAWaKQIecOphkftXgXlYZVK/IRHM1UD7WAIew="
2023-10-08 02:59:34 -05:00
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"h.lyte.dev:HeVWtne31ZG8iMf+c15VY3/Mky/4ufXlfTpT8+4Xbs0="
];
};
2023-09-04 11:40:30 -05:00
}