nix/flake.nix

108 lines
3.5 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
2023-10-03 12:13:30 -05:00
# TODO: avoid my manual workaround of `nix profile install helix#helix --priority 4`
2023-10-03 11:52:44 -05:00
helix.url = "github:helix-editor/helix/75c0a5ceb32d8a503915a93ccc1b64c8ad1cba8b";
2023-09-18 09:02:00 -05:00
disko.url = "github:nix-community/disko/master";
sops-nix.url = "github:Mic92/sops-nix";
2023-10-03 11:52:44 -05:00
# TODO: do I really need this in the root of my flake if _only_ beefcake uses it?
api-lyte-dev.url = "git+ssh://gitea@git.lyte.dev/lytedev/api.lyte.dev.git";
2023-10-03 13:18:12 -05:00
hardware.url = "github:nixos/nixos-hardware";
2023-09-14 21:20:27 -05:00
# TODO: hyprland.url = "github:hyprwm/Hyprland";
2023-10-03 11:52:44 -05:00
# TODO: nix-colors.url = "github:misterio77/nix-colors";
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;
systems = [
"aarch64-linux"
# "i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
2023-10-03 14:50:00 -05:00
forAllSystems = nixpkgs-stable.lib.genAttrs systems;
2023-10-03 11:52:44 -05:00
in {
# Your custom packages
# Acessible through 'nix build', 'nix shell', etc
2023-10-03 14:50:00 -05:00
packages = forAllSystems (system: import ./pkgs nixpkgs-stable.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-03 14:50:00 -05:00
# mkNixosSystem = system: modules:
# nixpkgs-stable.lib.nixosSystem {
2023-10-03 13:18:12 -05:00
# system = system;
# specialArgs = {
# inherit inputs outputs system;
# flake = self;
# };
2023-10-03 14:50:00 -05:00
# modules = [self.nixosModules.common] ++ modules;
2023-10-03 13:18:12 -05:00
# };
2023-10-03 14:50:00 -05:00
mkNixosUnstableSystem = system: modules:
nixpkgs-unstable.lib.nixosSystem {
system = system;
specialArgs = {
inherit inputs outputs system;
flake = self;
};
modules = [ self.nixosModules.common ] ++ modules;
};
2023-10-03 13:18:12 -05:00
in {
2023-10-03 14:50:00 -05:00
dragon = mkNixosUnstableSystem "x86_64-linux" [./nixos/dragon];
thinker = mkNixosUnstableSystem "x86_64-linux" [./nixos/thinker];
2023-10-03 11:52:44 -05:00
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
2023-10-03 14:50:00 -05:00
homeConfigurations = let
mkHome = system: modules:
home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs-unstable.legacyPackages.${system};
extraSpecialArgs = {inherit inputs outputs system;};
modules = modules;
};
in {
"daniel" = mkHome "x86_64-linux" [./home ./home/linux.nix];
"daniel.flanagan" = mkHome "aarch64-darwin" [./home];
2023-10-03 11:52:44 -05:00
};
2023-10-03 10:28:12 -05:00
# TODO: darwin for work?
# 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
};
}