File: flake.nix

package info (click to toggle)
snimpy 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 620 kB
  • sloc: python: 4,191; makefile: 209
file content (34 lines) | stat: -rw-r--r-- 1,310 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
  inputs = {
    nixpkgs.url = "nixpkgs";
    flake-utils.url = "github:numtide/flake-utils";
  };
  outputs = { self, ... }@inputs:
    inputs.flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = inputs.nixpkgs.legacyPackages."${system}";
        checkInputs = with pkgs.python3Packages; [ pytest coverage ];
        buildInputs = with pkgs.python3Packages; [ pkgs.libsmi vcversioner ];
        propagatedBuildInputs = with pkgs.python3Packages; [ cffi pysnmp-lextudio ipython ];
      in
      {
        packages.default = pkgs.python3Packages.buildPythonPackage {
          inherit checkInputs buildInputs propagatedBuildInputs;
          name = "snimpy";
          src = self;
          preConfigure = ''
            # Unfortunately, we cannot build a proper string from what we got in self
            echo "1.0.0-0-000000000000" > version.txt
          '';
          checkPhase = "${pkgs.python3Packages.pytest}/bin/pytest";
        };
        apps.default = { type = "app"; program = "${self.packages."${system}".default}/bin/snimpy"; };
        devShells.default = pkgs.mkShell {
          name = "snimpy-dev";
          buildInputs = checkInputs ++ buildInputs ++ propagatedBuildInputs ++
            [
              pkgs.python3Packages.ipython
            ];
        };
      });
}