2024-08-16 10:36:55 -04:00
|
|
|
{
|
|
|
|
|
description = "NixOS config";
|
|
|
|
|
|
|
|
|
|
inputs = {
|
2024-10-04 20:07:34 -04:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
|
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
|
2024-08-23 14:52:05 -04:00
|
|
|
home-manager = {
|
2024-10-04 20:07:34 -04:00
|
|
|
url = "github:nix-community/home-manager";
|
2024-08-23 14:52:05 -04:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
2024-10-22 21:40:59 -04:00
|
|
|
flake-programs-sqlite = {
|
|
|
|
|
url = "github:wamserma/flake-programs-sqlite";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
2024-08-16 10:36:55 -04:00
|
|
|
};
|
|
|
|
|
|
2024-10-22 21:40:59 -04:00
|
|
|
outputs = { nixpkgs, nixpkgs-stable, home-manager, flake-programs-sqlite, ... }@inputs:
|
2024-10-11 00:51:53 -04:00
|
|
|
let
|
2024-08-16 10:36:55 -04:00
|
|
|
system = "x86_64-linux";
|
2024-10-11 00:51:53 -04:00
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
2024-10-17 23:01:00 -04:00
|
|
|
pkgs-stable = nixpkgs-stable.legacyPackages.${system};
|
2024-10-27 02:36:51 -04:00
|
|
|
in with builtins; with nixpkgs.lib.attrsets; {
|
|
|
|
|
nixosConfigurations = mapAttrs' (host: _: {
|
|
|
|
|
name = host;
|
|
|
|
|
value = nixpkgs.lib.nixosSystem {
|
2024-10-24 17:40:50 -04:00
|
|
|
inherit system;
|
2024-10-27 02:36:51 -04:00
|
|
|
specialArgs = {
|
|
|
|
|
inherit pkgs-stable;
|
|
|
|
|
inherit flake-programs-sqlite;
|
|
|
|
|
};
|
|
|
|
|
modules = [ (./hosts + "/${host}") ];
|
2024-10-24 17:40:50 -04:00
|
|
|
};
|
2024-10-27 02:36:51 -04:00
|
|
|
}) (readDir ./hosts);
|
|
|
|
|
homeConfigurations = foldl' (a: b: a//b) {} (map (host: let users = ./hosts + "/${host}/users"; in
|
|
|
|
|
if pathExists users
|
|
|
|
|
then mapAttrs' (user: _: {
|
|
|
|
|
name = "${user}@${host}";
|
|
|
|
|
value = home-manager.lib.homeManagerConfiguration {
|
|
|
|
|
inherit pkgs;
|
|
|
|
|
extraSpecialArgs = {
|
|
|
|
|
inherit pkgs-stable;
|
|
|
|
|
};
|
|
|
|
|
modules = [ (users + "/${user}") ];
|
|
|
|
|
};}) (readDir users)
|
|
|
|
|
else {}
|
|
|
|
|
) (attrNames (readDir ./hosts)));
|
2024-08-16 10:36:55 -04:00
|
|
|
};
|
|
|
|
|
}
|