Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 1 addition & 35 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 32 additions & 21 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,41 @@

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, utils }:
let cargoMeta = builtins.fromTOML (builtins.readFile ./Cargo.toml);
in utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
packages = rec {
outputs =
{
self,
nixpkgs,
}:
let
inherit (nixpkgs) lib;
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = lib.genAttrs supportedSystems;
in
{
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-tree);

packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
rec {
default = typst-package-check;
typst-package-check = pkgs.rustPlatform.buildRustPackage {
pname = cargoMeta.package.name;
version = cargoMeta.package.version;
src = ./.;
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [ pkgs.openssl.dev pkgs.git ];
cargoHash = "sha256-RMjZLacXHStsPyK5R0T++mr2yLlJE52xpcK1sqJ57Fw=";
# Don't run `cargo test`, as there are no tests to run.
doCheck = false;
};

typst-package-check = pkgs.callPackage ./package.nix { };

docker-image = pkgs.dockerTools.buildImage {
name = "ghcr.io/typst/package-check";
tag = typst-package-check.version;
copyToRoot = with pkgs.dockerTools; [
caCertificates
copyToRoot = [
pkgs.dockerTools.caCertificates
pkgs.gitMinimal
pkgs.bashNonInteractive
pkgs.busybox
Expand All @@ -38,6 +48,7 @@
WorkingDir = "/data";
};
};
};
});
}
);
};
}
19 changes: 19 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
lib,
rustPlatform,
pkg-config,
openssl,
}:
let
cargoMeta = lib.importTOML ./Cargo.toml;
in
rustPlatform.buildRustPackage {
pname = cargoMeta.package.name;
inherit (cargoMeta.package) version;
src = ./.;
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ];
cargoHash = "sha256-7lpmevoAZ0pRTdpSx17IhhwdqhcVVsvoqHUci+Makf8=";
# Don't run `cargo test`, as there are no tests to run.
doCheck = false;
}
Loading