Add nix flake

This commit is contained in:
adisbladis 2019-11-19 19:33:44 +00:00
parent eb2255ebaf
commit 21cd90e820
No known key found for this signature in database
GPG key ID: 110BFAD44C6249B7
3 changed files with 40 additions and 1 deletions

11
flake.lock generated Normal file
View 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
View 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;
});
};
}

View file

@ -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