1
0
mirror of https://github.com/kmein/niveum synced 2026-03-19 19:41:08 +01:00

6 Commits

7 changed files with 59 additions and 42 deletions

View File

@@ -1,9 +1,9 @@
{
"url": "https://github.com/NixOS/nixpkgs.git",
"rev": "7c679678d6fd5e9b6a37155fa7b66228341dc4fa",
"date": "2021-05-03T12:47:27+01:00",
"path": "/nix/store/j6sznqfiqsd39ra8rxm11pi52vis7aad-nixpkgs",
"sha256": "1yi897052cy9s1c9il3h8774jmch1p7clyg0b5jrpq1px6bd29rd",
"rev": "c23146505c35a07bafbecf36af4f9ebde2bb7dfd",
"date": "2021-05-03T19:49:00-07:00",
"path": "/nix/store/wq0bmvjvrv8yh6v6qdq4cg3jk3za8j1y-nixpkgs",
"sha256": "15d0pwdf0xlpnvkdsg3arvx3v8jyi2ji7r9w8slrpdgfgrbfak4q",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false

View File

@@ -1,9 +1,9 @@
{
"url": "https://github.com/NixOS/nixpkgs.git",
"rev": "bba3474a5798b5a3a87e10102d1a55f19ec3fca5",
"date": "2021-04-26T02:53:56+02:00",
"path": "/nix/store/yh0manlyc4aa78n7fbzcjxmfnj4gn6jf-nixpkgs",
"sha256": "0g261s4n3hdhm7l5flmyl8jjihla688ib12flvwsvcax1p8h34d5",
"rev": "4a154d476238163eda54475d02382394b202961a",
"date": "2021-05-03T12:19:22-05:00",
"path": "/nix/store/3s77pfr5ja69wn7dqysv3fn669l54w4w-nixpkgs",
"sha256": "1fbmjdjv7s76daa51if50bpb7rmdw8mh4bs1zf37lqdn8fli3yk3",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false

View File

@@ -1,9 +1,9 @@
{
"url": "https://github.com/krebs/retiolum",
"rev": "0d3f175804d51f7fad891b04a6f742ebb1c1c923",
"date": "2021-04-16T23:02:19+02:00",
"path": "/nix/store/489x2j1adwg3yhwadygxha7j00w67jzh-retiolum",
"sha256": "1fxp397ndjl7qbzkh2dgipjfjj3sjbsd8bqd0p8sm3a9jgfgp7nn",
"rev": "890364eba07602127f2dd96c7e1dac7d5d5e85e9",
"date": "2021-05-03T15:02:17+02:00",
"path": "/nix/store/3wnxdlif1dhc9cqasgynr26v8nn8l255-retiolum",
"sha256": "115z5406x81473jg0qfz0qzajgq8rnjb75b438q6yk8qnrmb3r6v",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false

View File

@@ -1,5 +1,4 @@
{ lib, config, ... }:
let inherit (lib.sources) commitIdFromGitRepo;
in {
environment.etc."niveum/version".text = commitIdFromGitRepo <niveum/.git>;
{
environment.etc."niveum/version".text = lib.sources.commitIdFromGitRepo <niveum/.git>;
}

View File

@@ -29,7 +29,7 @@ in {
krebs.fetchWallpaper = {
enable = true;
# unitConfig.ConditionPathExists = "!/var/run/ppp0.pid";
url = "http://prism.r/realwallpaper-krebs-stars.png"; # http://prism.r/realwallpaper-krebs.png"; # "http://prism.r/realwallpaper-krebs-stars-berlin.png";
url = "http://prism.r/realwallpaper-krebs-stars-berlin.png"; # http://prism.r/realwallpaper-krebs.png"; # "http://prism.r/realwallpaper-krebs-stars.png";
};
services.xserver = {

View File

@@ -1,6 +1,7 @@
{ lib, pkgs, ... }:
let
inherit (import <niveum/lib>) kieran nixpkgs-unstable;
inherit (import <niveum/lib>) kieran;
nixpkgs-unstable = import <nixpkgs-unstable> {};
relayPassword = lib.fileContents <system-secrets/weechat/relay>;
in {
systemd.services.weechat =
@@ -44,7 +45,7 @@ in {
/relay add weechat 9000
/set relay.network.password ${relayPassword}
/set irc.server.freenode.autojoin "#krebs,#flipdot,##myengadin,##fysitech,#nixos,#nixos-de,#haskell"
/set irc.server.freenode.autojoin "#krebs,#flipdot,#fysi,#nixos,#nixos-de,#haskell"
/set irc.server.hackint.autojoin "#hsmr"
/set irc.server.irc.r.autojoin "#xxx,#brockman,#flix"
/set irc.server.news.r.autojoin "#cook,#drachengame,#oepnv,#kmeinung,#memes"

View File

@@ -36,19 +36,29 @@ let
path = toString .versions/retiolum.json;
};
};
updateCommand = name: dependency: ''
${pkgs.nix-prefetch-git}/bin/nix-prefetch-git --url "${dependency.url}" --rev "${dependency.ref}" > "${dependency.path}"'';
updateScripts =
lib.mapAttrsToList
(name: dependency: pkgs.writers.writeDashBin "niveum-update-${name}" (updateCommand name dependency))
dependencies;
in pkgs.mkShell {
buildInputs = updateScripts ++ [
(pkgs.writers.writeDashBin "niveum-update"
(lib.concatStringsSep " &\n" (lib.mapAttrsToList updateCommand dependencies)))
buildInputs = [
(let
updateCommand = pkgs.writers.writeDash "niveum-update-one" ''
[ $# -eq 1 ] || {
echo "Please provide a dependency to update." >&2
exit 1
}
case "$1" in
${lib.concatStringsSep "\n" (lib.mapAttrsToList (name: dependency: ''
${name})
${pkgs.nix-prefetch-git}/bin/nix-prefetch-git --url "${dependency.url}" --rev "${dependency.ref}" > "${dependency.path}";;
'') dependencies)}
esac
'';
in pkgs.writers.writeDashBin "niveum-update" ''
if [ $# -gt 0 ]; then
dependencies="$@"
else
dependencies="${lib.concatStringsSep " " (lib.attrNames dependencies)}"
fi
${pkgs.parallel}/bin/parallel --line-buffer --tagstring '{}' -q ${updateCommand} '{1}' ::: $dependencies
'')
(let
deployCommand = pkgs.writers.writeDash "niveum-deploy-one" ''
@@ -63,22 +73,29 @@ in pkgs.mkShell {
fi
'')
(pkgs.writers.writeDashBin "niveum-status" ''
cd "${toString ./.}"
(let
statusCommand = pkgs.writers.writeDash "niveum-status-one" ''
[ $# -eq 1 ] || {
echo "Please provide a niveum system hostname." >&2
exit 1
}
version_file=/etc/niveum/version
hostname="$1"
version_file=/etc/niveum/version
for system in systems/*; do
hostname="$(${pkgs.coreutils}/bin/basename "$system")"
if commit_id="$(${pkgs.openssh}/bin/ssh "$hostname" cat $version_file 2>/dev/null)"; then
machine_status="$(${pkgs.git}/bin/git log -1 --oneline "$commit_id")"
if commit_id="$(${pkgs.coreutils}/bin/timeout 2s ${pkgs.openssh}/bin/ssh "$hostname" cat $version_file 2>/dev/null)"; then
${pkgs.git}/bin/git log -1 --oneline "$commit_id"
else
machine_status=offline
echo offline
fi
printf "\033[1m%11s\033[0m %s\n" "$hostname" "$machine_status"
done
'';
in pkgs.writers.writeDashBin "niveum-status" ''
if [ $# -gt 0 ]; then
systems="$@"
else
systems="$(ls ${toString ./.}/systems)"
fi
${pkgs.parallel}/bin/parallel --line-buffer --tagstring '{}' -q ${statusCommand} '{1}' ::: $systems
'')
];
}