{ description = "THROWAWAY Wayfinder #6 Dovecot/FUSE prototype"; inputs = { nixpkgs23.url = "github:NixOS/nixpkgs/nixos-24.05"; nixpkgs24.url = "github:NixOS/nixpkgs/nixos-unstable"; }; outputs = { self, nixpkgs23, nixpkgs24 }: let linuxSystems = [ "x86_64-linux" "aarch64-linux" ]; forLinuxSystems = nixpkgs24.lib.genAttrs linuxSystems; makePackage = pkgs: pkgs.rustPlatform.buildRustPackage { pname = "wayfinder-6-prototype"; version = "0.0.0"; src = ./prototype/wayfinder-6; cargoLock.lockFile = ./prototype/wayfinder-6/Cargo.lock; doCheck = true; }; packagesFor = system: let pkgs23 = import nixpkgs23 { inherit system; }; pkgs24 = import nixpkgs24 { inherit system; }; in { inherit pkgs23 pkgs24; # fuser 0.17 uses edition 2024; build both prototype binaries with # current Rust while testing each binary against its Dovecot generation. package23 = makePackage pkgs24; package24 = makePackage pkgs24; }; vmTest = pkgs: package: generation: separator: import ./prototype/wayfinder-6/nix/vm-test.nix { inherit pkgs package generation separator; dovecot = pkgs.dovecot; }; checksFor = system: let built = packagesFor system; in { dovecot-2_3-dot = vmTest built.pkgs23 built.package23 "2.3" "."; dovecot-2_3-slash = vmTest built.pkgs23 built.package23 "2.3" "/"; dovecot-2_4-dot = vmTest built.pkgs24 built.package24 "2.4" "."; dovecot-2_4-slash = vmTest built.pkgs24 built.package24 "2.4" "/"; }; runnerFor = runnerPkgs: targetSystem: runnerPkgs.writeShellApplication { name = "wayfinder-6-vm-test-${targetSystem}"; text = '' set -x nix build -L \ ${self}#checks.${targetSystem}.dovecot-2_3-dot \ ${self}#checks.${targetSystem}.dovecot-2_3-slash \ ${self}#checks.${targetSystem}.dovecot-2_4-dot \ ${self}#checks.${targetSystem}.dovecot-2_4-slash ''; }; appFor = runnerPkgs: targetSystem: { type = "app"; program = "${runnerFor runnerPkgs targetSystem}/bin/wayfinder-6-vm-test-${targetSystem}"; }; darwinPkgs = import nixpkgs24 { system = "aarch64-darwin"; }; darwinAarch64App = appFor darwinPkgs "aarch64-linux"; in { packages = forLinuxSystems (system: { default = (packagesFor system).package24; }); checks = forLinuxSystems checksFor; apps = (forLinuxSystems (system: { default = appFor (packagesFor system).pkgs24 system; vm-test = appFor (packagesFor system).pkgs24 system; })) // { # Run these from Apple Silicon with a matching Colima builder for aarch64, # or an x86_64-linux QEMU/TCG builder for the cross-architecture matrix. aarch64-darwin = { default = darwinAarch64App; vm-test-aarch64-linux = darwinAarch64App; vm-test-x86_64-linux = appFor darwinPkgs "x86_64-linux"; }; }; }; }