Bcachefs: Difference between revisions

imported>Onny
mNo edit summary
imported>Onny
Update installation media generation to nix flakes
Line 54: Line 54:
=== Generate bcachefs enabled installation media ===
=== Generate bcachefs enabled installation media ===


Use following Nix expression <code>iso.nix</code> to generate a ISO installation image with a bcachefs enabled kernel
Use following Nix [[Flakes|Flake-expression]] to generate a ISO installation image with a bcachefs enabled kernel


<syntaxhighlight lang="nix">
{{file|flake.nix|nix|<nowiki>
# This module defines a small NixOS installation CD. It does not
# contain any graphical stuff.
{ config, pkgs, lib, ... }:
{
{
   imports = [
   description = "Bcachefs enabled installation media";
    # Currently fails on NixOS 23.05 to build due to ZFS incompatibility with bcachefs
  inputs.nixos.url = "nixpkgs/23.11-beta";
     #<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix>
  outputs = { self, nixos }: {
    <nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix>
     nixosConfigurations = {
  ];
      exampleIso = nixos.lib.nixosSystem {
  boot.supportedFilesystems = [ "bcachefs" ];
        system = "x86_64-linux";
  # kernelPackages already defined in installation-cd-minimal-new-kernel-no-zfs.nix
        modules = [
  boot.kernelPackages = lib.mkOverride 0 pkgs.linuxPackages_testing_bcachefs;
          "${nixos}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
   isoImage.squashfsCompression = "gzip -Xcompression-level 1";
          ({ lib, pkgs, ... }: {
            boot.supportedFilesystems = [ "bcachefs" ];
            boot.kernelPackages = lib.mkOverride 0 pkgs.linuxPackages_testing_bcachefs;
          })
        ];
      };
    };
   };
}
}
</syntaxhighlight>
</nowiki>}}
 
The following commands will generate the iso-image which will be available in the directory <code>./result/iso</code>


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
# nix-build '<nixpkgs/nixos>' -A config.system.build.isoImage -I nixos-config=iso.nix
# git init
# git add flake.nix
# nix build .#nixosConfigurations.exampleIso.config.system.build.isoImage
</syntaxhighlight>
</syntaxhighlight>