mirror of
https://github.com/RGBCube/alejandra
synced 2025-07-30 12:07:46 +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:
|
||||
import inputs.nixpkgs {
|
||||
overlays = [
|
||||
(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;
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
overlays = [overlay];
|
||||
system = host;
|
||||
};
|
||||
|
||||
|
@ -59,6 +25,40 @@
|
|||
nixpkgs."x86_64-darwin" = nixpkgsForHost "x86_64-darwin";
|
||||
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
|
||||
binaries = builtins.listToAttrs (
|
||||
builtins.map (pkg: {
|
||||
|
@ -115,6 +115,9 @@
|
|||
];
|
||||
};
|
||||
|
||||
inherit overlay;
|
||||
overlays.default = overlay;
|
||||
|
||||
packages."aarch64-darwin" = with nixpkgs."aarch64-darwin";
|
||||
buildBinariesForHost "aarch64-darwin" [
|
||||
alejandra
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue