This commit is contained in:
2025-08-26 15:27:26 +04:00
parent c44751a91e
commit 3972656c61
6 changed files with 624 additions and 57 deletions

View File

@@ -31,6 +31,19 @@
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
tdlib = prev.tdlib.overrideAttrs (_: {
version = "1.8.29";
src = prev.fetchFromGitHub {
owner = "tdlib";
repo = "td";
rev = "af69dd4397b6dc1bf23ba0fd0bf429fcba6454f6";
hash = "sha256-2RhKSxy0AvuA74LHI86pqUxv9oJZ+ZxxDe4TPI5UYxE=";
# hash = "sha256-mbhxuJjrV3nC8Ja7N0WWF9ByHovJLmoLLuuzoU4khjU=";
};
});
})
(import rust-overlay)
];
};
@@ -48,29 +61,33 @@
];
}
);
src = craneLib.cleanCargoSource ./.;
src = lib.cleanSourceWith {
src = ./.;
filter = (
path: type: (craneLib.filterCargoSources path type) || (builtins.match ".*/\.env$" path != null)
);
name = "source";
};
commonArgs = {
inherit src;
strictDeps = true;
nativeBuildInputs = with pkgs; [
pkg-config
];
buildInputs = with pkgs; [
tdlib
openssl
];
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
individualCrateArgs = commonArgs // {
inherit cargoArtifacts;
inherit (craneLib.crateNameFromCargoToml { inherit src; }) version;
};
fileSetForCrate =
crate:
lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./Cargo.toml
./Cargo.lock
];
};
server = craneLib.buildPackage (
individualCrateArgs
commonArgs
// {
inherit cargoArtifacts;
inherit (craneLib.crateNameFromCargoToml { inherit src; }) version;
postInstall = ''
${pkgs.upx}/bin/upx --lzma --best $out/bin/telegram-exporter
'';
}
);
in
@@ -81,6 +98,8 @@
config = (import ./process-compose.nix { inherit pkgs; });
modules = [ ];
};
default = server;
inherit server;
};
devShells.default = craneLib.devShell {