Skip to content

Commit b9710a9

Browse files
committed
lockers: Module to run /mit/ automounter
1 parent 48fb8cf commit b9710a9

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

modules/default.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
# Add your NixOS modules here
3-
#
4-
# my-module = ./my-module;
3+
# Don't forget that nixathena.modules.whatever also needs to be in the
4+
# `modules = [ ... ]` list of your config to actually process these.
55
discussd = ./discussd.nix;
66
remctld = ./remctld.nix;
7+
pyhesiodfs = ./pyhesiodfs.nix;
78
}

modules/pyhesiodfs.nix

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{ lib, pkgs, config, options,
2+
specialArgs, modulesPath,
3+
}:
4+
let
5+
cfg = config.services.pyhesiodfs;
6+
athena-pkgs = import ../pkgs { inherit pkgs; };
7+
in
8+
{
9+
options.services.pyhesiodfs = (let
10+
mkOption = lib.mkOption;
11+
mkEnableOption = lib.mkEnableOption;
12+
types = lib.types;
13+
in {
14+
enable = mkEnableOption "pyhesiodfs";
15+
});
16+
17+
config = lib.mkIf cfg.enable {
18+
users.groups.pyhesiodfs = { };
19+
users.users.pyhesiodfs = {
20+
description = "pyhesiodfs /mit/ automounter";
21+
isSystemUser = true;
22+
group = "pyhesiodfs";
23+
};
24+
programs.fuse.userAllowOther = true;
25+
26+
# systemd unit
27+
systemd.services."pyhesiodfs" = {
28+
# https://github.com/mit-athena/pyhesiodfs/blob/debian/debian/debathena-pyhesiodfs.service
29+
description = "Hesiod automounter for Athena lockers";
30+
after = [ "local-fs.target" "network.target" "systemd-tmpfiles-setup.service" ];
31+
before = [ "remote-fs.target" ];
32+
#documentation = [ ];
33+
serviceConfig = {
34+
Type = "simple";
35+
Environment = "pyhesiodfs_dir=/mit";
36+
OOMScoreAdjust = -1000;
37+
User = "pyhesiodfs";
38+
ExecStart = "${athena-pkgs.pyhesiodfs}/bin/pyhesiodfs -f $pyhesiodfs_dir -o nonempty";
39+
};
40+
wantedBy= [ "multi-user.target" "remote-fs.target" ];
41+
};
42+
43+
# Create /mit/
44+
systemd.tmpfiles.rules = [
45+
# https://github.com/mit-athena/pyhesiodfs/blob/debian/debian/debathena-pyhesiodfs.tmpfile
46+
"d /mit 0770 root pyhesiodfs"
47+
];
48+
};
49+
}

0 commit comments

Comments
 (0)