add clean-s3-cache
This commit is contained in:
parent
e6f3c2e87b
commit
2ded704cac
3 changed files with 54 additions and 10 deletions
17
flake.lock
17
flake.lock
|
@ -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"
|
||||
}
|
||||
|
|
29
flake.nix
29
flake.nix
|
@ -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;
|
||||
|
|
18
scripts/clean-s3-cache.nix
Normal file
18
scripts/clean-s3-cache.nix
Normal 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
|
||||
'';
|
||||
};
|
||||
}
|
Reference in a new issue