1{ lib, stdenv, fetchurl, coreutils, openssh, gnutar }:
2
3stdenv.mkDerivation rec {
4 pname = "rset";
5 version = "2.1";
6
7 src = fetchurl {
8 url = "https://scriptedconfiguration.org/code/${pname}-${version}.tar.gz";
9 sha256 = "0916f96afl8kcn2hpj4qhg92g2j93ycp2sb94nsz3q44sqc6ddhb";
10 };
11
12 patches = [ ./paths.patch ];
13
14 postPatch = ''
15 substituteInPlace rset.c \
16 --replace @ssh@ ${openssh}/bin/ssh \
17 --replace @miniquark@ $out/bin/miniquark \
18 --replace @rinstall@ $out/bin/rinstall \
19 --replace @rsub@ $out/bin/rsub
20
21 substituteInPlace execute.c \
22 --replace @ssh@ ${openssh}/bin/ssh \
23 --replace @ssh-add@ ${openssh}/bin/ssh-add \
24 --replace @tar@ ${gnutar}/bin/tar
25
26 substituteInPlace rutils.c \
27 --replace @install@ ${coreutils}/bin/install
28 '';
29
30 # these are to be run on the remote host,
31 # so we want to preserve the original shebang.
32 postFixup = ''
33 sed -i "1s@.*@#!/bin/sh@" $out/bin/rinstall
34 sed -i "1s@.*@#!/bin/sh@" $out/bin/rsub
35 '';
36
37 dontAddPrefix = true;
38 installFlags = [ "PREFIX=$(out)" ];
39
40 meta = with lib; {
41 homepage = "https://scriptedconfiguration.org/";
42 description = "Configure systems using any scripting language";
43 changelog = "https://github.com/eradman/rset/raw/${version}/NEWS";
44 license = licenses.isc;
45 platforms = platforms.unix;
46 maintainers = with maintainers; [ cstrahan ];
47 };
48}