summaryrefslogtreecommitdiffstats
path: root/tv/3modules
diff options
context:
space:
mode:
Diffstat (limited to 'tv/3modules')
-rw-r--r--tv/3modules/default.nix1
-rw-r--r--tv/3modules/ejabberd/default.nix2
-rw-r--r--tv/3modules/nixpkgs-overlays.nix23
-rw-r--r--tv/3modules/slock.nix20
4 files changed, 12 insertions, 34 deletions
diff --git a/tv/3modules/default.nix b/tv/3modules/default.nix
index f53a58e9a..67fb3f650 100644
--- a/tv/3modules/default.nix
+++ b/tv/3modules/default.nix
@@ -5,7 +5,6 @@
./ejabberd
./hosts.nix
./iptables.nix
- ./nixpkgs-overlays.nix
./slock.nix
./x0vncserver.nix
];
diff --git a/tv/3modules/ejabberd/default.nix b/tv/3modules/ejabberd/default.nix
index e99b94ff9..f16dfac86 100644
--- a/tv/3modules/ejabberd/default.nix
+++ b/tv/3modules/ejabberd/default.nix
@@ -67,7 +67,7 @@ in {
type = types.user;
default = {
name = "ejabberd";
- home = "/var/ejabberd";
+ home = "/var/lib/ejabberd";
};
};
};
diff --git a/tv/3modules/nixpkgs-overlays.nix b/tv/3modules/nixpkgs-overlays.nix
deleted file mode 100644
index 4eb7a86bd..000000000
--- a/tv/3modules/nixpkgs-overlays.nix
+++ /dev/null
@@ -1,23 +0,0 @@
-with import <stockholm/lib>;
-{ config, pkgs, ... }: {
-
- options.tv.nixpkgs-overlays = mkOption {
- apply = src:
- pkgs.runCommand "nixpkgs-overlays" {} ''
- mkdir $out
- ${concatStringsSep "\n" (mapAttrsToList (name: path:
- "ln -s ${shell.escape path} $out/${shell.escape name}"
- ) src)}
- '' // {
- inherit src;
- };
- type = types.attrsOf types.absolute-pathname;
- };
-
- config = {
- tv.nixpkgs-overlays = {
- krebs = mkDefault "/var/src/stockholm/krebs/5pkgs";
- tv = mkDefault "/var/src/stockholm/tv/5pkgs";
- };
- };
-}
diff --git a/tv/3modules/slock.nix b/tv/3modules/slock.nix
index 1c84b1e9e..53f7f1f62 100644
--- a/tv/3modules/slock.nix
+++ b/tv/3modules/slock.nix
@@ -5,10 +5,12 @@ in {
options.tv.slock = {
enable = mkEnableOption "tv.slock";
package = mkOption {
- default = pkgs.execBin "slock" rec {
- filename = "${pkgs.systemd}/bin/systemctl";
- argv = [ filename "start" "slock-${cfg.user.name}.service" ];
- };
+ default = pkgs.writeDashBin "slock" ''
+ set -efu
+ display=''${DISPLAY#:}
+ service=slock-$LOGNAME@$display.service
+ exec ${pkgs.systemd}/bin/systemctl start "$service"
+ '';
type = types.package;
};
user = mkOption {
@@ -18,16 +20,16 @@ in {
config = mkIf cfg.enable {
security.polkit.extraConfig = /* js */ ''
polkit.addRule(function(action, subject) {
- if (action.id == "org.freedesktop.systemd1.manage-units" &&
- action.lookup("unit") == "slock-${cfg.user.name}.service" &&
- subject.user == ${toJSON cfg.user.name}) {
+ if (action.id === "org.freedesktop.systemd1.manage-units" &&
+ subject.user === ${toJSON cfg.user.name} &&
+ /^slock-${cfg.user.name}@[0-9]+\.service$/.test(action.lookup("unit")) ) {
return polkit.Result.YES;
}
});
'';
- systemd.services."slock-${cfg.user.name}" = {
+ systemd.services."slock-${cfg.user.name}@" = {
environment = {
- DISPLAY = ":${toString config.services.xserver.display}";
+ DISPLAY = ":%I";
LD_PRELOAD = pkgs.runCommandCC "slock-${cfg.user.name}.so" {
passAsFile = ["text"];
text = /* c */ ''