2024-05-20 00:47:07 +02:00
|
|
|
{
|
|
|
|
inputs = {
|
2024-05-20 04:02:53 +02:00
|
|
|
naersk.url = "github:nix-community/naersk/master";
|
2024-05-20 00:47:07 +02:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2024-05-20 04:02:53 +02:00
|
|
|
utils.url = "github:numtide/flake-utils";
|
2024-05-20 00:47:07 +02:00
|
|
|
};
|
|
|
|
|
2024-05-20 04:02:53 +02:00
|
|
|
outputs = { self, nixpkgs, utils, naersk }:
|
|
|
|
utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
naersk-lib = pkgs.callPackage naersk { };
|
|
|
|
in
|
|
|
|
{
|
|
|
|
defaultPackage = naersk-lib.buildPackage ./.;
|
|
|
|
devShell = with pkgs; mkShell {
|
|
|
|
buildInputs = [ cargo rustc rustfmt pre-commit rustPackages.clippy ];
|
|
|
|
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
|
|
|
# todo add rust for vscodium
|
2024-05-20 00:47:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-05-20 04:02:53 +02:00
|
|
|
nixosModules.default =
|
|
|
|
{ pkgs, config, lib, ... }:
|
2024-05-20 00:47:07 +02:00
|
|
|
{
|
2024-05-20 04:02:53 +02:00
|
|
|
options = {
|
|
|
|
services.i2pd-exporter = with lib; {
|
|
|
|
|
|
|
|
enable = mkEnableOption "i2pd-exporter";
|
|
|
|
|
|
|
|
listenAddress = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = "127.0.0.1";
|
|
|
|
};
|
|
|
|
|
|
|
|
port = mkOption {
|
|
|
|
type = types.port;
|
|
|
|
default = 5733;
|
|
|
|
};
|
|
|
|
|
|
|
|
routerAddress = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = "http://127.0.0.1:7650";
|
|
|
|
};
|
|
|
|
|
|
|
|
routerPassword = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = "itoopie";
|
|
|
|
};
|
|
|
|
};
|
2024-05-20 00:47:07 +02:00
|
|
|
};
|
|
|
|
|
2024-05-20 04:02:53 +02:00
|
|
|
config =
|
|
|
|
let
|
|
|
|
cfg = config.services.i2pd-exporter;
|
|
|
|
in
|
|
|
|
lib.mkIf cfg.enable {
|
|
|
|
systemd.services.i2pd-exporter = {
|
|
|
|
environment = {
|
|
|
|
IP = cfg.listenAddress;
|
|
|
|
PORT = cfg.port;
|
|
|
|
ADDRESS = cfg.routerAddress;
|
|
|
|
PASSWORD = cfg.routerPassword;
|
|
|
|
};
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig.ExecStart = "${pkgs.i2pd-exporter}/bin/i2pdexporter";
|
|
|
|
};
|
|
|
|
};
|
2024-05-20 00:47:07 +02:00
|
|
|
};
|
2024-05-20 04:02:53 +02:00
|
|
|
}
|
|
|
|
);
|
2024-05-20 00:47:07 +02:00
|
|
|
}
|