nix/flake.nix

127 lines
4.3 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-10-03 16:26:45 -05:00
hyprland.url = "github:hyprwm/Hyprland";
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,
2023-10-03 16:26:45 -05:00
nix-colors,
2023-10-03 11:52:44 -05:00
...
} @ 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 16:26:45 -05:00
mkNixosSystem = cb: system: modules:
cb {
2023-10-03 14:50:00 -05:00
system = system;
specialArgs = {
2023-10-03 16:26:45 -05:00
inherit inputs outputs system nix-colors;
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
++ [
# all nixos hosts should use our home manager config
# TODO: unify with the module list in outputs.homeConfigurations.daniel
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
extraSpecialArgs = {inherit inputs outputs system nix-colors;};
users.daniel = {
imports = [./home ./home/linux.nix];
};
};
}
];
2023-10-03 14:50:00 -05:00
};
2023-10-03 16:26:45 -05:00
mkNixosStableSystem = mkNixosSystem nixpkgs-stable.lib.nixosSystem;
mkNixosUnstableSystem = mkNixosSystem nixpkgs-unstable.lib.nixosSystem;
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 16:26:45 -05:00
beefcake = mkNixosStableSystem "x86_64-linux" [
inputs.api-lyte-dev.nixosModules.x86_64-linux.api-lyte-dev
./nixos/beefcake
];
rascal = mkNixosStableSystem "x86_64-linux" [./nixos/rascal];
musicbox = mkNixosUnstableSystem "x86_64-linux" [./nixos/musicbox];
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};
2023-10-03 16:26:45 -05:00
extraSpecialArgs = {inherit inputs outputs system nix-colors;};
2023-10-03 14:50:00 -05:00
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
};
}