{ inputs = { naersk.url = "github:nix-community/naersk/master"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; utils.url = "github:numtide/flake-utils"; }; 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 }; nixosModules.default = { pkgs, config, lib, ... }: { 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"; }; }; }; 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"; }; }; }; } ); }