From add807ef8980197bbd06652a36d937b93b2a31c7 Mon Sep 17 00:00:00 2001 From: technofab Date: Tue, 9 Sep 2025 15:26:18 +0200 Subject: [PATCH] feat: add nice to have `devshellModule` to soonix module for easy import --- lib/module.nix | 11 +++++++++++ nix/repo/devShells.nix | 6 ++---- 2 files changed, 13 insertions(+), 4 deletions(-) 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; }; }