Merge pull request #43308 from Chiiruno/dev/hydron

hydron: init at 2018-07-11

authored by Silvan Mosberger and committed by GitHub 810f91f4 35c069ea

+236
+2
nixos/modules/misc/ids.nix
··· 322 hdfs = 295; 323 mapred = 296; 324 hadoop = 297; 325 326 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! 327 ··· 604 hdfs = 295; 605 mapred = 296; 606 hadoop = 297; 607 608 # When adding a gid, make sure it doesn't match an existing 609 # uid. Users and groups with the same name should have equal
··· 322 hdfs = 295; 323 mapred = 296; 324 hadoop = 297; 325 + hydron = 298; 326 327 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! 328 ··· 605 hdfs = 295; 606 mapred = 296; 607 hadoop = 297; 608 + hydron = 298; 609 610 # When adding a gid, make sure it doesn't match an existing 611 # uid. Users and groups with the same name should have equal
+1
nixos/modules/module-list.nix
··· 676 ./services/web-servers/caddy.nix 677 ./services/web-servers/fcgiwrap.nix 678 ./services/web-servers/hitch/default.nix 679 ./services/web-servers/jboss/default.nix 680 ./services/web-servers/lighttpd/cgit.nix 681 ./services/web-servers/lighttpd/collectd.nix
··· 676 ./services/web-servers/caddy.nix 677 ./services/web-servers/fcgiwrap.nix 678 ./services/web-servers/hitch/default.nix 679 + ./services/web-servers/hydron.nix 680 ./services/web-servers/jboss/default.nix 681 ./services/web-servers/lighttpd/cgit.nix 682 ./services/web-servers/lighttpd/collectd.nix
+105
nixos/modules/services/web-servers/hydron.nix
···
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + let cfg = config.services.hydron; 4 + in with lib; { 5 + options.services.hydron = { 6 + enable = mkEnableOption "hydron"; 7 + 8 + dataDir = mkOption { 9 + type = types.path; 10 + default = "/var/lib/hydron"; 11 + example = "/home/okina/hydron"; 12 + description = "Location where hydron runs and stores data."; 13 + }; 14 + 15 + interval = mkOption { 16 + type = types.str; 17 + default = "hourly"; 18 + example = "06:00"; 19 + description = '' 20 + How often we run hydron import and possibly fetch tags. Runs by default every hour. 21 + 22 + The format is described in 23 + <citerefentry><refentrytitle>systemd.time</refentrytitle> 24 + <manvolnum>7</manvolnum></citerefentry>. 25 + ''; 26 + }; 27 + 28 + listenAddress = mkOption { 29 + type = types.nullOr types.str; 30 + default = null; 31 + example = "127.0.0.1:8010"; 32 + description = "Listen on a specific IP address and port."; 33 + }; 34 + 35 + importPaths = mkOption { 36 + type = types.listOf types.path; 37 + default = []; 38 + example = [ "/home/okina/Pictures" ]; 39 + description = "Paths that hydron will recursively import."; 40 + }; 41 + 42 + fetchTags = mkOption { 43 + type = types.bool; 44 + default = true; 45 + description = "Fetch tags for imported images and webm from gelbooru."; 46 + }; 47 + }; 48 + 49 + config = mkIf cfg.enable { 50 + systemd.services.hydron = { 51 + description = "hydron"; 52 + after = [ "network.target" ]; 53 + wantedBy = [ "multi-user.target" ]; 54 + 55 + preStart = '' 56 + # Ensure folder exists and permissions are correct 57 + mkdir -p ${escapeShellArg cfg.dataDir}/images 58 + chmod 750 ${escapeShellArg cfg.dataDir} 59 + chown -R hydron:hydron ${escapeShellArg cfg.dataDir} 60 + ''; 61 + 62 + serviceConfig = { 63 + PermissionsStartOnly = true; 64 + User = "hydron"; 65 + Group = "hydron"; 66 + ExecStart = "${pkgs.hydron}/bin/hydron serve" 67 + + optionalString (cfg.listenAddress != null) " -a ${cfg.listenAddress}"; 68 + }; 69 + }; 70 + 71 + systemd.services.hydron-fetch = { 72 + description = "Import paths into hydron and possibly fetch tags"; 73 + 74 + serviceConfig = { 75 + Type = "oneshot"; 76 + User = "hydron"; 77 + Group = "hydron"; 78 + ExecStart = "${pkgs.hydron}/bin/hydron import " 79 + + optionalString cfg.fetchTags "-f " 80 + + (escapeShellArg cfg.dataDir) + "/images " + (escapeShellArgs cfg.importPaths); 81 + }; 82 + }; 83 + 84 + systemd.timers.hydron-fetch = { 85 + description = "Automatically import paths into hydron and possibly fetch tags"; 86 + after = [ "network.target" ]; 87 + wantedBy = [ "timers.target" ]; 88 + timerConfig.OnCalendar = cfg.interval; 89 + }; 90 + 91 + users = { 92 + groups.hydron.gid = config.ids.gids.hydron; 93 + 94 + users.hydron = { 95 + description = "hydron server service user"; 96 + home = cfg.dataDir; 97 + createHome = true; 98 + group = "hydron"; 99 + uid = config.ids.uids.hydron; 100 + }; 101 + }; 102 + }; 103 + 104 + meta.maintainers = with maintainers; [ chiiruno ]; 105 + }
+33
pkgs/servers/hydron/default.nix
···
··· 1 + { stdenv, buildGoPackage, fetchFromGitHub, pkgconfig, ffmpeg-full, graphicsmagick 2 + , quicktemplate, go-bindata, easyjson }: 3 + 4 + buildGoPackage rec { 5 + name = "hydron-unstable-${version}"; 6 + version = "2018-07-15"; 7 + goPackagePath = "github.com/bakape/hydron"; 8 + goDeps = ./deps.nix; 9 + 10 + src = fetchFromGitHub { 11 + rev = "3906ace0b4cf48ba9acccf372377c7feb0665be4"; 12 + owner = "bakape"; 13 + repo = "hydron"; 14 + sha256 = "079a88740wxgq73sq8w96zppfng7af76k7h484x3w695qk83j33r"; 15 + }; 16 + 17 + enableParallelBuilding = true; 18 + nativeBuildInputs = [ pkgconfig ]; 19 + buildInputs = [ ffmpeg-full graphicsmagick quicktemplate go-bindata easyjson ]; 20 + 21 + # Temporary workaround for https://github.com/NixOS/nixpkgs/issues/43593 22 + preBuild = '' 23 + rm go/src/github.com/bakape/hydron/ico.syso 24 + ''; 25 + 26 + meta = with stdenv.lib; { 27 + homepage = "https://github.com/bakape/hydron"; 28 + description = "High performance media tagger and organizer"; 29 + license = licenses.lgpl3Plus; 30 + maintainers = with maintainers; [ chiiruno ]; 31 + platforms = platforms.all; 32 + }; 33 + }
+93
pkgs/servers/hydron/deps.nix
···
··· 1 + # This file was generated by https://github.com/kamilchm/go2nix v1.2.1 2 + [ 3 + { 4 + goPackagePath = "github.com/Masterminds/squirrel"; 5 + fetch = { 6 + type = "git"; 7 + url = "https://github.com/Masterminds/squirrel"; 8 + rev = "b127ed9be03443fe3c0877e391130e3dd3f3107a"; 9 + sha256 = "04vgwm5g5486188656hiw1x56mrkv27s5g2s8mc1lz7z1ig5g5bg"; 10 + }; 11 + } 12 + { 13 + goPackagePath = "github.com/bakape/thumbnailer"; 14 + fetch = { 15 + type = "git"; 16 + url = "https://github.com/bakape/thumbnailer"; 17 + rev = "fa88f595f3882773bc425b382eee71e3e2fa1291"; 18 + sha256 = "19xfn8aj1nhh5dj93hskzrhaa07sayd8agmz1vkkh6varqrldanf"; 19 + }; 20 + } 21 + { 22 + goPackagePath = "github.com/dimfeld/httptreemux"; 23 + fetch = { 24 + type = "git"; 25 + url = "https://github.com/dimfeld/httptreemux"; 26 + rev = "7f532489e7739b3d49df5c602bf63549881fe753"; 27 + sha256 = "0hkw04rsvljvx8ynqjgz9cb743x09fd2xiiycrgz5vbsa8q9iyyk"; 28 + }; 29 + } 30 + { 31 + goPackagePath = "github.com/gorilla/handlers"; 32 + fetch = { 33 + type = "git"; 34 + url = "https://github.com/gorilla/handlers"; 35 + rev = "13a38d26174b16d5b4bf6f1094c1389ec9879572"; 36 + sha256 = "0zg43blpyyy667y0kpiifk5a2w35jh8qkk4zwlabb365c0lzrv6v"; 37 + }; 38 + } 39 + { 40 + goPackagePath = "github.com/lann/builder"; 41 + fetch = { 42 + type = "git"; 43 + url = "https://github.com/lann/builder"; 44 + rev = "1b87b36280d04fe7882d1512bf038ea2967ad534"; 45 + sha256 = "015q46awbyp47vld07yi7d27i0lkd82r7qn5230bb9qxl4mcfiqc"; 46 + }; 47 + } 48 + { 49 + goPackagePath = "github.com/lann/ps"; 50 + fetch = { 51 + type = "git"; 52 + url = "https://github.com/lann/ps"; 53 + rev = "62de8c46ede02a7675c4c79c84883eb164cb71e3"; 54 + sha256 = "10yhcyymypvdiiipchsp80jbglk8c4r7lq7h54v9f4mxmvz6xgf7"; 55 + }; 56 + } 57 + { 58 + goPackagePath = "github.com/mailru/easyjson"; 59 + fetch = { 60 + type = "git"; 61 + url = "https://github.com/mailru/easyjson"; 62 + rev = "3fdea8d05856a0c8df22ed4bc71b3219245e4485"; 63 + sha256 = "0g3crph77yhv4ipdnwqc32z4cp87ahi4ikad5kyy6q4znnxliz74"; 64 + }; 65 + } 66 + { 67 + goPackagePath = "github.com/mattn/go-sqlite3"; 68 + fetch = { 69 + type = "git"; 70 + url = "https://github.com/mattn/go-sqlite3"; 71 + rev = "3aefd9f0a162514f66d0e4ceda3edc44e66b502e"; 72 + sha256 = "0as2kqmlvd21r481vxl457n5lxxp4i1jdjkmyqsjf5vg6xr9gd2d"; 73 + }; 74 + } 75 + { 76 + goPackagePath = "github.com/valyala/bytebufferpool"; 77 + fetch = { 78 + type = "git"; 79 + url = "https://github.com/valyala/bytebufferpool"; 80 + rev = "e746df99fe4a3986f4d4f79e13c1e0117ce9c2f7"; 81 + sha256 = "01lqzjddq6kz9v41nkky7wbgk7f1cw036sa7ldz10d82g5klzl93"; 82 + }; 83 + } 84 + { 85 + goPackagePath = "github.com/valyala/quicktemplate"; 86 + fetch = { 87 + type = "git"; 88 + url = "https://github.com/valyala/quicktemplate"; 89 + rev = "a91e0946457b6583004fbfc159339b8171423aed"; 90 + sha256 = "1z89ang5pkq5qs5b2nwhzyrw0zjlsas539l9kix374fhka49n8yc"; 91 + }; 92 + } 93 + ]
+2
pkgs/top-level/all-packages.nix
··· 12774 12775 home-assistant = callPackage ../servers/home-assistant { }; 12776 12777 ircdHybrid = callPackage ../servers/irc/ircd-hybrid { }; 12778 12779 jboss = callPackage ../servers/http/jboss { };
··· 12774 12775 home-assistant = callPackage ../servers/home-assistant { }; 12776 12777 + hydron = callPackage ../servers/hydron { }; 12778 + 12779 ircdHybrid = callPackage ../servers/irc/ircd-hybrid { }; 12780 12781 jboss = callPackage ../servers/http/jboss { };