2021-06-05 23:59:06 +03:00
|
|
|
{
|
|
|
|
description = "Private Void system configurations";
|
|
|
|
|
|
|
|
inputs = {
|
2021-12-02 21:52:45 +02:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
|
2021-06-05 23:59:06 +03:00
|
|
|
|
2022-02-26 02:13:42 +02:00
|
|
|
nix-super.url = "git+https://git.privatevoid.net/max/nix-super-fork";
|
|
|
|
nix-super.inputs.nixpkgs.follows = "nixpkgs";
|
2021-06-05 23:59:06 +03:00
|
|
|
|
|
|
|
home-manager.url = "github:nix-community/home-manager/master";
|
|
|
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
2021-11-25 21:09:15 +02:00
|
|
|
deploy-rs.url = "git+https://git.privatevoid.net/max/deploy-rs";
|
2021-06-05 23:59:06 +03:00
|
|
|
|
|
|
|
agenix.url = "github:ryantm/agenix";
|
|
|
|
agenix.inputs.nixpkgs.follows = "nixpkgs";
|
2021-10-16 21:24:25 +03:00
|
|
|
|
2021-12-11 17:00:09 +02:00
|
|
|
nar-serve.url = "github:numtide/nar-serve/v0.5.0";
|
2021-10-16 21:24:25 +03:00
|
|
|
nar-serve.inputs.nixpkgs.follows = "nixpkgs";
|
2022-01-11 21:58:10 +02:00
|
|
|
|
|
|
|
dream2nix.url = "github:nix-community/dream2nix";
|
|
|
|
dream2nix.inputs.nixpkgs.follows = "nixpkgs";
|
2022-03-21 21:50:15 +02:00
|
|
|
|
|
|
|
devshell.url = "github:numtide/devshell";
|
|
|
|
devshell.inputs.nixpkgs.follows = "nixpkgs";
|
2022-03-25 20:42:03 +02:00
|
|
|
|
|
|
|
mms.url = "github:mkaito/nixos-modded-minecraft-servers";
|
|
|
|
mms.inputs.nixpkgs.follows = "nixpkgs";
|
2022-03-29 23:53:19 +03:00
|
|
|
|
|
|
|
hercules-ci-agent.url = "github:hercules-ci/hercules-ci-agent";
|
2021-06-05 23:59:06 +03:00
|
|
|
};
|
|
|
|
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
|
|
|
let
|
2022-02-03 21:20:59 +02:00
|
|
|
systems = [ "x86_64-linux" "aarch64-linux" ];
|
|
|
|
|
|
|
|
forSystems = nixpkgs.lib.genAttrs systems;
|
|
|
|
|
|
|
|
nixpkgsFor = system: import nixpkgs {
|
2021-06-05 23:59:06 +03:00
|
|
|
inherit system;
|
|
|
|
};
|
|
|
|
|
2022-02-03 21:20:59 +02:00
|
|
|
inherit (nixpkgs) lib;
|
2021-06-05 23:59:06 +03:00
|
|
|
|
|
|
|
aspect = import ./modules inputs;
|
|
|
|
hosts = import ./hosts;
|
2022-02-03 21:20:59 +02:00
|
|
|
|
|
|
|
nixosHosts' = lib.filterAttrs (_: host: host ? nixos) hosts;
|
|
|
|
|
|
|
|
nixosHosts = lib.attrNames nixosHosts';
|
|
|
|
|
|
|
|
meta = import ./tools/meta.nix;
|
|
|
|
|
2021-10-16 18:00:47 +03:00
|
|
|
specialArgs = {
|
|
|
|
inherit inputs hosts aspect;
|
|
|
|
toolsets = import ./tools;
|
|
|
|
};
|
2022-02-03 21:20:59 +02:00
|
|
|
mkNixOS' = lib: name: let host = hosts.${name}; in lib.nixosSystem {
|
2021-06-05 23:59:06 +03:00
|
|
|
inherit specialArgs;
|
2022-02-03 21:20:59 +02:00
|
|
|
system = "${host.arch}-linux";
|
|
|
|
modules = [ host.nixos ./tools/inject.nix ];
|
2021-06-05 23:59:06 +03:00
|
|
|
};
|
|
|
|
mkNixOS = mkNixOS' lib;
|
2022-02-03 21:20:59 +02:00
|
|
|
|
|
|
|
mkDeploy = name: let
|
|
|
|
host = hosts.${name};
|
|
|
|
subdomain = host.enterprise.subdomain or "services";
|
|
|
|
deploy-rs = inputs.deploy-rs.lib."${host.arch}-linux";
|
|
|
|
in {
|
|
|
|
hostname = "${lib.toLower name}.${subdomain}.${meta.domain}";
|
|
|
|
profiles.system = {
|
|
|
|
user = "root";
|
|
|
|
sshUser = "deploy";
|
|
|
|
path = deploy-rs.activate.nixos self.nixosConfigurations.${name};
|
2021-10-16 19:34:11 +03:00
|
|
|
};
|
2021-06-05 23:59:06 +03:00
|
|
|
};
|
|
|
|
|
2022-02-03 21:20:59 +02:00
|
|
|
mkDeployments = hosts: overrides: lib.genAttrs hosts
|
|
|
|
(host: mkDeploy host // (overrides.${host} or {}) );
|
2021-06-05 23:59:06 +03:00
|
|
|
|
2022-03-14 00:13:53 +02:00
|
|
|
depot = forSystems (system: import ./packages {
|
|
|
|
inherit inputs;
|
|
|
|
pkgs = nixpkgsFor system;
|
|
|
|
});
|
|
|
|
|
2022-02-03 21:20:59 +02:00
|
|
|
in {
|
|
|
|
nixosModules = aspect.modules;
|
2022-01-11 21:58:10 +02:00
|
|
|
|
2022-02-03 21:20:59 +02:00
|
|
|
nixosConfigurations = lib.genAttrs nixosHosts mkNixOS;
|
|
|
|
|
|
|
|
deploy.nodes = mkDeployments nixosHosts {};
|
|
|
|
|
|
|
|
apps = forSystems (system: {
|
|
|
|
dream2nix = inputs.dream2nix.defaultApp.${system};
|
|
|
|
});
|
2021-06-05 23:59:06 +03:00
|
|
|
|
2022-03-14 00:13:53 +02:00
|
|
|
packages = forSystems (system: depot.${system}.packages);
|
|
|
|
|
|
|
|
devShells = forSystems (system: depot.${system}.devShells);
|
|
|
|
|
2021-06-05 23:59:06 +03:00
|
|
|
hydraJobs = {
|
2022-02-03 21:20:59 +02:00
|
|
|
systems = lib.mapAttrs (_: x: x.config.system.build.toplevel) self.nixosConfigurations;
|
2022-03-13 00:16:38 +02:00
|
|
|
inherit (self) packages;
|
2021-06-05 23:59:06 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|