moved package mkDerivation to ./nix/proxytunnel.nix

This commit is contained in:
zsuper 2025-04-03 15:17:29 -07:00
parent c4c6caafbb
commit 5e9a22d035
2 changed files with 37 additions and 27 deletions

View file

@ -9,41 +9,20 @@
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
# TODO: Add support for more systems once checked.
# TODO: Maybe add configuration options for toggling Makefile {C/LD/OPT}FLAGS
systems = ["x86_64-linux"];
imports = [inputs.flake-parts.flakeModules.easyOverlay];
perSystem = {
config,
pkgs,
...
}: {
packages.proxytunnel = pkgs.callPackage (
{
enableSSL ? true,
stdenv,
}:
stdenv.mkDerivation {
pname = "proxytunnel";
version = "1.12.3";
src = ./.;
overlayAttrs = {
inherit (config.packages) proxytunnel;
};
nativeBuildInputs = [pkgs.gnumake];
buildInputs = [pkgs.openssl];
buildPhase = ''
make
'';
installPhase = ''
mkdir -p $out/bin
cp ./proxytunnel $out/bin/${
if enableSSL
then "proxytunnel-yes-ssl"
else "proxytunnel-no-ssl"
}
'';
}
) {};
packages.proxytunnel = pkgs.callPackage ./nix/proxytunnel.nix {};
packages.default = config.packages.proxytunnel;
devShells.default = pkgs.mkShell {

31
nix/proxytunnel.nix Normal file
View file

@ -0,0 +1,31 @@
{
enableSSL ? true,
set-proc-title ? true,
pkgs,
}: let
optflags = "${
if enableSSL
then "-DUSE_SSL"
else ""
} ${
if set-proc-title
then "-DSETPROCTITLE -DSPT_TYPE=2"
else ""
}";
in
pkgs.stdenv.mkDerivation {
pname = "proxytunnel";
version = "1.12.3";
src = ./..;
buildInputs = [pkgs.openssl];
buildPhase = ''
make OPTFLAGS="${optflags}"
'';
installPhase = ''
mkdir -p $out/bin
cp ./proxytunnel $out/bin
'';
}