diff --git a/lib/module.nix b/lib/module.nix index 4233de1..4546319 100644 --- a/lib/module.nix +++ b/lib/module.nix @@ -124,6 +124,13 @@ in { 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 { type = types.package; @@ -294,6 +301,10 @@ in { then generatedShellHook else ""; shellHookFile = pkgs.writeShellScript "shellHook" shellHook; + devshellModule = { + imports = [./devshellModule.nix]; + config.soonixShellHook = shellHook; + }; finalFiles = buildAllFiles allFiles; # make it simpler to update the hooks without any devshell packages."soonix:update" = pkgs.writeShellScriptBin "soonix:update" '' diff --git a/nix/repo/devShells.nix b/nix/repo/devShells.nix index 7953e9d..16ebc5d 100644 --- a/nix/repo/devShells.nix +++ b/nix/repo/devShells.nix @@ -3,11 +3,10 @@ inputs, ... }: let - inherit (inputs) pkgs devshell soonix treefmt; - soonixShellHook = cell.soonix.shellHook; + inherit (inputs) pkgs devshell treefmt; in { default = devshell.mkShell { - imports = [soonix.devshellModule]; + imports = [cell.soonix.devshellModule]; packages = [ pkgs.nil (treefmt.mkWrapper pkgs { @@ -17,6 +16,5 @@ in { }; }) ]; - inherit soonixShellHook; }; }