nix/flake.nix

188 lines
5.5 KiB
Nix
Raw Normal View History

2023-09-04 11:40:30 -05:00
{
inputs = {
2024-06-01 20:08:59 -05:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
2024-06-24 10:03:00 -05:00
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
2024-02-29 09:02:36 -06:00
2024-06-17 13:00:23 -05:00
disko.url = "github:nix-community/disko/master";
disko.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
# sops-nix.inputs.nixpkgs.follows = "nixpkgs-unstable";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
2024-06-17 13:00:23 -05:00
home-manager.url = "github:nix-community/home-manager/release-24.05";
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";
2023-10-03 17:09:12 -05:00
hardware.url = "github:nixos/nixos-hardware";
2024-03-22 09:54:00 -05:00
hyprland.url = "github:hyprwm/Hyprland";
2024-05-29 14:58:10 -05:00
slippi.url = "github:lytedev/slippi-nix";
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,
2023-10-03 11:52:44 -05:00
home-manager,
2024-02-28 09:31:58 -06:00
hardware,
pre-commit-hooks,
2023-10-03 11:52:44 -05:00
...
} @ inputs: let
# TODO: make @ inputs unnecessary by making arguments explicit in all modules?
2024-06-25 09:38:00 -05:00
systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
forSystems = nixpkgs.lib.genAttrs systems;
2024-06-14 11:07:06 -05:00
pkgsFor = system: import nixpkgs {inherit system;};
2024-06-25 09:38:00 -05:00
genPkgs = f: (f (forSystems pkgsFor));
2024-01-04 14:45:10 -06:00
in {
2024-06-14 11:07:06 -05:00
colors = (import ./lib/colors.nix {inherit (nixpkgs) lib;}).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
2024-06-25 09:38:00 -05:00
packages = genPkgs (pkgs: import ./packages {inherit pkgs;});
formatter = genPkgs (pkgs: pkgs.alejandra);
checks = genPkgs (pkgs: {
pre-commit-check = pre-commit-hooks.lib.${pkgs.system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
};
};
});
2024-06-25 09:38:00 -05:00
devShell = genPkgs (pkgs:
2024-03-25 09:44:55 -05:00
pkgs.mkShell {
2024-06-25 09:38:00 -05:00
inherit (self.outputs.checks.${pkgs.system}.pre-commit-check) shellHook;
2024-03-25 09:44:55 -05:00
buildInputs = with pkgs; [
lua-language-server
];
});
2024-06-01 20:08:59 -05:00
overlays = import ./overlays {inherit nixpkgs;};
2023-10-03 11:52:44 -05:00
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
nixosConfigurations =
(builtins.mapAttrs (name: {
system,
modules,
...
}:
# let
# commonModules =
# in
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
# TODO: avoid special args and actually pass inputs to modules?
2024-06-25 09:38:00 -05:00
inherit (self) outputs;
inherit inputs hardware;
};
# extraSpecialArgs = {
2024-05-07 01:00:06 -05:00
# inherit inputs outputs system;
# };
modules =
[
self.nixosModules.common
]
++ modules;
}) (import ./nixos))
// {
beefcake = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
2024-06-25 09:38:00 -05:00
inherit (self) outputs;
inherit inputs hardware;
};
modules = [self.nixosModules.common ./nixos/beefcake.nix];
2024-01-04 17:20:02 -06:00
};
# rascal = {
# system = "x86_64-linux";
# modules = [./rascal.nix];
# };
# router = {
# system = "x86_64-linux";
# modules = [./router.nix];
2024-02-21 21:38:42 -06:00
# };
};
2023-10-03 11:52:44 -05:00
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 {
2024-06-17 13:00:23 -05:00
pkgs = pkgsFor system;
2024-01-19 09:40:57 -06:00
extraSpecialArgs = {
2024-06-25 09:38:00 -05:00
inherit (self) outputs;
inherit inputs system;
inherit (self.outputs) colors font;
2024-01-19 09:40:57 -06:00
};
2024-06-25 09:38:00 -05:00
modules = with self.outputs.homeManagerModules; [
2024-01-19 09:40:57 -06:00
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 {
2024-06-17 13:00:23 -05:00
pkgs = pkgsFor system;
2024-02-06 15:37:49 -06:00
extraSpecialArgs = {
2024-06-25 09:38:00 -05:00
inherit (self) outputs;
inherit inputs system;
inherit (self.outputs) colors font;
2024-02-06 15:37:49 -06:00
};
2024-06-25 09:38:00 -05:00
modules = with self.outputs.homeManagerModules; [
2024-02-06 15:37:49 -06:00
common
{
home.homeDirectory = "/Users/daniel.flanagan";
home.username = "daniel.flanagan";
home.stateVersion = "24.05";
}
macos
];
};
2023-10-03 11:52:44 -05:00
};
2023-10-03 12:13:30 -05:00
diskoConfigurations = import ./disko;
2023-12-19 10:27:11 -06:00
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"
"https://nix-community.cachix.org"
2024-06-14 09:30:11 -05:00
"https://nix.h.lyte.dev"
2024-03-27 10:38:30 -05:00
"https://hyprland.cachix.org"
2023-10-08 02:59:34 -05:00
];
extra-trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"h.lyte.dev:HeVWtne31ZG8iMf+c15VY3/Mky/4ufXlfTpT8+4Xbs0="
2024-03-27 10:38:30 -05:00
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
2023-10-08 02:59:34 -05:00
];
};
2023-09-04 11:40:30 -05:00
}