refactor nix

This commit is contained in:
xenia 2024-04-17 16:04:26 -04:00
parent 8378ab8edb
commit 3d5b5aa245
4 changed files with 37 additions and 49 deletions

View File

@ -1,2 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
(pkgs.ocamlPackages.callPackage ./nix/package.nix {}).package

View File

@ -1,45 +0,0 @@
{
lib,
mkShell,
buildDunePackage,
eio,
eio_main,
ocaml,
dune_3,
odoc,
utop
}:
{
package =
let
sourceRoot = ../.;
fs = lib.fileset;
sourceFiles = fs.difference
(fs.gitTracked sourceRoot)
(fs.fileFilter (file: file.hasExt "nix") sourceRoot);
sourceSet = fs.toSource { root = sourceRoot; fileset = sourceFiles; };
in buildDunePackage rec {
pname = "bk910x";
version = "devel";
src = sourceSet;
minimalOCamlVersion = "5.1";
dontStrip = true;
propagatedBuildInputs = [ eio eio_main ];
};
shell = mkShell {
nativeBuildInputs = [
# base
ocaml dune_3 odoc
# shell
utop
# package deps
eio eio_main
];
};
}

37
package.nix Normal file
View File

@ -0,0 +1,37 @@
{
lib,
mkShell,
buildDunePackage,
eio,
eio_main,
ocaml,
dune_3,
odoc,
utop,
enableShell ? false
}:
let
sourceRoot = ./.;
fs = lib.fileset;
sourceFiles = fs.difference
(fs.gitTracked sourceRoot)
(fs.fileFilter (file: file.hasExt "nix") sourceRoot);
sourceSet = fs.toSource { root = sourceRoot; fileset = sourceFiles; };
in buildDunePackage rec {
pname = "bk910x";
version = "devel";
src = sourceSet;
minimalOCamlVersion = "5.1";
dontStrip = true;
propagatedBuildInputs = [ eio eio_main ];
nativeBuildInputs = lib.optionals enableShell [
ocaml dune_3 odoc utop
];
}

View File

@ -1,2 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
(pkgs.ocamlPackages.callPackage ./nix/package.nix {}).shell