summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorDaniel Hill <daniel@gluo.nz>2022-11-25 12:47:29 +1300
committerDaniel Hill <daniel@gluo.nz>2023-01-03 16:58:55 +1300
commit9a44c6d4d020035f25baf74b1f7986b3221a274e (patch)
tree5d40fc996aa15176c9f75e45fc738200f25eb27a /flake.nix
parent9d6040c8b60d10f901141df9d739005f3fe0326e (diff)
nix: overhaul build system.
Removed outdated overlay. Simply build tooling using bingenHook and propagated*Inputs Signed-off-by: Daniel Hill <daniel@gluo.nz>
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix120
1 files changed, 26 insertions, 94 deletions
diff --git a/flake.nix b/flake.nix
index b52bc7e5..567a3dc1 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,96 +1,28 @@
{
- description = "Userspace tools for bcachefs";
-
- # Nixpkgs / NixOS version to use.
- inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
- inputs.utils.url = "github:numtide/flake-utils";
- inputs.filter.url = "github:numtide/nix-filter";
-
- outputs = { self, nixpkgs, utils, filter, ... }@inputs:
- let
- # System types to support.
- supportedSystems = [ "x86_64-linux" ];
- in
- {
- version = "${builtins.substring 0 8 self.lastModifiedDate}-${self.shortRev or "dirty"}";
-
- overlay = import ./nix/overlay.nix inputs;
- nixosModule = self.nixosModules.bcachefs;
- nixosModules.bcachefs = import ./rust-src/mount/module.nix;
- nixosModules.bcachefs-enable-boot = ({config, pkgs, lib, ... }:{
- # Disable Upstream NixOS Module when this is in use
- disabledModules = [ "tasks/filesystems/bcachefs.nix" ];
- # Import needed packages
- nixpkgs.overlays = [ self.overlay ];
-
- # Add bcachefs to boot and kernel
- boot.initrd.supportedFilesystems = [ "bcachefs" ];
- boot.supportedFilesystems = [ "bcachefs" ];
- });
-
- nixosConfigurations.netboot-bcachefs = self.systems.netboot-bcachefs "x86_64-linux";
- systems.netboot-bcachefs = system: (nixpkgs.lib.nixosSystem {
- inherit system; modules = [
- self.nixosModule
- self.nixosModules.bcachefs-enable-boot
- ("${nixpkgs}/nixos/modules/installer/netboot/netboot-minimal.nix")
- ({ lib, pkgs, config, ... }: {
- # installation disk autologin
- services.getty.autologinUser = lib.mkForce "root";
- users.users.root.initialPassword = "toor";
-
- # Symlink everything together
- system.build.netboot = pkgs.symlinkJoin {
- name = "netboot";
- paths = with config.system.build; [
- netbootRamdisk
- kernel
- netbootIpxeScript
- ];
- preferLocalBuild = true;
- };
- })
- ];
- });
- }
- // utils.lib.eachSystem supportedSystems (system:
- let pkgs = import nixpkgs {
- inherit system;
- overlays = [ self.overlay ];
- };
- in rec {
-
- # A Nixpkgs overlay.
-
- # Provide some binary packages for selected system types.
- defaultPackage = pkgs.bcachefs.tools;
- packages = {
- inherit (pkgs.bcachefs)
- tools
- toolsValgrind
- toolsDebug
- mount
- bch_bindgen
- kernel;
-
- tools-musl = pkgs.pkgsMusl.bcachefs.tools;
- mount-musl = pkgs.pkgsMusl.bcachefs.mount;
- };
-
- checks = {
- kernelSrc = packages.kernel.src;
- inherit (packages)
- mount
- bch_bindgen
- toolsValgrind;
-
- # Build and test initrd with bcachefs and bcachefs.mount installed
- # Disabled Test because it takes a while to build the kernel
- # bootStage1Module = self.nixosConfigurations.netboot-bcachefs.config.system.build.bootStage1;
- };
-
- devShell = devShells.tools;
- devShells.tools = pkgs.bcachefs.tools.override { inShell = true; };
- devShells.mount = pkgs.bcachefs.mount.override { inShell = true; };
- });
+ description = "Userspace tools for bcachefs";
+
+ # Nixpkgs / NixOS version to use.
+ inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+ inputs.utils.url = "github:numtide/flake-utils";
+ inputs.flake-compat = {
+ url = "github:edolstra/flake-compat";
+ flake = false;
+ };
+
+ outputs = { self, nixpkgs, utils, ... }:
+ utils.lib.eachDefaultSystem (system:
+ let
+ pkgs = nixpkgs.legacyPackages.${system};
+ binary = pkgs.callPackage ./binary.nix { };
+ mount = pkgs.callPackage ./rust-src/mount/default.nix { inherit binary; };
+ bcachefs = pkgs.callPackage ./base.nix {
+ inherit binary mount;
+ testWithValgrind = false;
+ };
+ in {
+ packages = {
+ inherit binary mount;
+ default = bcachefs;
+ };
+ });
}