diff options
author | José Romildo Malaquias <malaquias@gmail.com> | 2017-11-02 00:29:12 -0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-02 00:29:12 -0200 |
commit | c07835a11bedd070aef2d2e86e7d03d579b560f3 (patch) | |
tree | 8b7f11859dd719c4d6dd7cfd83da5c541d5a6454 /nixos/modules/services/misc | |
parent | d3763a7164e7c8b1b269add0d0ed1e8f316bbdc9 (diff) | |
parent | bb6257bd3a22f79b00350966e9de0786cae26f5b (diff) | |
download | nixlib-c07835a11bedd070aef2d2e86e7d03d579b560f3.tar nixlib-c07835a11bedd070aef2d2e86e7d03d579b560f3.tar.gz nixlib-c07835a11bedd070aef2d2e86e7d03d579b560f3.tar.bz2 nixlib-c07835a11bedd070aef2d2e86e7d03d579b560f3.tar.lz nixlib-c07835a11bedd070aef2d2e86e7d03d579b560f3.tar.xz nixlib-c07835a11bedd070aef2d2e86e7d03d579b560f3.tar.zst nixlib-c07835a11bedd070aef2d2e86e7d03d579b560f3.zip |
Merge branch 'master' into upd.lxqt
Diffstat (limited to 'nixos/modules/services/misc')
-rw-r--r-- | nixos/modules/services/misc/gitlab.nix | 6 | ||||
-rw-r--r-- | nixos/modules/services/misc/nixos-manual.nix | 5 | ||||
-rw-r--r-- | nixos/modules/services/misc/plexpy.nix | 81 |
3 files changed, 87 insertions, 5 deletions
diff --git a/nixos/modules/services/misc/gitlab.nix b/nixos/modules/services/misc/gitlab.nix index 740cbc141b53..7b2b40e59232 100644 --- a/nixos/modules/services/misc/gitlab.nix +++ b/nixos/modules/services/misc/gitlab.nix @@ -572,7 +572,7 @@ in { rm -rf ${cfg.statePath}/config ${cfg.statePath}/shell/hooks mkdir -p ${cfg.statePath}/config - tr -dc A-Za-z0-9 < /dev/urandom | head -c 32 > ${cfg.statePath}/config/gitlab_shell_secret + ${pkgs.openssl}/bin/openssl rand -hex 32 > ${cfg.statePath}/config/gitlab_shell_secret # The uploads directory is hardcoded somewhere deep in rails. It is # symlinked in the gitlab package to /run/gitlab/uploads to make it @@ -619,7 +619,7 @@ in { fi # enable required pg_trgm extension for gitlab - ${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql gitlab -c "CREATE EXTENSION IF NOT EXISTS pg_trgm" + ${pkgs.sudo}/bin/sudo -u ${pgSuperUser} psql ${cfg.databaseName} -c "CREATE EXTENSION IF NOT EXISTS pg_trgm" # Always do the db migrations just to be sure the database is up-to-date ${gitlab-rake}/bin/gitlab-rake db:migrate RAILS_ENV=production @@ -634,7 +634,7 @@ in { # The gitlab:shell:create_hooks task seems broken for fixing links # so we instead delete all the hooks and create them anew - rm ${cfg.statePath}/repositories/**/*.git/hooks + rm -f ${cfg.statePath}/repositories/**/*.git/hooks ${gitlab-rake}/bin/gitlab-rake gitlab:shell:create_hooks RAILS_ENV=production # Change permissions in the last step because some of the diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix index 515864ec2e2d..41cadb4a6de0 100644 --- a/nixos/modules/services/misc/nixos-manual.nix +++ b/nixos/modules/services/misc/nixos-manual.nix @@ -135,8 +135,9 @@ in }; }; - services.mingetty.helpLine = mkIf cfg.showManual - "\nPress <Alt-F${toString cfg.ttyNumber}> for the NixOS manual."; + services.mingetty.helpLine = "\nRun `nixos-help` " + + lib.optionalString cfg.showManual "or press <Alt-F${toString cfg.ttyNumber}> " + + "for the NixOS manual."; }; diff --git a/nixos/modules/services/misc/plexpy.nix b/nixos/modules/services/misc/plexpy.nix new file mode 100644 index 000000000000..df9f12581247 --- /dev/null +++ b/nixos/modules/services/misc/plexpy.nix @@ -0,0 +1,81 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.services.plexpy; +in +{ + options = { + services.plexpy = { + enable = mkEnableOption "PlexPy Plex Monitor"; + + dataDir = mkOption { + type = types.str; + default = "/var/lib/plexpy"; + description = "The directory where PlexPy stores its data files."; + }; + + configFile = mkOption { + type = types.str; + default = "/var/lib/plexpy/config.ini"; + description = "The location of PlexPy's config file."; + }; + + port = mkOption { + type = types.int; + default = 8181; + description = "TCP port where PlexPy listens."; + }; + + user = mkOption { + type = types.str; + default = "plexpy"; + description = "User account under which PlexPy runs."; + }; + + group = mkOption { + type = types.str; + default = "nogroup"; + description = "Group under which PlexPy runs."; + }; + + package = mkOption { + type = types.package; + default = pkgs.plexpy; + defaultText = "pkgs.plexpy"; + description = '' + The PlexPy package to use. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + systemd.services.plexpy = { + description = "PlexPy Plex Monitor"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + preStart = '' + test -d "${cfg.dataDir}" || { + echo "Creating initial PlexPy data directory in \"${cfg.dataDir}\"." + mkdir -p "${cfg.dataDir}" + chown ${cfg.user}:${cfg.group} "${cfg.dataDir}" + } + ''; + serviceConfig = { + Type = "simple"; + User = cfg.user; + Group = cfg.group; + PermissionsStartOnly = "true"; + GuessMainPID = "false"; + ExecStart = "${cfg.package}/bin/plexpy --datadir ${cfg.dataDir} --config ${cfg.configFile} --port ${toString cfg.port} --pidfile ${cfg.dataDir}/plexpy.pid --nolaunch"; + Restart = "on-failure"; + }; + }; + + users.extraUsers = mkIf (cfg.user == "plexpy") { + plexpy = { group = cfg.group; uid = config.ids.uids.plexpy; }; + }; + }; +} |