Aerograme build #6
File diff suppressed because it is too large
Load Diff
13
Cargo.toml
13
Cargo.toml
|
@ -19,12 +19,13 @@ futures = "0.3"
|
|||
im = "15"
|
||||
itertools = "0.10"
|
||||
lazy_static = "1.4"
|
||||
ldap3 = { version = "0.10", default-features = false, features = ["tls"] }
|
||||
ldap3 = { version = "0.10", default-features = false, features = ["tls-rustls"] }
|
||||
log = "0.4"
|
||||
mail-parser = "0.8.2"
|
||||
rusoto_core = "0.48.0"
|
||||
rusoto_core = { version = "0.48.0", default_features = false, features = ["rustls"] }
|
||||
rusoto_credential = "0.48.0"
|
||||
rusoto_s3 = "0.48"
|
||||
rusoto_s3 = { version = "0.48.0", default_features = false, features = ["rustls"] }
|
||||
|
||||
rusoto_signature = "0.48.0"
|
||||
serde = "1.0.137"
|
||||
rand = "0.8.5"
|
||||
|
@ -52,6 +53,6 @@ smtp-server = { git = "http://github.com/Alexis211/kannader", branch = "feature/
|
|||
|
||||
[dev-dependencies]
|
||||
#mail-parser-05 = { package = "mail-parser", version = "0.5" }
|
||||
mail-parser-main = { package = "mail-parser", git = "https://github.com/stalwartlabs/mail-parser", branch = "main" }
|
||||
mail-parser-superboum = { package = "mail-parser", git = "https://github.com/superboum/mail-parser", branch = "feature/no_decode" }
|
||||
mail-parser-db61a03 = { package = "mail-parser", git = "https://github.com/superboum/mail-parser", rev = "db61a03" }
|
||||
#mail-parser-main = { package = "mail-parser", git = "https://github.com/stalwartlabs/mail-parser", branch = "main" }
|
||||
#mail-parser-superboum = { package = "mail-parser", git = "https://github.com/superboum/mail-parser", branch = "feature/no_decode" }
|
||||
#mail-parser-db61a03 = { package = "mail-parser", git = "https://github.com/superboum/mail-parser", rev = "db61a03" }
|
||||
|
|
|
@ -0,0 +1,210 @@
|
|||
{
|
||||
"nodes": {
|
||||
"cargo2nix": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1673262828,
|
||||
"narHash": "sha256-pDqno5/2ghQDt4LjVt5ZUMV9pTSA5rGGdz6Skf2rBwc=",
|
||||
"owner": "Alexis211",
|
||||
"repo": "cargo2nix",
|
||||
"rev": "505caa32110d42ee03bd68b47031142eff9c827b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Alexis211",
|
||||
"ref": "custom_unstable",
|
||||
"repo": "cargo2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"fenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1682038649,
|
||||
"narHash": "sha256-HwGwWLMKdIT24xhDf+mRoCehA8yUlLmuJgS9JeMt4IM=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "37b3a6dad6d6060bd305eb7d3628d3b476c87bb6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "monthly",
|
||||
"repo": "fenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1668681692,
|
||||
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1682600000,
|
||||
"narHash": "sha256-ha4BehR1dh8EnXSoE1m/wyyYVvHI9txjW4w5/oxsW5Y=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "50fc86b75d2744e1ab3837ef74b53f103a9b55a0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "release-22.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1683408522,
|
||||
"narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1683631309,
|
||||
"narHash": "sha256-1cNXXM98+9NyH8TV3TYSESFjZ+MZGbFbNO4AtM6um3I=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e840c93ea7623f31400bc8fbe1d4cc767becf34d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "master",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"cargo2nix": "cargo2nix",
|
||||
"fenix": "fenix",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1683571499,
|
||||
"narHash": "sha256-SUs1qlsGJB09yjAKLQIJVxUPHGUdcayzE9IOkV4XRFM=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "c26a43d6bd660eba94500645a47f931e153015d8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rust-lang",
|
||||
"ref": "nightly",
|
||||
"repo": "rust-analyzer",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"cargo2nix",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"cargo2nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1673231106,
|
||||
"narHash": "sha256-Tbw4N/TL+nHmxF8RBoOJbl/6DRRzado/9/ttPEzkGr8=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "3488cec01351c2f1086b02a3a61808be7a25103e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
{
|
||||
description = "Aerogramme";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/master";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
# this patched version of cargo2nix makes easier to use clippy for building
|
||||
cargo2nix = {
|
||||
type = "github";
|
||||
owner = "Alexis211";
|
||||
repo = "cargo2nix";
|
||||
ref = "custom_unstable";
|
||||
};
|
||||
|
||||
# use rust project builds
|
||||
fenix.url = "github:nix-community/fenix/monthly";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, cargo2nix, flake-utils, fenix }:
|
||||
flake-utils.lib.eachSystem [
|
||||
"x86_64-unknown-linux-musl"
|
||||
"aarch64-unknown-linux-musl"
|
||||
"armv6l-unknown-linux-musleabihf"
|
||||
] (targetHost: let
|
||||
|
||||
# with fenix, we get builds from the rust project.
|
||||
# they are done with an old version of musl (prior to 1.2.x that is used in NixOS),
|
||||
# however musl has a breaking change from 1.1.x to 1.2.x on 32 bit systems.
|
||||
# so we pin the lib to 1.1.x to avoid recompiling rust ourselves.
|
||||
muslOverlay = self: super: {
|
||||
musl = super.musl.overrideAttrs(old: if targetHost == "armv6l-unknown-linux-musleabihf" then rec {
|
||||
pname = "musl";
|
||||
version = "1.1.24";
|
||||
src = builtins.fetchurl {
|
||||
url = "https://musl.libc.org/releases/${pname}-${version}.tar.gz";
|
||||
sha256 = "sha256:18r2a00k82hz0mqdvgm7crzc7305l36109c0j9yjmkxj2alcjw0k";
|
||||
};
|
||||
} else {});
|
||||
};
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
system = "x86_64-linux"; # hardcoded as we will cross compile
|
||||
crossSystem = {
|
||||
config = targetHost; # here we cross compile
|
||||
isStatic = true;
|
||||
};
|
||||
overlays = [
|
||||
cargo2nix.overlays.default
|
||||
muslOverlay
|
||||
];
|
||||
};
|
||||
|
||||
shell = pkgs.mkShell {
|
||||
buildInputs = [
|
||||
cargo2nix.packages.x86_64-linux.default
|
||||
];
|
||||
};
|
||||
|
||||
rustTarget = if targetHost == "armv6l-unknown-linux-musleabihf" then "arm-unknown-linux-musleabihf" else targetHost;
|
||||
|
||||
# release builds
|
||||
rustRelease = pkgs.rustBuilder.makePackageSet({
|
||||
packageFun = import ./Cargo.nix;
|
||||
target = rustTarget;
|
||||
release = true;
|
||||
rustToolchain = with fenix.packages.x86_64-linux; combine [
|
||||
minimal.cargo
|
||||
minimal.rustc
|
||||
targets.${rustTarget}.latest.rust-std
|
||||
];
|
||||
});
|
||||
|
||||
# debug builds with clippy as the compiler (hack to speed up compilation)
|
||||
debugBuildEnv = (drv:
|
||||
''
|
||||
${drv.setBuildEnv or ""}
|
||||
echo
|
||||
echo --- BUILDING WITH CLIPPY ---
|
||||
echo
|
||||
|
||||
export NIX_RUST_BUILD_FLAGS="''${NIX_RUST_BUILD_FLAGS} --deny warnings"
|
||||
export RUSTC="''${CLIPPY_DRIVER}"
|
||||
'');
|
||||
rustDebug = pkgs.rustBuilder.makePackageSet({
|
||||
packageFun = import ./Cargo.nix;
|
||||
target = rustTarget;
|
||||
release = false;
|
||||
rustToolchain = with fenix.packages.x86_64-linux; combine [
|
||||
default.cargo
|
||||
default.rustc
|
||||
default.clippy
|
||||
targets.${rustTarget}.latest.rust-std
|
||||
];
|
||||
packageOverrides = pkgs: pkgs.rustBuilder.overrides.all ++ [
|
||||
(pkgs.rustBuilder.rustLib.makeOverride {
|
||||
name = "aerogramme";
|
||||
overrideAttrs = drv: {
|
||||
setBuildEnv = (debugBuildEnv drv);
|
||||
};
|
||||
})
|
||||
];
|
||||
});
|
||||
|
||||
# binary extract
|
||||
bin = pkgs.stdenv.mkDerivation {
|
||||
pname = "aerogramme-bin";
|
||||
version = "0.0.1";
|
||||
dontUnpack = true;
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
cp ${(rustRelease.workspace.aerogramme {}).bin}/bin/aerogramme $out
|
||||
'';
|
||||
};
|
||||
|
||||
# docker packaging
|
||||
archMap = {
|
||||
"x86_64-unknown-linux-musl" = {
|
||||
GOARCH = "amd64";
|
||||
};
|
||||
"aarch64-unknown-linux-musl" = {
|
||||
GOARCH = "arm64";
|
||||
};
|
||||
"armv6l-unknown-linux-musleabihf" = {
|
||||
GOARCH = "arm";
|
||||
};
|
||||
};
|
||||
container = pkgs.dockerTools.buildImage {
|
||||
name = "dxflrs/aerogramme";
|
||||
architecture = (builtins.getAttr targetHost archMap).GOARCH;
|
||||
config = {
|
||||
Cmd = [ "${bin}" ];
|
||||
};
|
||||
};
|
||||
|
||||
in {
|
||||
devShells.default = shell;
|
||||
packages.debug = (rustDebug.workspace.aerogramme {}).bin;
|
||||
packages.aerogramme = bin;
|
||||
packages.container = container;
|
||||
packages.default = self.packages.${targetHost}.aerogramme;
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue