style(nix): replace nixpkgs-fmt with nixfmt-rfc-style

This commit is contained in:
uncenter 2024-07-31 20:44:57 -04:00
parent 96f0c82ade
commit a94bd8a3c3
No known key found for this signature in database
4 changed files with 124 additions and 110 deletions

View file

@ -11,26 +11,31 @@
};
};
outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }@inputs:
outputs =
{
self,
nixpkgs,
flake-utils,
rust-overlay,
...
}@inputs:
let
# Nixpkgs overlays
overlays = [
rust-overlay.overlays.default
(final: _: {
rustToolchain = final.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
};
rustToolchain = final.rust-bin.stable.latest.default.override { extensions = [ "rust-src" ]; };
})
];
in
flake-utils.lib.eachDefaultSystem
(system:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system overlays; };
rev = self.shortRev or "dirty";
date = self.lastModifiedDate or self.lastModified or "19700101";
version = (builtins.fromTOML
(builtins.readFile ./yazi-fm/Cargo.toml)).package.version
version =
(builtins.fromTOML (builtins.readFile ./yazi-fm/Cargo.toml)).package.version
+ "pre${builtins.substring 0 8 date}_${rev}";
yazi-unwrapped = pkgs.callPackage ./nix/yazi-unwrapped.nix { inherit version rev date; };
@ -42,16 +47,15 @@
default = yazi;
};
formatter = pkgs.nixpkgs-fmt;
formatter = pkgs.nixfmt-rfc-style;
devShells.default = import ./nix/shell.nix { inherit pkgs inputs; };
})
}
)
// {
overlays = rec {
default = yazi;
yazi = final: _: {
inherit (self.packages."${final.system}") yazi yazi-unwrapped;
};
yazi = final: _: { inherit (self.packages."${final.system}") yazi yazi-unwrapped; };
};
};
}

View file

@ -18,9 +18,11 @@ pkgs.mkShell {
zoxide
];
buildInputs = with pkgs;
lib.optionals stdenv.isDarwin
(with darwin.apple_sdk.frameworks; [ Foundation ]);
buildInputs =
with pkgs;
lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Foundation ]);
env = { RUST_BACKTRACE = "1"; };
env = {
RUST_BACKTRACE = "1";
};
}

View file

@ -1,18 +1,23 @@
{ makeRustPlatform
, rustToolchain
, version ? "git"
, rev
, date
, lib
{
makeRustPlatform,
rustToolchain,
version ? "git",
rev,
date,
lib,
, installShellFiles
, stdenv
, darwin
installShellFiles,
stdenv,
darwin,
, imagemagick
imagemagick,
}:
(makeRustPlatform { cargo = rustToolchain; rustc = rustToolchain; }).buildRustPackage {
(makeRustPlatform {
cargo = rustToolchain;
rustc = rustToolchain;
}).buildRustPackage
{
pname = "yazi";
inherit version;
@ -29,10 +34,11 @@
env.VERGEN_GIT_SHA = rev;
env.VERGEN_BUILD_DATE = builtins.concatStringsSep "-" (builtins.match "(.{4})(.{2})(.{2}).*" date);
nativeBuildInputs = [ installShellFiles imagemagick ];
buildInputs = lib.optionals stdenv.isDarwin (
with darwin.apple_sdk.frameworks; [ Foundation ]
);
nativeBuildInputs = [
installShellFiles
imagemagick
];
buildInputs = lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Foundation ]);
postInstall = ''
installShellCompletion --cmd yazi \

View file

@ -1,32 +1,33 @@
{ lib
, runCommand
, makeWrapper
, yazi-unwrapped
{
lib,
runCommand,
makeWrapper,
yazi-unwrapped,
, withFile ? true
, file
, withJq ? true
, jq
, withPoppler ? true
, poppler_utils
, withUnar ? true
, unar
, withFfmpegthumbnailer ? true
, ffmpegthumbnailer
, withFd ? true
, fd
, withRipgrep ? true
, ripgrep
, withFzf ? true
, fzf
, withZoxide ? true
, zoxide
withFile ? true,
file,
withJq ? true,
jq,
withPoppler ? true,
poppler_utils,
withUnar ? true,
unar,
withFfmpegthumbnailer ? true,
ffmpegthumbnailer,
withFd ? true,
fd,
withRipgrep ? true,
ripgrep,
withFzf ? true,
fzf,
withZoxide ? true,
zoxide,
}:
let
inherit (lib) optional makeBinPath;
runtimePaths = optional withFile file
runtimePaths =
optional withFile file
++ optional withJq jq
++ optional withPoppler poppler_utils
++ optional withUnar unar
@ -41,7 +42,8 @@ runCommand yazi-unwrapped.name
inherit (yazi-unwrapped) pname version meta;
nativeBuildInputs = [ makeWrapper ];
} ''
}
''
mkdir -p $out/bin
ln -s ${yazi-unwrapped}/share $out/share
ln -s ${yazi-unwrapped}/bin/ya $out/bin/ya