Commit Graph

10 Commits

Author SHA1 Message Date
Thomas Mühlbacher
b91647aab8 style(nix): run nix fmt
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:35:05 +02:00
Finn Behrens
813310c343 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>
2023-11-09 22:09:33 +01:00
Daniel Hill
9a44c6d4d0 nix: overhaul build system.
Removed outdated overlay.
Simply build tooling using bingenHook and propagated*Inputs

Signed-off-by: Daniel Hill <daniel@gluo.nz>
2023-01-03 16:58:55 +13:00
Daniel B. Hill
962390c0b2 Simplify Nix(OS) development
Signed-off-by: Daniel B. Hill <daniel@gluo.nz>
2022-05-30 22:26:27 -04:00
Chris Webb
49923376d1 Use scrypt from libsodium
bcachefs-tools has both libscrypt and libsodium as build dependencies,
but libsodium already includes the same scrypt implementation as libscrypt,
originally written by Colin Percival.

Use the libsodium copy, dropping the extra libscrypt dependency.

Explicitly adopt the default scrypt N, r and p values from libscrypt to
avoid unintended changes in the default work parameters for bcachefs.

Signed-off-by: Chris Webb <chris@arachsys.com>
2021-10-23 12:16:08 -04:00
Kayla Firestack
41d10332bd switch to -n2 for pytest 2021-10-20 22:11:58 -04:00
Kayla Firestack
1fe24a0e83 edit default.nix to use the proper pytest variable 2021-10-20 09:53:04 -04:00
Kayla Firestack
e70c66e3b5 update default.nix to use latest dependencies and newer stdenv, as well as be flake compatible and overlay compatible 2021-10-18 11:30:30 -04:00
Austin Seipp
8acc54456e make: correct path to 'bcachefs' in mkfs/fsck scripts
The fsck and bcachefs scripts simply worked by running 'exec bcachefs
...', but this executes whatever is out of `$PATH`, which is likely not
what a user expected when working inside the bcachefs-tools tree.

This replaces the local uses of 'exec bcachefs' to use bash's
readlink/dirname builtins in order to find the location of the currently
executing wrapper, and execute the 'bcachefs' tool from there.

This allows executing these wrappers from anywhere, provided 'bcachefs'
is just right next to them, with the correct semantics.

As a result, this also allows removing a tiny hack from the Nix
expressions, allowing the included default.nix to use completely
standard mkDerivation builders, with no extra patch/fixup phases.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2017-12-17 12:46:45 -06:00
Austin Seipp
fa36882a73 nix: add nix expressions for development
This adds Nix expressions for bcachefs-tools that are modular, work in
purely sandboxed build environments (e.g. on NixOS itself, or macOS, where
sandboxing is enabled by default), use a fixed copy of Nixpkgs (to avoid hidden,
global state) and uses standard build idioms.

This change uses a fixed version of Nixpkgs, one that will always be used for
every build of bcachefs-tools, for all users, rather than relying on whatever
copy of Nixpkgs the user has available.

This has a major benefit in that it allows the build to work in sandboxed
environments such as NixOS, and it correctly declares all of the necessary
dependencies that bcachefs-tools needs. This is done simply by using
stdenv.mkDerivation in order to write a "normal" Nix expression, where the
previous version used a variant of the stdenv builder, but this isn't needed for
the most part. (Doing this has other knock-on benefits, such as the usage of
standardized options like `enableParallelBuild = true;` -- allowing `nix-build`
to automatically do parallel builds, etc.)

Another major benefit of this change is that anyone can now use `nix-shell` to
develop/hack on bcachefs-tools incrementally; simply running nix-shell will put
you in a Bash shell environment where all of bcachefs-tools' dependencies are
proprerly provided, no matter the state of the outside build environment/host
operating system:

    $ nix-shell

    [nix-shell:~/src/bcachefs-tools]$ make -j4 # works immediately

As mentioned before, with this change, by default, nix-build and
nix-shell run using a prepackaged copy of an upstream Nixpkgs snapshot. This is
done purely to ensure anyone who builds bcachefs-tools using Nix does, in fact,
get a reproducible build. Without this, nix-build defaults to using the the
`<nixpkgs>` NIX_PATH entry in order to fetch dependencies; meaning that two
users on different channels will get different results (for example, if you have
the November 2017 channel but I have the October 2017 channel, the results may
be different).

With this patch, a user running

    $ nix-build

will always use the exact same copy of nixpkgs to bootstrap the build,
regardless of whatever channels the user has. This bootstrap mechanism does not
even depend on an existing copy of Nixpkgs itself; e.g. it can work with a
completely empty `NIX_PATH`.

This is arguably anti-modular, but for end-user applications like
bcachefs-tools, fixing the version of Nixpkgs is not normally a huge deal. Users
who wish to use a different copy of Nixpkgs can provide this with an argument to
nix-build directly, using the `nixpkgs` argument to the expression:

    $ nix-build --pure --arg nixpkgs 'import <nixpkgs> {}'

This uses the `<nixpkgs>` provided inside your `NIX_PATH` environment variable
to acquire dependencies, which by default is managed using `nix-channel`. If you
have a copy of the Nixpkgs source code e.g. from a `git clone`, you may use that
too by simply using `-I` to prepend your Nixpkgs to `NIX_PATH` (see `man
nix-build` for more):

    $ nix-build --pure \
        -I nixpkgs=$HOME/src/nixpkgs \
        --arg nixpkgs 'import <nixpkgs> {}'

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2017-12-10 16:07:33 -06:00