treewide: pipe /modules through flake-parts

This commit is contained in:
Max Headroom 2023-01-31 22:59:53 +01:00
parent 1f1c0554a6
commit be919cb2b3
9 changed files with 91 additions and 91 deletions

View file

@ -1,4 +1,4 @@
{ aspect, config, inputs, lib, pkgs, tools, ... }: { config, depot, inputs, lib, pkgs, tools, ... }:
let let
inherit (tools.meta) domain; inherit (tools.meta) domain;
@ -11,7 +11,7 @@ let
proxySocket = "/run/ipfs-cluster/ipfs-api-proxy.sock"; proxySocket = "/run/ipfs-cluster/ipfs-api-proxy.sock";
in { in {
imports = [ imports = [
aspect.modules.ipfs-cluster depot.nixosModules.ipfs-cluster
]; ];
age.secrets = { age.secrets = {

View file

@ -1,4 +1,4 @@
{ aspect, cluster, config, inputs, lib, hosts, pkgs, tools, ... }: { cluster, config, depot, inputs, lib, hosts, pkgs, tools, ... }:
let let
inherit (tools.meta) domain; inherit (tools.meta) domain;
cfg = config.services.ipfs; cfg = config.services.ipfs;
@ -9,7 +9,7 @@ let
in in
{ {
imports = [ imports = [
aspect.modules.ipfs depot.nixosModules.ipfs
]; ];
links.ipfsGateway.protocol = "http"; links.ipfsGateway.protocol = "http";

View file

@ -1,4 +1,4 @@
{ aspect, cluster, config, lib, pkgs, ... }: { cluster, config, depot, lib, pkgs, ... }:
let let
inherit (cluster.config) vars; inherit (cluster.config) vars;
@ -14,7 +14,7 @@ in
{ {
imports = [ imports = [
aspect.modules.patroni depot.nixosModules.patroni
]; ];
age.secrets = lib.mapAttrs (_: file: { age.secrets = lib.mapAttrs (_: file: {

View file

@ -14,7 +14,6 @@
inherit (nixpkgs) lib; inherit (nixpkgs) lib;
aspect = import ./modules inputs;
hosts = import ./hosts; hosts = import ./hosts;
nixosHosts' = lib.filterAttrs (_: host: host ? nixos) hosts; nixosHosts' = lib.filterAttrs (_: host: host ? nixos) hosts;
@ -28,7 +27,8 @@
meta = import ./tools/meta.nix; meta = import ./tools/meta.nix;
specialArgs = { specialArgs = {
inherit inputs hosts aspect; inherit inputs hosts;
depot = inputs.self;
toolsets = import ./tools; toolsets = import ./tools;
}; };
mkNixOS' = lib: name: let host = hosts.${name}; in lib.nixosSystem { mkNixOS' = lib: name: let host = hosts.${name}; in lib.nixosSystem {
@ -78,8 +78,6 @@
in flake-parts.lib.mkFlake { inherit inputs; } { in flake-parts.lib.mkFlake { inherit inputs; } {
inherit systems; inherit systems;
flake = { flake = {
nixosModules = aspect.modules;
nixosConfigurations = lib.genAttrs nixosHosts mkNixOS; nixosConfigurations = lib.genAttrs nixosHosts mkNixOS;
deploy.nodes = mkDeployments deployableNixosHosts {}; deploy.nodes = mkDeployments deployableNixosHosts {};
@ -89,6 +87,7 @@
imports = [ imports = [
inputs.drv-parts.flakeModule inputs.drv-parts.flakeModule
inputs.dream2nix.flakeModuleBeta inputs.dream2nix.flakeModuleBeta
./modules/part.nix
./packages/part.nix ./packages/part.nix
]; ];
}; };

View file

@ -1,4 +1,4 @@
{ aspect, config, hosts, inputs, tools, ... }: { config, depot, hosts, inputs, tools, ... }:
{ {
imports = imports =
@ -40,12 +40,13 @@
./services/warehouse ./services/warehouse
./services/websites ./services/websites
./services/wireguard-server ./services/wireguard-server
aspect.modules.hyprspace depot.nixosModules.hyprspace
aspect.modules.nix-builder depot.nixosModules.nix-builder
]
depot.nixosModules.backboneBase
];
# TODO: fix users # TODO: fix users
# ++ (import ../../users "server").groups.admin # ++ (import ../../users "server").groups.admin
++ aspect.sets.backbone;
# Use the GRUB 2 boot loader. # Use the GRUB 2 boot loader.
boot.loader.grub.enable = true; boot.loader.grub.enable = true;

View file

@ -1,4 +1,4 @@
{ aspect, inputs, hosts, ... }: { inputs, depot, hosts, ... }:
{ {
imports = imports =
@ -8,13 +8,12 @@
inputs.agenix.nixosModules.age inputs.agenix.nixosModules.age
aspect.modules.hyprspace depot.nixosModules.hyprspace
aspect.modules.nix-builder depot.nixosModules.nix-builder
aspect.modules.sss depot.nixosModules.sss
depot.nixosModules.serverBase
] ];
++ aspect.sets.server;
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;

View file

@ -1,12 +1,12 @@
{ aspect, hosts, ... }: { depot, hosts, ... }:
{ {
imports = with aspect; [ imports = with depot.nixosModules; [
modules.fail2ban containerBase
modules.nix-config-server fail2ban
modules.sss sss
./soda.nix ./soda.nix
] ++ sets.base ++ sets.networking; ];
boot.isContainer = true; boot.isContainer = true;

View file

@ -1,63 +0,0 @@
inputs:
with builtins;
let
aspects = {
autopatch = import ./autopatch;
consul-service-registry = import ./consul-service-registry;
deploy-rs-receiver = import ./deploy-rs-receiver;
enterprise = import ./enterprise;
fail2ban = import ./fail2ban;
hydra = import ./hydra;
hyprspace = import ./hyprspace;
ipfs = import ./ipfs;
ipfs-cluster = import ./ipfs-cluster;
maintenance = import ./maintenance;
minimal = import ./minimal;
motd = import ./motd;
nix-builder = import ./nix-builder;
nix-config-server = import ./nix-config/server.nix;
nix-register-flakes = import ./nix-register-flakes;
patroni = import ./patroni;
port-magic = import ./port-magic;
shell-config = import ./shell-config;
ssh = import ./ssh;
sss = import ./sss;
system-info = import ./system-info;
system-recovery = import ./system-recovery;
tested = import ./tested;
};
in rec {
modules = aspects;
sets = with modules; rec {
base = [
autopatch
enterprise
maintenance
minimal
];
networking = [
port-magic
ssh
];
server = [
consul-service-registry
deploy-rs-receiver
fail2ban
motd
nix-config-server
system-info
system-recovery
tested
] ++ base ++ networking;
container = [
nix-config-server
] ++ base ++ networking;
backbone = server ++ [
sss
];
};
}

64
modules/part.nix Normal file
View file

@ -0,0 +1,64 @@
{ config, ... }:
let
group = imports: { inherit imports; };
in
{
flake.nixosModules = with config.flake.nixosModules; {
autopatch = ./autopatch;
consul-service-registry = ./consul-service-registry;
deploy-rs-receiver = ./deploy-rs-receiver;
enterprise = ./enterprise;
fail2ban = ./fail2ban;
hydra = ./hydra;
hyprspace = ./hyprspace;
ipfs = ./ipfs;
ipfs-cluster = ./ipfs-cluster;
maintenance = ./maintenance;
minimal = ./minimal;
motd = ./motd;
nix-builder = ./nix-builder;
nix-config-server = ./nix-config/server.nix;
nix-register-flakes = ./nix-register-flakes;
patroni = ./patroni;
port-magic = ./port-magic;
shell-config = ./shell-config;
ssh = ./ssh;
sss = ./sss;
system-info = ./system-info;
system-recovery = ./system-recovery;
tested = ./tested;
machineBase = group [
autopatch
enterprise
maintenance
minimal
port-magic
ssh
];
serverBase = group [
machineBase
consul-service-registry
deploy-rs-receiver
fail2ban
motd
nix-config-server
system-info
system-recovery
tested
];
containerBase = group [
machineBase
nix-config-server
];
backboneBase = group [
serverBase
sss
];
};
}