Something went wrong. Try again.
FTP for Zig 0.16: a client, a server, and the wire protocol as a layer you can use on its own, all built on std.Io.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110# SPDX-FileCopyrightText: © 2025 Jeffrey C. Ollie# SPDX-License-Identifier: MIT
{ description = "zig-ftp";
inputs = { nixpkgs = { url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"; }; zon2nix = { url = "github:jcollie/zon2nix"; inputs = { nixpkgs.follows = "nixpkgs"; }; }; };
outputs = { nixpkgs, zon2nix, ... }: let inherit (nixpkgs) lib; makePackages = system: import nixpkgs { inherit system; }; forAllSystems = lib.genAttrs lib.systems.flakeExposed; # The virtual machine tests are NixOS ones, so they exist only where # NixOS does. Without this `nix flake check` tries to evaluate them for # Darwin and fails before it has run anything. forLinuxSystems = lib.genAttrs ( lib.filter (system: lib.hasSuffix "-linux" system) lib.systems.flakeExposed ); in { packages = forAllSystems ( system: let pkgs = makePackages system; in rec { zig-ftp = pkgs.callPackage ./package.nix { }; default = zig-ftp; } );
# The virtual machine tests, which are here rather than in `zig build # test` because what they test cannot be reached from a test binary: a # real proftpd, a real inetutils ftpd, a real vsftpd, each with a real # login against a real user database -- and each of them chrooting, # which needs a root nobody should have to be to run the test suite. checks = forLinuxSystems ( system: let pkgs = makePackages system; zig-ftp = pkgs.callPackage ./package.nix { }; test = file: pkgs.testers.runNixOSTest (import file { inherit zig-ftp; }); in { inherit zig-ftp; proftpd = test ./tests/nixos/proftpd.nix; ftpd = test ./tests/nixos/ftpd.nix; vsftpd = test ./tests/nixos/vsftpd.nix; rclone = test ./tests/nixos/rclone.nix; pyftpdlib = test ./tests/nixos/pyftpdlib.nix; server = test ./tests/nixos/server.nix; } );
devShells = forAllSystems ( system: let pkgs = makePackages system; in { default = pkgs.mkShell { name = "zig-ftp"; nativeBuildInputs = [ pkgs.zig_0_17 pkgs.git-pages-cli pkgs.pinact pkgs.reuse
# The other implementations to test against. `inetutils` has the # BSD `ftp` client, which is the oldest thing likely to connect # to this and so the strictest reading of RFC 959; proftpd and # pyftpdlib are the servers, and aioftp is a second client with # a mind of its own about MLSD. pkgs.inetutils pkgs.proftpd (pkgs.python3.withPackages ( python-pkgs: with python-pkgs; [ pyftpdlib aioftp ] ))
zon2nix.packages.${system}.zon2nix ]; }; } ); };}