mirror of
https://github.com/RGBCube/alejandra
synced 2025-07-31 04:27:45 +00:00
feat: add an overlay
This commit is contained in:
parent
bb7f2ad3f1
commit
7acde21fc5
1 changed files with 38 additions and 35 deletions
73
flake.nix
73
flake.nix
|
@ -15,41 +15,7 @@
|
||||||
|
|
||||||
nixpkgsForHost = host:
|
nixpkgsForHost = host:
|
||||||
import inputs.nixpkgs {
|
import inputs.nixpkgs {
|
||||||
overlays = [
|
overlays = [overlay];
|
||||||
(self: super: {
|
|
||||||
alejandra = self.rustPlatform.buildRustPackage {
|
|
||||||
pname = "alejandra";
|
|
||||||
inherit version;
|
|
||||||
src = self.stdenv.mkDerivation {
|
|
||||||
name = "src";
|
|
||||||
builder = builtins.toFile "builder.sh" ''
|
|
||||||
source $stdenv/setup
|
|
||||||
|
|
||||||
mkdir $out
|
|
||||||
cp -rT --no-preserve=mode,ownership $src $out/src/
|
|
||||||
cp $cargoLock $out/Cargo.lock
|
|
||||||
cp $cargoToml $out/Cargo.toml
|
|
||||||
'';
|
|
||||||
cargoLock = ./Cargo.lock;
|
|
||||||
cargoToml = ./Cargo.toml;
|
|
||||||
src = ./src;
|
|
||||||
};
|
|
||||||
cargoLock.lockFile = ./Cargo.lock;
|
|
||||||
|
|
||||||
passthru.tests = {
|
|
||||||
version = self.testVersion {package = super.alejandra;};
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
description = "The Uncompromising Nix Code Formatter.";
|
|
||||||
homepage = "https://github.com/kamadorueda/alejandra";
|
|
||||||
license = self.lib.licenses.unlicense;
|
|
||||||
maintainers = [self.lib.maintainers.kamadorueda];
|
|
||||||
platforms = self.lib.systems.doubles.all;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
system = host;
|
system = host;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -59,6 +25,40 @@
|
||||||
nixpkgs."x86_64-darwin" = nixpkgsForHost "x86_64-darwin";
|
nixpkgs."x86_64-darwin" = nixpkgsForHost "x86_64-darwin";
|
||||||
nixpkgs."x86_64-linux" = nixpkgsForHost "x86_64-linux";
|
nixpkgs."x86_64-linux" = nixpkgsForHost "x86_64-linux";
|
||||||
|
|
||||||
|
overlay = final: prev: {
|
||||||
|
alejandra = final.rustPlatform.buildRustPackage {
|
||||||
|
pname = "alejandra";
|
||||||
|
inherit version;
|
||||||
|
src = final.stdenv.mkDerivation {
|
||||||
|
name = "src";
|
||||||
|
builder = builtins.toFile "builder.sh" ''
|
||||||
|
source $stdenv/setup
|
||||||
|
|
||||||
|
mkdir $out
|
||||||
|
cp -rT --no-preserve=mode,ownership $src $out/src/
|
||||||
|
cp $cargoLock $out/Cargo.lock
|
||||||
|
cp $cargoToml $out/Cargo.toml
|
||||||
|
'';
|
||||||
|
cargoLock = ./Cargo.lock;
|
||||||
|
cargoToml = ./Cargo.toml;
|
||||||
|
src = ./src;
|
||||||
|
};
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
|
||||||
|
passthru.tests = {
|
||||||
|
version = final.testVersion {package = prev.alejandra;};
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "The Uncompromising Nix Code Formatter.";
|
||||||
|
homepage = "https://github.com/kamadorueda/alejandra";
|
||||||
|
license = final.lib.licenses.unlicense;
|
||||||
|
maintainers = [final.lib.maintainers.kamadorueda];
|
||||||
|
platforms = final.lib.systems.doubles.all;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
buildBinariesForHost = host: pkgs: let
|
buildBinariesForHost = host: pkgs: let
|
||||||
binaries = builtins.listToAttrs (
|
binaries = builtins.listToAttrs (
|
||||||
builtins.map (pkg: {
|
builtins.map (pkg: {
|
||||||
|
@ -115,6 +115,9 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inherit overlay;
|
||||||
|
overlays.default = overlay;
|
||||||
|
|
||||||
packages."aarch64-darwin" = with nixpkgs."aarch64-darwin";
|
packages."aarch64-darwin" = with nixpkgs."aarch64-darwin";
|
||||||
buildBinariesForHost "aarch64-darwin" [
|
buildBinariesForHost "aarch64-darwin" [
|
||||||
alejandra
|
alejandra
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue