-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maxim Avanov
committed
Mar 3, 2023
1 parent
fdc6157
commit ce706e6
Showing
4 changed files
with
92 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ pyVersion ? "311" | ||
, isDevEnv ? true | ||
}: | ||
|
||
let | ||
commonEnv = import ./nixpkgs {}; | ||
pkgs = commonEnv.pkgs; | ||
|
||
python = pkgs."python${pyVersion}"; | ||
pythonPkgs = pkgs."python${pyVersion}Packages"; | ||
devLibs = if isDevEnv then [ pythonPkgs.twine pythonPkgs.wheel ] else [ pythonPkgs.coveralls ]; | ||
|
||
# Make a new "derivation" that represents our shell | ||
devEnv = pkgs.mkShellNoCC { | ||
name = "typeit"; | ||
|
||
# The packages in the `buildInputs` list will be added to the PATH in our shell | ||
# Python-specific guide: | ||
# https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/python.section.md | ||
nativeBuildInputs = with pkgs; [ | ||
# see https://nixos.org/nixos/packages.html | ||
# Python distribution | ||
python | ||
pythonPkgs.virtualenv | ||
ncurses | ||
libxml2 | ||
libxslt | ||
libzip | ||
zlib | ||
which | ||
] ++ devLibs; | ||
shellHook = '' | ||
# set SOURCE_DATE_EPOCH so that we can use python wheels | ||
export SOURCE_DATE_EPOCH=$(date +%s) | ||
export VENV_DIR="$PWD/.venv${pyVersion}" | ||
export PATH=$VENV_DIR/bin:$PATH | ||
export PYTHONPATH="" | ||
export LANG=en_US.UTF-8 | ||
# https://python-poetry.org/docs/configuration/ | ||
export PIP_CACHE_DIR="$PWD/.local/pip-cache${pyVersion}" | ||
# Setup virtualenv | ||
if [ ! -d $VENV_DIR ]; then | ||
virtualenv $VENV_DIR | ||
pip install -r requirements/minimal.txt | ||
pip install -r requirements/test.txt | ||
pip install -r requirements/extras/third_party.txt | ||
fi | ||
''; | ||
}; | ||
in | ||
|
||
{ | ||
inherit devEnv; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{}: | ||
|
||
let | ||
|
||
common-src = builtins.fetchTarball { | ||
name = "common-2023-03-03"; | ||
url = https://github.com/avanov/nix-common/archive/a30f466f3ac73842d111e80f40f287d8aa13e929.tar.gz; | ||
# Hash obtained using `nix-prefetch-url --unpack <url>` | ||
sha256 = "sha256:1dimd334ay4jx4n81n5ms8p4i9kpyn0z7mm8xa0kcy2cpdlbq798"; | ||
}; | ||
|
||
overlays = import ./overlays.nix {}; | ||
pkgs = (import common-src { projectOverlays = [ overlays.globalPackageOverlay ]; }).pkgs; | ||
|
||
in | ||
|
||
{ | ||
inherit pkgs; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{}: | ||
|
||
let | ||
|
||
globalPackageOverlay = (self: original: rec { | ||
# Place overrides here as described in https://nixos.wiki/wiki/Overlays#Examples_of_overlays | ||
}); | ||
|
||
in | ||
|
||
{ | ||
inherit globalPackageOverlay; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,4 @@ | ||
{ | ||
pkgs ? (import (builtins.fetchGit { | ||
url = "https://github.com/avanov/nix-common.git"; | ||
ref = "master"; | ||
rev = "be2dc05bf6beac92fc12da9a2adae6994c9f2ee6"; | ||
}) {}).pkgs | ||
, pyVersion ? "310" | ||
, isDevEnv ? true | ||
}: | ||
|
||
let | ||
|
||
python = pkgs."python${pyVersion}"; | ||
pythonPkgs = pkgs."python${pyVersion}Packages"; | ||
devLibs = if isDevEnv then [ pythonPkgs.twine pythonPkgs.wheel ] else [ pythonPkgs.coveralls ]; | ||
repository = import ./default.nix {}; | ||
in | ||
|
||
# Make a new "derivation" that represents our shell | ||
pkgs.mkShellNoCC { | ||
name = "typeit"; | ||
|
||
# The packages in the `buildInputs` list will be added to the PATH in our shell | ||
# Python-specific guide: | ||
# https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/python.section.md | ||
nativeBuildInputs = with pkgs; [ | ||
# see https://nixos.org/nixos/packages.html | ||
# Python distribution | ||
python | ||
pythonPkgs.virtualenv | ||
ncurses | ||
libxml2 | ||
libxslt | ||
libzip | ||
zlib | ||
which | ||
] ++ devLibs; | ||
shellHook = '' | ||
# set SOURCE_DATE_EPOCH so that we can use python wheels | ||
export SOURCE_DATE_EPOCH=$(date +%s) | ||
export VENV_DIR="$PWD/.venv${pyVersion}" | ||
export PATH=$VENV_DIR/bin:$PATH | ||
export PYTHONPATH="" | ||
export LANG=en_US.UTF-8 | ||
# https://python-poetry.org/docs/configuration/ | ||
export PIP_CACHE_DIR="$PWD/.local/pip-cache${pyVersion}" | ||
# Setup virtualenv | ||
if [ ! -d $VENV_DIR ]; then | ||
virtualenv $VENV_DIR | ||
pip install -r requirements/minimal.txt | ||
pip install -r requirements/test.txt | ||
pip install -r requirements/extras/third_party.txt | ||
fi | ||
''; | ||
} | ||
repository.devEnv |