-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
mirakurun: init at 3.3.0 #48740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
mirakurun: init at 3.3.0 #48740
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| { config, lib, pkgs, ... }: | ||
|
|
||
| with lib; | ||
|
|
||
| let | ||
| cfg = config.services.mirakurun; | ||
| mirakurun = pkgs.mirakurun; | ||
| username = config.users.users.mirakurun.name; | ||
| groupname = config.users.users.mirakurun.group; | ||
| settingsFmt = pkgs.formats.yaml {}; | ||
| in | ||
| { | ||
| options = { | ||
| services.mirakurun = { | ||
| enable = mkEnableOption mirakurun.meta.description; | ||
|
|
||
| port = mkOption { | ||
| type = with types; nullOr port; | ||
| default = 40772; | ||
| description = '' | ||
| Port to listen on. If null, it won't listen on any port. | ||
| ''; | ||
| }; | ||
|
|
||
| openFirewall = mkOption { | ||
| type = types.bool; | ||
| default = false; | ||
| description = '' | ||
| Open ports in the firewall for Mirakurun. | ||
| ''; | ||
| }; | ||
|
|
||
| serverSettings = mkOption { | ||
| type = settingsFmt.type; | ||
| default = {}; | ||
| example = literalExample '' | ||
| { | ||
| highWaterMark = 25165824; | ||
| overflowTimeLimit = 30000; | ||
| }; | ||
| ''; | ||
| description = '' | ||
| Options for server.yml. | ||
|
|
||
| Documentation: | ||
| <link xlink:href="https://github.com/Chinachu/Mirakurun/blob/master/doc/Configuration.md"/> | ||
| ''; | ||
| }; | ||
|
|
||
| tunerSettings = mkOption { | ||
| type = with types; nullOr settingsFmt.type; | ||
| default = null; | ||
| example = literalExample '' | ||
| [ | ||
| { | ||
| name = "tuner-name"; | ||
| types = [ "GR" "BS" "CS" "SKY" ]; | ||
| dvbDevicePath = "/dev/dvb/adapterX/dvrX"; | ||
| } | ||
| ]; | ||
| ''; | ||
| description = '' | ||
| Options which are added to tuners.yml. If none is specified, it will | ||
| automatically be generated at runtime. | ||
|
|
||
| Documentation: | ||
| <link xlink:href="https://github.com/Chinachu/Mirakurun/blob/master/doc/Configuration.md"/> | ||
| ''; | ||
| }; | ||
|
|
||
| channelSettings = mkOption { | ||
| type = with types; nullOr settingsFmt.type; | ||
| default = null; | ||
| example = literalExample '' | ||
| [ | ||
| { | ||
| name = "channel"; | ||
| types = "GR"; | ||
| channel = "0"; | ||
| } | ||
| ]; | ||
| ''; | ||
| description = '' | ||
| Options which are added to channels.yml. If none is specified, it | ||
| will automatically be generated at runtime. | ||
|
|
||
| Documentation: | ||
| <link xlink:href="https://github.com/Chinachu/Mirakurun/blob/master/doc/Configuration.md"/> | ||
| ''; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| config = mkIf cfg.enable { | ||
| environment.systemPackages = [ mirakurun ]; | ||
| environment.etc = { | ||
| "mirakurun/server.yml".source = settingsFmt.generate "server.yml" cfg.serverSettings; | ||
| "mirakurun/tuners.yml" = mkIf (cfg.tunerSettings != null) { | ||
| source = settingsFmt.generate "tuners.yml" cfg.tunerSettings; | ||
infinisil marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| mode = "0644"; | ||
| user = username; | ||
| group = groupname; | ||
| }; | ||
| "mirakurun/channels.yml" = mkIf (cfg.channelSettings != null) { | ||
| source = settingsFmt.generate "channels.yml" cfg.channelSettings; | ||
| mode = "0644"; | ||
| user = username; | ||
| group = groupname; | ||
| }; | ||
| }; | ||
|
|
||
| networking.firewall = mkIf cfg.openFirewall { | ||
| allowedTCPPorts = mkIf (cfg.port != null) [ cfg.port ]; | ||
| }; | ||
|
|
||
| users.users.mirakurun = { | ||
| description = "Mirakurun user"; | ||
| group = "video"; | ||
| isSystemUser = true; | ||
| }; | ||
|
|
||
| services.mirakurun.serverSettings = { | ||
| logLevel = mkDefault 2; | ||
| path = mkDefault "/var/run/mirakurun/mirakurun.sock"; | ||
| port = mkIf (cfg.port != null) (mkDefault cfg.port); | ||
| }; | ||
|
|
||
| systemd.tmpfiles.rules = [ | ||
| "d '/etc/mirakurun' - ${username} ${groupname} - -" | ||
| ]; | ||
|
|
||
| systemd.services.mirakurun = { | ||
| description = mirakurun.meta.description; | ||
| wantedBy = [ "multi-user.target" ]; | ||
| after = [ "network.target" ]; | ||
| serviceConfig = { | ||
| ExecStart = "${mirakurun}/bin/mirakurun"; | ||
| User = username; | ||
| Group = groupname; | ||
infinisil marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| RuntimeDirectory="mirakurun"; | ||
| StateDirectory="mirakurun"; | ||
| Nice = -10; | ||
| IOSchedulingClass = "realtime"; | ||
| IOSchedulingPriority = 7; | ||
| }; | ||
|
|
||
| environment = { | ||
| SERVER_CONFIG_PATH = "/etc/mirakurun/server.yml"; | ||
| TUNERS_CONFIG_PATH = "/etc/mirakurun/tuners.yml"; | ||
| CHANNELS_CONFIG_PATH = "/etc/mirakurun/channels.yml"; | ||
| SERVICES_DB_PATH = "/var/lib/mirakurun/services.json"; | ||
| PROGRAMS_DB_PATH = "/var/lib/mirakurun/programs.json"; | ||
| NODE_ENV = "production"; | ||
| }; | ||
|
|
||
| restartTriggers = let | ||
| getconf = target: config.environment.etc."mirakurun/${target}.yml".source; | ||
| targets = [ | ||
| "server" | ||
| ] ++ optional (cfg.tunerSettings != null) "tuners" | ||
| ++ optional (cfg.channelSettings != null) "channels"; | ||
| in (map getconf targets); | ||
| }; | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,6 +119,7 @@ | |
| , "mathjax" | ||
| , "meat" | ||
| , "meguca" | ||
| , "mirakurun" | ||
| , "mocha" | ||
| , "multi-file-swagger" | ||
| , "neovim" | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.