network/flake.nix

56 lines
1.4 KiB
Nix
Raw Normal View History

2021-03-05 20:05:50 +01:00
{
description = "Zentralwerk network";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
2021-03-19 23:25:31 +01:00
zentralwerk-network-key.url = "git+https://gitea.c3d2.de/zentralwerk/network.git?dir=nix/key&ref=nix";
2021-03-05 20:05:50 +01:00
};
2021-03-19 23:25:31 +01:00
outputs = { self, nixpkgs, zentralwerk-network-key }:
2021-03-05 20:05:50 +01:00
let
system = "x86_64-linux";
systems = [ system ];
forAllSystems = nixpkgs.lib.genAttrs systems;
nixosConfig = name:
nixpkgs.lib.nixosSystem {
inherit system;
modules = [ self.nixosModule ];
extraModules = [ ({ ... }: {
networking.hostName = name;
}) ];
};
2021-03-05 20:05:50 +01:00
in
rec {
2021-03-19 01:41:12 +01:00
lib =
2021-03-19 23:25:31 +01:00
import ./nix/lib {
inherit self nixpkgs;
2021-03-19 23:25:31 +01:00
inherit (zentralwerk-network-key.lib) gpgKey;
};
2021-03-05 20:05:50 +01:00
packages = forAllSystems (system:
import ./nix/pkgs { inherit self nixpkgs system; }
);
2021-03-05 20:05:50 +01:00
nixosModule = { ... }: {
2021-03-19 22:55:48 +01:00
imports = [ ./nix/nixos-module ];
2021-03-05 20:05:50 +01:00
};
nixosConfigurations =
builtins.mapAttrs (hostName: _: nixosConfig hostName) (
nixpkgs.lib.filterAttrs (_: { role, ... }:
builtins.elem role [ "server" "container" ]
) lib.config.site.hosts
);
2021-03-05 20:05:50 +01:00
# nixosConfigurations.test_vm =
# nixpkgs.lib.nixosSystem {
# inherit system;
# modules = [ nixosModule ];
# extraModules = [ ({ ... }: {
# networking.hostName = "test_vm";
# }) ];
# };
2021-03-05 20:05:50 +01:00
};
}