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