-
Notifications
You must be signed in to change notification settings - Fork 9
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
Showing
6 changed files
with
168 additions
and
46 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.idea | ||
.env | ||
.envrc | ||
.direnv | ||
__pycache__ | ||
binaries/* | ||
!binaries/README.md | ||
|
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,12 @@ | ||
# flake-compat shim for usage without flakes | ||
(import | ||
( | ||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in | ||
fetchTarball { | ||
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.flake-compat.locked.narHash; | ||
} | ||
) | ||
{ src = ./.; } | ||
).defaultNix | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,65 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/master"; | ||
|
||
# cross-platform convenience | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
|
||
# backwards compatibility with nix-build and nix-shell | ||
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils, flake-compat }: | ||
# resolve for all platforms in turn | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
# packages for this system platform | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
|
||
# control versions | ||
|
||
# get these python packages from nix | ||
python_packages = python-packages: [ | ||
python-packages.pip | ||
]; | ||
|
||
# use this pyton version, and include the abvoe packages | ||
python = pkgs.python312.withPackages python_packages; | ||
in { | ||
devShell = pkgs.stdenv.mkDerivation { | ||
name = "devshell"; | ||
|
||
buildInputs = with pkgs; [ | ||
# version to use + default packages are declared above | ||
python | ||
|
||
|
||
# linters | ||
shellcheck | ||
|
||
# for scripts | ||
bash | ||
fswatch | ||
rsync | ||
] ++ lib.optionals (pkgs.stdenv.isDarwin) [ | ||
# for python watchdog package | ||
darwin.apple_sdk.frameworks.CoreServices | ||
]; | ||
|
||
|
||
shellHook = '' | ||
export PYTHON_VERSION="$(python -c 'import platform; import re; print(re.sub(r"\.\d+$", "", platform.python_version()))')" | ||
# replicate virtualenv behaviour | ||
export PIP_PREFIX="$PWD/vendor/python/$PYTHON_VERSION/packages" | ||
export PYTHONPATH="$PIP_PREFIX/lib/python$PYTHON_VERSION/site-packages:$PYTHONPATH" | ||
unset SOURCE_DATE_EPOCH | ||
export PATH="$PIP_PREFIX/bin:$PATH" | ||
# hack: can't find libstdc++.so.8 otherwise | ||
export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib" | ||
''; | ||
}; | ||
} | ||
); | ||
} |
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,45 +1,11 @@ | ||
{ | ||
# use the environment channel | ||
pkgs ? import <nixpkgs> {}, | ||
|
||
# use a pinned package state | ||
pinned ? import(fetchTarball("https://github.com/NixOS/nixpkgs/archive/c75037bbf909.tar.gz")) {}, | ||
}: | ||
let | ||
# get these python packages from nix | ||
python_packages = python-packages: [ | ||
python-packages.pip | ||
]; | ||
|
||
# use this pyton version, and include the abvoe packages | ||
python = pinned.python39.withPackages python_packages; | ||
in pinned.stdenv.mkDerivation { | ||
# unique project name for this environment derivation | ||
name = "system-tests.devshell"; | ||
|
||
buildInputs = [ | ||
# version to use + default packages are declared above | ||
python | ||
|
||
# linters | ||
pinned.shellcheck | ||
|
||
# for scripts | ||
pinned.bash | ||
pinned.fswatch | ||
pinned.rsync | ||
]; | ||
|
||
shellHook = '' | ||
export PYTHON_VERSION="$(python -c 'import platform; import re; print(re.sub(r"\.\d+$", "", platform.python_version()))')" | ||
# replicate virtualenv behaviour | ||
export PIP_PREFIX="$PWD/vendor/python/$PYTHON_VERSION/packages" | ||
export PYTHONPATH="$PIP_PREFIX/lib/python$PYTHON_VERSION/site-packages:$PYTHONPATH" | ||
unset SOURCE_DATE_EPOCH | ||
export PATH="$PIP_PREFIX/bin:$PATH" | ||
# hack: can't find libstdc++.so.8 otherwise | ||
export LD_LIBRARY_PATH="${pinned.stdenv.cc.cc.lib}/lib" | ||
''; | ||
} | ||
# flake-compat shim for usage without flakes | ||
(import | ||
( | ||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in | ||
fetchTarball { | ||
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.flake-compat.locked.narHash; | ||
} | ||
) | ||
{ src = ./.; } | ||
).shellNix |
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