Add ERIS CoAP server to nncp

This commit is contained in:
Emery 2022-09-01 14:28:20 -05:00
parent 23f12b0e97
commit 678313627a
4 changed files with 182 additions and 10 deletions

View File

@ -1,5 +1,26 @@
{ {
"nodes": { "nodes": {
"eris": {
"inputs": {
"nimble": "nimble",
"nixpkgs": [
"nixos"
]
},
"locked": {
"lastModified": 1662480366,
"narHash": "sha256-TvVZy/iE5jcWWyVFV+9NUrptkepn5V8ttN91EMYueZ0=",
"ref": "refs/heads/trunk",
"rev": "39efd5f8333cdff03bd12766ce3943c1e91f27fc",
"revCount": 18,
"type": "git",
"url": "https://codeberg.org/eris/nix-eris"
},
"original": {
"type": "git",
"url": "https://codeberg.org/eris/nix-eris"
}
},
"fenix": { "fenix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -36,6 +57,21 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_2": {
"locked": {
"lastModified": 1637014545,
"narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "bba5dcc8e0b20ab664967ad83d24d64cb64ec4f4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"heliwatch": { "heliwatch": {
"inputs": { "inputs": {
"fenix": [ "fenix": [
@ -189,6 +225,28 @@
"type": "github" "type": "github"
} }
}, },
"naersk_2": {
"inputs": {
"nixpkgs": [
"ticker",
"nixpkgs"
]
},
"locked": {
"lastModified": 1659610603,
"narHash": "sha256-LYgASYSPYo7O71WfeUOaEUzYfzuXm8c8eavJcel+pfI=",
"owner": "nix-community",
"repo": "naersk",
"rev": "c6a45e4277fa58abd524681466d3450f896dc094",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"rev": "c6a45e4277fa58abd524681466d3450f896dc094",
"type": "github"
}
},
"newNixpkgs": { "newNixpkgs": {
"locked": { "locked": {
"lastModified": 1647380550, "lastModified": 1647380550,
@ -221,6 +279,26 @@
"type": "github" "type": "github"
} }
}, },
"nimble": {
"inputs": {
"nixpkgs": [
"eris",
"nixpkgs"
]
},
"locked": {
"lastModified": 1662431150,
"narHash": "sha256-0TD9T6aMxUGe9FVvTI6np8V5HnnOgl4aoeSJ7XJgKZM=",
"owner": "nix-community",
"repo": "flake-nimble",
"rev": "961c2ab20939f0aaae17f97ab5a72e2c6589e600",
"type": "github"
},
"original": {
"id": "nimble",
"type": "indirect"
}
},
"nix": { "nix": {
"inputs": { "inputs": {
"lowdown-src": "lowdown-src", "lowdown-src": "lowdown-src",
@ -462,6 +540,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"eris": "eris",
"fenix": "fenix", "fenix": "fenix",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"heliwatch": "heliwatch", "heliwatch": "heliwatch",
@ -481,12 +560,35 @@
"secrets": "secrets", "secrets": "secrets",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"spacemsg": "spacemsg", "spacemsg": "spacemsg",
"syndicate": "syndicate",
"ticker": "ticker", "ticker": "ticker",
"tigger": "tigger", "tigger": "tigger",
"yammat": "yammat", "yammat": "yammat",
"zentralwerk": "zentralwerk" "zentralwerk": "zentralwerk"
} }
}, },
"rust": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": [
"syndicate",
"nixpkgs"
]
},
"locked": {
"lastModified": 1656384549,
"narHash": "sha256-hUe2t7//B9U9SSODAplfzdKkwxwO4kHsPX2k0y95SUU=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "61df523b5c22665d89710d9985cf5afe751d703f",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-analyzer-src": { "rust-analyzer-src": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -579,14 +681,33 @@
"type": "github" "type": "github"
} }
}, },
"syndicate": {
"inputs": {
"nixpkgs": [
"nixos"
],
"rust": "rust"
},
"locked": {
"lastModified": 1662481109,
"narHash": "sha256-h1PqGefF5mptkQmvXY7hSlBApK4t854QWsLEW0plq14=",
"ref": "refs/heads/trunk",
"rev": "3f4c5ae37e5e26b2a9167eb0503927b41e678871",
"revCount": 53,
"type": "git",
"url": "https://git.syndicate-lang.org/ehmry/syndicate-flake"
},
"original": {
"type": "git",
"url": "https://git.syndicate-lang.org/ehmry/syndicate-flake"
}
},
"ticker": { "ticker": {
"inputs": { "inputs": {
"fenix": [ "fenix": [
"fenix" "fenix"
], ],
"naersk": [ "naersk": "naersk_2",
"naersk"
],
"nixpkgs": [ "nixpkgs": [
"nixos" "nixos"
], ],

View File

@ -6,6 +6,10 @@
nixpkgs-mobilizon.url = "github:minijackson/nixpkgs/init-mobilizon"; nixpkgs-mobilizon.url = "github:minijackson/nixpkgs/init-mobilizon";
nixos-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixos-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:nixos/nixos-hardware"; nixos-hardware.url = "github:nixos/nixos-hardware";
eris = {
url = "git+https://codeberg.org/eris/nix-eris";
inputs.nixpkgs.follows = "nixos";
};
fenix = { fenix = {
url = "github:nix-community/fenix"; url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixos"; inputs.nixpkgs.follows = "nixos";
@ -86,6 +90,10 @@
url = "github:astro/tigger"; url = "github:astro/tigger";
flake = false; flake = false;
}; };
syndicate = {
url = "git+https://git.syndicate-lang.org/ehmry/syndicate-flake";
inputs.nixpkgs.follows = "nixos";
};
yammat = { yammat = {
url = "git+https://gitea.c3d2.de/C3D2/yammat.git?ref=nix"; url = "git+https://gitea.c3d2.de/C3D2/yammat.git?ref=nix";
inputs.nixpkgs.follows = "nixos"; inputs.nixpkgs.follows = "nixos";
@ -100,7 +108,7 @@
}; };
}; };
outputs = inputs@{ self, nixos-unstable, nixos, secrets, nixos-hardware, zentralwerk, yammat, scrapers, spacemsg, tigger, ticker, heliwatch, sops-nix, naersk, fenix, microvm, riscv64, oparl-scraper, ... }: outputs = inputs@{ self, eris, fenix, heliwatch, microvm, naersk, nixos, nixos-hardware, nixos-unstable, oparl-scraper, riscv64, scrapers, secrets, sops-nix, spacemsg, syndicate, ticker, tigger, yammat, zentralwerk, ... }:
let let
inherit (nixos) lib; inherit (nixos) lib;
forAllSystems = lib.genAttrs [ "aarch64-linux" "x86_64-linux" ]; forAllSystems = lib.genAttrs [ "aarch64-linux" "x86_64-linux" ];
@ -148,10 +156,15 @@
inherit nixos-unstable; inherit nixos-unstable;
}; };
legacyPackages = lib.attrsets.mapAttrs legacyPackages = lib.attrsets.mapAttrs (system: pkgs:
(system: pkgs: pkgs.appendOverlays pkgs.appendOverlays [
[ fenix.overlay naersk.overlay self.overlay ]) fenix.overlay
nixos.legacyPackages; naersk.overlay
syndicate.overlays.default
eris.inputs.nimble.overlay
eris.overlays.default
self.overlay
]) nixos.legacyPackages;
packages = lib.attrsets.mapAttrs (system: pkgs: packages = lib.attrsets.mapAttrs (system: pkgs:
let overlayPkgs = builtins.intersectAttrs (self.overlay {} {}) pkgs; let overlayPkgs = builtins.intersectAttrs (self.overlay {} {}) pkgs;
@ -531,7 +544,15 @@
modules = [ modules = [
self.nixosModules.microvm self.nixosModules.microvm
self.nixosModules.nncp self.nixosModules.nncp
syndicate.nixosModules.default
./hosts/nncp ./hosts/nncp
{
nixpkgs.overlays = [
syndicate.overlays.default
eris.inputs.nimble.overlay
eris.overlays.default
];
}
]; ];
}; };

View File

@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = [ ./neighbours.nix ]; imports = [ ./eris.nix ./neighbours.nix ];
microvm.interfaces = [ { microvm.interfaces = [ {
type = "tap"; type = "tap";
@ -33,7 +33,7 @@
neigh = # use c3d2.nncp.neigh but remove this node neigh = # use c3d2.nncp.neigh but remove this node
let let
hourlyCall = { hourlyCall = {
cron = "0 42 * * * * *"; # 4:00 cron = "0 42 * * * * *";
xx = "tx"; # transmit only xx = "tx"; # transmit only
when-tx-exists = true; when-tx-exists = true;
}; };

30
hosts/nncp/eris.nix Normal file
View File

@ -0,0 +1,30 @@
{ pkgs, ... }:
let home = "/var/spool/eris";
in {
services.syndicate.eris = {
enable = true;
user = "eris";
config = [
(pkgs.writeText "eris.pr" ''
<require-service <daemon eris-resolver>>
<daemon eris-resolver {
argv: [ "${pkgs.nimPackages.eris_utils}/bin/eriscmd" "resolver" ]
protocol: text/syndicate
}>
? <service-object <daemon eris-resolver> ?cap> $cap [
<coap-server "::" 5683 #{Get Put}>
<tkrzw "${home}/eris.tkh" #{Get Put} >
]
'')
];
};
users.groups.eris = { };
users.users.eris = {
isSystemUser = true;
group = "eris";
inherit home;
};
}