add nix flake with checks, overlay, and default package

This commit is contained in:
Kayla Firestack 2021-10-14 10:19:36 -04:00
parent e70c66e3b5
commit 5625937162
2 changed files with 109 additions and 0 deletions

59
flake.lock Normal file
View File

@ -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
}

50
flake.nix Normal file
View File

@ -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; };
});
}