1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-30 12:07:46 +00:00

feat: correct aarch64-darwin build

This commit is contained in:
Kevin Amado 2022-02-17 13:16:03 -05:00
parent ea6e3bfc92
commit 9bbc0f6d85
No known key found for this signature in database
GPG key ID: FFF341057F503148
7 changed files with 98 additions and 161 deletions

View file

@ -24,15 +24,15 @@ steps:
- alejandra-x86_64-unknown-linux-musl
command:
- echo +++
- nix build .#aarch64-unknown-linux-musl
- nix build .#alejandra-aarch64-unknown-linux-musl
- cachix push alejandra result
- cp -L result/bin/alejandra alejandra-aarch64-unknown-linux-musl
- nix build .#x86_64-unknown-linux-gnu
- nix build .#alejandra-x86_64-unknown-linux-gnu
- cachix push alejandra result
- cp -L result/bin/alejandra alejandra-x86_64-unknown-linux-gnu
- nix build .#x86_64-unknown-linux-musl
- nix build .#alejandra-x86_64-unknown-linux-musl
- cachix push alejandra result
- cp -L result/bin/alejandra alejandra-x86_64-unknown-linux-musl
@ -107,7 +107,7 @@ steps:
artifacts:
- alejandra.vsix
command:
- nix build --out-link alejandra.vsix .#integrations-vscode
- nix build --out-link alejandra.vsix .#alejandra-vscode-vsix
- label: flake check
command:

View file

@ -8,4 +8,4 @@ let
};
flake = import flakeCompatSrc { src = ./.; };
in
flake.defaultNix.defaultPackage
flake.defaultNix.defaultPackage

46
flake.lock generated
View file

@ -1,26 +1,5 @@
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1644992777,
"narHash": "sha256-SXUZrKw+UlMlkbcKYHVAhaohW8Ss62oP3EWNO0UhyDA=",
"owner": "nix-community",
"repo": "fenix",
"rev": "8fa7c3c91809cd9665a2391890469160c5ba01dd",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flakeCompat": {
"flake": false,
"locked": {
@ -39,42 +18,25 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1645072054,
"narHash": "sha256-I+HkWU1IpRb93VzjayAybj3L2CcJxNlZDhSeSpL3eSw=",
"lastModified": 1644972330,
"narHash": "sha256-6V2JFpTUzB9G+KcqtUR1yl7f6rd9495YrFECslEmbGw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "97777606991c3a78040c883fa97791ae77073022",
"rev": "19574af0af3ffaf7c9e359744ed32556f34536bd",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"fenix": "fenix",
"flakeCompat": "flakeCompat",
"nixpkgs": "nixpkgs"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1644917782,
"narHash": "sha256-nFaqGKTtzzPY6rXwjYfuJetNAnvZGuFVtfJ4nWKaVes=",
"owner": "rust-analyzer",
"repo": "rust-analyzer",
"rev": "f0210f8a43efefef93dcb9ce0cf34b083fd3d51a",
"type": "github"
},
"original": {
"owner": "rust-analyzer",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
}
},
"root": "root",

172
flake.nix
View file

