Co-authored-by: Leona Maroni <d...@leona.is> Signed-off-by: Leona Maroni <d...@leona.is> Signed-off-by: Finn Behrens <m...@kloenk.de> --- build.nix | 34 +++++++++------------------------- default.nix | 16 ++++++---------- flake.lock | 18 +++++++++--------- flake.nix | 17 +++++++++++++---- 4 files changed, 37 insertions(+), 48 deletions(-)
diff --git a/build.nix b/build.nix index 5cf07de..e05dad4 100644 --- a/build.nix +++ b/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; + }; } diff --git a/default.nix b/default.nix index 2cccff2..80aeb43 100644 --- a/default.nix +++ b/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 diff --git a/flake.lock b/flake.lock index 899f297..413959e 100644 --- a/flake.lock +++ b/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": { diff --git a/flake.nix b/flake.nix index 0f8e90d..bdaa4bf 100644 --- a/flake.nix +++ b/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; }); } -- 2.42.0