feat: add nice to have devshellModule to soonix module for easy import

This commit is contained in:
technofab 2025-09-09 15:26:18 +02:00
parent 6d8cbdcdec
commit add807ef89
No known key found for this signature in database
2 changed files with 13 additions and 4 deletions

View file

@ -124,6 +124,13 @@ in {
Generated shell hook script for managing all files. (readonly) Generated shell hook script for managing all files. (readonly)
''; '';
}; };
devshellModule = mkOption {
type = types.attrs;
readOnly = true;
description = ''
Devshell module with automatically configured hooks, just import and you're good to go. (readonly)
'';
};
finalFiles = mkOption { finalFiles = mkOption {
type = types.package; type = types.package;
@ -294,6 +301,10 @@ in {
then generatedShellHook then generatedShellHook
else ""; else "";
shellHookFile = pkgs.writeShellScript "shellHook" shellHook; shellHookFile = pkgs.writeShellScript "shellHook" shellHook;
devshellModule = {
imports = [./devshellModule.nix];
config.soonixShellHook = shellHook;
};
finalFiles = buildAllFiles allFiles; finalFiles = buildAllFiles allFiles;
# make it simpler to update the hooks without any devshell # make it simpler to update the hooks without any devshell
packages."soonix:update" = pkgs.writeShellScriptBin "soonix:update" '' packages."soonix:update" = pkgs.writeShellScriptBin "soonix:update" ''

View file

@ -3,11 +3,10 @@
inputs, inputs,
... ...
}: let }: let
inherit (inputs) pkgs devshell soonix treefmt; inherit (inputs) pkgs devshell treefmt;
soonixShellHook = cell.soonix.shellHook;
in { in {
default = devshell.mkShell { default = devshell.mkShell {
imports = [soonix.devshellModule]; imports = [cell.soonix.devshellModule];
packages = [ packages = [
pkgs.nil pkgs.nil
(treefmt.mkWrapper pkgs { (treefmt.mkWrapper pkgs {
@ -17,6 +16,5 @@ in {
}; };
}) })
]; ];
inherit soonixShellHook;
}; };
} }