# Mach-nix: Create python environments quick and easy

**URL:** https://discourse.nixos.org/t/mach-nix-create-python-environments-quick-and-easy/6858
**Category:** Announcements
**Created:** [April 24, 2020, 10:59am UTC](https://discourse.nixos.org/t/mach-nix-create-python-environments-quick-and-easy/6858 "2020-04-24T10:59:39Z")
**Posts on this page:** 1
**Showing post:** 9

<div class="post-metadata">

### Author: ![das-g](https://discourse.nixos.org/user_avatar/discourse.nixos.org/das-g/32/1163_2.png) [@das-g](https://discourse.nixos.org/u/das-g)
#### Post date: [April 25, 2020, 11:07am UTC](https://discourse.nixos.org/t/mach-nix-create-python-environments-quick-and-easy/6858/9 "2020-04-25T11:07:48Z")

</div>

Nice! Instead of

```nix
let pkgs = import <nixpkgs> { };
in pkgs.mkShell {
  buildInputs = let
    python-with-pkgs = pkgs.python3.withPackages (ps:
      with ps;
      [
        # Figure out what to put here based on requirements.txt
      ]);
  in [python-with-pkgs];
}

```

I can now put this `shell.nix` alongside `requirements.txt`:

```nix
let
  mach-nix = import (builtins.fetchGit {
    url = "https://github.com/DavHau/mach-nix/";
    ref = "master";
    rev = "fa2bb2d33fb9b9dc3113046e4fcc16088f56981a";
  });
in mach-nix.mkPythonShell {
  requirements = builtins.readFile ./requirements.txt;
}

```

And it works in conjunction with [lorri](https://discourse.nixos.org/t/introducing-lorri-your-projects-nix-env/2560), too.

---

_[View the full topic](https://discourse.nixos.org/t/mach-nix-create-python-environments-quick-and-easy/6858)._
