Skip to content

Commit

Permalink
chore: update flops
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Apr 18, 2024
1 parent 0756d43 commit 3e73949
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 56 deletions.
2 changes: 1 addition & 1 deletion examples
16 changes: 8 additions & 8 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions local/lock/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

109 changes: 65 additions & 44 deletions src/pops/hive.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,76 @@
lib,
flops,
super,
root,
projectRoot,
}:
let
inherit (POP) pop;

genColmenaFromHosts = hosts: {
meta = {
nodes = lib.mapAttrs (hostName: hostConfig: {
inherit (hostConfig.meta.colmena) imports deployment;
}) hosts;
nodeNixpkgs = lib.mapAttrs (
hostName: hostConfig: (super.types.hive.colmena hostConfig.meta.colmena).nixpkgs
) hosts;
};
};
hosts = root.load { src = projectRoot + "/templates/nixos/units/nixos/hosts"; };
in
setHosts:
pop {
defaults = {
hosts = lib.mapAttrs (
hostName: hostConfig:
(hostConfig)
// {
meta = (hostConfig.meta or { }) // (removeAttrs hostConfig [ "meta" ]);
}
) setHosts;
pops = {
omnibus = { };
nixosProfiles = { };
nixosModules = { };
};
exports = {
hosts = { };
/*
bee = {
home = {};
nixpkgs = {};
nixos = {};
}
*/
(
setHosts:
pop {
defaults = {
hosts = lib.mapAttrs (
hostName: hostConfig:
(hostConfig)
// {
bee = (hostConfig.bee or { }) // (removeAttrs hostConfig [ "bee" ]);
}
) setHosts;
pops = {
omnibus = { };
nixosProfiles = { };
nixosModules = { };
};
exports = {
hosts = { };
};
};
};
extension = final: prev: {
colmena = genColmenaFromHosts (
lib.filterAttrs (n: v: v.meta ? "colmena") prev.hosts
);
addMapLoadToPops = load: { };
pops = { };
exports = {
hosts = lib.omnibus.mkHosts {
# hostsDir = projectRoot + "/units/nixos/hosts";
hostsDir = ./.;
pops = super.hostsInterface;
addLoadExtender = {
load = { };
extension = final: prev: {
colmena = final.genColmenaFromHosts (
lib.filterAttrs (n: v: v.bee ? "colmena") prev.hosts
);
genColmenaFromHosts = hosts: {
meta = {
nodes = lib.mapAttrs (hostName: hostConfig: {
inherit (hostConfig.bee.colmena) imports deployment;
}) hosts;
nodeNixpkgs = lib.mapAttrs (
hostName: hostConfig: (super.types.bee.colmena hostConfig.bee.colmena).nixpkgs
) hosts;
};
};
addMapLoadToPops = load: { };

nixosConfigurations = lib.mapAttrs (
hostName: hostConfig:
let
nixosConfiguration = hostConfig.bee.nixosConfiguration or { };
in
nixosConfiguration
) hosts;

pops = { };
exports = {
# hosts = lib.omnibus.mkHosts {
# # hostsDir = projectRoot + "/units/nixos/hosts";
# hostsDir = ./.;
# pops = super.hostsInterface;
# addLoadExtender = {
# load = { };
# };
# };
};
};
};
}
}
)
hosts
5 changes: 5 additions & 0 deletions templates/nixos/units/nixos/hosts/darwin/bee.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
colmena = {
nixpkgs = { };
};
}
5 changes: 5 additions & 0 deletions templates/nixos/units/nixos/hosts/nixos/bee.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
colmena = {
nixpkgs = { };
};
}

0 comments on commit 3e73949

Please sign in to comment.