WIP: Add progenitor client

This commit is contained in:
Daniel Lundin 2024-12-14 22:47:40 +01:00
parent a5e3170d37
commit b07d037a7d
Signed by: dln
SSH key fingerprint: SHA256:dQy1Xj3UiqJYpKR5ggQ2bxgz4jCH8IF+k3AB8o0kmdI
11 changed files with 1016 additions and 39 deletions

View file

@ -49,29 +49,24 @@
nativeBuildInputs = with pkgs; [
clang_18
mold
pkg-config
];
sourceAndFixtures = path: type: (craneLib.filterCargoSources path type);
jsonFilter = path: _type: builtins.match ".*json$" path != null;
sourceAndFixtures = path: type:
(jsonFilter path type) || (craneLib.filterCargoSources path type);
src = pkgs.lib.cleanSourceWith {
src = ./.;
filter = sourceAndFixtures;
};
treefmtEval = treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
nixfmt.package = pkgs.nixfmt-rfc-style;
shfmt.enable = true;
rustfmt.enable = true;
};
settings.formatter.rustfmt.command = pkgs.lib.mkForce "${pkgs.rust-toolchain}/bin/rustfmt";
};
commonArgs = {
inherit src stdenv nativeBuildInputs;
strictDeps = true;
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
buildInputs = with pkgs; [
openssl
];
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
@ -123,6 +118,18 @@
src = fileSetForCrate ./xtask;
}
);
treefmtEval = treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
nixfmt.package = pkgs.nixfmt-rfc-style;
shfmt.enable = true;
rustfmt.enable = true;
};
settings.formatter.rustfmt.command = pkgs.lib.mkForce "${pkgs.rust-toolchain}/bin/rustfmt";
};
in
{
# `nix build`
@ -142,7 +149,7 @@
}
);
fmt = craneLib.cargoFmt (commonArgs // { inherit src; });
# fmt = craneLib.cargoFmt (commonArgs // { inherit src; });
audit = craneLib.cargoAudit (commonArgs // { inherit src advisory-db; });
@ -156,11 +163,17 @@
);
openapi =
pkgs.runCommand "openapi" (commonArgs // {
src = fileSetForCrate ./xtask;
}) ''
${self.packages.${system}.xtask}/bin/xtask open-api | ${pkgs.diffutils}/bin/diff -u $src/api.json - | tee $out
'';
pkgs.runCommand "openapi"
(
commonArgs
// {
inherit cargoArtifacts;
src = fileSetForCrate ./xtask;
}
)
''
${self.packages.${system}.xtask}/bin/xtask open-api | ${pkgs.diffutils}/bin/diff -u $src/api.json - | tee $out
'';
};
# For `nix fmt`
@ -178,14 +191,16 @@
cargo-nextest
cargo-watch
hyperfine
openssl
just
rust-dev-toolchain
watchexec
];
RUST_BACKTRACE = 1;
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc; # Required for rust-analyzer
shellHook = ''
export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc} # Required for rust-analyzer
echo
echo " Welcome to the Patagia development environment! "
echo "🛠 Welcome to the Patagia development environment 🛠"
echo "Run 'just' to see available commands."
echo
'';