init 2
This commit is contained in:
51
flake.nix
51
flake.nix
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user