Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NixOS module #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add NixOS module #12

wants to merge 1 commit into from

Conversation

tomodachi94
Copy link
Contributor

@tomodachi94 tomodachi94 commented Aug 6, 2023

Description

Adds NixOS support.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Syntax is valid; checked with nix flake show.

Test Configuration:

Please delete options that are not relevant.

  • Python: Python 3.10
  • Nixpkgs channel: nixpkgs-unstable and release-23.05 both work, but nixpkgs-unstable is more up-to-date, so we use that.

Checklist

  • My code follows the style guidelines of this project (all lints have passed)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation: See Add NixOS docs cc-youcube.github.io#3
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Commandcracker
Copy link
Member

Commandcracker commented Aug 26, 2023

Took me a while but there seams to be a small issue

[red@nixos:~/youcube-server]$ nix run
error: unable to execute '/nix/store/ykwxgqxqpnzrjkfz4x64fa7hihccz0vk-youcube-20230806/bin/youcube': No such file or directory

Screenshot_20230826_184002

@Commandcracker
Copy link
Member

I changed makeWrapper ${pkgs.python3}/bin/python3 $out/bin/youcube-server \ to makeWrapper ${pkgs.python3}/bin/python3 $out/bin/youcube \ as a quick workaround but now i encountered another issue. The server needs to be able to write the media files to some place. If it is needed to change the path, I could make an env var out of it.

Exception in thread Thread-1 (run_with_thread_save_asyncio_event_with_return_value):
Traceback (most recent call last):
  File "/nix/store/jhflvwr40xbb0xr6jx4311icp9cym1fp-python3-3.10.12/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/nix/store/jhflvwr40xbb0xr6jx4311icp9cym1fp-python3-3.10.12/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/nix/store/wd42gdpjrb5s5iwyn5axxc628aasfwkj-youcube-20230806/lib/python3.10/site-packages/youcube/yc_magic.py", line 44, in run_with_thread_save_asyncio_event_with_return_value
    result = func(*args)
  File "/nix/store/wd42gdpjrb5s5iwyn5axxc628aasfwkj-youcube-20230806/lib/python3.10/site-packages/youcube/yc_download.py", line 240, in download
    create_data_folder_if_not_present()
  File "/nix/store/wd42gdpjrb5s5iwyn5axxc628aasfwkj-youcube-20230806/lib/python3.10/site-packages/youcube/yc_utils.py", line 87, in create_data_folder_if_not_present
    mkdir(DATA_FOLDER)
OSError: [Errno 30] Read-only file system: '/nix/store/wd42gdpjrb5s5iwyn5axxc628aasfwkj-youcube-20230806/lib/python3.10/site-packages/youcube/data'

@tomodachi94
Copy link
Contributor Author

tomodachi94 commented Aug 26, 2023

I changed makeWrapper ${pkgs.python3}/bin/python3 $out/bin/youcube-server \ to makeWrapper ${pkgs.python3}/bin/python3 $out/bin/youcube \ as a quick workaround but now i encountered another issue.

This could be fixed by changing the package's pname or setting the meta.mainProgram variable.

The server needs to be able to write the media files to some place. If it is needed to change the path, I could make an env var out of it.

Normally, data should get written out to /var on POSIX-compliant systems. I think an environment variable would be good, but we may want to consider changing the default as well.

@Commandcracker
Copy link
Member

Normally, data should get written out to /var on POSIX-compliant systems. I think an environment variable would be good, but we may want to consider changing the default as well.

I will make an env var out of it. I was thinking about making the default a temp folder as the data folder is currently only used as a media cache and Using something like /var/lib/youcube would need a windows counter part.

I changed makeWrapper ${pkgs.python3}/bin/python3 $out/bin/youcube-server \ to makeWrapper ${pkgs.python3}/bin/python3 $out/bin/youcube \ as a quick workaround but now i encountered another issue.

Could you fix it ? as you have more experience with nix :)

@tomodachi94
Copy link
Contributor Author

I was thinking about making the default a temp folder as the data folder is currently only used as a media cache and Using something like /var/lib/youcube would need a windows counter part.

Good idea, I didn't know it was all temporary data :)

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