style(nix): run nix fmt

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
This commit is contained in:
Thomas Mühlbacher 2024-05-22 20:41:19 +02:00
parent e94c985640
commit b91647aab8
3 changed files with 75 additions and 25 deletions

View File

@ -1,12 +1,31 @@
{ lib, stdenv, pkg-config, attr, libuuid, libsodium, keyutils, liburcu, zlib {
, libaio, udev, zstd, lz4, nix-gitignore, rustPlatform, rustc, cargo, fuse3 lib,
, fuseSupport ? false, }: stdenv,
pkg-config,
attr,
libuuid,
libsodium,
keyutils,
liburcu,
zlib,
libaio,
udev,
zstd,
lz4,
nix-gitignore,
rustPlatform,
rustc,
cargo,
fuse3,
fuseSupport ? false,
}:
let let
src = nix-gitignore.gitignoreSource [ ] ./.; src = nix-gitignore.gitignoreSource [ ] ./.;
commit = lib.strings.substring 0 7 (builtins.readFile ./.bcachefs_revision); commit = lib.strings.substring 0 7 (builtins.readFile ./.bcachefs_revision);
version = "git-${commit}"; version = "git-${commit}";
in stdenv.mkDerivation { in
stdenv.mkDerivation {
inherit src version; inherit src version;
pname = "bcachefs-tools"; pname = "bcachefs-tools";
@ -39,11 +58,13 @@ in stdenv.mkDerivation {
# when git-based crates are updated, run: # when git-based crates are updated, run:
# nix run github:Mic92/nix-update -- --version=skip --flake default # nix run github:Mic92/nix-update -- --version=skip --flake default
# to update the hashes # to update the hashes
cargoDeps = rustPlatform.importCargoLock { cargoDeps = rustPlatform.importCargoLock { lockFile = "${src}/Cargo.lock"; };
lockFile = "${src}/Cargo.lock";
};
makeFlags = [ "DESTDIR=${placeholder "out"}" "PREFIX=" "VERSION=${commit}" ]; makeFlags = [
"DESTDIR=${placeholder "out"}"
"PREFIX="
"VERSION=${commit}"
];
dontStrip = true; dontStrip = true;
checkPhase = "./target/release/bcachefs version"; checkPhase = "./target/release/bcachefs version";

View File

@ -1,6 +1,9 @@
(import (let lock = builtins.fromJSON (builtins.readFile ./flake.lock); (import (
in fetchTarball { let
url = lock = builtins.fromJSON (builtins.readFile ./flake.lock);
"https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; in
sha256 = lock.nodes.flake-compat.locked.narHash; fetchTarball {
}) { src = ./.; }).defaultNix url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
) { src = ./.; }).defaultNix

View File

@ -9,18 +9,25 @@
flake = false; flake = false;
}; };
outputs = { self, nixpkgs, utils, ... }: outputs =
{ {
overlays.default = final: prev: { self,
bcachefs = final.callPackage ./build.nix { }; nixpkgs,
}; utils,
} // utils.lib.eachDefaultSystem (system: ...
}:
{
overlays.default = final: prev: { bcachefs = final.callPackage ./build.nix { }; };
}
// utils.lib.eachDefaultSystem (
system:
let let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = [ self.overlays.default ]; overlays = [ self.overlays.default ];
}; };
in { in
{
packages = { packages = {
inherit (pkgs) bcachefs; inherit (pkgs) bcachefs;
bcachefs-fuse = pkgs.bcachefs.override { fuseSupport = true; }; bcachefs-fuse = pkgs.bcachefs.override { fuseSupport = true; };
@ -29,12 +36,31 @@
formatter = pkgs.nixfmt-rfc-style; formatter = pkgs.nixfmt-rfc-style;
devShells.default = pkgs.callPackage ({ mkShell, rustc, cargo, gnumake devShells.default = pkgs.callPackage (
, gcc, clang, pkg-config, libuuid, libsodium, keyutils, liburcu, zlib {
, libaio, zstd, lz4, udev, bcachefs }: mkShell,
rustc,
cargo,
gnumake,
gcc,
clang,
pkg-config,
libuuid,
libsodium,
keyutils,
liburcu,
zlib,
libaio,
zstd,
lz4,
udev,
bcachefs,
}:
mkShell { mkShell {
LIBCLANG_PATH = "${clang.cc.lib}/lib"; LIBCLANG_PATH = "${clang.cc.lib}/lib";
inherit (bcachefs) nativeBuildInputs buildInputs; inherit (bcachefs) nativeBuildInputs buildInputs;
}) { }; }
}); ) { };
}
);
} }