oparl: prepare
This commit is contained in:
parent
67ff9c7b65
commit
69ebfb1f42
|
@ -597,11 +597,11 @@
|
|||
"openwrt-imagebuilder": "openwrt-imagebuilder"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1652575777,
|
||||
"narHash": "sha256-AMCW3gP2JThiFI+9zRuF5rIiMRtjAc48ugcd2y57gO0=",
|
||||
"lastModified": 1653685024,
|
||||
"narHash": "sha256-Z+wUh3Zyi4Hwaxmd/A3r/DN6tihWin2fy+3GvdZwqa8=",
|
||||
"ref": "master",
|
||||
"rev": "8acc5bcb595b0307539c2f068ee58b946717f31e",
|
||||
"revCount": 1394,
|
||||
"rev": "259a51f8a51e3d589965fcf98caaf25b52ba1e77",
|
||||
"revCount": 1399,
|
||||
"type": "git",
|
||||
"url": "https://gitea.c3d2.de/zentralwerk/network.git"
|
||||
},
|
||||
|
|
|
@ -565,6 +565,14 @@
|
|||
];
|
||||
};
|
||||
|
||||
oparl = nixosSystem' {
|
||||
modules = [
|
||||
microvm.nixosModules.microvm
|
||||
./hosts/containers/oparl
|
||||
{ sops.defaultSopsFile = "${secrets}/hosts/oparl/secrets.yaml"; }
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
nixosModule = self.nixosModules.c3d2;
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
{ 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
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
./hardware-configuration.nix
|
||||
./network.nix
|
||||
./microvm-staging.nix
|
||||
./microvms.nix
|
||||
];
|
||||
|
||||
# Use the GRUB 2 boot loader.
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
microvm.autostart = [ "oparl" ];
|
||||
c3d2.server.bridgePorts = {
|
||||
serv = [ "oparl" ];
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue