From af6b58bc087f745b900d47b41764b29ac554917e Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 27 Apr 2021 21:40:35 +0200 Subject: realwallpaper: move pkgs into export --- krebs/5pkgs/simple/realwallpaper/default.nix | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'krebs/5pkgs/simple') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index 04a2a6718..aafabb7b6 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -1,6 +1,21 @@ { pkgs, ... }: pkgs.writers.writeDashBin "generate-wallpaper" '' - set -euf + set -xeuf + + export PATH=${with pkgs; lib.makeBinPath [ + coreutils + curl + gnugrep + gnused + file + findutils + grib2json + imagemagick + inkscape + jq + nomads-cloud + xplanet + ]} # usage: getimg FILENAME URL fetch() { @@ -118,7 +133,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' # fetch clouds if they are older than 3h if ! test "$(find clouds-raw.png -mmin -180)"; then - ${pkgs.nomads-cloud}/bin/nomads-cloud clouds-raw.png + nomads-cloud clouds-raw.png fi in_size=3600x1800 @@ -161,14 +176,14 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' fi if needs_rebuild krebs.png krebs-raw.svg; then - inkscape -z -e krebs.png -w 16 -h 16 krebs-raw.svg + inkscape --export-type="png" --export-width=16 --export-height=16 --export-filename=krebs.png krebs-raw.svg fi # -- Planets -- for planet in mercury venus mars jupiter saturn uranus neptune; do if needs_rebuild "$planet".png "$planet"-raw.svg; then sed -i 's/#000/#FE8019/g' "$planet"-raw.svg - inkscape -z -e "$planet".png -w 40 -h 40 "$planet"-raw.svg + inkscape --export-type="png" --export-width=40 --export-height=40 --export-filename="$planet.png" "$planet-raw.svg" fi done -- cgit v1.2.3 From 0f21f4250a7e5037cc0cf9a0416857e7da16d30a Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 27 Apr 2021 21:43:18 +0200 Subject: nomads-cloud: fix url --- krebs/5pkgs/simple/nomads-cloud/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'krebs/5pkgs/simple') diff --git a/krebs/5pkgs/simple/nomads-cloud/default.nix b/krebs/5pkgs/simple/nomads-cloud/default.nix index 6e4ace484..97cf10d1f 100644 --- a/krebs/5pkgs/simple/nomads-cloud/default.nix +++ b/krebs/5pkgs/simple/nomads-cloud/default.nix @@ -10,7 +10,8 @@ writers.writeDashBin "nomads-cloud" '' date=$(${coreutils}/bin/date +%Y%m%d) for hour in 18 12 06 00; do - url="https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25_1hr.pl?file=gfs.t''${hour}z.pgrb2.0p25.anl&lev_entire_atmosphere_%5C%28considered_as_a_single_layer%5C%29=on&var_CWAT=on&leftlon=-180&rightlon=180&toplat=90&bottomlat=-90&dir=%2Fgfs.$date%2F$hour" + url="https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25_1hr.pl?file=gfs.t''${hour}z.pgrb2.0p25.anl&lev_entire_atmosphere_%5C%28considered_as_a_single_layer%5C%29=on&var_CWAT=on&leftlon=-180&rightlon=180&toplat=90&bottomlat=-90&dir=%2Fgfs.''${date}%2F''${hour}%2Fatmos" + echo "$url" ${curl}/bin/curl -fsS "$url" > "$grib_path" if [ "$?" -eq 0 ]; then break -- cgit v1.2.3 From aec780247000278c7c46c7ff30f215009a79454c Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 2 May 2021 17:37:10 +0200 Subject: realwallpaper: add version with star constellations --- krebs/5pkgs/simple/realwallpaper/default.nix | 33 +++++++++++++++++++- .../simple/realwallpaper/get_constellations.py | 36 ++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 krebs/5pkgs/simple/realwallpaper/get_constellations.py (limited to 'krebs/5pkgs/simple') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index aafabb7b6..c9b2e76b6 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -271,6 +271,32 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' shade=15 ''} + ${pkgs.writers.writePython3 "get_constellations" { + libraries = [ pkgs.python3Packages.astropy ]; + } ./get_constellations.py} ${pkgs.fetchurl { + url = "https://raw.githubusercontent.com/ofrohn/d3-celestial/d2e20e104b86429d90ac8227a5b021262b45d75a/data/constellations.lines.json"; + sha256 = "0g71fdrnxvxd6pcqvihj2q9iaynrl7px45kzw6qm1kymynz6ckr9"; + }} > constellations.arcs + + xplanet --num_times 1 --geometry $xplanet_out_size \ + --output xplanet-krebs-stars-output.png --projection merc \ + -config ${pkgs.writeText "xplanet-krebs-stars.config" '' + [default] + + arc_thickness=1 + arc_file=constellations.arcs + + [earth] + "Earth" + map=daymap-final.png + night_map=nightmap-final.png + cloud_map=clouds.png + cloud_threshold=1 + cloud_gamma=10 + marker_file=marker_file + shade=15 + ''} + # trim xplanet output if needs_rebuild realwallpaper.png xplanet-output.png; then convert xplanet-output.png -crop $out_geometry \ @@ -278,7 +304,6 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' mv realwallpaper-tmp.png realwallpaper.png fi - # trim xplanet output if needs_rebuild realwallpaper-marker.png xplanet-marker-output.png; then convert xplanet-marker-output.png -crop $out_geometry \ realwallpaper-marker-tmp.png @@ -292,6 +317,12 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' mkdir -p archive convert realwallpaper-krebs.png archive/"$(date -Is)".jpg fi + + if needs_rebuild realwallpaper-krebs-stars.png xplanet-krebs-stars-output.png; then + convert xplanet-krebs-stars-output.png -crop $out_geometry \ + realwallpaper-krebs-stars-tmp.png + mv realwallpaper-krebs-stars-tmp.png realwallpaper-krebs-stars.png + fi } main "$@" diff --git a/krebs/5pkgs/simple/realwallpaper/get_constellations.py b/krebs/5pkgs/simple/realwallpaper/get_constellations.py new file mode 100644 index 000000000..5d8d3df5d --- /dev/null +++ b/krebs/5pkgs/simple/realwallpaper/get_constellations.py @@ -0,0 +1,36 @@ +from astropy.coordinates import SkyCoord, ITRS, representation +from astropy.time import Time +import json +import sys + + +def convert_to_itrs(coord): + c = SkyCoord(coord[0], coord[1], unit='degree', frame='icrs') + c_itrs = c.transform_to(ITRS(obstime=Time.now())) + rep = c_itrs.represent_as(representation.UnitSphericalRepresentation) + return [rep.lat.deg, rep.lon.deg] + + +def points_to_lines(points): + lines = [] + for x in range(len(points) - 1): + lines.append([points[x], points[x+1]]) + return lines + + +with open(sys.argv[1]) as f: + constellations = json.load(f)['features'] + +output = [] + +for const in constellations: + for line in const['geometry']['coordinates']: + transformed_line = [] + for point in line: + transformed_line.append(convert_to_itrs(point)) + + line_combined = points_to_lines(transformed_line) + for l in line_combined: # noqa + output.append(f'{l[0][0]} {l[0][1]} {l[1][0]} {l[1][1]} # {const["id"]}') # noqa + +print('\n'.join(output)) -- cgit v1.2.3 From 020154a8599142dae4f9ac838fe1657dbf0da8d3 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 2 May 2021 19:09:47 +0200 Subject: realwallpaper: add krebs-stars-berlin version --- krebs/5pkgs/simple/realwallpaper/default.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'krebs/5pkgs/simple') diff --git a/krebs/5pkgs/simple/realwallpaper/default.nix b/krebs/5pkgs/simple/realwallpaper/default.nix index c9b2e76b6..8728c0ae7 100644 --- a/krebs/5pkgs/simple/realwallpaper/default.nix +++ b/krebs/5pkgs/simple/realwallpaper/default.nix @@ -297,6 +297,26 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' shade=15 ''} + xplanet --num_times 1 --geometry $xplanet_out_size \ + --latitude 52.520008 --longitude 13.404954 \ + --output xplanet-krebs-stars-berlin-output.png --projection merc \ + -config ${pkgs.writeText "xplanet-krebs-stars.config" '' + [default] + + arc_thickness=1 + arc_file=constellations.arcs + + [earth] + "Earth" + map=daymap-final.png + night_map=nightmap-final.png + cloud_map=clouds.png + cloud_threshold=1 + cloud_gamma=10 + marker_file=marker_file + shade=15 + ''} + # trim xplanet output if needs_rebuild realwallpaper.png xplanet-output.png; then convert xplanet-output.png -crop $out_geometry \ @@ -323,6 +343,12 @@ pkgs.writers.writeDashBin "generate-wallpaper" '' realwallpaper-krebs-stars-tmp.png mv realwallpaper-krebs-stars-tmp.png realwallpaper-krebs-stars.png fi + + if needs_rebuild realwallpaper-krebs-stars-berlin.png xplanet-krebs-stars-berlin-output.png; then + convert xplanet-krebs-stars-berlin-output.png -crop $out_geometry \ + realwallpaper-krebs-stars-berlin-tmp.png + mv realwallpaper-krebs-stars-berlin-tmp.png realwallpaper-krebs-stars-berlin.png + fi } main "$@" -- cgit v1.2.3 From f1c47ae668eb3fa47a8c4ea952b81c9a909391a4 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 18 May 2021 23:59:03 +0200 Subject: solanum: init at 2021-04-27 --- krebs/5pkgs/simple/solanum/bandb.patch | 12 +++++ krebs/5pkgs/simple/solanum/default.nix | 63 ++++++++++++++++++++++ .../5pkgs/simple/solanum/dont-create-logdir.patch | 14 +++++ 3 files changed, 89 insertions(+) create mode 100644 krebs/5pkgs/simple/solanum/bandb.patch create mode 100644 krebs/5pkgs/simple/solanum/default.nix create mode 100644 krebs/5pkgs/simple/solanum/dont-create-logdir.patch (limited to 'krebs/5pkgs/simple') diff --git a/krebs/5pkgs/simple/solanum/bandb.patch b/krebs/5pkgs/simple/solanum/bandb.patch new file mode 100644 index 000000000..7d204398b --- /dev/null +++ b/krebs/5pkgs/simple/solanum/bandb.patch @@ -0,0 +1,12 @@ +diff --git a/ircd/bandbi.c b/ircd/bandbi.c +index 29a3bfa2..16a40f17 100644 +--- a/ircd/bandbi.c ++++ b/ircd/bandbi.c +@@ -83,7 +83,6 @@ start_bandb(void) + const char *suffix = ""; + #endif + +- rb_setenv("BANDB_DBPATH", ircd_paths[IRCD_PATH_BANDB], 1); + if(bandb_path == NULL) + { + snprintf(fullpath, sizeof(fullpath), "%s%cbandb%s", ircd_paths[IRCD_PATH_LIBEXEC], RB_PATH_SEPARATOR, suffix); diff --git a/krebs/5pkgs/simple/solanum/default.nix b/krebs/5pkgs/simple/solanum/default.nix new file mode 100644 index 000000000..279cccbcc --- /dev/null +++ b/krebs/5pkgs/simple/solanum/default.nix @@ -0,0 +1,63 @@ +{ lib, stdenv +, fetchFromGitHub +, autoreconfHook +, pkg-config +, bison +, flex +, openssl +, sqlite +, lksctp-tools +}: + +stdenv.mkDerivation rec { + pname = "solanum"; + version = "unstable-2021-04-27"; + + src = fetchFromGitHub { + owner = "solanum-ircd"; + repo = pname; + rev = "3ff5a12e75662e9a642f2a4364797bd361eb0925"; + sha256 = "14ywmfdv8cncbyg08y2qdis00kwg8lvhkcgj185is67smh0qf88f"; + }; + + patches = [ + ./dont-create-logdir.patch + ./bandb.patch # https://github.com/solanum-ircd/solanum/issues/156 + ]; + + configureFlags = [ + "--enable-epoll" + "--enable-ipv6" + "--enable-openssl=${openssl.dev}" + "--with-program-prefix=solanum-" + "--localstatedir=/var/lib" + "--with-rundir=/run" + "--with-logdir=/var/log" + ] ++ lib.optionals (stdenv.isLinux) [ + "--enable-sctp=${lksctp-tools.out}/lib" + ]; + + nativeBuildInputs = [ + autoreconfHook + bison + flex + pkg-config + ]; + + buildInputs = [ + openssl + sqlite + ]; + + doCheck = !stdenv.isDarwin; + + enableParallelBuilding = true; + + meta = with lib; { + description = "An IRCd for unified networks"; + homepage = "https://github.com/solanum-ircd/solanum"; + license = licenses.gpl2Only; + maintainers = with maintainers; [ hexa ]; + platforms = platforms.unix; + }; +} diff --git a/krebs/5pkgs/simple/solanum/dont-create-logdir.patch b/krebs/5pkgs/simple/solanum/dont-create-logdir.patch new file mode 100644 index 000000000..e348dd7b8 --- /dev/null +++ b/krebs/5pkgs/simple/solanum/dont-create-logdir.patch @@ -0,0 +1,14 @@ +diff --git a/Makefile.am b/Makefile.am +index 19e7b396..21093521 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -35,9 +35,6 @@ include/serno.h: + echo '#define DATECODE 0UL' >>include/serno.h; \ + fi + +-install-data-hook: +- test -d ${DESTDIR}${logdir} || mkdir -p ${DESTDIR}${logdir} +- + install-exec-hook: + rm -f ${DESTDIR}${libdir}/*.la + rm -f ${DESTDIR}${moduledir}/*.la -- cgit v1.2.3 From 434420bd0a1a6e0b2d62cc17388ebf7cb6a7760e Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 24 May 2021 16:21:20 +0200 Subject: solanum: remove unneeded BANDB stuff --- krebs/5pkgs/simple/solanum/bandb.patch | 12 ------------ krebs/5pkgs/simple/solanum/default.nix | 1 - 2 files changed, 13 deletions(-) delete mode 100644 krebs/5pkgs/simple/solanum/bandb.patch (limited to 'krebs/5pkgs/simple') diff --git a/krebs/5pkgs/simple/solanum/bandb.patch b/krebs/5pkgs/simple/solanum/bandb.patch deleted file mode 100644 index 7d204398b..000000000 --- a/krebs/5pkgs/simple/solanum/bandb.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/ircd/bandbi.c b/ircd/bandbi.c -index 29a3bfa2..16a40f17 100644 ---- a/ircd/bandbi.c -+++ b/ircd/bandbi.c -@@ -83,7 +83,6 @@ start_bandb(void) - const char *suffix = ""; - #endif - -- rb_setenv("BANDB_DBPATH", ircd_paths[IRCD_PATH_BANDB], 1); - if(bandb_path == NULL) - { - snprintf(fullpath, sizeof(fullpath), "%s%cbandb%s", ircd_paths[IRCD_PATH_LIBEXEC], RB_PATH_SEPARATOR, suffix); diff --git a/krebs/5pkgs/simple/solanum/default.nix b/krebs/5pkgs/simple/solanum/default.nix index 279cccbcc..3fa765c94 100644 --- a/krebs/5pkgs/simple/solanum/default.nix +++ b/krebs/5pkgs/simple/solanum/default.nix @@ -22,7 +22,6 @@ stdenv.mkDerivation rec { patches = [ ./dont-create-logdir.patch - ./bandb.patch # https://github.com/solanum-ircd/solanum/issues/156 ]; configureFlags = [ -- cgit v1.2.3