Files
hearth/infra/attic-migration/default.nix
T
yukkop 9eb7eb2e5d
runner nix smoke / nix label and flake smoke (push) Failing after 8s
fix!: attic chaces with hatzner limites
2026-09-09 23:35:45 +00:00

49 lines
1.2 KiB
Nix

{ pkgs }:
let
source = pkgs.lib.cleanSourceWith {
src = ./.;
filter = path: type:
builtins.baseNameOf path != "__pycache__"
&& !(pkgs.lib.hasSuffix ".pyc" path);
};
pythonEnv = pkgs.python3.withPackages (ps: [
ps.requests
ps.boto3
ps.zstandard
]);
in
pkgs.stdenv.mkDerivation {
pname = "attic-repack";
version = "0.1.0";
src = source;
nativeBuildInputs = [ pkgs.makeWrapper ];
installPhase = ''
mkdir -p $out/bin $out/libexec/attic-repack
cp $src/repack.py $out/libexec/attic-repack/repack.py
chmod +x $out/libexec/attic-repack/repack.py
makeWrapper ${pythonEnv}/bin/python3 $out/bin/attic-repack \
--add-flags $out/libexec/attic-repack/repack.py \
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.nix ]}
'';
doCheck = true;
checkPhase = ''
${pythonEnv}/bin/python3 -m unittest discover -s $src -p 'test_*.py'
'';
passthru = {
inherit pythonEnv;
tests.unittest = pkgs.runCommand "attic-repack-unittest" {
nativeBuildInputs = [ pythonEnv pkgs.nix ];
} ''
cp -r ${source} ./src
chmod -R u+w ./src
${pythonEnv}/bin/python3 -m unittest discover -s ./src -p 'test_*.py'
mkdir -p $out
'';
};
}