mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-27 06:10:53 +01:00
Added status page
This commit is contained in:
parent
48c36bbd4c
commit
a42a771ece
7 changed files with 88 additions and 0 deletions
1
base.nix
1
base.nix
|
@ -30,6 +30,7 @@
|
|||
rxvt_unicode
|
||||
xorg.xbacklight
|
||||
neovim
|
||||
tinystatus
|
||||
];
|
||||
|
||||
environment.variables.EDITOR = "nvim";
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
outputs = { self, home-manager, nixpkgs, unstable, sops-nix, neovim-nightly-overlay, nur, ... }@inputs:
|
||||
let
|
||||
utils = import ./utils.nix { inherit nixpkgs sops-nix home-manager inputs; nixpkgs-unstable = unstable; };
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
in
|
||||
with utils;
|
||||
{
|
||||
|
@ -42,5 +43,6 @@
|
|||
(builtins.attrNames (builtins.readDir ./modules)));
|
||||
|
||||
nixosConfigurations = builtins.mapAttrs (name: value: (mkMachine name value self.nixosModules)) (importConfig ./machines);
|
||||
packages."x86_64-linux".tinystatus = import ./packages/tinystatus { inherit pkgs; };
|
||||
};
|
||||
}
|
||||
|
|
|
@ -25,6 +25,13 @@
|
|||
subdomain = "ci";
|
||||
};
|
||||
};
|
||||
status = {
|
||||
enable = true;
|
||||
nginx = {
|
||||
enable = true;
|
||||
subdomain = "status";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nix.maxJobs = lib.mkDefault 8;
|
||||
|
|
4
modules/status/checks.csv
Normal file
4
modules/status/checks.csv
Normal file
|
@ -0,0 +1,4 @@
|
|||
http, 200, Homepage, https://julienmalka.me
|
||||
http, 200, CI, https://ci.julienmalka.me
|
||||
ping, 0, Newton, newton.julienmalka.me
|
||||
|
|
48
modules/status/default.nix
Normal file
48
modules/status/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.luj.status;
|
||||
in
|
||||
{
|
||||
|
||||
options.luj.jackett = {
|
||||
enable = mkEnableOption "activate status page";
|
||||
nginx.enable = mkEnableOption "activate nginx";
|
||||
nginx.subdomain = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (
|
||||
mkMerge [{
|
||||
systemd = {
|
||||
timers.simple-timer = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
partOf = [ "tinystatus.service" ];
|
||||
timerConfig.OnCalendar = "minutely";
|
||||
};
|
||||
services.tinystatus = {
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
mkdir -p /var/www/status
|
||||
${pkgs.tinystatus}/bin/tinystatus ${./checks.csv} > /var/www/status/index.html
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
(mkIf cfg.nginx.enable {
|
||||
luj.nginx.enable = true;
|
||||
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
root = "/var/www/status/";
|
||||
};
|
||||
|
||||
})]);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
25
packages/tinystatus/default.nix
Normal file
25
packages/tinystatus/default.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{ pkgs, ... }:
|
||||
with pkgs;
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "tinystatus";
|
||||
version = "1.0.0";
|
||||
|
||||
src = fetchFromGitHub{
|
||||
owner = "bderenzo";
|
||||
repo = "tinystatus";
|
||||
rev="fc128adf240261ac99ea3e3be8d65a92eda52a73";
|
||||
sha256= "FvQwibm6F10l9/U3RnNTGu+C2JjHOwbv62VxXAfI7/s=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs .
|
||||
'';
|
||||
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin/
|
||||
mv tinystatus $out/bin/
|
||||
'';
|
||||
|
||||
|
||||
}
|
|
@ -25,6 +25,7 @@ in
|
|||
overlay-unstable
|
||||
(final: prev:
|
||||
{
|
||||
tinystatus = prev.pkgs.callPackage ./packages/tinystatus {};
|
||||
mosh = prev.mosh.overrideAttrs (old: {
|
||||
patches = (prev.lib.take 1 old.patches) ++ (prev.lib.sublist 4 4 old.patches);
|
||||
postPatch = '''';
|
||||
|
|
Loading…
Add table
Reference in a new issue