feat: replace the older script with a nix flake, gitlab pipeline incoming shortly

This commit is contained in:
silver 2023-09-30 19:08:15 +01:00
parent 7e50989ca5
commit 0a3aba3758
3 changed files with 79 additions and 23 deletions

59
flake.lock Normal file
View file

@ -0,0 +1,59 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1695837737,
"narHash": "sha256-KcqmJ5hNacLuE7fkz5586kp/vt4NLo6+Prq3DMgrxpQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "517501bcf14ae6ec47efd6a17dda0ca8e6d866f9",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

20
flake.nix Normal file
View file

@ -0,0 +1,20 @@
{
description = "Skynet Almnui Renew";
inputs = {
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
in rec {
# `nix build`
defaultPackage = pkgs.stdenv.mkDerivation {
name = "skynet-website-renew";
src = self;
installPhase = "mkdir -p $out; cp -R src/* $out";
};
}
);
}

View file

@ -1,23 +0,0 @@
#! /bin/sh -e
# keep the files in renew up to date with git repo
# this script will be called from a cronjob every 7 days
# cwalsh 2020-10-10
# ensure we are in the correct directory
cd /var/www/html/renew
# check the repo is available
git ls-remote http://github.com/ULCompSoc/skynet.ie-renew.git -q || { echo 'Repo not available' ; exit 1; }
# delete all files in directory except for this script
ls | grep -v update-renew-from-github.sh | xargs rm -rf --
# clone renew directory
git clone http://github.com/ULCompSoc/skynet.ie-renew.git
# copy files from git repo to main directory
cp -r skynet.ie-renew/* .
# remove the git repo from the directory
rm -rf skynet.ie-renew