mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-22 00:00:03 +03:00
nix: fix build add overlay and formatter to flake
Adds overlay flake output to expose the bcachefs package and add and run a nix formatter. Co-authored-by: Leona Maroni <dev@leona.is> Signed-off-by: Leona Maroni <dev@leona.is> Signed-off-by: Finn Behrens <me@kloenk.de>
This commit is contained in:
parent
81352a29bc
commit
813310c343
34
build.nix
34
build.nix
@ -1,28 +1,10 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, pkg-config
|
||||
, attr
|
||||
, libuuid
|
||||
, libsodium
|
||||
, keyutils
|
||||
, liburcu
|
||||
, zlib
|
||||
, libaio
|
||||
, udev
|
||||
, zstd
|
||||
, lz4
|
||||
, nix-gitignore
|
||||
, rustPlatform
|
||||
, rustc
|
||||
, cargo
|
||||
}:
|
||||
|
||||
{ lib, stdenv, pkg-config, attr, libuuid, libsodium, keyutils, liburcu, zlib
|
||||
, libaio, udev, zstd, lz4, nix-gitignore, rustPlatform, rustc, cargo, }:
|
||||
let
|
||||
src = nix-gitignore.gitignoreSource [] ./. ;
|
||||
src = nix-gitignore.gitignoreSource [ ] ./.;
|
||||
|
||||
commit = lib.strings.substring 0 7 (builtins.readFile ./.bcachefs_revision);
|
||||
version = "git-${commit}";
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
inherit src version;
|
||||
|
||||
@ -61,12 +43,14 @@ in stdenv.mkDerivation {
|
||||
};
|
||||
};
|
||||
|
||||
makeFlags = [
|
||||
"PREFIX=${placeholder "out"}"
|
||||
"VERSION=${commit}"
|
||||
];
|
||||
makeFlags = [ "DESTDIR=${placeholder "out"}" "PREFIX=" "VERSION=${commit}" ];
|
||||
|
||||
dontStrip = true;
|
||||
checkPhase = "./bcachefs version";
|
||||
doCheck = true;
|
||||
|
||||
meta = {
|
||||
mainProgram = "bcachefs";
|
||||
license = lib.licenses.gpl2Only;
|
||||
};
|
||||
}
|
||||
|
16
default.nix
16
default.nix
@ -1,10 +1,6 @@
|
||||
(import
|
||||
(
|
||||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
|
||||
fetchTarball {
|
||||
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
|
||||
(import (let lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
in fetchTarball {
|
||||
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
|
||||
|
18
flake.lock
18
flake.lock
@ -3,11 +3,11 @@
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -18,11 +18,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1686592866,
|
||||
"narHash": "sha256-riGg89eWhXJcPNrQGcSwTEEm7CGxWC06oSX44hajeMw=",
|
||||
"lastModified": 1698924604,
|
||||
"narHash": "sha256-GCFbkl2tj8fEZBZCw3Tc0AkGo0v+YrQlohhEGJ/X4s0=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0eeebd64de89e4163f4d3cf34ffe925a5cf67a05",
|
||||
"rev": "fa804edfb7869c9fb230e174182a8a1a7e512c40",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -59,11 +59,11 @@
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1685518550,
|
||||
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
17
flake.nix
17
flake.nix
@ -10,13 +10,22 @@
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, utils, ... }:
|
||||
utils.lib.eachDefaultSystem (system:
|
||||
{
|
||||
overlays.default = final: prev: {
|
||||
bcachefs = final.callPackage ./build.nix { };
|
||||
};
|
||||
} // utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
bcachefs = pkgs.callPackage ./build.nix {};
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlays.default ];
|
||||
};
|
||||
in {
|
||||
packages = {
|
||||
default = bcachefs;
|
||||
inherit (pkgs) bcachefs;
|
||||
default = pkgs.bcachefs;
|
||||
};
|
||||
|
||||
formatter = pkgs.nixfmt;
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user