Changed flake.nix to use flake-parts for modular arch support. Updated INSTALL.md

This commit is contained in:
zsuper 2025-04-01 23:09:45 -07:00
parent 20be023202
commit 3ec1efe42e
3 changed files with 114 additions and 45 deletions

View file

@ -10,6 +10,46 @@ to build simply run `make` and optionally `make install`.
If you manually want to install, copy proxytunnel to /usr/local/bin
and optionally the manual-page from the debian-subdirectory to your manpath
# Nix Flakes
> NOTE: The Nix Flake installation currently only supports the default Makefile flags (i.e. GNU system assumed + SSL enabled).
A simple Nix Flake is included to allow for use via flake inputs. To create a temporary Nix Shell with access to the `proxytunnel` binary, you can run the command:
```console
nix develop github:proxytunnel/proxytunnel
```
If you instead want to include it as a flake input, the following `flake.nix` shows how to do so:
```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# Add proxytunnel as an input
proxytunnel.url = "github:proxytunnel/proxytunnel";
};
outputs = {
nixpkgs,
proxytunnel,
...
}: let
system = "x86_64-linux";
pkgs = import nixpkgs {system = "x86_64-linux";};
in {
devShells.${system}.default = pkgs.mkShell {
buildInputs = [
# Make the `proxytunnel` binary available in a Nix Shell
proxytunnel.packages.${system}.default
# And include any other packages as desired...
pkgs.gcc
pkgs.glibc.dev
];
};
};
}
```
# msys2
To install msys2 with [chocolatey](https://chocolatey.org/install):

48
flake.lock generated
View file

@ -1,23 +1,57 @@
{
"nodes": {
"nixpkgs": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1743315132,
"narHash": "sha256-6hl6L/tRnwubHcA4pfUUtk542wn2Om+D4UnDhlDW9BE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "52faf482a3889b7619003c0daec593a1912fddc1",
"lastModified": 1743550720,
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
"type": "github"
},
"original": {
"owner": "nixos",
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1743448293,
"narHash": "sha256-bmEPmSjJakAp/JojZRrUvNcDX2R5/nuX6bm+seVaGhs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "77b584d61ff80b4cef9245829a6f1dfad5afdfa3",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1743296961,
"narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs"
}
}

View file

@ -1,50 +1,45 @@
{
description = "A flake that provides the proxytunnel command";
description = "Basic flake that provides proxytunnel as a package or as a binary in a nix shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = {
self,
nixpkgs,
...
}: let
# TODO: Check functionality and add support for other architectures.
supportedSystems = ["x86_64-linux"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
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"];
mkProxyTunnel = system: let
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.stdenv.mkDerivation {
pname = "proxytunnel";
perSystem = {
config,
pkgs,
...
}: {
packages.default = config.packages.proxytunnel;
version = "1.0.0";
packages.proxytunnel = pkgs.stdenv.mkDerivation {
pname = "proxytunnel";
version = "1.0.0";
src = ./.;
src = ./.;
nativeBuildInputs = [pkgs.gnumake];
buildInputs = [pkgs.openssl];
nativeBuildInputs = [pkgs.gnumake];
buildInputs = [pkgs.openssl];
buildPhase = ''
make
'';
buildPhase = ''
make
'';
installPhase = ''
mkdir -p $out/bin
cp ./proxytunnel $out/bin
'';
installPhase = ''
mkdir -p $out/bin
cp ./proxytunnel $out/bin
'';
};
devShells.default = pkgs.mkShell {
packages = [config.packages.default];
};
};
in {
packages = forAllSystems mkProxyTunnel;
defaultPackage = forAllSystems (system: self.packages.${system});
devShells = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.mkShell {
packages = [self.defaultPackage.${system}];
});
};
};
}