nix/flake.nix

190 lines
6.3 KiB
Nix
Raw Permalink Normal View History

2023-09-04 11:40:30 -05:00
{
inputs = {
2023-10-18 09:14:19 -05:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
2023-11-07 17:09:05 -06:00
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";
2023-11-07 17:09:05 -06:00
helix.inputs.nixpkgs.follows = "nixpkgs";
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";
2023-10-03 17:09:12 -05:00
hyprland.url = "github:hyprwm/Hyprland";
2023-11-07 17:09:05 -06:00
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
2023-10-25 11:07:39 -05:00
ssbm.url = "github:lytedev/ssbm-nix/my-nixpkgs";
2023-11-07 17:09:05 -06:00
ssbm.inputs.nixpkgs.follows = "nixpkgs";
2023-10-04 12:39:01 -05:00
# doesn't support the forge mod loader yet
# nix-minecraft.url = "github:Infinidoge/nix-minecraft";
2023-10-03 17:14:15 -05:00
# need to bump ishiiruka upstream I think
# slippi-desktop.url = "github:project-slippi/slippi-desktop-app";
# slippi-desktop.flake = false;
# ssbm.inputs.slippi-desktop.follows = "slippi-desktop";
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,
...
} @ inputs: let
inherit (self) outputs;
2023-10-06 00:49:19 -05:00
systems = [
2023-10-03 11:52:44 -05:00
"aarch64-linux"
# "i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
2023-10-18 09:14:19 -05:00
forAllSystems = nixpkgs.lib.genAttrs systems;
2023-10-06 00:49:19 -05:00
2023-10-05 13:43:28 -05:00
color-schemes = (import ./lib/colors.nix inputs).schemes;
2023-10-05 01:02:31 -05:00
colors = color-schemes.catppuccin-mocha-sapphire;
2023-10-05 13:43:28 -05:00
# colors = (import ./lib/colors.nix inputs).color-schemes.donokai;
2023-10-05 01:02:31 -05:00
font = {
name = "IosevkaLyteTerm";
size = 12;
};
2023-10-03 11:52:44 -05:00
in {
2023-10-06 01:30:15 -05:00
colors = colors;
font = font;
2023-10-03 11:52:44 -05:00
# Your custom packages
# Acessible through 'nix build', 'nix shell', etc
2023-10-18 09:14:19 -05:00
packages = forAllSystems (system: import ./pkgs nixpkgs.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
# Your custom packages and modifications, exported as overlays
overlays = import ./overlays {inherit inputs;};
# 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'
2023-10-03 13:18:12 -05:00
nixosConfigurations = let
2023-10-18 09:14:19 -05:00
mkNixosSystem = system: modules: homeManagerModules:
nixpkgs.lib.nixosSystem {
2023-10-03 14:50:00 -05:00
system = system;
specialArgs = {
2023-10-05 01:02:31 -05:00
inherit inputs outputs system colors font;
2023-10-03 14:50:00 -05:00
flake = self;
};
2023-10-03 16:26:45 -05:00
modules =
[
inputs.sops-nix.nixosModules.sops
self.nixosModules.common
]
++ modules
++ [
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
2023-10-05 01:02:31 -05:00
extraSpecialArgs = {inherit inputs outputs system colors font;};
2023-10-03 16:26:45 -05:00
users.daniel = {
2023-10-05 13:43:28 -05:00
imports = homeManagerModules;
2023-10-03 16:26:45 -05:00
};
};
}
];
2023-10-03 14:50:00 -05:00
};
2024-01-02 18:54:46 -06:00
base = mkNixosSystem "x86_64-linux" [./nixos/base] [outputs.homeManagerModules.base];
2023-10-03 13:18:12 -05:00
in {
2024-01-02 18:54:46 -06:00
base = base;
nixos = base; # alias
2024-01-04 13:40:14 -06:00
thablet = mkNixosSystem "x86_64-linux" [./nixos/thablet] [outputs.homeManagerModules.base];
thinker = mkNixosSystem "x86_64-linux" [./nixos/thinker] [outputs.homeManagerModules.thinker];
foxtrot = mkNixosSystem "x86_64-linux" [./nixos/foxtrot] [
outputs.homeManagerModules.foxtrot
];
2023-10-05 13:43:28 -05:00
beefcake =
2023-10-18 09:14:19 -05:00
mkNixosSystem "x86_64-linux" [
2023-10-05 13:43:28 -05:00
inputs.api-lyte-dev.nixosModules.x86_64-linux.api-lyte-dev
./nixos/beefcake
] (with outputs.homeManagerModules; [
linux
]);
2024-01-04 13:40:14 -06:00
rascal = mkNixosSystem "x86_64-linux" [./nixos/rascal] [
outputs.homeManagerModules.linux
];
musicbox = mkNixosSystem "x86_64-linux" [./nixos/musicbox] [outputs.homeManagerModules.sway];
router = mkNixosSystem "x86_64-linux" [./nixos/router] [outputs.homeManagerModules.common];
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?
2023-10-06 00:56:04 -05:00
"base-x86_64-linux" = let
2023-10-05 13:43:28 -05:00
system = "x86_64-linux";
2023-10-06 00:56:04 -05:00
in
home-manager.lib.homeManagerConfiguration {
2023-10-18 09:14:19 -05:00
pkgs = nixpkgs.legacyPackages.${system};
2023-10-06 00:56:04 -05:00
extraSpecialArgs = {inherit inputs outputs system colors font;};
modules = with outputs.homeManagerModules; [linux];
};
"base-aarch64-darwin" = let
2023-10-06 00:49:19 -05:00
system = "aarch64-darwin";
2023-10-06 00:56:04 -05:00
in
home-manager.lib.homeManagerConfiguration {
2023-10-18 09:14:19 -05:00
pkgs = nixpkgs.legacyPackages.${system};
2023-10-06 00:56:04 -05:00
extraSpecialArgs = {inherit inputs outputs system colors font;};
modules = with outputs.homeManagerModules; [macos];
};
2023-10-03 11:52:44 -05:00
};
2023-10-05 13:43:28 -05:00
# TODO: nix-on-droid for phone terminal usage?
# TODO: nix-darwin for work?
2023-10-03 10:28:12 -05:00
# TODO: nixos ISO?
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;
};
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"
"https://nix.h.lyte.dev"
];
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="
];
};
2023-09-04 11:40:30 -05:00
}