akkoma2sql/default.nix

58 lines
1.6 KiB
Nix

{ pkgs ? import <nixpkgs> {},
poetry2nix ? pkgs.poetry2nix,
stdenv ? pkgs.stdenv,
python ? pkgs.python3 }:
let
mkPoetryApplication' =
{ projectDir,
editablePackageSources,
overrides ? poetry2nix.defaultPoetryOverrides,
... }@args:
let
# pass all args which are not specific to mkPoetryEnv
app = poetry2nix.mkPoetryApplication (builtins.removeAttrs args [ "editablePackageSources" ]);
# pass args specific to mkPoetryEnv and all remaining arguments to mkDerivation
editableEnv = stdenv.mkDerivation (
{
name = "editable-env";
src = poetry2nix.mkPoetryEnv {
inherit projectDir editablePackageSources overrides;
};
# copy all the output of mkPoetryEnv so that patching and wrapping of outputs works
installPhase = ''
mkdir -p $out
cp -a * $out
'';
} // builtins.removeAttrs args [ "projectDir" "editablePackageSources" "overrides" ]
);
in
app.overrideAttrs (super: {
passthru = super.passthru // { inherit editableEnv; };
})
;
in
mkPoetryApplication' {
inherit python;
projectDir = ./.;
propagatedBuildInputs = [
pkgs.coreutils
];
preferWheels = true;
overrides = [
(poetry2nix.defaultPoetryOverrides.overrideOverlay (self: super:
{
click = super.click.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [self.setuptools self.flit-core];
}
);
}))
];
editablePackageSources = {
akkoma2sql = ./.;
};
}