static nix build for linux/amd64

This commit is contained in:
Quentin 2023-05-09 15:39:29 +02:00
parent f7e041e35e
commit 8711c0c190
Signed by: quentin
GPG key ID: E9602264D639FF68
5 changed files with 2995 additions and 1849 deletions

1533
Cargo.lock generated

File diff suppressed because it is too large Load diff

3145
Cargo.nix

File diff suppressed because it is too large Load diff

View file

@ -19,12 +19,13 @@ futures = "0.3"
im = "15" im = "15"
itertools = "0.10" itertools = "0.10"
lazy_static = "1.4" 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" log = "0.4"
mail-parser = "0.8.2" 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_credential = "0.48.0"
rusoto_s3 = "0.48" rusoto_s3 = { version = "0.48.0", default_features = false, features = ["rustls"] }
rusoto_signature = "0.48.0" rusoto_signature = "0.48.0"
serde = "1.0.137" serde = "1.0.137"
rand = "0.8.5" rand = "0.8.5"
@ -52,6 +53,6 @@ smtp-server = { git = "http://github.com/Alexis211/kannader", branch = "feature/
[dev-dependencies] [dev-dependencies]
#mail-parser-05 = { package = "mail-parser", version = "0.5" } #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-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-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-db61a03 = { package = "mail-parser", git = "https://github.com/superboum/mail-parser", rev = "db61a03" }

View file

@ -22,6 +22,26 @@
"type": "github" "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-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -53,13 +73,31 @@
"type": "github" "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1672580127, "lastModified": 1682600000,
"narHash": "sha256-3lW3xZslREhJogoOkjeZtlBtvFMyxHku7I/9IVehhT8=", "narHash": "sha256-ha4BehR1dh8EnXSoE1m/wyyYVvHI9txjW4w5/oxsW5Y=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0874168639713f547c05947c76124f78441ea46c", "rev": "50fc86b75d2744e1ab3837ef74b53f103a9b55a0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -71,22 +109,59 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1678693419, "lastModified": 1683408522,
"narHash": "sha256-bbSv5yqZAW6dz+3f3f3pOUZbxpPN+3OgCljgn7P+nnQ=", "narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
"owner": "NixOS", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "8e3fad82be64c06fbfb9fd43993aec9ef4623936", "rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "nixos",
"type": "indirect" "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": { "root": {
"inputs": { "inputs": {
"cargo2nix": "cargo2nix", "cargo2nix": "cargo2nix",
"nixpkgs": "nixpkgs_2" "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": { "rust-overlay": {
@ -113,6 +188,21 @@
"repo": "rust-overlay", "repo": "rust-overlay",
"type": "github" "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", "root": "root",

View file

@ -8,17 +8,46 @@
repo = "cargo2nix"; repo = "cargo2nix";
ref = "custom_unstable"; ref = "custom_unstable";
}; };
nixpkgs.url = "github:NixOS/nixpkgs/master";
#cargo2nix.url = "github:cargo2nix/cargo2nix/release-0.11.0";
fenix.url = "github:nix-community/fenix/monthly";
flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, cargo2nix }: let outputs = { self, nixpkgs, cargo2nix, flake-utils, fenix }:
pkgs = import nixpkgs { system = "x86_64-linux"; }; flake-utils.lib.eachSystem [
in { "x86_64-unknown-linux-musl"
devShells.x86_64-linux.default = pkgs.mkShell { "aarch64-unknown-linux-musl"
"armv6l-unknown-linux-musleabihf"
] (targetHost: let
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];
};
shell = pkgs.mkShell {
buildInputs = [ buildInputs = [
cargo2nix.packages.x86_64-linux.default cargo2nix.packages.x86_64-linux.default
]; ];
}; };
packages.x86_64-linux.aerogramme = nixpkgs.legacyPackages.x86_64-linux.hello;
packages.x86_64-linux.default = self.packages.x86_64-linux.aerogramme; rustPkgs = pkgs.rustBuilder.makePackageSet({
}; rustToolchain = with fenix.packages.x86_64-linux; combine [
minimal.cargo
minimal.rustc
targets.${targetHost}.latest.rust-std
];
packageFun = import ./Cargo.nix;
});
in {
devShells.default = shell;
packages.aerogramme = (rustPkgs.workspace.aerogramme {}).bin;
packages.default = self.packages.${targetHost}.aerogramme;
});
} }