@ -2,127 +2,93 @@
description = "The Uncompromising Nix Code Formatter";
inputs = {
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
flakeCompat.url = github:edolstra/flake-compat;
flakeCompat.flake = false;
nixpkgs.url = "github:nixos/nixpkgs";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs = inputs: let
build = host: target: let
nixpkgs = import inputs.nixpkgs {
commit = inputs.self.shortRev or "dirty";
date = inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101";
version = "0.2.0+${builtins.substring 0 8 date}.${commit}";
nixpkgsForHost = host:
import inputs.nixpkgs {
overlays = [
(
self: super: {
alejandra = self.rustPlatform.buildRustPackage {
pname = "alejandra";
inherit version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
passthru.tests = {
version = nixpkgs.testVersion { package = super.alejandra; };
};
meta = {
description = "The Uncompromising Nix Code Formatter.";
homepage = "https://github.com/kamadorueda/alejandra";
license = self.lib.licenses.unlicense;
maintainers = [nixpkgs.lib.maintainers.kamadorueda];
};
};
}
)
];
system = host;
crossSystem = builtins.getAttr target {
"aarch64-apple-darwin" = inputs.nixpkgs.lib.systems.examples.aarch64-darwin;
"aarch64-unknown-linux-musl".config = "aarch64-unknown-linux-musl";
"x86_64-apple-darwin" = null;
"x86_64-unknown-linux-gnu" = null;
"x86_64-unknown-linux-musl".config = "x86_64-unknown-linux-musl";
};
};
fenix = inputs.fenix.packages.${host};
rustPlatform = nixpkgs.makeRustPlatform {
cargo = fenix.latest.cargo;
rustc = fenix.combine [
fenix.latest.rustc
fenix.targets.${target}.latest.rust-std
];
};
in rec {
bin = rustPlatform.buildRustPackage {
pname = "alejandra";
version =
let
commit = inputs.self.shortRev or "dirty";
date = inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101";
in "0.2.0+${builtins.substring 0 8 date}.${commit}";
src = ./.;
inherit target;
cargoLock.lockFile = ./Cargo.lock;
meta = {
description = "The Uncompromising Nix Code Formatter.";
homepage = "https://github.com/kamadorueda/alejandra";
license = nixpkgs.lib.licenses.unlicense;
maintainers = [nixpkgs.lib.maintainers.kamadorueda];
};
};
integrations.vscode-env = nixpkgs.mkYarnPackage {
name = "alejandra";
src = ./integrations/vscode;
packageJSON = ./integrations/vscode/package.json;
yarnLock = ./integrations/vscode/yarn.lock;
yarnNix = ./integrations/vscode/yarn.lock.nix;
};
integrations.vscode = nixpkgs.stdenv.mkDerivation {
name = "alejandra";
src = ./integrations/vscode;
env = integrations.vscode-env;
buildInputs = [nixpkgs.yarn];
builder = builtins.toFile "builder.sh" ''
source $stdenv/setup
cd $src
$env/libexec/alejandra/node_modules/.bin/vsce package --out $out
'';
};
shell = nixpkgs.mkShell {
name = "alejandra";
packages = [
fenix.latest.toolchain
nixpkgs.cargo-tarpaulin
nixpkgs.jq
nixpkgs.nodejs
nixpkgs.nodePackages.prettier
nixpkgs.nodePackages.prettier-plugin-toml
nixpkgs.shfmt
nixpkgs.treefmt
nixpkgs.yarn
nixpkgs.yarn2nix
];
};
};
nixpkgs."aarch64-darwin" = nixpkgsForHost "aarch64-darwin";
nixpkgs."aarch64-linux" = nixpkgsForHost "aarch64-linux";
nixpkgs."x86_64-darwin" = nixpkgsForHost "x86_64-darwin";
nixpkgs."x86_64-linux" = nixpkgsForHost "x86_64-linux";
in rec {
checks."aarch64-darwin" = packages."aarch64-darwin";
checks."x86_64-darwin" = packages."x86_64-darwin";
checks."aarch64-linux" = packages."aarch64-linux";
checks."x86_64-darwin" = packages."x86_64-darwin";
checks."x86_64-linux" = packages."x86_64-linux";
defaultPackage."aarch64-darwin" =
packages."aarch64-darwin"."aarch64-apple-darwin";
defaultPackage."aarch64-linux" =
packages."aarch64-linux"."aarch64-unknown-linux-musl";
defaultPackage."x86_64-darwin" =
packages."x86_64-darwin"."x86_64-apple-darwin";
defaultPackage."x86_64-linux" =
packages."x86_64-linux"."x86_64-unknown-linux-gnu";
defaultPackage."aarch64-darwin" = packages."aarch64-darwin"."alejandra-aarch64-apple-darwin";
defaultPackage."aarch64-linux" = packages."aarch64-linux"."alejandra-aarch64-unknown-linux-musl";
defaultPackage."x86_64-darwin" = packages."x86_64-darwin"."alejandra-x86_64-apple-darwin";
defaultPackage."x86_64-linux" = packages."x86_64-linux"."alejandra-x86_64-unknown-linux-gnu";
devShell."x86_64-linux" =
(build "x86_64-linux" "x86_64-unknown-linux-gnu").shell;
with nixpkgs."x86_64-linux";
mkShell {
name = "alejandra";
packages = [
cargo-tarpaulin
jq
nodejs
nodePackages.prettier
nodePackages.prettier-plugin-toml
shfmt
treefmt
yarn
yarn2nix
];
};
packages."aarch64-darwin"."aarch64-apple-darwin" =
(build "aarch64-darwin" "aarch64-apple-darwin").bin;
inherit nixpkgs;
packages."aarch64-linux"."aarch64-unknown-linux-musl" =
(build "aarch64-linux" "aarch64-unknown-linux-musl").bin;
packages."aarch64-darwin"."alejandra-aarch64-apple-darwin" = nixpkgs."aarch64-darwin".alejandra;
packages."aarch64-linux"."alejandra-aarch64-unknown-linux-musl" = nixpkgs."aarch64-linux".alejandra;
packages."x86_64-darwin"."alejandra-x86_64-apple-darwin" = nixpkgs."x86_64-darwin".alejandra;
packages."x86_64-linux"."alejandra-aarch64-unknown-linux-musl" = nixpkgs."x86_64-linux".pkgsCross.aarch64-multiplatform-musl.alejandra;
packages."x86_64-linux"."alejandra-x86_64-unknown-linux-gnu" = nixpkgs."x86_64-linux".alejandra;
packages."x86_64-linux"."alejandra-x86_64-unknown-linux-musl" = nixpkgs."x86_64-linux".pkgsCross.musl64.alejandra;
packages."x86_64-darwin"."x86_64-apple-darwin" =
(build "x86_64-darwin" "x86_64-apple-darwin").bin;
packages."x86_64-linux"."integrations-vscode" =
(build "x86_64-linux" "x86_64-unknown-linux-gnu").integrations.vscode;
packages."x86_64-linux"."aarch64-unknown-linux-musl" =
(build "x86_64-linux" "aarch64-unknown-linux-musl").bin;
packages."x86_64-linux"."x86_64-unknown-linux-gnu" =
(build "x86_64-linux" "x86_64-unknown-linux-gnu").bin;
packages."x86_64-linux"."x86_64-unknown-linux-musl" =
(build "x86_64-linux" "x86_64-unknown-linux-musl").bin;
packages."x86_64-linux"."alejandra-vscode-vsix" = nixpkgs."x86_64-linux".mkYarnPackage {
name = "alejandra";
src = ./integrations/vscode;
packageJSON = ./integrations/vscode/package.json;
yarnLock = ./integrations/vscode/yarn.lock;
yarnNix = ./integrations/vscode/yarn.lock.nix;
};
};
}

19
front/flake.lock generated
View file

@ -8,11 +8,11 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1644992777,
"narHash": "sha256-SXUZrKw+UlMlkbcKYHVAhaohW8Ss62oP3EWNO0UhyDA=",
"lastModified": 1645079077,
"narHash": "sha256-0dS1mkM6UaCNdixDuwj2xHyaRqhk9fXDLrfQRmOryBA=",
"owner": "nix-community",
"repo": "fenix",
"rev": "8fa7c3c91809cd9665a2391890469160c5ba01dd",
"rev": "1a1694cb7ae3708a90932e7a8a9a767c466a2976",
"type": "github"
},
"original": {
@ -23,15 +23,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1645072054,
"narHash": "sha256-I+HkWU1IpRb93VzjayAybj3L2CcJxNlZDhSeSpL3eSw=",
"lastModified": 1644972330,
"narHash": "sha256-6V2JFpTUzB9G+KcqtUR1yl7f6rd9495YrFECslEmbGw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "97777606991c3a78040c883fa97791ae77073022",
"rev": "19574af0af3ffaf7c9e359744ed32556f34536bd",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -45,11 +46,11 @@
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1644917782,
"narHash": "sha256-nFaqGKTtzzPY6rXwjYfuJetNAnvZGuFVtfJ4nWKaVes=",
"lastModified": 1645024434,
"narHash": "sha256-ZYwqOkx9MYKmbuqkLJdRhIn7IghMRclbUzxJgR7OOhA=",
"owner": "rust-analyzer",
"repo": "rust-analyzer",
"rev": "f0210f8a43efefef93dcb9ce0cf34b083fd3d51a",
"rev": "89faff7477e904f6820990f130a3aed72c1d7e6b",
"type": "github"
},
"original": {

View file

@ -3,7 +3,7 @@
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
nixpkgs.url = "github:nixos/nixpkgs";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs = inputs: let

View file

@ -7,7 +7,15 @@ options = ["run", "--"]
[formatter.prettier]
command = "prettier"
includes = ["*.html", "*.js", "*.json", "*.md", "*.toml", "*.yaml"]
includes = [
"*.html",
"*.js",
"*.json",
"*.md",
"*.toml",
"*.yaml",
"Cargo.lock",
]
options = ["--plugin", "prettier-plugin-toml", "--write"]
[formatter.rust]