2024-12-18 18:19:37 -06:00
|
|
|
{
|
|
|
|
inputs = {
|
2025-05-20 10:23:23 -05:00
|
|
|
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 = {
|
2025-05-20 10:23:23 -05:00
|
|
|
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";
|
2025-07-18 10:28:34 -04:00
|
|
|
git-hooks = {
|
|
|
|
url = "github:cachix/git-hooks.nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
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,
|
2025-07-18 10:28:34 -04:00
|
|
|
git-hooks,
|
2024-12-18 18:19:37 -06:00
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
system = "x86_64-linux";
|
2025-07-18 10:28:34 -04:00
|
|
|
overlayUnstable = _final: _prev: {
|
2024-12-18 18:19:37 -06:00
|
|
|
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 ];
|
|
|
|
}
|
2025-07-18 10:28:34 -04:00
|
|
|
{
|
|
|
|
nixpkgs.overlays = [ overlayUnstable ];
|
|
|
|
}
|
2025-07-18 09:42:07 -04:00
|
|
|
];
|
|
|
|
|
|
|
|
# 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
|
2025-07-18 10:28:34 -04:00
|
|
|
rec {
|
2024-12-18 18:19:37 -06:00
|
|
|
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
|
|
|
};
|
2025-07-18 10:28:34 -04:00
|
|
|
|
|
|
|
checks.${system} = {
|
|
|
|
pre-commit-check = git-hooks.lib.${system}.run {
|
|
|
|
src = ./.;
|
|
|
|
hooks = {
|
|
|
|
# Check formatting of flake.nix
|
|
|
|
nixfmt-rfc-style = {
|
|
|
|
enable = true;
|
|
|
|
files = "^flake\\.nix$";
|
|
|
|
};
|
|
|
|
# Check for dead code in flake.nix
|
|
|
|
deadnix = {
|
|
|
|
enable = true;
|
|
|
|
files = "^flake\\.nix$";
|
|
|
|
};
|
|
|
|
# Flake-specific checks
|
|
|
|
flake-checker.enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
devShells.${system}.default =
|
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
in
|
|
|
|
pkgs.mkShell {
|
|
|
|
inherit (checks.${system}.pre-commit-check) shellHook;
|
|
|
|
buildInputs = checks.${system}.pre-commit-check.enabledPackages;
|
|
|
|
};
|
2024-12-18 18:19:37 -06:00
|
|
|
};
|
|
|
|
}
|