]>
Commit | Line | Data |
---|---|---|
ab8f306d | 1 | { lib, pkgs, config, ... }: |
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 { |
1b9150a5 IB |
14 | myServices.ssh.modules = [{ |
15 | snippet = builtins.readFile ./ldap_pub.sh; | |
16 | dependencies = [ pkgs.coreutils ]; | |
17 | }]; | |
5ccc61bb | 18 | users.users.pub = let |
46a61a1b | 19 | restrict = pkgs.runCommand "restrict" { |
5ccc61bb IB |
20 | file = ./restrict; |
21 | buildInputs = [ pkgs.makeWrapper ]; | |
22 | } '' | |
23 | mkdir -p $out/bin | |
24 | cp $file $out/bin/restrict | |
25 | chmod a+x $out/bin/restrict | |
26 | patchShebangs $out/bin/restrict | |
27 | wrapProgram $out/bin/restrict \ | |
28 | --prefix PATH : ${lib.makeBinPath [ pkgs.bubblewrap pkgs.rrsync ]} \ | |
29 | --set TMUX_RESTRICT ${./tmux.restrict.conf} | |
30 | ''; | |
1be1a523 IB |
31 | purple-hangouts = pkgs.purple-hangouts.overrideAttrs(old: { |
32 | installPhase = '' | |
33 | install -Dm755 -t $out/lib/purple-2/ libhangouts.so | |
34 | for size in 16 22 24 48; do | |
35 | install -TDm644 hangouts$size.png $out/share/pixmaps/pidgin/protocols/$size/hangouts.png | |
36 | done | |
37 | ''; | |
38 | }); | |
5ccc61bb IB |
39 | in { |
40 | createHome = true; | |
41 | description = "Restricted shell user"; | |
42 | home = "/var/lib/pub"; | |
ab8f306d | 43 | uid = config.myEnv.users.pub.uid; |
5ccc61bb IB |
44 | useDefaultShell = true; |
45 | packages = [ | |
46 | restrict | |
47 | pkgs.tmux | |
48 | (pkgs.pidgin.override { plugins = [ | |
1be1a523 | 49 | pkgs.purple-plugin-pack purple-hangouts |
5ccc61bb IB |
50 | pkgs.purple-discord pkgs.purple-facebook |
51 | pkgs.telegram-purple | |
52 | ]; }) | |
53 | ]; | |
54 | }; | |
55 | }; | |
56 | } |