Skip to content

feat(wrapperModules.gh): init#336

Open
rachitvrma wants to merge 4 commits intoBirdeeHub:mainfrom
rachitvrma:gh-wrapper-module
Open

feat(wrapperModules.gh): init#336
rachitvrma wants to merge 4 commits intoBirdeeHub:mainfrom
rachitvrma:gh-wrapper-module

Conversation

@rachitvrma
Copy link
Contributor

Wrap github-cli gh using nix-wrapper-modules.

rachitvrma added 3 commits March 13, 2026 19:52
Wrap github-cli `gh` using nix-wrapper-module
take the env block out of drv block inside config block
Add `import = [ wlib.modules.default ];`
@rachitvrma rachitvrma changed the title feat(wrapperModules.gh): Wrapper for github-cli feat(wrapperModules.gh): init Mar 13, 2026
buildPhase = ''
runHook preBuild
mkdir -p "${placeholder config.outputName}/gh-config"
cp "$(cat "$configYmlPath")" "${placeholder config.outputName}/gh-config/config.yml"
Copy link
Owner

@BirdeeHub BirdeeHub Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are already doing some complicated thing here to build the directory, we can make this do placeholders without much extra effort, if you want?

If you set config.drv.nativeBuildInputs = [ pkgs.remarshal_0_17 ];

You can then configContent = builtins.toJSON config.settings;

and json2yaml $configContentPath "${placeholder config.outputName}/gh-config/config.yml" instead of this copy command.

Which is how they do it in nixpkgs

https://github.com/NixOS/nixpkgs/blob/87e875c8ea73c14dd96a883e37c691ab01c9da9e/pkgs/pkgs-lib/formats.nix#L165-L172


Alternatively, if you don't want all that, we should be able to simplify this line to

cp "$configYml" "${placeholder config.outputName}/gh-config/config.yml"

and then remove the passAsFile, which is not necessary in this case. configYml in this case as it is currently written contains a path. A single path is very very unlikely to ever exceed the max length for a variable. So if we are going to continue using .generate, you don't need passAsFile there either.

pass configYml directly to buildPhase
@BirdeeHub
Copy link
Owner

So, I found a problem with this approach.

It tries to write to its config directory, which is now in the store.

Any chance we can do this with gh config set instead?

@rachitvrma
Copy link
Contributor Author

Uh, yeah, I wanted to tell you about this problem. A similar one arises where the file hosts.yml has to be written as well, and then it encounters a read-only filesystem. I wonder how home-manager handles it...

Also there's this issue on home-manager. Seems that config.yml is not much of a problem, it's hosts.yml?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants