mirror of
https://github.com/RGBCube/alejandra
synced 2025-07-31 04:27:45 +00:00
static builds for x86_64-unknown-linux-musl
This commit is contained in:
parent
4ff1547d08
commit
856919ee82
2 changed files with 42 additions and 8 deletions
|
@ -3,12 +3,18 @@ steps:
|
||||||
command:
|
command:
|
||||||
- nix3 build
|
- nix3 build
|
||||||
|
|
||||||
|
- label: build-musl
|
||||||
|
command:
|
||||||
|
- nix3 build .#packages.x86_64-linux.musl
|
||||||
|
|
||||||
- label: cache
|
- label: cache
|
||||||
if: build.branch == "main"
|
if: build.branch == "main"
|
||||||
command:
|
command:
|
||||||
- echo +++
|
- echo +++
|
||||||
- nix3 build
|
- nix3 build
|
||||||
- cachix push alejandra result
|
- cachix push alejandra result
|
||||||
|
- nix3 build .#packages.x86_64-linux.musl
|
||||||
|
- cachix push alejandra result
|
||||||
|
|
||||||
- nix3 develop --profile develop --command true
|
- nix3 develop --profile develop --command true
|
||||||
- cachix push alejandra develop
|
- cachix push alejandra develop
|
||||||
|
|
44
flake.nix
44
flake.nix
|
@ -23,18 +23,29 @@
|
||||||
inputs.flakeUtils.lib.eachSystem [ "x86_64-darwin" "x86_64-linux" ] (
|
inputs.flakeUtils.lib.eachSystem [ "x86_64-darwin" "x86_64-linux" ] (
|
||||||
system: let
|
system: let
|
||||||
nixpkgs = import inputs.nixpkgs { inherit system; };
|
nixpkgs = import inputs.nixpkgs { inherit system; };
|
||||||
|
nixpkgsMusl = import inputs.nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
crossSystem =
|
||||||
|
nixpkgs.lib.systems.examples.musl64
|
||||||
|
// {
|
||||||
|
rustc.config = "x86_64-unknown-linux-musl";
|
||||||
|
};
|
||||||
|
};
|
||||||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||||
treefmt = inputs.treefmt.defaultPackage.${system};
|
treefmt = inputs.treefmt.defaultPackage.${system};
|
||||||
fenix = inputs.fenix.packages.${system};
|
fenix = inputs.fenix.packages.${system};
|
||||||
fenixPlatform = nixpkgs.makeRustPlatform { inherit (fenix.latest) cargo rustc; };
|
fenixPlatform = nixpkgs.makeRustPlatform { inherit (fenix.latest) cargo rustc; };
|
||||||
in
|
fenixPlatformMusl = nixpkgsMusl.makeRustPlatform {
|
||||||
{
|
cargo = muslToolchain;
|
||||||
checks.defaultPackage = inputs.self.defaultPackage.${system};
|
rustc = muslToolchain;
|
||||||
defaultApp = {
|
};
|
||||||
type = "app";
|
muslToolchain = with inputs.fenix.packages.${system}; combine [
|
||||||
program = "${inputs.self.defaultPackage.${system}}/bin/alejandra";
|
minimal.rustc
|
||||||
};
|
minimal.cargo
|
||||||
defaultPackage = fenixPlatform.buildRustPackage {
|
targets.x86_64-unknown-linux-musl.latest.rust-std
|
||||||
|
];
|
||||||
|
packageWith = platform: target:
|
||||||
|
platform.buildRustPackage {
|
||||||
pname = cargoToml.package.name;
|
pname = cargoToml.package.name;
|
||||||
version =
|
version =
|
||||||
let
|
let
|
||||||
|
@ -44,6 +55,7 @@
|
||||||
in
|
in
|
||||||
"${builtins.substring 0 8 date}_${commit}";
|
"${builtins.substring 0 8 date}_${commit}";
|
||||||
src = inputs.self.sourceInfo;
|
src = inputs.self.sourceInfo;
|
||||||
|
inherit target;
|
||||||
cargoLock.lockFile = ./Cargo.lock;
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
meta = {
|
meta = {
|
||||||
description = cargoToml.package.description;
|
description = cargoToml.package.description;
|
||||||
|
@ -52,6 +64,14 @@
|
||||||
maintainers = [ nixpkgs.lib.maintainers.kamadorueda ];
|
maintainers = [ nixpkgs.lib.maintainers.kamadorueda ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
checks.defaultPackage = inputs.self.defaultPackage.${system};
|
||||||
|
defaultApp = {
|
||||||
|
type = "app";
|
||||||
|
program = "${inputs.self.defaultPackage.${system}}/bin/alejandra";
|
||||||
|
};
|
||||||
|
defaultPackage = packageWith fenixPlatform system;
|
||||||
devShell = nixpkgs.mkShell {
|
devShell = nixpkgs.mkShell {
|
||||||
name = "Alejandra";
|
name = "Alejandra";
|
||||||
packages = [
|
packages = [
|
||||||
|
@ -67,5 +87,13 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// (
|
||||||
|
if system == "x86_64-linux"
|
||||||
|
then
|
||||||
|
{
|
||||||
|
packages.musl = packageWith fenixPlatformMusl "x86_64-unknown-linux-musl";
|
||||||
|
}
|
||||||
|
else { }
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue