Skip to content

Commit

Permalink
Add oura and fourmolu to the dev shell
Browse files Browse the repository at this point in the history
  • Loading branch information
Renegatto committed Aug 5, 2024
1 parent 2628d1c commit 9e3ace0
Show file tree
Hide file tree
Showing 3 changed files with 252 additions and 0 deletions.
181 changes: 181 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
inputs = {
raw-oura.url = "github:Renegatto/oura?rev=3be6b2883d41ced958c4d462b5e899e05cdf9b6a";
flake-utils.follows = "raw-oura/flake-utils";
rust-overlay.follows = "raw-oura/rust-overlay";
nixpkgs.follows = "raw-oura/nixpkgs";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = {
self,
raw-oura,
crane,
flake-utils,
rust-overlay,
nixpkgs,
...
}: let
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux"];
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit overlays;
system = "x86_64-linux";
};
# oura: Derivation
oura =
let
# oura.nix:
# {inputs: {crane: NixInput, oura: NixInput}} ->
# { perSystem: {pkgs: any} ->
# { packages: { oura-${string}: Package } }
# }
make-oura = import ./oura.nix {inputs = {inherit crane; oura = raw-oura;};};
in builtins.head (builtins.attrValues (make-oura.perSystem {inherit pkgs;}).packages);

in flake-utils.lib.eachSystem supportedSystems
(
system: {
devShells = {
default =
pkgs.mkShell {
nativeBuildInputs = [
oura
pkgs.haskellPackages.fourmolu
];
};
};
});
}
19 changes: 19 additions & 0 deletions oura.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# {inputs: {crane: NixInput, oura: NixInput}} ->
# { perSystem: {pkgs: any} -> { packages: { oura: Package } }
# }
{inputs}: {
perSystem = {pkgs}: let
craneLib = inputs.crane.mkLib pkgs;
oura = craneLib.buildPackage {
cargoExtraArgs = "--all-features"; # Enable all bundled plugins
env = {
OPENSSL_NO_VENDOR = "1"; # Use system openssl
};
nativeBuildInputs = [pkgs.pkg-config];
buildInputs = [pkgs.openssl];
src = craneLib.cleanCargoSource inputs.oura;
};
in {
packages = { inherit oura; };
};
}

0 comments on commit 9e3ace0

Please sign in to comment.