1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-31 04:27:45 +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 - alejandra-x86_64-unknown-linux-musl
command: command:
- echo +++ - echo +++
- nix build .#aarch64-unknown-linux-musl - nix build .#alejandra-aarch64-unknown-linux-musl
- cachix push alejandra result - cachix push alejandra result
- cp -L result/bin/alejandra alejandra-aarch64-unknown-linux-musl - 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 - cachix push alejandra result
- cp -L result/bin/alejandra alejandra-x86_64-unknown-linux-gnu - 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 - cachix push alejandra result
- cp -L result/bin/alejandra alejandra-x86_64-unknown-linux-musl - cp -L result/bin/alejandra alejandra-x86_64-unknown-linux-musl
@ -107,7 +107,7 @@ steps:
artifacts: artifacts:
- alejandra.vsix - alejandra.vsix
command: command:
- nix build --out-link alejandra.vsix .#integrations-vscode - nix build --out-link alejandra.vsix .#alejandra-vscode-vsix
- label: flake check - label: flake check
command: command:

View file

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

46
flake.lock generated
View file

@ -1,26 +1,5 @@
{ {
"nodes": { "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": { "flakeCompat": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -39,42 +18,25 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1645072054, "lastModified": 1644972330,
"narHash": "sha256-I+HkWU1IpRb93VzjayAybj3L2CcJxNlZDhSeSpL3eSw=", "narHash": "sha256-6V2JFpTUzB9G+KcqtUR1yl7f6rd9495YrFECslEmbGw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "97777606991c3a78040c883fa97791ae77073022", "rev": "19574af0af3ffaf7c9e359744ed32556f34536bd",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"fenix": "fenix",
"flakeCompat": "flakeCompat", "flakeCompat": "flakeCompat",
"nixpkgs": "nixpkgs" "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", "root": "root",

172
flake.nix
View file

@ -2,127 +2,93 @@
description = "The Uncompromising Nix Code Formatter"; description = "The Uncompromising Nix Code Formatter";
inputs = { inputs = {
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
flakeCompat.url = github:edolstra/flake-compat; flakeCompat.url = github:edolstra/flake-compat;
flakeCompat.flake = false; flakeCompat.flake = false;
nixpkgs.url = "github:nixos/nixpkgs"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
}; };
outputs = inputs: let outputs = inputs: let
build = host: target: let commit = inputs.self.shortRev or "dirty";
nixpkgs = import inputs.nixpkgs { 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; 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}; nixpkgs."aarch64-darwin" = nixpkgsForHost "aarch64-darwin";
rustPlatform = nixpkgs.makeRustPlatform { nixpkgs."aarch64-linux" = nixpkgsForHost "aarch64-linux";
cargo = fenix.latest.cargo; nixpkgs."x86_64-darwin" = nixpkgsForHost "x86_64-darwin";
rustc = fenix.combine [ nixpkgs."x86_64-linux" = nixpkgsForHost "x86_64-linux";
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
];
};
};
in rec { in rec {
checks."aarch64-darwin" = packages."aarch64-darwin"; checks."aarch64-darwin" = packages."aarch64-darwin";
checks."x86_64-darwin" = packages."x86_64-darwin";
checks."aarch64-linux" = packages."aarch64-linux"; checks."aarch64-linux" = packages."aarch64-linux";
checks."x86_64-darwin" = packages."x86_64-darwin";
checks."x86_64-linux" = packages."x86_64-linux"; checks."x86_64-linux" = packages."x86_64-linux";
defaultPackage."aarch64-darwin" = defaultPackage."aarch64-darwin" = packages."aarch64-darwin"."alejandra-aarch64-apple-darwin";
packages."aarch64-darwin"."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."aarch64-linux" = defaultPackage."x86_64-linux" = packages."x86_64-linux"."alejandra-x86_64-unknown-linux-gnu";
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";
devShell."x86_64-linux" = 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" = inherit nixpkgs;
(build "aarch64-darwin" "aarch64-apple-darwin").bin;
packages."aarch64-linux"."aarch64-unknown-linux-musl" = packages."aarch64-darwin"."alejandra-aarch64-apple-darwin" = nixpkgs."aarch64-darwin".alejandra;
(build "aarch64-linux" "aarch64-unknown-linux-musl").bin; 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" = packages."x86_64-linux"."alejandra-vscode-vsix" = nixpkgs."x86_64-linux".mkYarnPackage {
(build "x86_64-darwin" "x86_64-apple-darwin").bin; name = "alejandra";
src = ./integrations/vscode;
packages."x86_64-linux"."integrations-vscode" = packageJSON = ./integrations/vscode/package.json;
(build "x86_64-linux" "x86_64-unknown-linux-gnu").integrations.vscode; yarnLock = ./integrations/vscode/yarn.lock;
yarnNix = ./integrations/vscode/yarn.lock.nix;
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;
}; };
} }

19
front/flake.lock generated
View file

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

View file

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

View file

@ -7,7 +7,15 @@ options = ["run", "--"]
[formatter.prettier] [formatter.prettier]
command = "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"] options = ["--plugin", "prettier-plugin-toml", "--write"]
[formatter.rust] [formatter.rust]