diff --git a/projects/ThresholdOPRF/default.nix b/projects/ThresholdOPRF/default.nix new file mode 100644 index 000000000..ee98d75dc --- /dev/null +++ b/projects/ThresholdOPRF/default.nix @@ -0,0 +1,37 @@ +{ + lib, + pkgs, + sources, + ... +}@args: + +{ + metadata = { + summary = "Oblivious Pseudo-random Functions (OPRFs) and Threshold constructions implementations"; + subgrants = { + Entrust = [ + "ThresholdOPRF" + ]; + Review = [ + "OpaqueSphinx" + "OpaqueSphinxServer" + "OpaqueStore-Sphinx2.0" + ]; + }; + }; + + nixos.modules.programs = { + ThresholdOPRF = { + name = "ThresholdOPRF"; + module = ./programs/ThresholdOPRF/module.nix; + examples."Enable ThresholdOPRF" = { + module = ./programs/ThresholdOPRF/examples/basic.nix; + description = ""; + tests.basic.module = null; + }; + }; + }; + + # pwdsphinx needs a module + nixos.modules.services.ThresholdOPRF.module = null; +} diff --git a/projects/ThresholdOPRF/programs/ThresholdOPRF/examples/basic.nix b/projects/ThresholdOPRF/programs/ThresholdOPRF/examples/basic.nix new file mode 100644 index 000000000..9abd1fb0c --- /dev/null +++ b/projects/ThresholdOPRF/programs/ThresholdOPRF/examples/basic.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + programs.ThresholdOPRF.enable = true; +} diff --git a/projects/ThresholdOPRF/programs/ThresholdOPRF/module.nix b/projects/ThresholdOPRF/programs/ThresholdOPRF/module.nix new file mode 100644 index 000000000..c7c97734b --- /dev/null +++ b/projects/ThresholdOPRF/programs/ThresholdOPRF/module.nix @@ -0,0 +1,26 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.programs.ThresholdOPRF; +in +{ + options.programs.ThresholdOPRF = { + enable = lib.mkEnableOption "ThresholdOPRF"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + libopaque + liboprf + pwdsphinx + python3Packages.opaque + python3Packages.pyequihash + python3Packages.pyoprf + python3Packages.qrcodegen + ]; + }; +}