This commit is contained in:
atagen 2026-03-18 15:40:47 +11:00
commit 71de2e7b4b
22 changed files with 3717 additions and 0 deletions

71
flake.nix Normal file
View file

@ -0,0 +1,71 @@
{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
outputs =
{ self, nixpkgs }:
let
forAllSystems =
f:
nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] (
system: f (import nixpkgs { inherit system; })
);
in
{
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with pkgs.ocamlPackages; [
dune_3
ocaml
angstrom
angstrom-unix
camlzip
ppx_inline_test
ocaml-lsp
ocamlformat
ocamlformat-rpc-lib
utop
];
};
});
packages = forAllSystems (pkgs: {
default = pkgs.ocamlPackages.buildDunePackage {
pname = "inshellah";
version = "0.1";
src = ./.;
nativeBuildInputs = [ pkgs.git ];
buildInputs = with pkgs.ocamlPackages; [
dune_3
ocaml
angstrom
angstrom-unix
camlzip
];
meta.mainProgram = "inshellah";
};
});
nixosModules.default =
{
pkgs,
lib,
config,
...
}:
{
imports = [ ./nix/module.nix ];
programs.inshellah.package = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
programs.inshellah.snippet = ''
let inshellah_complete = {|spans|
${lib.getExe config.programs.inshellah.package} complete ...$spans --system-dir /run/current-system/sw/${config.programs.inshellah.completionsPath} | from json
}
$env.config.completions.external = {
enable: true
max_results: 100
completer: $inshellah_complete
}
'';
};
};
}