diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2018-05-13 12:29:00 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2018-05-13 12:29:00 +0200 |
commit | 002823adceee104f061a90f2c53f4dffeec73436 (patch) | |
tree | e7cbffb8275726ccd80ae33572f01740117f6b3d | |
parent | 03098e6f024260480ccd8002b9e20e70e05c11cf (diff) | |
download | utils-002823adceee104f061a90f2c53f4dffeec73436.tar utils-002823adceee104f061a90f2c53f4dffeec73436.tar.gz utils-002823adceee104f061a90f2c53f4dffeec73436.tar.bz2 utils-002823adceee104f061a90f2c53f4dffeec73436.tar.xz utils-002823adceee104f061a90f2c53f4dffeec73436.zip |
recv
-rw-r--r-- | nix/default.nix | 1 | ||||
-rw-r--r-- | nix/module.nix | 6 | ||||
-rw-r--r-- | nix/recv.nix | 24 | ||||
-rw-r--r-- | recv | 13 |
4 files changed, 44 insertions, 0 deletions
diff --git a/nix/default.nix b/nix/default.nix index dc225a3..b872f6a 100644 --- a/nix/default.nix +++ b/nix/default.nix | |||
@@ -6,4 +6,5 @@ self: super: | |||
6 | pulseaudio-ctl = self.callPackage ./pulseaudio-ctl.nix {}; | 6 | pulseaudio-ctl = self.callPackage ./pulseaudio-ctl.nix {}; |
7 | monitor-uucp = self.callPackage ./monitor-uucp.nix {}; | 7 | monitor-uucp = self.callPackage ./monitor-uucp.nix {}; |
8 | rolling-directory = self.callPackage ./rolling-directory.nix {}; | 8 | rolling-directory = self.callPackage ./rolling-directory.nix {}; |
9 | recv = self.callPackage ./recv.nix {}; | ||
9 | } | 10 | } |
diff --git a/nix/module.nix b/nix/module.nix index edc9bfb..40082b1 100644 --- a/nix/module.nix +++ b/nix/module.nix | |||
@@ -45,11 +45,17 @@ in { | |||
45 | type = with types; listOf (submodule dirConfig); | 45 | type = with types; listOf (submodule dirConfig); |
46 | default = []; | 46 | default = []; |
47 | }; | 47 | }; |
48 | |||
49 | programs.recv.enable = mkEnableOption "the ‘recv’ program"; | ||
48 | }; | 50 | }; |
49 | 51 | ||
50 | config = { | 52 | config = { |
51 | nixpkgs.overlays = [ (import ./default.nix) ]; | 53 | nixpkgs.overlays = [ (import ./default.nix) ]; |
52 | 54 | ||
53 | systemd.services = listToAttrs (map dirService config.services.rollingDirectories); | 55 | systemd.services = listToAttrs (map dirService config.services.rollingDirectories); |
56 | |||
57 | security.wrappers = mkIf config.programs.recv.enable { | ||
58 | recv.source = "${pkgs.recv}/bin/recv"; | ||
59 | }; | ||
54 | }; | 60 | }; |
55 | } | 61 | } |
diff --git a/nix/recv.nix b/nix/recv.nix new file mode 100644 index 0000000..6bdc559 --- /dev/null +++ b/nix/recv.nix | |||
@@ -0,0 +1,24 @@ | |||
1 | { stdenv | ||
2 | , zsh, gnutar | ||
3 | }: | ||
4 | |||
5 | stdenv.mkDerivation rec { | ||
6 | name = "recv-${version}"; | ||
7 | version = "0.1"; | ||
8 | src = ../recv; | ||
9 | |||
10 | phases = [ "buildPhase" "installPhase" ]; | ||
11 | |||
12 | inherit zsh gnutar; | ||
13 | |||
14 | buildPhase = '' | ||
15 | substituteAll $src recv | ||
16 | ''; | ||
17 | |||
18 | installPhase = '' | ||
19 | mkdir -p $out/bin | ||
20 | |||
21 | install -m 755 -t $out/bin \ | ||
22 | recv | ||
23 | ''; | ||
24 | } | ||
@@ -0,0 +1,13 @@ | |||
1 | #!@zsh@/bin/zsh | ||
2 | |||
3 | user="$0" | ||
4 | [[ -n "$user" ]] || exit 2 | ||
5 | |||
6 | homeDir=$(getent passwd "$user" | cut -f6 -d:) | ||
7 | recvDir="${homeDir}/uucppublic" | ||
8 | |||
9 | [[ -d "$recvDir" ]] || exit 1 | ||
10 | |||
11 | umask 007 | ||
12 | |||
13 | exec @gnutar@/bin/tar -xv -C $(mktemp -d -p "$recvDir" recv.XXXXXXXXXX) --owner "$user" --no-same-permissions \ No newline at end of file | ||