mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-09 22:45:08 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
49 lines
1.2 KiB
Nix
49 lines
1.2 KiB
Nix
{ lib
|
|
, stdenv
|
|
, buildPythonApplication
|
|
, nix-update-script
|
|
, python3Packages
|
|
, fetchFromGitHub
|
|
, iproute2
|
|
, iptables
|
|
, unixtools
|
|
}:
|
|
|
|
buildPythonApplication rec {
|
|
pname = "vpn-slice";
|
|
version = "0.16.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "dlenski";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
sha256 = "sha256-T6VULLNRLWO4OcAsuTmhty6H4EhinyxQSg0dfv2DUJs=";
|
|
};
|
|
|
|
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
substituteInPlace vpn_slice/mac.py \
|
|
--replace "'/sbin/route'" "'${unixtools.route}/bin/route'"
|
|
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
|
|
substituteInPlace vpn_slice/linux.py \
|
|
--replace "'/sbin/ip'" "'${iproute2}/bin/ip'" \
|
|
--replace "'/sbin/iptables'" "'${iptables}/bin/iptables'"
|
|
'';
|
|
|
|
propagatedBuildInputs = with python3Packages; [ setproctitle dnspython ];
|
|
|
|
doCheck = false;
|
|
|
|
passthru = {
|
|
updateScript = nix-update-script { };
|
|
};
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/dlenski/vpn-slice";
|
|
description =
|
|
"vpnc-script replacement for easy and secure split-tunnel VPN setup";
|
|
mainProgram = "vpn-slice";
|
|
license = licenses.gpl3;
|
|
maintainers = [ ];
|
|
};
|
|
}
|