]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
add nix flake with checks, overlay, and default package
authorKayla Firestack <dev@kaylafire.me>
Thu, 14 Oct 2021 14:19:36 +0000 (10:19 -0400)
committerKayla Firestack <dev@kaylafire.me>
Mon, 18 Oct 2021 15:30:30 +0000 (11:30 -0400)
flake.lock [new file with mode: 0644]
flake.nix [new file with mode: 0644]

diff --git a/flake.lock b/flake.lock
new file mode 100644 (file)
index 0000000..2c9c15b
--- /dev/null
@@ -0,0 +1,59 @@
+{
+  "nodes": {
+    "filter": {
+      "locked": {
+        "lastModified": 1620202920,
+        "narHash": "sha256-BOkm3eKT45Dk4NNxJT0xL9NnyYeZcF+t79zPnJkggac=",
+        "owner": "numtide",
+        "repo": "nix-filter",
+        "rev": "3c9e33ed627e009428197b07216613206f06ed80",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "nix-filter",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1633351077,
+        "narHash": "sha256-z38JG4Bb0GtM1aF1pANVdp1dniMP23Yb3HnRoJRy2uU=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "14aef06d9b3ad1d07626bdbb16083b83f92dc6c1",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "ref": "nixos-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "filter": "filter",
+        "nixpkgs": "nixpkgs",
+        "utils": "utils"
+      }
+    },
+    "utils": {
+      "locked": {
+        "lastModified": 1629481132,
+        "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "997f7efcb746a9c140ce1f13c72263189225f482",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644 (file)
index 0000000..36dda0e
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,50 @@
+{
+       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;
+               }
+               // 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
+                                       kernel;
+
+                               musl-tools = pkgs.pkgsMusl.bcachefs.tools;
+                               musl-mount = pkgs.pkgsMusl.bcachefs.mount;
+                       };
+
+                       checks = { 
+                               kernelSrc = packages.kernel.src;
+                               inherit (packages) 
+                                       toolsValgrind;
+                       };
+
+                       devShell = devShells.tools;
+                       devShells.tools = pkgs.bcachefs.tools.override { inShell = true; };
+               });
+}