2 description = "Userspace tools for bcachefs";
4 # Nixpkgs / NixOS version to use.
5 inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6 inputs.utils.url = "github:numtide/flake-utils";
7 inputs.filter.url = "github:numtide/nix-filter";
9 outputs = { self, nixpkgs, utils, filter, ... }@inputs:
11 # System types to support.
12 supportedSystems = [ "x86_64-linux" ];
15 version = "${builtins.substring 0 8 self.lastModifiedDate}-${self.shortRev or "dirty"}";
17 overlay = import ./nix/overlay.nix inputs;
18 nixosModule = self.nixosModules.bcachefs;
19 nixosModules.bcachefs = import ./rust-src/mount/module.nix;
20 nixosModules.bcachefs-enable-boot = ({config, pkgs, lib, ... }:{
21 # Disable Upstream NixOS Module when this is in use
22 disabledModules = [ "tasks/filesystems/bcachefs.nix" ];
23 # Import needed packages
24 nixpkgs.overlays = [ self.overlay ];
26 # Add bcachefs to boot and kernel
27 boot.initrd.supportedFilesystems = [ "bcachefs" ];
28 boot.supportedFilesystems = [ "bcachefs" ];
31 // utils.lib.eachSystem supportedSystems (system:
32 let pkgs = import nixpkgs {
34 overlays = [ self.overlay ];
40 # Provide some binary packages for selected system types.
41 defaultPackage = pkgs.bcachefs.tools;
43 inherit (pkgs.bcachefs)
51 tools-musl = pkgs.pkgsMusl.bcachefs.tools;
52 mount-musl = pkgs.pkgsMusl.bcachefs.mount;
56 kernelSrc = packages.kernel.src;
63 devShell = devShells.tools;
64 devShells.tools = pkgs.bcachefs.tools.override { inShell = true; };
65 devShells.mount = pkgs.bcachefs.mount.override { inShell = true; };