diff options
Diffstat (limited to 'modules/private/pub/default.nix')
-rw-r--r-- | modules/private/pub/default.nix | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/modules/private/pub/default.nix b/modules/private/pub/default.nix new file mode 100644 index 0000000..c31c8eb --- /dev/null +++ b/modules/private/pub/default.nix | |||
@@ -0,0 +1,52 @@ | |||
1 | { lib, pkgs, config, myconfig, ... }: | ||
2 | { | ||
3 | options = { | ||
4 | myServices.pub.enable = lib.mkOption { | ||
5 | type = lib.types.bool; | ||
6 | default = false; | ||
7 | description = '' | ||
8 | Whether to enable pub user. | ||
9 | ''; | ||
10 | }; | ||
11 | }; | ||
12 | |||
13 | config = lib.mkIf config.myServices.pub.enable { | ||
14 | users.users.pub = let | ||
15 | restrict = pkgs.runCommand "restrict" { | ||
16 | file = ./restrict; | ||
17 | buildInputs = [ pkgs.makeWrapper ]; | ||
18 | } '' | ||
19 | mkdir -p $out/bin | ||
20 | cp $file $out/bin/restrict | ||
21 | chmod a+x $out/bin/restrict | ||
22 | patchShebangs $out/bin/restrict | ||
23 | wrapProgram $out/bin/restrict \ | ||
24 | --prefix PATH : ${lib.makeBinPath [ pkgs.bubblewrap pkgs.rrsync ]} \ | ||
25 | --set TMUX_RESTRICT ${./tmux.restrict.conf} | ||
26 | ''; | ||
27 | purple-hangouts = pkgs.purple-hangouts.overrideAttrs(old: { | ||
28 | installPhase = '' | ||
29 | install -Dm755 -t $out/lib/purple-2/ libhangouts.so | ||
30 | for size in 16 22 24 48; do | ||
31 | install -TDm644 hangouts$size.png $out/share/pixmaps/pidgin/protocols/$size/hangouts.png | ||
32 | done | ||
33 | ''; | ||
34 | }); | ||
35 | in { | ||
36 | createHome = true; | ||
37 | description = "Restricted shell user"; | ||
38 | home = "/var/lib/pub"; | ||
39 | uid = myconfig.env.users.pub.uid; | ||
40 | useDefaultShell = true; | ||
41 | packages = [ | ||
42 | restrict | ||
43 | pkgs.tmux | ||
44 | (pkgs.pidgin.override { plugins = [ | ||
45 | pkgs.purple-plugin-pack purple-hangouts | ||
46 | pkgs.purple-discord pkgs.purple-facebook | ||
47 | pkgs.telegram-purple | ||
48 | ]; }) | ||
49 | ]; | ||
50 | }; | ||
51 | }; | ||
52 | } | ||