From 71345b35269df89a987143c19645884b3ebc9fce Mon Sep 17 00:00:00 2001 From: Victor Engmark Date: Thu, 21 Mar 2024 13:16:34 +1300 Subject: [PATCH] feat: Add Nix support --- .gitignore | 1 + shell.nix | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 shell.nix diff --git a/.gitignore b/.gitignore index de40c11..471b7dd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,6 @@ *.pyc __pycache__ /.pytest_cache/ +/python Thumbs.db /.vscode/ diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..b666729 --- /dev/null +++ b/shell.nix @@ -0,0 +1,35 @@ +let + pkgs = import ( + builtins.fetchTarball { + name = "nixos-unstable-2024-06-05"; + url = "https://github.com/nixos/nixpkgs/archive/57610d2f8f0937f39dbd72251e9614b1561942d8.tar.gz"; + sha256 = "0k8az8vmfdk1n8xlza252sqk0hm1hfc7g67adin6jxqaab2s34n9"; + } + ) {}; + poetry2nix = + import ( + builtins.fetchTarball { + name = "poetry2nix-2024.6.557458"; + url = "https://github.com/nix-community/poetry2nix/archive/81662ae1ad31491eae3bb1d976fb74c71853bc63.tar.gz"; + sha256 = "1zvlhzlc7mxr74qii3mkyn4iyd5rdivrm40yf7r7jvj9ry5gnbx9"; + } + ) { + inherit pkgs; + }; + poetryPackages = poetry2nix.mkPoetryPackages { + projectDir = builtins.path { + path = ./.; + name = "python-linz-logger"; + }; + }; +in + pkgs.mkShell { + packages = [ + pkgs.bashInteractive + pkgs.poetry + poetryPackages.poetryPackages + ]; + shellHook = '' + ln --force --no-target-directory --symbolic "${poetryPackages.python}/bin/python" python + ''; + }