rbreaves / kinto

Mac-style shortcut keys for Linux & Windows.
http://kinto.sh
GNU General Public License v2.0
4.45k stars 214 forks source link

NixOS formula please #566

Open pshirshov opened 3 years ago

pshirshov commented 3 years ago

NixOS is a very special system and stateful installation approach doesn't work there.

Currently the installer fails immediately:

❯ /bin/bash -c "$(wget -qO- https://raw.githubusercontent.com/rbreaves/kinto/HEAD/install/linux.sh || curl -fsSL https://raw.githubusercontent.com/rbreaves/kinto/HEAD/install/linux.sh)"

zsh: no such file or directory: /bin/bash

In case we change the basic installer it still fails:

  inflating: /home/pavel/Downloads/kinto-master/windows/unused/theme_onehalfdark.reg
  inflating: /home/pavel/Downloads/kinto-master/windows/unused/theme_onehalflight.reg
  inflating: /home/pavel/Downloads/kinto-master/windows/usb.vbs
  inflating: /home/pavel/Downloads/kinto-master/xkeysnail_service.sh
Installing Kinto...
/nix/store/dpjnjrqbgbm8a5wvi1hya01vd8wyvsq4-bash-4.4-p23/bin/sh: ./linux/system-config/dename.sh: /bin/bash: bad interpreter: No such file or directory
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git

Kinto  build
Type in Linux like it's a Mac.

Traceback (most recent call last):
  File "/home/pavel/Downloads/kinto-master/./setup.py", line 137, in <module>
    subprocess.check_call(shlex.split("./xkeysnail_service.sh"))
  File "/nix/store/1g54cwl6m78rgrqsnn1pp29dbvldpvsd-python3-3.9.6/lib/python3.9/subprocess.py", line 368, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/nix/store/1g54cwl6m78rgrqsnn1pp29dbvldpvsd-python3-3.9.6/lib/python3.9/subprocess.py", line 349, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/nix/store/1g54cwl6m78rgrqsnn1pp29dbvldpvsd-python3-3.9.6/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/1g54cwl6m78rgrqsnn1pp29dbvldpvsd-python3-3.9.6/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: './xkeysnail_service.sh'

Also the whole approach with mutating installer which requires sudo doesn't work on Nix, probably it would be necessary to use systemd's user services (systemd --user ...)

Could you implement a Nix formula please?

pshirshov commented 3 years ago

https://github.com/NixOS/nixpkgs/issues/137698

rbreaves commented 3 years ago

I do need to slow down and work on this.. and packaging in general for multiple packaging managers. To be honest though, apt, and pacman will likely get done first.

pshirshov commented 3 years ago

Well, working deb package can be reused in Nix relatively easy.

Atemu commented 2 years ago

If you can provide instructions for offline installation to a prefixed path, that's good enough for Nix support and we can take it from there. We can't expect you to figure out how to write a Nix derivation, that's too much effort for something you're probably not using yourself.

A few more details on the requirements:

These are generally desirable properties of a project's installer for any packaging effort.

Once Kinto has a sane installation method, adding a Nixpkgs package and NixOS module should be relatively trivial and will likely require no further input from your end (lots of mac users in the Nix community ;) ).

rbreaves commented 2 years ago

@Atemu Thanks for the input, and typically on bash scripts I reference it this way #!/usr/bin/env bash although I am noticing I missed the shell script in the root so I do need to update that one.

By default the app installs at ~/.config/kinto for now - and while I plan to keep that I also need to provide better multi-user support and should be installing it or allowing users to install it in a system path for all users as well and to keep defaults in a more global system path type location imo.

To re-iterate the few requirements in the readme

Beyond that there are other small dependencies that get referenced in this file here to ensure that many distros are covered. (sometimes thing still break because distros will change their packages names - it has happened to me) https://github.com/rbreaves/kinto/blob/master/xkeysnail_service.sh

There's also a file called limitedadmins that gets added to the sudoers.d directory to ensure that kinto/xkeysnail gets ran at a high enough permissions level, changes to Fedora as well related to selinux.

Not sure what all that would be involved to create a completely offline install for NixOS or any particular OS. I know that I desperately need to slow down though and get this into a PPA for Debian/Ubuntu based distros. Following that Arch's AUR is on the radar.

I don't think that much about NixOS that is true, and only because it just isn't an OS I have spent any time with. I feel I do need to spin it up in a VM though and really poke around. I was doing something similar not that long ago with ClearLinux as well and did get it working for ClearLinux, and made several notes, but have yet to merge those potential changes into a branch just yet. I am very impressed with the optimizations in ClearLinux, its packaging I find to be a bit unusual compared to most distros I am used to as many things end up getting bundled together, not sure of NixOS is similar or not.

rbreaves commented 2 years ago

NixOS is a lot different than what I expected it to be and there's no nice GUI installer for it either, that is saddening.

https://news.ycombinator.com/item?id=16773875

Also I really don't care to get into installing an OS purely by CLI without any sort of scripted setup.. so I found this. https://github.com/samuela/nixos-up

Atemu commented 2 years ago

allowing users to install it in a system path for all users as well and to keep defaults in a more global system path type location imo.

Sounds good!

Beyond that there are other small dependencies that get referenced in this file here to ensure that many distros are covered. (sometimes thing still break because distros will change their packages names - it has happened to me) https://github.com/rbreaves/kinto/blob/master/xkeysnail_service.sh

There's also a file called limitedadmins that gets added to the sudoers.d directory to ensure that kinto/xkeysnail gets ran at a high enough permissions level, changes to Fedora as well related to selinux.

All of this needs to be precisely documented because configuring these things imperatively is not going to fly for NixOS at all and when packaging for regular distros, that'd be a hard sell too.
Let the distros and/or users take care of setting up services with the correct permissions etc. An install script that does anything more than putting files into some directory is a no-go when it comes to distro packaging.

I know that I desperately need to slow down though and get this into a PPA for Debian/Ubuntu based distros. Following that Arch's AUR is on the radar.

Do those first. Once those are possible, Nixpkgs packaging should be relatively trivial and can(/should) be handled on our end.

NixOS is a lot different than what I expected it to be and there's no nice GUI installer for it either, that is saddening.

NixOS is very different and a GUI installer isn't really that useful until there is a usable GUI to configure NixOS options which is where the real meat of NixOS is: Declarative configuration.
This is not your typical distro that is only really set apart in the way it unpacks tarballs to the root filesystem.

We can't expect you to figure out how to use NixOS, much less package for it, and nixos-up isn't going to help there much I don't think.
You're going to have big issues on a conceptual level if you approach NixOS by trying to use it like a regular distro.

Once Kinto can be installed to regular FHS distros in a sane manner (current mechanism is not sane), we can take it from there.

dvonessen commented 12 months ago

Hi, @rbreaves is there any progress? I would like to see this package in nix to change my keyboard layout. Regards

RedBearAK commented 12 months ago

@pshirshov @Atemu @dvonessen

I have a project that is closely related to Kinto, but is substantially different in how it installs and runs (such as using "user" services and no messing with sudoers). If any of you are interested in discussing how to make it possible to install it on NixOS, I opened an issue here:

https://github.com/RedBearAK/toshy/issues/104