94 lines
2.8 KiB
Nix
94 lines
2.8 KiB
Nix
{
|
|
description = "Application packaged using poetry2nix";
|
|
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
|
|
inputs.poetry2nix = {
|
|
url = "github:nix-community/poetry2nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication mkPoetryEnv mkPoetryPackages defaultPoetryOverrides;
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
overrides = defaultPoetryOverrides.extend
|
|
(self: super: {
|
|
nextcord = super.nextcord.overridePythonAttrs
|
|
(
|
|
old: {
|
|
propagatedBuildInputs = (
|
|
old.propagatedBuildInputs or []
|
|
) ++ [super.setuptools];
|
|
}
|
|
);
|
|
pdftotext = super.pdftotext.overridePythonAttrs
|
|
(
|
|
old: {
|
|
buildInputs = (
|
|
old.buildInputs or []
|
|
) ++ (with pkgs; [
|
|
poppler
|
|
]);
|
|
}
|
|
);
|
|
});
|
|
in rec {
|
|
|
|
hydraJobs = pkgs.lib.optionalAttrs
|
|
(system == "x86_64-linux" ) {
|
|
handyhelper = packages.handyhelper;
|
|
runCommandHook = {
|
|
|
|
handyhelper = pkgs.runCommand "Handy Helper Deploy" {
|
|
nativeBuildInputs = [
|
|
packages.handyhelper
|
|
];
|
|
} ''
|
|
cat << 'DOC' >> $out
|
|
#!${pkgs.runtimeShell}
|
|
export tmp=$(mktemp -d)
|
|
pushd $tmp
|
|
${pkgs.wget}/bin/wget \
|
|
https://git.syzygial.cc/Syzygial/HandyHelper/archive/${self.rev}.bundle
|
|
git clone * src
|
|
${pkgs.tree}/bin/tree
|
|
cd src
|
|
${pkgs.sops}/bin/sops -i -d secrets/deploy.nix
|
|
${pkgs.sops}/bin/sops -i -d secrets/deploy.sh
|
|
export flake="$tmp/src/deploy"
|
|
${pkgs.runtimeShell} ./secrets/deploy.sh
|
|
DOC
|
|
chmod +x $out
|
|
'';
|
|
};
|
|
};
|
|
|
|
packages = {
|
|
handyhelper = mkPoetryApplication {
|
|
projectDir = self;
|
|
# TODO: Upload to poetry2nix
|
|
# https://github.com/nix-community/poetry2nix/blob/master/docs/edgecases.md
|
|
inherit overrides;
|
|
};
|
|
default = self.packages.${system}.handyhelper;
|
|
};
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
PYPROJECT_FILE = ./pyproject.toml;
|
|
packages = with pkgs; [
|
|
poetry2nix.packages.${system}.poetry
|
|
(mkPoetryEnv {
|
|
projectDir = self;
|
|
inherit overrides;
|
|
})
|
|
sops
|
|
# For pdftotext
|
|
poppler
|
|
];
|
|
};
|
|
}
|
|
);
|
|
}
|