nixpkgs/pkgs/by-name/vp/vpnc-scripts/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

52 lines
1.4 KiB
Nix

{ lib
, stdenv
, fetchgit
, coreutils
, gawk
, gnugrep
, iproute2
, makeWrapper
, nettools
, openresolv
, systemd
}:
stdenv.mkDerivation {
pname = "vpnc-scripts";
version = "unstable-2023-01-03";
src = fetchgit {
url = "https://gitlab.com/openconnect/vpnc-scripts.git";
rev = "22756827315bc875303190abb3756b5b1dd147ce";
hash = "sha256-EWrDyXg47Ur9mFutaG8+oYOCAW9AZowzwwJp3YbogIY=";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir -p $out/bin
cp vpnc-script $out/bin
'';
preFixup = ''
substituteInPlace $out/bin/vpnc-script \
--replace "which" "type -P"
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace $out/bin/vpnc-script \
--replace "/sbin/resolvconf" "${openresolv}/bin/resolvconf" \
--replace "/usr/bin/resolvectl" "${systemd}/bin/resolvectl"
'' + ''
wrapProgram $out/bin/vpnc-script \
--prefix PATH : "${lib.makeBinPath ([ nettools gawk coreutils gnugrep ] ++ lib.optionals stdenv.hostPlatform.isLinux [ openresolv iproute2 ])}"
'';
meta = with lib; {
homepage = "https://www.infradead.org/openconnect/";
description = "Script for vpnc to configure the network routing and name service";
mainProgram = "vpnc-script";
license = licenses.gpl2Only;
maintainers = with maintainers; [ jerith666 ];
platforms = platforms.linux ++ platforms.darwin;
};
}