Move sp-api to nix overlay

This commit is contained in:
Inex Code 2021-11-17 16:35:00 +03:00
parent bc669579f7
commit 2dc389799a
3 changed files with 7 additions and 26 deletions

View file

@ -3,7 +3,6 @@
with lib; with lib;
let let
selfprivacy-api = pkgs.callPackage ./api-package.nix { };
cfg = config.services.selfprivacy-api; cfg = config.services.selfprivacy-api;
directionArg = directionArg =
if cfg.direction == "" if cfg.direction == ""
@ -70,7 +69,7 @@ in
wantedBy = [ "network-online.target" ]; wantedBy = [ "network-online.target" ];
serviceConfig = { serviceConfig = {
User = "root"; User = "root";
ExecStart = "${selfprivacy-api}/bin/app.py"; ExecStart = "${pkgs.selfprivacy-api}/bin/app.py";
Restart = "always"; Restart = "always";
RestartSec = "5"; RestartSec = "5";
}; };

View file

@ -1,24 +0,0 @@
{ nixpkgs ? import <nixpkgs> { }, pythonPkgs ? nixpkgs.pkgs.python39Packages }:
let
inherit (nixpkgs) pkgs;
inherit pythonPkgs;
selfprivacy-api = { buildPythonPackage, flask, flask-restful, setuptools, portalocker, flask-swagger, flask-swagger-ui }:
buildPythonPackage rec {
pname = "selfprivacy-api";
version = "1.1";
src = builtins.fetchGit {
url = "https://git.selfprivacy.org/ilchub/selfprivacy-rest-api.git";
rev = "dc56b6f4ad5358875f26d9639eee5835ea30a386";
};
propagatedBuildInputs = [ flask flask-restful setuptools portalocker flask-swagger flask-swagger-ui ];
meta = {
description = ''
SelfPrivacy Server Management API
'';
};
};
drv = pythonPkgs.callPackage selfprivacy-api { };
in
if pkgs.lib.inNixShell then drv.env else drv

View file

@ -1,4 +1,8 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let
url-overlay = "https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nix-repo/archive/1.0.tar.gz";
nix-overlay = (import (builtins.fetchTarball url-overlay));
in
{ {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
@ -26,6 +30,8 @@
./git/gitea.nix ./git/gitea.nix
]; ];
nixpkgs.overlays = [ (nix-overlay) ];
boot.cleanTmpDir = true; boot.cleanTmpDir = true;
networking = { networking = {
hostName = config.services.userdata.hostname; hostName = config.services.userdata.hostname;