mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-04 16:51:40 -05:00
Add nix flake
This commit is contained in:
parent
eb2255ebaf
commit
21cd90e820
3 changed files with 40 additions and 1 deletions
11
flake.lock
generated
Normal file
11
flake.lock
generated
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"inputs": {
|
||||
"nixpkgs": {
|
||||
"inputs": {},
|
||||
"narHash": "sha256-Y5ZOTgInrYYoas3vM8uTPLA2DvFI9YoI6haftIKl9go=",
|
||||
"originalUrl": "nixpkgs",
|
||||
"url": "github:edolstra/nixpkgs/015c9ec3372e328ea6742b409a1e9aa26dab2b31"
|
||||
}
|
||||
},
|
||||
"version": 3
|
||||
}
|
28
flake.nix
Normal file
28
flake.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
description = "Poetry2nix flake";
|
||||
|
||||
edition = 201909;
|
||||
|
||||
outputs = { self, nixpkgs }: let
|
||||
# TODO: There must be a better way to provide arch-agnostic flakes..
|
||||
systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" ];
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
|
||||
# Memoize nixpkgs for different platforms for efficiency.
|
||||
nixpkgsFor = forAllSystems (system:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlay ];
|
||||
}
|
||||
);
|
||||
|
||||
in {
|
||||
|
||||
overlay = import ./overlay.nix;
|
||||
|
||||
# TODO: I feel like `packages` is the wrong place for the poetry2nix attr
|
||||
packages = forAllSystems (system: {
|
||||
inherit (nixpkgsFor.${system}) poetry poetry2nix;
|
||||
});
|
||||
|
||||
};
|
||||
}
|
|
@ -34,7 +34,7 @@ poetry2nix.mkPoetryPackage {
|
|||
mkdir -p $out/bin
|
||||
cat > $out/bin/poetry <<EOF
|
||||
#!${runtimeShell}
|
||||
export PYTHONPATH=$PYTHONPATH
|
||||
export PYTHONPATH=$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH
|
||||
exec ${python}/bin/python -m poetry "\$@"
|
||||
EOF
|
||||
chmod +x $out/bin/poetry
|
||||
|
|
Loading…
Add table
Reference in a new issue