Skip to content

Instantly share code, notes, and snippets.

@nghamilton
Created July 18, 2024 00:01
Show Gist options
  • Save nghamilton/4d2ac74a45aa5c4068ae494ed8dc21bc to your computer and use it in GitHub Desktop.
Save nghamilton/4d2ac74a45aa5c4068ae494ed8dc21bc to your computer and use it in GitHub Desktop.
bad poetry.
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.poetry2nix.url = "github:nix-community/poetry2nix";
outputs = { self, nixpkgs, poetry2nix }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
in
{
packages = forAllSystems (system: let
inherit (poetry2nix.lib.mkPoetry2Nix { pkgs = pkgs.${system}; }) mkPoetryApplication;
in {
default = mkPoetryApplication { projectDir = self; };
});
devShells = forAllSystems (system: let
inherit (poetry2nix.lib.mkPoetry2Nix { pkgs = pkgs.${system}; }) mkPoetryEnv;
in {
default = pkgs.${system}.mkShell {
packages = with pkgs.${system}; [
(mkPoetryEnv {
projectDir = self;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
})
poetry
postgresql
];
shellHook = ''
export PGHOST=$PWD/build/db
export PGDATABASE="atlas"
export LD_LIBRARY_PATH=${pkgs.${system}.lib.makeLibraryPath [ pkgs.${system}.stdenv.cc.cc ]}
'';
};
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment