94 lines
2.1 KiB
Nix
94 lines
2.1 KiB
Nix
{ zentralwerk, config, pkgs, ... }:
|
|
let
|
|
ratsinfo-scraper = import (pkgs.fetchFromGitHub {
|
|
owner = "offenesdresden";
|
|
repo = "ratsinfo-scraper";
|
|
rev = "oparl";
|
|
sha256 = "sha256-KicEjx0WlKTyFng1WSdYmS9Wd8RVKUxCJrVi9aHa1eg=";
|
|
}) { inherit pkgs; };
|
|
in
|
|
{
|
|
microvm = {
|
|
hypervisor = "cloud-hypervisor";
|
|
|
|
shares = [ {
|
|
source = "/nix/store";
|
|
mountPoint = "/nix/.ro-store";
|
|
tag = "store";
|
|
proto = "virtiofs";
|
|
socket = "store.socket";
|
|
} ] ++ map (dir: {
|
|
source = "/var/lib/microvms/staging-data-hoarder/${dir}";
|
|
mountPoint = "/${dir}";
|
|
tag = dir;
|
|
proto = "virtiofs";
|
|
socket = "${dir}.socket";
|
|
}) [ "etc" "home" "var"];
|
|
|
|
interfaces = [ {
|
|
type = "tap";
|
|
id = "oparl";
|
|
mac = "00:de:9a:ce:38:79";
|
|
} ];
|
|
};
|
|
|
|
networking.hostName = "oparl";
|
|
|
|
networking.interfaces.eth0 = {
|
|
useDHCP = false;
|
|
ipv4.addresses =
|
|
let
|
|
netConfig = zentralwerk.lib.config.site.net.serv;
|
|
in [ {
|
|
address = netConfig.hosts4.${config.networking.hostName};
|
|
prefixLength = netConfig.subnet4Len;
|
|
} ];
|
|
};
|
|
|
|
users.users.oparl = {
|
|
isNormalUser = true;
|
|
group = "oparl";
|
|
};
|
|
users.groups.oparl = {};
|
|
|
|
systemd.services.oparl-scraper = {
|
|
wantedBy = [ "multi-user.target" ];
|
|
startAt = "daily";
|
|
serviceConfig = {
|
|
User = "oparl";
|
|
Group = "oparl";
|
|
WorkingDirectory = "${config.users.users.oparl.home}";
|
|
};
|
|
path = with pkgs; [
|
|
git openssh ratsinfo-scraper
|
|
];
|
|
script = ''
|
|
if [ -d data ]; then
|
|
pushd data
|
|
git pull
|
|
popd
|
|
else
|
|
git clone git@github.com:offenesdresden/dresden-ratsinfo.git data
|
|
fi
|
|
|
|
scrape
|
|
pushd data
|
|
find . -name \*.json -exec git add "{}" +
|
|
git commit -m update
|
|
popd data
|
|
|
|
meetings2ics data/meetings/ > data/meetings.ics
|
|
pushd data
|
|
git add meetings.ics
|
|
git commit -m "update meetings.ics"
|
|
popd
|
|
|
|
files_extract
|
|
pushd data
|
|
find . -name \*.txt -exec git add {} +
|
|
git commit -m update\ text
|
|
git push origin master
|
|
'';
|
|
};
|
|
}
|