diff options
Diffstat (limited to 'lass')
-rw-r--r-- | lass/2configs/mpv.nix | 2 | ||||
-rw-r--r-- | lass/2configs/nixpkgs.nix | 2 | ||||
-rw-r--r-- | lass/2configs/websites/lassulus.nix | 2 | ||||
-rw-r--r-- | lass/3modules/default.nix | 1 | ||||
-rw-r--r-- | lass/3modules/news.nix | 76 | ||||
-rw-r--r-- | lass/5pkgs/default.nix | 1 | ||||
-rw-r--r-- | lass/5pkgs/xml2json/default.nix | 17 |
7 files changed, 98 insertions, 3 deletions
diff --git a/lass/2configs/mpv.nix b/lass/2configs/mpv.nix index d9c6274db..bb068e7a1 100644 --- a/lass/2configs/mpv.nix +++ b/lass/2configs/mpv.nix @@ -34,7 +34,7 @@ let down = moveToDir "Y" "./down"; in { - krebs.per-user.lass.packages = [ + environment.systemPackages = [ mpv ]; } diff --git a/lass/2configs/nixpkgs.nix b/lass/2configs/nixpkgs.nix index 86b7d6d2a..49c44aa88 100644 --- a/lass/2configs/nixpkgs.nix +++ b/lass/2configs/nixpkgs.nix @@ -3,6 +3,6 @@ { krebs.build.source.nixpkgs.git = { url = https://cgit.lassul.us/nixpkgs; - ref = "11b82a9"; + ref = "2bb9c1c"; }; } diff --git a/lass/2configs/websites/lassulus.nix b/lass/2configs/websites/lassulus.nix index 9d5f2645d..0771570ca 100644 --- a/lass/2configs/websites/lassulus.nix +++ b/lass/2configs/websites/lassulus.nix @@ -81,7 +81,7 @@ in { alias ${config.krebs.tinc.retiolum.hostsArchive}; ''; locations."= /retiolum.hosts".extraConfig = '' - alias /etc/hosts; + alias ${pkgs.retiolum-hosts}; ''; locations."/tinc".extraConfig = '' alias ${config.krebs.tinc_graphs.workingDir}/external; diff --git a/lass/3modules/default.nix b/lass/3modules/default.nix index 959c9d1b4..73692446a 100644 --- a/lass/3modules/default.nix +++ b/lass/3modules/default.nix @@ -5,6 +5,7 @@ _: ./folderPerms.nix ./hosts.nix ./mysql-backup.nix + ./news.nix ./umts.nix ./usershadow.nix ./xresources.nix diff --git a/lass/3modules/news.nix b/lass/3modules/news.nix new file mode 100644 index 000000000..ecf43ab0a --- /dev/null +++ b/lass/3modules/news.nix @@ -0,0 +1,76 @@ +{ config, lib, pkgs, ... }: + +with import <stockholm/lib>; + +let + cfg = config.lass.news; + + out = { + options.lass.news = api; + config = lib.mkIf cfg.enable imp; + }; + + api = { + enable = mkEnableOption "umts"; + feeds = mkOption { + type = types.listOf (types.submodule { options = { + nick = mkOption { + type = types.str; + }; + feedurl = mkOption { + type = types.str; + }; + interval = mkOption { + type = types.int; + default = 1000; + }; + channels = mkOption { + type = types.listOf types.str; + }; + };}); + }; + user = mkOption { + type = types.user; + default = { + name = "news"; + home = "/var/lib/news"; + }; + }; + ircServer = mkOption { + type = types.str; + default = "echelon.r"; + description = "to which server the bot should connect"; + }; + }; + + imp = { + + users.users.${cfg.user.name} = { + inherit (cfg.user) home name uid; + createHome = true; + }; + + systemd.services = listToAttrs (map (feed: + nameValuePair "news-${feed.nick}" { + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + serviceConfig = { + SyslogIdentifier = "news-${feed.nick}"; + User = cfg.user.name; + PrivateTmp = true; + Restart = "always"; + ExecStart = pkgs.writeDash "news-${feed.nick}" '' + ${pkgs.haskellPackages.news}/bin/news '${feed.feedurl}' '${toString feed.interval}' \ + | ${pkgs.goify}/bin/goify \ + | while :; do + ${pkgs.haskellPackages.kirk}/bin/ircout --nick '${feed.nick}' --host '${cfg.ircServer}' \ + \${concatStringsSep " \\" feed.channels} + done + ''; + }; + } + ) cfg.feeds); + + }; + +in out diff --git a/lass/5pkgs/default.nix b/lass/5pkgs/default.nix index fd52325ae..6e6ba56fa 100644 --- a/lass/5pkgs/default.nix +++ b/lass/5pkgs/default.nix @@ -19,6 +19,7 @@ q = pkgs.callPackage ./q {}; rs = pkgs.callPackage ./rs/default.nix {}; urban = pkgs.callPackage ./urban/default.nix {}; + xml2json = pkgs.callPackage ./xml2json/default.nix {}; xmonad-lass = import ./xmonad-lass.nix { inherit pkgs; }; yt-next = pkgs.callPackage ./yt-next/default.nix {}; }; diff --git a/lass/5pkgs/xml2json/default.nix b/lass/5pkgs/xml2json/default.nix new file mode 100644 index 000000000..78690d4b7 --- /dev/null +++ b/lass/5pkgs/xml2json/default.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: +let + pp = pkgs.python35Packages; +in pp.buildPythonPackage rec { + name = "xml2json-${version}"; + version = "22ffcd"; + propagatedBuildInputs = [ + pp.simplejson + ]; + src = pkgs.fetchFromGitHub { + owner = "hay"; + repo = "xml2json"; + rev = "${version}"; + sha256 = "1snjd6q6bk517350gdrl8kkphkra0iaz56i583h2q57ab09r29vc"; + }; + doCheck = false; +} |