[Feature Request]: home-manager module
Preflight Checklist
- [x] I use the latest version of YouTube Music (Application).
- [x] I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Problem Description
Hey, has anyone considered a home-manager module
Proposed Solution
create a home-manager module that allows one to configure the plugins and the settings, and also options
Alternatives Considered
none
Additional Information
none
Could you provide relevant documentation?
https://nix-community.github.io/home-manager/index.xhtml#ch-writing-modules
It's possible to configure youtube-music's config.json file using home manager, but since the nix store is read-only, youtube-music can't write to config.json anymore (it uses it to store some values).
Error: EROFS: read-only file system, open '/nix/store/16y98k58vn7qpy9yqq49y6rm7ymcg90a-hm_YouTubeMusicconfig.json.tmp-7148096567a96831'
at openSync (node:fs:573:18)
at func (node:electron/js2c/node_init:2:2559)
at p (/nix/store/70l884lf1qcix8j456ygnxlhyn41y3hk-youtube-music-v3.7.1/share/lib/youtube-music/resources/app.asar/dist/main/index.js:157:24681)
at writeFileSync (/nix/store/70l884lf1qcix8j456ygnxlhyn41y3hk-youtube-music-v3.7.1/share/lib/youtube-music/resources/app.asar/dist/main/index.js:157:29679)
at ElectronStore._write (/nix/store/70l884lf1qcix8j456ygnxlhyn41y3hk-youtube-music-v3.7.1/share/lib/youtube-music/resources/app.asar/dist/main/index.js:165:8300)
at ElectronStore.set store [as store] (/nix/store/70l884lf1qcix8j456ygnxlhyn41y3hk-youtube-music-v3.7.1/share/lib/youtube-music/resources/app.asar/dist/main/index.js:165:6850)
at ElectronStore.set (/nix/store/70l884lf1qcix8j456ygnxlhyn41y3hk-youtube-music-v3.7.1/share/lib/youtube-music/resources/app.asar/dist/main/index.js:165:5562)
at Object.set (/nix/store/70l884lf1qcix8j456ygnxlhyn41y3hk-youtube-music-v3.7.1/share/lib/youtube-music/resources/app.asar/dist/main/index.js:165:24914)
at handleData (/nix/store/70l884lf1qcix8j456ygnxlhyn41y3hk-youtube-music-v3.7.1/share/lib/youtube-music/resources/app.asar/dist/main/index.js:165:26147)
at /nix/store/70l884lf1qcix8j456ygnxlhyn41y3hk-youtube-music-v3.7.1/share/lib/youtube-music/resources/app.asar/dist/main/index.js:165:27818 {
errno: -30,
code: 'EROFS',
syscall: 'open',
path: '/nix/store/16y98k58vn7qpy9yqq49y6rm7ymcg90a-hm_YouTubeMusicconfig.json.tmp-7148096567a96831'
}
So it's somewhat doable, but I think it would be better to not touch config.json. It would be nice to have separate my-config.json files managed by the user, or home manager in this case, and a way to select/import it. Something similar to #1384
Here's a basic hm module https://github.com/h-banii/youtube-music-nix ~~(I didn't implement all plugins though, just a few for testing)~~ edit: I finished implementing all the options, I haven't tested all of them, but they should probably work
@h-banii I think the point of nix is for the system to be declarative so why would youtube-music need to write to the config.json?
edit: can we talk on discord?
@Lalit64 we are writing to the config.json for various reasons, one of them is config migration from an older version to a newer version.
Another reason is, if you have the setting to continue where you left off, it saves the current url to the config, an immutable config would render this useless
It would be better to have a user-config, like an override, using a secondary file managed by nix, just like how @h-banii proposed
@ArjixWasTaken Ok, I understand
Just to give an update on this:
I decided to copy the config.json file instead of symlinking it to the store (to avoid the read-only problem)
So technically the home manager module at https://github.com/h-banii/youtube-music-nix is in a functional state now
I added a documentation for all the options in the repo's github page https://h-banii.github.io/youtube-music-nix/pages/home-manager/