scrape: convert scrapers to flake input

This commit is contained in:
Astro 2021-03-06 03:11:43 +01:00
parent 4b8353c011
commit ae1c93404d
3 changed files with 28 additions and 10 deletions

View File

@ -34,10 +34,27 @@
"inputs": {
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"scrapers": "scrapers",
"secrets": "secrets",
"yammat": "yammat"
}
},
"scrapers": {
"flake": false,
"locked": {
"lastModified": 1614995337,
"narHash": "sha256-0MvWFV+Kvd83hcX75Z/rghrUyTPRObGjch7/hKxvROY=",
"ref": "master",
"rev": "77c864b4d7e1ef4075ed115b036791c75176bef7",
"revCount": 24,
"type": "git",
"url": "https://gitea.c3d2.de/astro/scrapers.git"
},
"original": {
"type": "git",
"url": "https://gitea.c3d2.de/astro/scrapers.git"
}
},
"secrets": {
"locked": {
"lastModified": 1614994700,

View File

@ -6,9 +6,11 @@
secrets.url = "git+ssh://git@gitea.c3d2.de:2222/c3d2-admins/secrets.git";
yammat.url = "git+https://gitea.c3d2.de/astro/yammat.git?ref=nix";
yammat.flake = false;
scrapers.url = "git+https://gitea.c3d2.de/astro/scrapers.git";
scrapers.flake = false;
};
outputs = { self, nixpkgs, secrets, nixos-hardware, yammat }:
outputs = { self, nixpkgs, secrets, nixos-hardware, yammat, scrapers }:
let
forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-linux" "x86_64-linux" ];
@ -74,9 +76,11 @@
nixosConfigurations = let
nixosSystem' =
# Our custom NixOS builder
{ ... }@args:
{ extraArgs ? {}, ... }@args:
nixpkgs.lib.nixosSystem (args // {
extraArgs = { inherit hostRegistry; };
extraArgs = extraArgs // {
inherit hostRegistry;
};
extraModules = [
self.nixosModules.c3d2
({ pkgs, ... }: {
@ -157,6 +161,7 @@
nixpkgs.overlays = [ secrets.overlays.scrape ];
})
];
extraArgs = { inherit scrapers; };
system = "x86_64-linux";
};

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, modulesPath, ... }:
{ pkgs, scrapers, ... }:
let
freifunkNodes = {
@ -23,14 +23,10 @@ in {
environment.systemPackages = [ pkgs.git ];
systemd.services = let
scrapers = import (pkgs.fetchgit {
url = "https://gitea.c3d2.de/astro/scrapers.git";
rev = "77c864b4d7e1ef4075ed115b036791c75176bef7";
sha256 = "1rj4dyn89zqyfaiv2ffi6g4x86l2xfgybyy5hlvxzgcabwaxdjyh";
}) { inherit pkgs; };
scraperPkgs = import scrapers { inherit pkgs; };
makeService = { script, host, user ? "", password ? "" }: {
script =
"${scrapers.${script}}/bin/${script} ${host} ${user} ${password}";
"${scraperPkgs.${script}}/bin/${script} ${host} ${user} ${password}";
};
makeNodeScraper = nodeId: {
name = "scrape-node${nodeId}";