summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKayla Firestack <dev@kaylafire.me>2021-10-14 10:19:36 -0400
committerKayla Firestack <dev@kaylafire.me>2021-10-18 11:30:30 -0400
commit5625937162ed6034be13567cc21108812d56cf6b (patch)
tree259d05555794d6bf35e628a9db4696358667b84c
parente70c66e3b59d10f8ea09f7c2e4cc373b330d84f7 (diff)
add nix flake with checks, overlay, and default package
-rw-r--r--flake.lock59
-rw-r--r--flake.nix50
2 files changed, 109 insertions, 0 deletions
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 00000000..2c9c15b9
--- /dev/null
+++ b/flake.lock
@@ -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
index 00000000..36dda0ec
--- /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; };
+ });
+}