add clean-s3-cache

This commit is contained in:
Charlotte 🦝 Delenk 2022-06-11 13:55:50 +01:00
parent e6f3c2e87b
commit 2ded704cac
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
3 changed files with 54 additions and 10 deletions

View file

@ -1,5 +1,21 @@
{
"nodes": {
"clean-s3-cache": {
"flake": false,
"locked": {
"lastModified": 1654951411,
"narHash": "sha256-Om6LZGjdrhsIL2K8VwzyRrX3+fOHJ1Bct4pI7/ijDP4=",
"ref": "refs/heads/main",
"rev": "e4bef52b5b8b8427d7027c681c96ac52ea007421",
"revCount": 1,
"type": "git",
"url": "https://gist.github.com/DarkKirb/533e9e8b9b6dd1badf9b103b4285dc4e"
},
"original": {
"type": "git",
"url": "https://gist.github.com/DarkKirb/533e9e8b9b6dd1badf9b103b4285dc4e"
}
},
"flake-utils": {
"locked": {
"lastModified": 1653893745,
@ -32,6 +48,7 @@
},
"root": {
"inputs": {
"clean-s3-cache": "clean-s3-cache",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}

View file

@ -4,17 +4,24 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
# Source files for packages
clean-s3-cache.url = "git+https://gist.github.com/DarkKirb/533e9e8b9b6dd1badf9b103b4285dc4e";
clean-s3-cache.flake = false;
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachSystem ["aarch64-linux" "x86_64-linux"] (
system: let
pkgs = import nixpkgs {inherit system;};
in rec {
outputs =
{ self
, nixpkgs
, flake-utils
, ...
} @ inputs:
flake-utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ] (
system:
let
pkgs = import nixpkgs { inherit system; };
in
rec {
formatter = pkgs.alejandra;
devShells.default = pkgs.mkShell {
@ -23,7 +30,9 @@
];
};
packages = {};
packages = pkgs.lib.lists.foldl (a: b: a // b) { } [
(pkgs.callPackage ./scripts/clean-s3-cache.nix { inherit inputs; })
];
hydraJobs = {
inherit packages devShells;

View file

@ -0,0 +1,18 @@
{ stdenvNoCC, python3, python3Packages, inputs }: rec {
clean-s3-cache-env = python3.buildEnv.override {
extraLibs = with python3Packages; [ boto3 ];
};
clean-s3-cache = stdenvNoCC.mkDerivation {
pname = "clean-s3-cache";
version = inputs.clean-s3-cache.lastModifiedDate;
srcs = inputs.clean-s3-cache;
buildPhase = ''
sed -i 's|#SHEBANG#|${clean-s3-cache-env}|' clean-s3-cache.py
'';
installPhase = ''
mkdir -p $out/bin
cp clean-s3-cache.py $out/bin
chmod +x $out/bin/clean-s3-cache.py
'';
};
}