File: shell.nix

package info (click to toggle)
input-remapper 2.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 2,852 kB
  • sloc: python: 27,277; sh: 191; xml: 33; makefile: 3
file content (48 lines) | stat: -rw-r--r-- 1,358 bytes parent folder | download | duplicates (3)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# shell.nix - used with nix-shell to get a development environment with necessary dependencies
# Should be enough to run unit tests, integration tests and the service won't work
# If you don't use nix, don't worry about/use this file
let
  pkgs = import <nixpkgs> { };
  python = pkgs.python310;
in
pkgs.mkShell {
  nativeBuildInputs = [
    pkgs.pkg-config
    pkgs.wrapGAppsHook
  ];
  buildInputs = [
    pkgs.gobject-introspection
    pkgs.gtk3
    pkgs.bashInteractive
    pkgs.gobject-introspection
    pkgs.xlibs.xmodmap
    pkgs.gtksourceview4
    (python.withPackages (
      python-packages: with python-packages; [
        pip
        wheel
        setuptools # for pkg_resources
        types-setuptools

        evdev
        pydbus
        pygobject3
        pydantic

        psutil # only used in tests
      ]
    ))
  ];
  # https://nixos.wiki/wiki/Python#Emulating_virtualenv_with_nix-shell
  shellHook = ''
    # Tells pip to put packages into $PIP_PREFIX instead of the usual locations.
    # See https://pip.pypa.io/en/stable/user_guide/#environment-variables.
    export PIP_PREFIX=$(pwd)/venv
    export PYTHONPATH="$PIP_PREFIX/${python.sitePackages}:$PYTHONPATH"
    export PATH="$PIP_PREFIX/bin:$PATH"
    unset SOURCE_DATE_EPOCH

    python setup.py egg_info
    pip install `grep -v '^\[' *.egg-info/requires.txt` || true
  '';
}