nixos/flake.nix
2025-12-08 20:30:22 -05:00

81 lines
1.9 KiB
Nix

{
description = "Nest's Flake";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
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 ? [],
}:
nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs outputs vars;
};
modules = [
./nixos/common
path
]
++ extraModules;
};
# Additional modules for physical hosts
mkPhysicalNixOSConfig = path:
mkNixOSConfig {
path = path;
extraModules = [ ./hosts/physical ];
};
# 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
# =========== Desktops ===========
crow = mkPhysicalNixOSConfig ./hosts/physical/crow;
# nixosConfigurations.crow = nixpkgs.lib.nixosSystem {
# system = "x86_64-linux";
# modules = [
# ./configuration.nix
# home-manager.nixosModules.home-manager {
# home-manager = {
# useGlobalPkgs = true;
# useUserPackages = true;
# users.nest = import ./home.nix;
# backupFileExtension = "backup";
# };
# }
# ];
# };
};
}