Pip packages are missing in the pip repository, when trying to get python3 script into NixOS

High respected community,

I’m trying to get my python script into nixos and run it as systemd service. I’ve prepared a package for NixOS and a module for NixOS, but when I’m trying to enable this service, I bump into an error:

'selfprivacy-api' at /etc/nixos/api/api-package.nix:7:21 called without required argument 'flask_restful'

Here’s a contents of api-package.nix

{ nixpkgs ? import <nixpkgs> {}, pythonPkgs ? nixpkgs.pkgs.python37Packages }:

let
  inherit (nixpkgs) pkgs;
  inherit pythonPkgs;

  selfprivacy-api = { buildPythonPackage, flask, flask_restful, pandas, ast, subprocess, os }:
    buildPythonPackage rec {
      pname = "selfprivacy-api";
      version = "1.0";
      src = builtins.fetchGit {
        url = "git://git.selfprivacy.org/ilchub/selfprivacy-rest-api.git";
        ref = "master";
      };
      propagatedBuildInputs = [ flask flask_restful pandas ast subprocess os ];
      meta = {
        description = ''
          SelfPrivacy Server Management API
        '';
      };
    };
  drv = pythonPkgs.callPackage selfprivacy-api {};
in
  if pkgs.lib.inNixShell then drv.env else drv

Could you please advice, why flask_restful package is missing(that’s how I explain to myself ocurred error)?
This problem also appears with packages: ast, subprocess, os

I think you just need flask-restful.

AFAIK ast, subprocess and os are all builtin (batteries-included) python modules. If you intend to use the builtin modules, you don’t need to specify any of these as inputs here.

Edit: you can use the package search to help find/verify the name of a package’s attribute

1 Like