From d571568530f805119059e60151cb8bfc48f85409 Mon Sep 17 00:00:00 2001 From: rachitvrma Date: Fri, 13 Mar 2026 19:52:51 +0530 Subject: [PATCH 1/4] feat(wrapperModules.gh): Wrapper for github-cli Wrap github-cli `gh` using nix-wrapper-module --- wrapperModules/g/gh/module.nix | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 wrapperModules/g/gh/module.nix diff --git a/wrapperModules/g/gh/module.nix b/wrapperModules/g/gh/module.nix new file mode 100644 index 0000000..3678d88 --- /dev/null +++ b/wrapperModules/g/gh/module.nix @@ -0,0 +1,41 @@ +{ + wlib, + lib, + pkgs, + config, + ... +}: +let + yamlFormat = pkgs.formats.yaml { }; + inherit (lib) mkOption; +in +{ + options = { + settings = mkOption { + inherit (yamlFormat) type; + default = { }; + description = '' + Configuration that goes to {file}`config.yml` + ''; + }; + }; + config = { + package = lib.mkDefault pkgs.gh; + drv = { + configYml = yamlFormat.generate "config.yml" config.settings; + passAsFile = [ + "configYml" + ]; + buildPhase = '' + runHook preBuild + mkdir -p "${placeholder config.outputName}/gh-config" + cp "$(cat "$configYmlPath")" "${placeholder config.outputName}/gh-config/config.yml" + runHook postBuild + ''; + env = { + GH_CONFIG_DIR = "${placeholder config.outputName}/gh-config"; + }; + }; + meta.maintainers = [ wlib.maintainers.rachitvrma ]; + }; +} From c5b3ebb06591faf80bc706e7c0ede6f3a3300231 Mon Sep 17 00:00:00 2001 From: rachitvrma Date: Fri, 13 Mar 2026 20:03:02 +0530 Subject: [PATCH 2/4] fix: take env block out of drv block take the env block out of drv block inside config block --- wrapperModules/g/gh/module.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wrapperModules/g/gh/module.nix b/wrapperModules/g/gh/module.nix index 3678d88..7031cf6 100644 --- a/wrapperModules/g/gh/module.nix +++ b/wrapperModules/g/gh/module.nix @@ -21,6 +21,9 @@ in }; config = { package = lib.mkDefault pkgs.gh; + env = { + GH_CONFIG_DIR = "${placeholder config.outputName}/gh-config"; + }; drv = { configYml = yamlFormat.generate "config.yml" config.settings; passAsFile = [ @@ -32,9 +35,6 @@ in cp "$(cat "$configYmlPath")" "${placeholder config.outputName}/gh-config/config.yml" runHook postBuild ''; - env = { - GH_CONFIG_DIR = "${placeholder config.outputName}/gh-config"; - }; }; meta.maintainers = [ wlib.maintainers.rachitvrma ]; }; From ab4710768685eae176e918dd13c4db2c63bb8d0a Mon Sep 17 00:00:00 2001 From: rachitvrma Date: Fri, 13 Mar 2026 20:08:51 +0530 Subject: [PATCH 3/4] fix: add import for wlib.modules.default Add `import = [ wlib.modules.default ];` --- wrapperModules/g/gh/module.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/wrapperModules/g/gh/module.nix b/wrapperModules/g/gh/module.nix index 7031cf6..8d824fd 100644 --- a/wrapperModules/g/gh/module.nix +++ b/wrapperModules/g/gh/module.nix @@ -10,6 +10,7 @@ let inherit (lib) mkOption; in { + imports = [ wlib.modules.default ]; options = { settings = mkOption { inherit (yamlFormat) type; From 707b7fee0536ac3e73b9b840ad68c60607f97103 Mon Sep 17 00:00:00 2001 From: rachitvrma Date: Sat, 14 Mar 2026 14:34:02 +0530 Subject: [PATCH 4/4] modify: remove passAsFile pass configYml directly to buildPhase --- wrapperModules/g/gh/module.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/wrapperModules/g/gh/module.nix b/wrapperModules/g/gh/module.nix index 8d824fd..4ec2b9f 100644 --- a/wrapperModules/g/gh/module.nix +++ b/wrapperModules/g/gh/module.nix @@ -27,13 +27,10 @@ in }; drv = { configYml = yamlFormat.generate "config.yml" config.settings; - passAsFile = [ - "configYml" - ]; buildPhase = '' runHook preBuild mkdir -p "${placeholder config.outputName}/gh-config" - cp "$(cat "$configYmlPath")" "${placeholder config.outputName}/gh-config/config.yml" + cp "$configYml" "${placeholder config.outputName}/gh-config/config.yml" runHook postBuild ''; };