nixos/flake.nix

76 lines
1.7 KiB
Nix
Raw Normal View History

2025-12-07 22:57:38 -05:00
{
description = "Nest's Flake";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
2025-12-08 20:30:22 -05:00
outputs = { self, nixpkgs, ... }@inputs:
let
inherit (self) outputs;
# Set the default user. Can be overitten on a system level
vars.user = "nest";
# List of system types our hosts use
systems = [ "x86_64-linux" ];
# Generic NixOS config
mkNixOSConfig = {
path,
extraModules ? [],
2025-12-11 23:39:49 +00:00
vars,
2025-12-08 20:30:22 -05:00
}:
nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs outputs vars;
};
modules = [
./nixos/common
path
]
++ extraModules;
};
2025-12-11 23:39:49 +00:00
# Additional modules for physical hosts
mkPhysicalNixOSConfig = path:
let
updatedVars = vars // {
hostType = "physical";
hostName = "crow";
};
in
mkNixOSConfig {
vars = updatedVars;
path = path;
extraModules = [ ./hosts/physical ];
};
2025-12-08 20:30:22 -05:00
# Additional modules for servers
# mkServerNixOSConfig = path: serverType:
# mkNixOSConfig {
# path = path;
# extraModules = [
# ./hosts/server
# ./nixos/roles/server/${serverType}
# ./nixos/modules/backup
# ];
# };
in {
# Format our nix files using alejandra
formatter = nixpkgs.lib.genAttrs systems (system: nixpkgs.legacyPackages.${system}.alejandra);
# Collection of all of our configs
2025-12-09 18:27:15 -05:00
nixosConfigurations = {
# =========== Desktops ===========
2025-12-11 23:39:49 +00:00
crow = mkPhysicalNixOSConfig ./hosts/physical/crow;
2025-12-09 18:27:15 -05:00
};
2025-12-07 22:57:38 -05:00
};
}