mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +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
|
{ lib, stdenv, pkg-config, attr, libuuid, libsodium, keyutils, liburcu, zlib
|
||||||
, stdenv
|
, libaio, udev, zstd, lz4, nix-gitignore, rustPlatform, rustc, cargo, }:
|
||||||
, pkg-config
|
|
||||||
, attr
|
|
||||||
, libuuid
|
|
||||||
, libsodium
|
|
||||||
, keyutils
|
|
||||||
, liburcu
|
|
||||||
, zlib
|
|
||||||
, libaio
|
|
||||||
, udev
|
|
||||||
, zstd
|
|
||||||
, lz4
|
|
||||||
, nix-gitignore
|
|
||||||
, rustPlatform
|
|
||||||
, rustc
|
|
||||||
, cargo
|
|
||||||
}:
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@ -61,12 +43,14 @@ in stdenv.mkDerivation {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
makeFlags = [
|
makeFlags = [ "DESTDIR=${placeholder "out"}" "PREFIX=" "VERSION=${commit}" ];
|
||||||
"PREFIX=${placeholder "out"}"
|
|
||||||
"VERSION=${commit}"
|
|
||||||
];
|
|
||||||
|
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
checkPhase = "./bcachefs version";
|
checkPhase = "./bcachefs version";
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
mainProgram = "bcachefs";
|
||||||
|
license = lib.licenses.gpl2Only;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
16
default.nix
16
default.nix
@ -1,10 +1,6 @@
|
|||||||
(import
|
(import (let lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||||
(
|
in fetchTarball {
|
||||||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
|
url =
|
||||||
fetchTarball {
|
"https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
}) { src = ./.; }).defaultNix
|
||||||
}
|
|
||||||
)
|
|
||||||
{ src = ./.; }
|
|
||||||
).defaultNix
|
|
||||||
|
18
flake.lock
18
flake.lock
@ -3,11 +3,11 @@
|
|||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1673956053,
|
"lastModified": 1696426674,
|
||||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
"owner": "edolstra",
|
"owner": "edolstra",
|
||||||
"repo": "flake-compat",
|
"repo": "flake-compat",
|
||||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -18,11 +18,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1686592866,
|
"lastModified": 1698924604,
|
||||||
"narHash": "sha256-riGg89eWhXJcPNrQGcSwTEEm7CGxWC06oSX44hajeMw=",
|
"narHash": "sha256-GCFbkl2tj8fEZBZCw3Tc0AkGo0v+YrQlohhEGJ/X4s0=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "0eeebd64de89e4163f4d3cf34ffe925a5cf67a05",
|
"rev": "fa804edfb7869c9fb230e174182a8a1a7e512c40",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -59,11 +59,11 @@
|
|||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1685518550,
|
"lastModified": 1694529238,
|
||||||
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
|
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
17
flake.nix
17
flake.nix
@ -10,13 +10,22 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, utils, ... }:
|
outputs = { self, nixpkgs, utils, ... }:
|
||||||
utils.lib.eachDefaultSystem (system:
|
{
|
||||||
|
overlays.default = final: prev: {
|
||||||
|
bcachefs = final.callPackage ./build.nix { };
|
||||||
|
};
|
||||||
|
} // utils.lib.eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = import nixpkgs {
|
||||||
bcachefs = pkgs.callPackage ./build.nix {};
|
inherit system;
|
||||||
|
overlays = [ self.overlays.default ];
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
packages = {
|
packages = {
|
||||||
default = bcachefs;
|
inherit (pkgs) bcachefs;
|
||||||
|
default = pkgs.bcachefs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
formatter = pkgs.nixfmt;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user