2022-04-23 03:01:58 +02:00
|
|
|
{
|
2023-10-28 16:33:27 +02:00
|
|
|
nixConfig = {
|
|
|
|
extra-substituters = [ "https://nix-cache.hq.c3d2.de" ];
|
|
|
|
extra-trusted-public-keys = [ "nix-cache.hq.c3d2.de:KZRGGnwOYzys6pxgM8jlur36RmkJQ/y8y62e52fj1ps=" ];
|
|
|
|
};
|
|
|
|
|
2022-04-23 13:41:36 +02:00
|
|
|
inputs = {
|
2023-05-26 16:18:59 +02:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
|
2023-03-04 23:59:22 +01:00
|
|
|
|
|
|
|
# naersk and flake utils are not used by this flake directly, but needed
|
|
|
|
# for the follows in all the other ones.
|
|
|
|
naersk = {
|
|
|
|
url = "github:nix-community/naersk";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
|
2023-03-17 19:51:49 +01:00
|
|
|
# DO NOT remame this to utils
|
2023-05-26 21:50:07 +02:00
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2023-03-16 22:55:12 +01:00
|
|
|
|
2022-05-14 22:47:54 +02:00
|
|
|
microvm = {
|
2023-06-14 18:32:00 +02:00
|
|
|
url = "github:astro/microvm.nix";
|
2022-06-06 22:41:04 +02:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2023-03-17 19:51:49 +01:00
|
|
|
inputs.flake-utils.follows = "flake-utils";
|
2022-05-14 22:47:54 +02:00
|
|
|
};
|
|
|
|
|
2022-05-31 18:56:43 +02:00
|
|
|
sops-nix = {
|
2023-02-19 22:28:44 +01:00
|
|
|
url = "github:Mic92/sops-nix";
|
2022-05-31 18:56:43 +02:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2022-10-04 20:31:27 +02:00
|
|
|
|
2023-03-05 14:07:31 +01:00
|
|
|
## TLMS stuff below
|
2022-10-04 20:31:27 +02:00
|
|
|
documentation-src = {
|
2023-02-19 22:28:44 +01:00
|
|
|
url = "github:tlm-solutions/documentation";
|
2022-10-04 20:31:27 +02:00
|
|
|
flake = false;
|
|
|
|
};
|
2023-02-15 11:17:36 +01:00
|
|
|
|
|
|
|
trekkie = {
|
|
|
|
url = "github:tlm-solutions/trekkie";
|
2023-03-04 23:59:22 +01:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
|
|
|
naersk.follows = "naersk";
|
2023-03-05 14:07:31 +01:00
|
|
|
tlms-rs.follows = "tlms-rs";
|
2023-03-17 19:51:49 +01:00
|
|
|
utils.follows = "flake-utils";
|
2023-03-04 23:59:22 +01:00
|
|
|
};
|
2023-02-15 11:17:36 +01:00
|
|
|
};
|
2023-02-19 22:28:44 +01:00
|
|
|
|
|
|
|
datacare = {
|
|
|
|
url = "github:tlm-solutions/datacare";
|
|
|
|
};
|
2023-02-24 14:25:30 +01:00
|
|
|
|
2023-10-14 15:25:29 +02:00
|
|
|
kindergarten = {
|
|
|
|
url = "github:tlm-solutions/kindergarten";
|
2023-10-27 22:45:54 +02:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
|
|
|
flake-utils.follows = "flake-utils";
|
|
|
|
};
|
2023-10-14 15:25:29 +02:00
|
|
|
};
|
|
|
|
|
2023-03-05 00:00:05 +01:00
|
|
|
telegram-decoder = {
|
|
|
|
url = "github:tlm-solutions/telegram-decoder";
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
|
|
|
naersk.follows = "naersk";
|
2023-03-17 19:51:49 +01:00
|
|
|
utils.follows = "flake-utils";
|
2023-03-05 00:00:05 +01:00
|
|
|
};
|
|
|
|
};
|
2023-03-05 14:07:31 +01:00
|
|
|
|
|
|
|
gnuradio-decoder = {
|
|
|
|
url = "github:tlm-solutions/gnuradio-decoder";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2023-03-17 19:51:49 +01:00
|
|
|
inputs.utils.follows = "flake-utils";
|
2023-03-05 14:07:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
data-accumulator = {
|
|
|
|
url = "github:tlm-solutions/data-accumulator";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.naersk.follows = "naersk";
|
2023-03-17 19:51:49 +01:00
|
|
|
inputs.utils.follows = "flake-utils";
|
2023-03-05 14:07:31 +01:00
|
|
|
};
|
|
|
|
|
2023-04-12 17:20:07 +02:00
|
|
|
lizard = {
|
|
|
|
url = "github:tlm-solutions/lizard";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.utils.follows = "flake-utils";
|
|
|
|
};
|
|
|
|
|
|
|
|
bureaucrat = {
|
|
|
|
url = "github:tlm-solutions/bureaucrat";
|
2023-03-05 14:07:31 +01:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2023-03-17 19:51:49 +01:00
|
|
|
inputs.utils.follows = "flake-utils";
|
2023-03-05 14:07:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
funnel = {
|
|
|
|
url = "github:tlm-solutions/funnel";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
2023-03-17 19:51:49 +01:00
|
|
|
inputs.utils.follows = "flake-utils";
|
2023-03-05 14:07:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
tlms-rs = {
|
|
|
|
url = "github:tlm-solutions/tlms.rs";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-03-20 03:56:14 +01:00
|
|
|
|
|
|
|
chemo = {
|
|
|
|
url = "github:tlm-solutions/chemo";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2023-05-19 19:08:52 +02:00
|
|
|
borzoi = {
|
|
|
|
url = "github:tlm-solutions/borzoi";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2022-04-28 14:43:40 +02:00
|
|
|
};
|
2022-04-23 13:41:36 +02:00
|
|
|
|
2022-07-06 20:58:15 +02:00
|
|
|
outputs =
|
|
|
|
inputs@{ self
|
2023-05-19 19:08:52 +02:00
|
|
|
, borzoi
|
2023-03-05 14:07:31 +01:00
|
|
|
, data-accumulator
|
2023-02-19 22:28:44 +01:00
|
|
|
, datacare
|
2023-03-05 14:07:31 +01:00
|
|
|
, documentation-src
|
|
|
|
, funnel
|
|
|
|
, gnuradio-decoder
|
2023-10-14 15:25:29 +02:00
|
|
|
, kindergarten
|
2022-07-06 20:58:15 +02:00
|
|
|
, microvm
|
2022-07-06 22:12:28 +02:00
|
|
|
, nixpkgs
|
2022-07-06 20:58:15 +02:00
|
|
|
, sops-nix
|
2023-04-12 17:20:07 +02:00
|
|
|
, lizard
|
|
|
|
, bureaucrat
|
2023-03-05 14:07:31 +01:00
|
|
|
, telegram-decoder
|
2023-02-15 11:17:36 +01:00
|
|
|
, trekkie
|
2023-03-20 03:56:14 +01:00
|
|
|
, chemo
|
2022-07-06 20:58:15 +02:00
|
|
|
, ...
|
|
|
|
}:
|
2022-04-30 23:41:24 +02:00
|
|
|
let
|
2022-05-14 01:33:50 +02:00
|
|
|
pkgs = nixpkgs.legacyPackages."x86_64-linux";
|
|
|
|
lib = pkgs.lib;
|
2022-05-28 06:12:39 +02:00
|
|
|
|
2022-10-02 20:49:31 +02:00
|
|
|
|
2022-05-28 21:24:15 +02:00
|
|
|
data-hoarder-modules = [
|
2022-07-07 15:55:50 +02:00
|
|
|
./modules/data-hoarder
|
2022-12-30 18:29:13 +01:00
|
|
|
./modules/TLMS
|
2023-03-05 14:07:31 +01:00
|
|
|
data-accumulator.nixosModules.default
|
2023-02-19 22:28:44 +01:00
|
|
|
datacare.nixosModules.default
|
2023-03-05 14:07:31 +01:00
|
|
|
funnel.nixosModules.default
|
|
|
|
sops-nix.nixosModules.sops
|
2023-04-12 17:20:07 +02:00
|
|
|
lizard.nixosModules.default
|
|
|
|
bureaucrat.nixosModules.default
|
2023-02-15 11:17:36 +01:00
|
|
|
trekkie.nixosModules.default
|
2023-03-20 03:56:14 +01:00
|
|
|
chemo.nixosModules.default
|
2022-05-28 21:24:15 +02:00
|
|
|
{
|
|
|
|
nixpkgs.overlays = [
|
2023-02-19 22:28:44 +01:00
|
|
|
datacare.overlays.default
|
2023-10-14 15:25:29 +02:00
|
|
|
kindergarten.overlays.default
|
2023-02-15 11:17:36 +01:00
|
|
|
trekkie.overlays.default
|
2023-04-12 17:20:07 +02:00
|
|
|
lizard.overlays.default
|
|
|
|
bureaucrat.overlays.default
|
2023-03-05 14:07:31 +01:00
|
|
|
funnel.overlays.default
|
|
|
|
data-accumulator.overlays.default
|
2023-03-20 03:56:14 +01:00
|
|
|
chemo.overlays.default
|
2022-10-02 22:14:34 +02:00
|
|
|
(final: prev: {
|
2022-10-04 20:31:27 +02:00
|
|
|
inherit documentation-src;
|
2022-09-03 22:14:43 +02:00
|
|
|
options-docs = (pkgs.nixosOptionsDoc {
|
2022-12-30 18:29:13 +01:00
|
|
|
options = self.nixosConfigurations.data-hoarder.options.TLMS;
|
2022-09-03 22:14:43 +02:00
|
|
|
}).optionsCommonMark;
|
|
|
|
})
|
2022-05-28 21:24:15 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
2022-05-28 06:12:39 +02:00
|
|
|
|
2022-09-23 17:26:27 +02:00
|
|
|
stop-box-modules = [
|
2023-03-05 14:07:31 +01:00
|
|
|
./modules/TLMS
|
|
|
|
telegram-decoder.nixosModules.default
|
|
|
|
gnuradio-decoder.nixosModules.default
|
2022-09-27 01:01:20 +02:00
|
|
|
{
|
|
|
|
nixpkgs.overlays = [
|
2023-03-05 14:07:31 +01:00
|
|
|
telegram-decoder.overlays.default
|
|
|
|
gnuradio-decoder.overlays.default
|
2022-09-27 01:01:20 +02:00
|
|
|
];
|
|
|
|
}
|
2022-09-23 17:26:27 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
# function that generates a system with the given number
|
2023-05-05 21:00:24 +02:00
|
|
|
generate_system = (id: arch: monitoring:
|
2022-09-23 17:26:27 +02:00
|
|
|
{
|
2023-05-05 21:00:24 +02:00
|
|
|
"traffic-stop-box-${toString id}" = nixpkgs.lib.nixosSystem
|
|
|
|
{
|
|
|
|
system = arch;
|
|
|
|
specialArgs = inputs;
|
|
|
|
modules =
|
|
|
|
let
|
|
|
|
monitoring-mod =
|
|
|
|
if monitoring
|
|
|
|
then { deployment-TLMS.monitoring.enable = true; }
|
|
|
|
else { deployment-TLMS.monitoring.enable = false; };
|
|
|
|
in
|
|
|
|
[
|
|
|
|
# box-specific config
|
|
|
|
./hosts/traffic-stop-box/${toString id}
|
|
|
|
|
|
|
|
# default modules
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
./modules/traffic-stop-box
|
|
|
|
./modules/TLMS
|
|
|
|
{
|
|
|
|
deployment-TLMS.systemNumber = id;
|
|
|
|
}
|
|
|
|
monitoring-mod
|
|
|
|
] ++ stop-box-modules;
|
|
|
|
};
|
2022-04-30 23:41:24 +02:00
|
|
|
}
|
2022-04-28 14:43:40 +02:00
|
|
|
);
|
|
|
|
|
2022-08-22 18:51:00 +02:00
|
|
|
id_list = [
|
2022-08-24 18:48:33 +02:00
|
|
|
{
|
|
|
|
# Barkhausen Bau
|
2022-08-22 18:51:00 +02:00
|
|
|
id = 0;
|
|
|
|
arch = "x86_64-linux";
|
2023-05-05 21:00:24 +02:00
|
|
|
monitoring = true;
|
2022-08-22 18:51:00 +02:00
|
|
|
}
|
2022-08-24 18:48:33 +02:00
|
|
|
{
|
|
|
|
# Zentralwerk
|
2022-08-22 18:51:00 +02:00
|
|
|
id = 1;
|
|
|
|
arch = "x86_64-linux";
|
2023-05-05 21:00:24 +02:00
|
|
|
monitoring = true;
|
2022-08-22 18:51:00 +02:00
|
|
|
}
|
2022-08-30 16:55:40 +02:00
|
|
|
{
|
|
|
|
# Wundstr. 9
|
|
|
|
id = 4;
|
|
|
|
arch = "x86_64-linux";
|
2023-05-05 21:00:24 +02:00
|
|
|
monitoring = true;
|
2022-08-30 16:55:40 +02:00
|
|
|
}
|
2023-08-30 19:25:56 +02:00
|
|
|
{
|
2023-10-29 00:48:55 +02:00
|
|
|
# Hannover Bredero Hochhaus City
|
2023-08-30 19:25:56 +02:00
|
|
|
id = 8;
|
2023-10-14 15:25:29 +02:00
|
|
|
arch = "aarch64-linux";
|
2023-08-30 19:25:56 +02:00
|
|
|
monitoring = false;
|
|
|
|
}
|
2023-10-29 00:48:55 +02:00
|
|
|
{
|
|
|
|
# Hannover Bredero Hochhaus Wider Area
|
|
|
|
id = 9;
|
|
|
|
arch = "aarch64-linux";
|
|
|
|
monitoring = false;
|
|
|
|
}
|
2022-08-22 18:51:00 +02:00
|
|
|
];
|
2022-05-30 20:50:18 +02:00
|
|
|
|
2022-04-30 23:41:24 +02:00
|
|
|
# attribute set of all traffic stop boxes
|
2023-05-05 21:00:24 +02:00
|
|
|
stop_boxes = nixpkgs.lib.foldl (x: y: nixpkgs.lib.mergeAttrs x (generate_system y.id y.arch y.monitoring)) { } id_list;
|
2022-05-14 20:47:17 +02:00
|
|
|
|
2022-05-29 01:57:24 +02:00
|
|
|
packages = {
|
2022-05-28 21:24:15 +02:00
|
|
|
staging-microvm = self.nixosConfigurations.staging-data-hoarder.config.microvm.declaredRunner;
|
2023-05-01 05:51:43 +02:00
|
|
|
borken-microvm = self.nixosConfigurations.borken-data-hoarder.config.microvm.declaredRunner;
|
2022-08-22 18:51:00 +02:00
|
|
|
data-hoarder-microvm = self.nixosConfigurations.data-hoarder.config.microvm.declaredRunner;
|
2022-09-04 15:06:02 +02:00
|
|
|
docs = pkgs.callPackage ./pkgs/documentation.nix {
|
2022-10-04 20:31:27 +02:00
|
|
|
inherit documentation-src;
|
2022-09-04 15:06:02 +02:00
|
|
|
options-docs = (pkgs.nixosOptionsDoc {
|
2022-12-30 18:29:13 +01:00
|
|
|
options = self.nixosConfigurations.data-hoarder.options.TLMS;
|
2022-09-04 15:06:02 +02:00
|
|
|
}).optionsCommonMark;
|
|
|
|
};
|
2022-10-02 20:49:31 +02:00
|
|
|
}
|
2023-06-08 14:46:27 +02:00
|
|
|
// (import ./pkgs/deployment.nix { inherit self pkgs lib; })
|
2022-10-02 20:49:31 +02:00
|
|
|
// (lib.foldl (x: y: lib.mergeAttrs x { "${y.config.system.name}-vm" = y.config.system.build.vm; }) { } (lib.attrValues self.nixosConfigurations));
|
2022-09-25 21:36:26 +02:00
|
|
|
|
2022-04-30 23:41:24 +02:00
|
|
|
in
|
|
|
|
{
|
2023-10-28 16:33:27 +02:00
|
|
|
|
|
|
|
packages."aarch64-linux".box8 = self.nixosConfigurations.traffic-stop-box-8.config.system.build.sdImage;
|
2023-10-29 00:48:55 +02:00
|
|
|
packages."aarch64-linux".box9 = self.nixosConfigurations.traffic-stop-box-9.config.system.build.sdImage;
|
2022-05-14 20:47:17 +02:00
|
|
|
packages."x86_64-linux" = packages;
|
2022-04-28 14:43:40 +02:00
|
|
|
|
2022-05-28 06:12:39 +02:00
|
|
|
nixosConfigurations = stop_boxes // {
|
2022-09-25 21:36:26 +02:00
|
|
|
|
2022-05-28 21:24:15 +02:00
|
|
|
data-hoarder = nixpkgs.lib.nixosSystem {
|
|
|
|
system = "x86_64-linux";
|
2023-03-05 14:07:31 +01:00
|
|
|
specialArgs = { inherit inputs self; };
|
2022-05-29 01:57:24 +02:00
|
|
|
modules = [
|
2022-07-10 21:58:02 +02:00
|
|
|
microvm.nixosModules.microvm
|
2022-10-02 21:39:37 +02:00
|
|
|
./hosts/data-hoarder
|
2022-05-29 01:57:24 +02:00
|
|
|
] ++ data-hoarder-modules;
|
2022-05-28 06:12:39 +02:00
|
|
|
};
|
2022-10-02 20:49:31 +02:00
|
|
|
|
2022-05-28 21:24:15 +02:00
|
|
|
staging-data-hoarder = nixpkgs.lib.nixosSystem {
|
|
|
|
system = "x86_64-linux";
|
2023-03-05 14:07:31 +01:00
|
|
|
specialArgs = { inherit inputs self; };
|
2022-05-29 01:57:24 +02:00
|
|
|
modules = [
|
2022-10-02 21:39:37 +02:00
|
|
|
./hosts/staging-data-hoarder
|
2022-05-28 21:24:15 +02:00
|
|
|
microvm.nixosModules.microvm
|
2022-05-29 01:57:24 +02:00
|
|
|
] ++ data-hoarder-modules;
|
2022-05-28 21:24:15 +02:00
|
|
|
};
|
2023-04-17 00:06:47 +02:00
|
|
|
|
2023-05-01 05:51:43 +02:00
|
|
|
borken-data-hoarder = nixpkgs.lib.nixosSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
specialArgs = { inherit inputs self; };
|
|
|
|
modules = [
|
|
|
|
./hosts/borken-data-hoarder
|
|
|
|
microvm.nixosModules.microvm
|
|
|
|
] ++ data-hoarder-modules;
|
|
|
|
};
|
|
|
|
|
2023-04-23 21:19:45 +02:00
|
|
|
notice-me-senpai = nixpkgs.lib.nixosSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
specialArgs = { inherit inputs self; };
|
|
|
|
modules = [
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
./modules/TLMS
|
|
|
|
./hosts/notice-me-senpai
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-05-19 19:08:52 +02:00
|
|
|
tram-borzoi = nixpkgs.lib.nixosSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
specialArgs = { inherit inputs self; };
|
|
|
|
modules = [
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
microvm.nixosModules.microvm
|
|
|
|
|
|
|
|
borzoi.nixosModules.default
|
|
|
|
{ nixpkgs.overlays = [ borzoi.overlays.default ]; }
|
|
|
|
|
|
|
|
./modules/TLMS
|
|
|
|
./hosts/tram-borzoi
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-05-30 16:00:35 +02:00
|
|
|
uranus = nixpkgs.lib.nixosSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
specialArgs = { inherit inputs self; };
|
|
|
|
modules = [
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
microvm.nixosModules.microvm
|
|
|
|
|
|
|
|
./modules/TLMS
|
|
|
|
./hosts/uranus
|
2023-06-08 14:46:27 +02:00
|
|
|
{ deployment-TLMS.monitoring.enable = true; }
|
2023-05-30 16:00:35 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-04-17 00:06:47 +02:00
|
|
|
};
|
|
|
|
apps."x86_64-linux".mctest = {
|
|
|
|
type = "app";
|
|
|
|
program = "${self.packages."x86_64-linux".test-vm-wrapper}";
|
2022-12-07 20:06:46 +01:00
|
|
|
};
|
2022-04-29 11:52:57 +02:00
|
|
|
|
2023-05-26 22:17:21 +02:00
|
|
|
hydraJobs =
|
|
|
|
let
|
|
|
|
get-toplevel = (host: nixSystem: nixSystem.config.microvm.declaredRunner or nixSystem.config.system.build.toplevel);
|
|
|
|
in
|
|
|
|
nixpkgs.lib.mapAttrs get-toplevel self.nixosConfigurations;
|
2023-06-08 14:46:27 +02:00
|
|
|
};
|
2022-12-07 23:30:37 +01:00
|
|
|
}
|