Files
HandyHelper/flake.nix

65 lines
1.9 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;
pkgs = nixpkgs.legacyPackages.${system};
in rec {
hydraJobs = pkgs.lib.optionalAttrs
(system == "x86_64-linux" ) {
handyhelper = packages.handyhelper;
runCommandHook = {
handyhelper = pkgs.runCommand "Handy Helper Deploy" {
nativeBuildInputs = [
packages.handyhelper_pkg
];
} ''
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; };
handyhelper_pkg = mkPoetryPackages { projectDir = self; };
default = self.packages.${system}.handyhelper;
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
poetry2nix.packages.${system}.poetry
(mkPoetryEnv {
projectDir = self;
})
sops
];
};
}
);
}