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 = {
|
2024-04-27 22:33:15 +02:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
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-11-27 16:08:17 +01:00
|
|
|
private-flake-overlays = {
|
|
|
|
url = "github:marenz2569/private-flake-overlays";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
|
2023-03-05 14:07:31 +01:00
|
|
|
## TLMS stuff below
|
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-11-18 14:55:13 +01:00
|
|
|
inputs.utils.follows = "flake-utils";
|
2023-03-20 03:56:14 +01:00
|
|
|
};
|
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-11-27 16:08:17 +01:00
|
|
|
, private-flake-overlays
|
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
|
|
|
, 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;
|
2023-11-27 16:08:17 +01:00
|
|
|
overlayFlake = private-flake-overlays.lib.overlayFlake;
|
2022-05-28 06:12:39 +02:00
|
|
|
|
2023-11-25 22:59:51 +01:00
|
|
|
registry = import ./registry;
|
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-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-11-25 22:59:51 +01:00
|
|
|
generate_system = (id:
|
|
|
|
let
|
|
|
|
myRegistry = registry.traffic-stop-box."${toString id}";
|
|
|
|
in
|
2022-09-23 17:26:27 +02:00
|
|
|
{
|
2023-11-26 01:22:19 +01:00
|
|
|
"${myRegistry.hostName}" = {
|
2023-11-25 22:59:51 +01:00
|
|
|
system = myRegistry.arch;
|
|
|
|
specialArgs = { inherit self inputs; registry = myRegistry; };
|
2023-05-05 21:00:24 +02:00
|
|
|
modules =
|
|
|
|
[
|
|
|
|
# box-specific config
|
|
|
|
./hosts/traffic-stop-box/${toString id}
|
|
|
|
|
|
|
|
# default modules
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
./modules/traffic-stop-box
|
|
|
|
./modules/TLMS
|
|
|
|
{
|
2023-11-25 22:59:51 +01:00
|
|
|
deployment-TLMS.monitoring.enable = myRegistry.monitoring;
|
2023-05-05 21:00:24 +02:00
|
|
|
}
|
|
|
|
] ++ stop-box-modules;
|
|
|
|
};
|
2022-04-30 23:41:24 +02:00
|
|
|
}
|
2022-04-28 14:43:40 +02:00
|
|
|
);
|
|
|
|
|
2023-11-25 22:59:51 +01:00
|
|
|
# list of traffic-stop-box-$id that will be built
|
|
|
|
stop_box_ids = [ 0 1 4 8 9 ];
|
2022-05-30 20:50:18 +02:00
|
|
|
|
2022-04-30 23:41:24 +02:00
|
|
|
# attribute set of all traffic stop boxes
|
2023-11-26 01:22:19 +01:00
|
|
|
r09_receivers = nixpkgs.lib.foldl (x: id: nixpkgs.lib.mergeAttrs x (generate_system id)) { } stop_box_ids;
|
2022-05-14 20:47:17 +02:00
|
|
|
|
2023-11-26 01:22:19 +01:00
|
|
|
unevaluatedNixosConfigurations = r09_receivers // {
|
|
|
|
data-hoarder = {
|
2022-05-28 21:24:15 +02:00
|
|
|
system = "x86_64-linux";
|
2023-11-25 20:56:46 +01:00
|
|
|
specialArgs = { inherit inputs self; registry = registry.data-hoarder; };
|
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
|
|
|
|
2023-11-26 01:22:19 +01:00
|
|
|
staging-data-hoarder = {
|
2022-05-28 21:24:15 +02:00
|
|
|
system = "x86_64-linux";
|
2023-11-26 02:38:52 +01:00
|
|
|
specialArgs = { inherit inputs self; registry = registry.staging-data-hoarder; };
|
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-11-26 01:22:19 +01:00
|
|
|
notice-me-senpai = {
|
2023-04-23 21:19:45 +02:00
|
|
|
system = "x86_64-linux";
|
2023-11-26 02:38:52 +01:00
|
|
|
specialArgs = { inherit inputs self; registry = registry.notice-me-senpai; };
|
2023-04-23 21:19:45 +02:00
|
|
|
modules = [
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
./modules/TLMS
|
|
|
|
./hosts/notice-me-senpai
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-11-26 01:22:19 +01:00
|
|
|
tram-borzoi = {
|
2023-05-19 19:08:52 +02:00
|
|
|
system = "x86_64-linux";
|
2023-11-26 02:38:52 +01:00
|
|
|
specialArgs = { inherit inputs self; registry = registry.tram-borzoi; };
|
2023-05-19 19:08:52 +02:00
|
|
|
modules = [
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
microvm.nixosModules.microvm
|
|
|
|
|
|
|
|
borzoi.nixosModules.default
|
|
|
|
{ nixpkgs.overlays = [ borzoi.overlays.default ]; }
|
|
|
|
|
|
|
|
./modules/TLMS
|
|
|
|
./hosts/tram-borzoi
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-11-27 16:08:17 +01:00
|
|
|
tetra-zw = {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
specialArgs = { inherit inputs self; registry = registry.tetra-zw; };
|
|
|
|
modules = [
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
|
|
|
|
./modules/TLMS
|
|
|
|
./hosts/tetra-zw
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-11-26 01:22:19 +01:00
|
|
|
uranus = {
|
2023-05-30 16:00:35 +02:00
|
|
|
system = "x86_64-linux";
|
2023-11-26 02:38:52 +01:00
|
|
|
specialArgs = { inherit inputs self; registry = registry.uranus; };
|
2023-05-30 16:00:35 +02:00
|
|
|
modules = [
|
|
|
|
sops-nix.nixosModules.sops
|
|
|
|
microvm.nixosModules.microvm
|
|
|
|
|
|
|
|
./modules/TLMS
|
|
|
|
./hosts/uranus
|
|
|
|
];
|
|
|
|
};
|
2023-11-26 01:22:19 +01:00
|
|
|
};
|
|
|
|
in
|
2023-11-27 16:08:17 +01:00
|
|
|
# overlays this private flake when in impure mode
|
|
|
|
overlayFlake "git+ssh://git@github.com/tlm-solutions/nix-config-private.git" {
|
2023-11-26 01:22:19 +01:00
|
|
|
inherit unevaluatedNixosConfigurations;
|
|
|
|
|
|
|
|
packages."aarch64-linux".box8 = self.nixosConfigurations.traffic-stop-box-8.config.system.build.sdImage;
|
|
|
|
packages."aarch64-linux".box9 = self.nixosConfigurations.traffic-stop-box-9.config.system.build.sdImage;
|
2023-05-30 16:00:35 +02:00
|
|
|
|
2023-11-26 01:22:19 +01:00
|
|
|
packages."x86_64-linux" = {
|
|
|
|
staging-microvm = self.nixosConfigurations.staging-data-hoarder.config.microvm.declaredRunner;
|
|
|
|
data-hoarder-microvm = self.nixosConfigurations.data-hoarder.config.microvm.declaredRunner;
|
2023-04-17 00:06:47 +02:00
|
|
|
};
|
2022-04-29 11:52:57 +02:00
|
|
|
|
2023-11-26 01:22:19 +01:00
|
|
|
# these are in the app declaration as nix before 2.19 tries to find attrPaths in packages first.
|
|
|
|
# here we evaluate over all nixos configurations making this extremely slow
|
|
|
|
apps."x86_64-linux" = (import ./pkgs/deployment.nix { inherit self pkgs lib; });
|
|
|
|
|
|
|
|
nixosConfigurations = lib.attrsets.mapAttrs (name: value: nixpkgs.lib.nixosSystem value) unevaluatedNixosConfigurations;
|
|
|
|
|
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
|
|
|
}
|