nix/flake.nix

151 lines
5.1 KiB
Nix
Raw Normal View History

2023-09-04 11:40:30 -05:00
{
inputs = {
2023-10-03 14:50:00 -05:00
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05";
2023-10-03 11:52:44 -05:00
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
2023-10-03 14:50:00 -05:00
home-manager.url = "github:nix-community/home-manager/master";
2023-10-03 11:52:44 -05:00
helix.url = "github:helix-editor/helix/75c0a5ceb32d8a503915a93ccc1b64c8ad1cba8b";
disko.url = "github:nix-community/disko/master";
sops-nix.url = "github:Mic92/sops-nix";
2023-10-03 17:09:12 -05:00
hardware.url = "github:nixos/nixos-hardware";
hyprland.url = "github:hyprwm/Hyprland";
2023-10-03 11:52:44 -05:00
api-lyte-dev.url = "git+ssh://gitea@git.lyte.dev/lytedev/api.lyte.dev.git";
2023-10-04 12:39:01 -05:00
# TODO: ssbm.url = "github:djanatyn/ssbm-nix";
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-03 14:50:00 -05:00
nixpkgs-stable,
2023-10-03 13:18:12 -05:00
nixpkgs-unstable,
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-06 00:49:19 -05:00
forAllSystems = nixpkgs-stable.lib.genAttrs systems;
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-05 01:02:31 -05:00
# TODO: nix-color integration?
2023-10-03 11:52:44 -05:00
# Your custom packages
# Acessible through 'nix build', 'nix shell', etc
2023-10-05 13:43:28 -05:00
packages = forAllSystems (system: import ./pkgs nixpkgs-unstable.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-03 14:50:00 -05:00
formatter = forAllSystems (system: nixpkgs-unstable.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-05 13:43:28 -05:00
mkNixosSystem = cb: system: modules: homeManagerModules:
2023-10-03 16:26:45 -05:00
cb {
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
};
2023-10-04 20:52:46 -05:00
# mkNixosStableSystem = mkNixosSystem nixpkgs-stable.lib.nixosSystem;
2023-10-03 16:26:45 -05:00
mkNixosUnstableSystem = mkNixosSystem nixpkgs-unstable.lib.nixosSystem;
2023-10-03 13:18:12 -05:00
in {
2023-10-05 13:43:28 -05:00
dragon = mkNixosUnstableSystem "x86_64-linux" [./nixos/dragon] (with outputs.homeManagerModules; [
2023-10-06 00:49:19 -05:00
dragon
2023-10-05 13:43:28 -05:00
]);
thinker = mkNixosUnstableSystem "x86_64-linux" [./nixos/thinker] (with outputs.homeManagerModules; [
2023-10-06 00:49:19 -05:00
thinker
2023-10-05 13:43:28 -05:00
]);
beefcake =
mkNixosUnstableSystem "x86_64-linux" [
inputs.api-lyte-dev.nixosModules.x86_64-linux.api-lyte-dev
./nixos/beefcake
] (with outputs.homeManagerModules; [
linux
]);
rascal = mkNixosUnstableSystem "x86_64-linux" [./nixos/rascal] (with outputs.homeManagerModules; [
linux
]);
musicbox = mkNixosUnstableSystem "x86_64-linux" [./nixos/musicbox] (with outputs.homeManagerModules; [
sway
]);
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 {
pkgs = nixpkgs-unstable.legacyPackages.${system};
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 {
pkgs = nixpkgs-unstable.legacyPackages.${system};
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-09-04 11:40:30 -05:00
};
}