nixos/flake.nix

99 lines
2.5 KiB
Nix
Raw Normal View History

2024-12-18 18:19:37 -06:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
2024-12-18 18:19:37 -06:00
nixpkgsUnstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
home-manager = {
url = "github:nix-community/home-manager/release-25.05";
2024-12-18 18:19:37 -06:00
inputs.nixpkgs.follows = "nixpkgs";
};
agenix.url = "github:ryantm/agenix";
2025-06-18 08:09:09 -04:00
simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-25.05";
2024-12-18 18:19:37 -06:00
};
outputs =
2024-12-23 18:19:55 -06:00
inputs@{
2024-12-18 18:19:37 -06:00
nixpkgs,
nixpkgsUnstable,
home-manager,
nixos-hardware,
agenix,
simple-nixos-mailserver,
...
}:
let
system = "x86_64-linux";
overlayUnstable = final: prev: {
unstable = import nixpkgsUnstable {
inherit system;
config.allowUnfree = true;
2025-03-18 11:32:27 -05:00
config.android_sdk.accept_license = true;
2024-12-18 18:19:37 -06:00
};
};
2025-07-18 09:42:07 -04:00
# Common modules shared across all hosts
commonModules = [
agenix.nixosModules.default
{
environment.systemPackages = [ agenix.packages.${system}.default ];
}
(
{ config, pkgs, ... }:
{
nixpkgs.overlays = [ overlayUnstable ];
}
)
];
# Common home-manager modules
homeManagerModules = [
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
];
# Helper function to create a host configuration
mkHost =
{
hostPath,
extraModules ? [ ],
includeHomeManager ? true,
specialArgs ? { },
}:
nixpkgs.lib.nixosSystem {
inherit system specialArgs;
modules =
commonModules
++ (if includeHomeManager then homeManagerModules else [ ])
++ extraModules
++ [ hostPath ];
};
2024-12-18 18:19:37 -06:00
in
{
nixosConfigurations = {
2025-07-18 09:42:07 -04:00
nixbox = mkHost {
hostPath = ./hosts/nixbox;
2024-12-18 18:19:37 -06:00
};
2025-07-18 09:42:07 -04:00
flynode = mkHost {
hostPath = ./hosts/flynode;
extraModules = [ nixos-hardware.nixosModules.lenovo-thinkpad-z13-gen1 ];
2024-12-18 18:19:37 -06:00
};
2025-07-18 09:42:07 -04:00
thewordnerd = mkHost {
hostPath = ./hosts/hub;
extraModules = [ simple-nixos-mailserver.nixosModule ];
2024-12-23 18:19:55 -06:00
specialArgs = { inherit inputs; };
2024-12-18 18:19:37 -06:00
};
2025-07-18 09:42:07 -04:00
garden = mkHost {
hostPath = ./hosts/garden;
includeHomeManager = false;
2024-12-23 18:19:55 -06:00
specialArgs = { inherit inputs; };
2024-12-23 11:20:27 -06:00
};
2024-12-18 18:19:37 -06:00
};
};
}