]>
Commit | Line | Data |
---|---|---|
8a964143 | 1 | { lib, pkgs, config, myconfig, ... }: |
5ccc61bb IB |
2 | { |
3 | options = { | |
8d213e2b | 4 | myServices.pub.enable = lib.mkOption { |
5ccc61bb IB |
5 | type = lib.types.bool; |
6 | default = false; | |
7 | description = '' | |
8 | Whether to enable pub user. | |
9 | ''; | |
10 | }; | |
11 | }; | |
12 | ||
8d213e2b | 13 | config = lib.mkIf config.myServices.pub.enable { |
6a8252b1 IB |
14 | services.backup.profiles.pub = { |
15 | rootDir = "/var/lib/pub"; | |
16 | }; | |
5ccc61bb IB |
17 | users.users.pub = let |
18 | restrict = pkgs.runCommand "restrict" { | |
19 | file = ./restrict; | |
20 | buildInputs = [ pkgs.makeWrapper ]; | |
21 | } '' | |
22 | mkdir -p $out/bin | |
23 | cp $file $out/bin/restrict | |
24 | chmod a+x $out/bin/restrict | |
25 | patchShebangs $out/bin/restrict | |
26 | wrapProgram $out/bin/restrict \ | |
27 | --prefix PATH : ${lib.makeBinPath [ pkgs.bubblewrap pkgs.rrsync ]} \ | |
28 | --set TMUX_RESTRICT ${./tmux.restrict.conf} | |
29 | ''; | |
1be1a523 IB |
30 | purple-hangouts = pkgs.purple-hangouts.overrideAttrs(old: { |
31 | installPhase = '' | |
32 | install -Dm755 -t $out/lib/purple-2/ libhangouts.so | |
33 | for size in 16 22 24 48; do | |
34 | install -TDm644 hangouts$size.png $out/share/pixmaps/pidgin/protocols/$size/hangouts.png | |
35 | done | |
36 | ''; | |
37 | }); | |
5ccc61bb IB |
38 | in { |
39 | createHome = true; | |
40 | description = "Restricted shell user"; | |
41 | home = "/var/lib/pub"; | |
42 | uid = myconfig.env.users.pub.uid; | |
43 | useDefaultShell = true; | |
44 | packages = [ | |
45 | restrict | |
46 | pkgs.tmux | |
47 | (pkgs.pidgin.override { plugins = [ | |
1be1a523 | 48 | pkgs.purple-plugin-pack purple-hangouts |
5ccc61bb IB |
49 | pkgs.purple-discord pkgs.purple-facebook |
50 | pkgs.telegram-purple | |
51 | ]; }) | |
52 | ]; | |
53 | }; | |
54 | }; | |
55 | } |