Move to JSON controlled server settings #3

Merged
Ghost merged 1 commits from :json-manipulations into master 2021-11-16 09:42:53 +02:00

Assumes server already moved to JSON-controlled Nix config

Now only the /etc/nixos/userdata/userdata.json file is modified by API.

Also, added some input validation.

api-package.nix

  • Added portalocker as Python dependency: for simple file locking
{ nixpkgs ? import <nixpkgs> { }, pythonPkgs ? nixpkgs.pkgs.python39Packages }:

let
  inherit (nixpkgs) pkgs;
  inherit pythonPkgs;

  selfprivacy-api = { buildPythonPackage, flask, flask-restful, setuptools, portalocker }:
    buildPythonPackage rec {
      pname = "selfprivacy-api";
      version = "1.1";
      src = builtins.fetchGit {
        url = "https://git.selfprivacy.org/ilchub/selfprivacy-rest-api.git";
        rev = "TO FILL";
      };
      propagatedBuildInputs = [ flask flask-restful setuptools portalocker ];
      meta = {
        description = ''
          SelfPrivacy Server Management API
        '';
      };
    };
  drv = pythonPkgs.callPackage selfprivacy-api { };
in
if pkgs.lib.inNixShell then drv.env else drv

**Assumes server already moved to JSON-controlled Nix config** Now only the `/etc/nixos/userdata/userdata.json` file is modified by API. Also, added some input validation. ## api-package.nix * Added `portalocker` as Python dependency: for simple file locking ```nix { nixpkgs ? import <nixpkgs> { }, pythonPkgs ? nixpkgs.pkgs.python39Packages }: let inherit (nixpkgs) pkgs; inherit pythonPkgs; selfprivacy-api = { buildPythonPackage, flask, flask-restful, setuptools, portalocker }: buildPythonPackage rec { pname = "selfprivacy-api"; version = "1.1"; src = builtins.fetchGit { url = "https://git.selfprivacy.org/ilchub/selfprivacy-rest-api.git"; rev = "TO FILL"; }; propagatedBuildInputs = [ flask flask-restful setuptools portalocker ]; meta = { description = '' SelfPrivacy Server Management API ''; }; }; drv = pythonPkgs.callPackage selfprivacy-api { }; in if pkgs.lib.inNixShell then drv.env else drv ```
inex added 1 commit 2021-11-15 15:53:02 +02:00
Ghost merged commit a86f2fe2bb into master 2021-11-16 09:42:53 +02:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: SelfPrivacy/selfprivacy-rest-api#3
There is no content yet.