Skip to content

Installing Jupyter #573

@TyberiusPrime

Description

@TyberiusPrime

These are todays workarounds to get jupyter (6.x) running in mach-nix,
with todays pypi-deps-db.

One of them is a genuine bug that needs tracking down eventually.

May this example flake be of use to somebody.

{
  description = "A very basic flake";
  inputs = {
    mach-nix = {
      url = "/home/finkernagel/upstream/mach-nix2";
    };
    pypi-deps-db = {
      url = "github:DavHau/pypi-deps-db?rev=6a09e5b6a604d76dcb8c5262be78dd6f64c99d33";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.mach-nix.follows = "mach-nix";
    };
    flake-utils = {
      url = "github:numtide/flake-utils?rev=7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19";
    };
  };

  outputs = {
    self,
    nixpkgs,
    mach-nix,
    pypi-deps-db,
    flake-utils,
  }:
    flake-utils.lib.eachDefaultSystem (
      system: let
        pkgs = import nixpkgs {
          inherit system;
          config = {allowUnfree = false;};
        };

        mn = (import mach-nix) {
          inherit pkgs;
          python = "python310";
        };
      in {
        defaultPackage = mn.mkPython {
          # there is a bug somewhere in mach-nix,
          # so that the [format-nongpl] extra on jsonschema
          # coming from jupyter get's ignored.
          # handing it in individually does help.
          requirements = ''
            jupyter>7
            jsonschema[format-nongpl]
          '';
          _.tornado.doCheck = false;
          _.tornado.doInstallCheck = false;
         # python has no file level isolation between packages, apparently.
          _."jupyter-core".postInstall = ''
            rm $out/lib/python*/site-packages/jupyter.py
            rm $out/lib/python*/site-packages/__pycache__/jupyter.cpython*.pyc
          '';
        };
      }
    );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions