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