[0] Flatpak can do it if you setup an entirely new installation on that disk, but flatpak has its own issues. Snaps can't do it at all, and while AppImage is really great relatively few projects distribute that way.
if you have a separate OS on the external drive, you could chroot in and install it. If you just want that one application to be on the other disk, you could mount it to wherever on the filesystem the program would be installed. However you probably don't wanna do that on an application by application basis. you could mount /usr/bin/ on the external drive for example. or use LVM to share disk space between the disks
Flatpak, Snap, Appimage and other portable format aren't really preferable. they lead to a software ecosystem that amounts to just downloading and running executable binaries off the internet, each with their own overhead.
Kinda illustrates my point about this being a foreign concept to Linux Desktop people. It's pretty simple: I want to put an application on an external disk and run it from there.
> if you have a separate OS on the external drive, you could chroot in and install it.
No thanks. I'd just like to have the application stored on an external disk, and execute it on the OS I have installed.
> If you just want that one application to be on the other disk, you could mount it to wherever on the filesystem the program would be installed.
Not really, because Linux likes to have an application spread its files all over the hierarchy, so in reality I need to either use some form of union-mounting, and/or simlinks. Of course that is only sufficient if there are no library conflicts between what the application wants and what the system uses, in that case I need to use LD_LIBRARY_PATH and other tricks. In some cases I'll need to use a launch script that calls a different ld.so.
That's a lot of hoops compared to how sane operating systems do it.
> LVM to share disk space between the disks
System breaks when disk is removed. No good.
> Flatpak, Snap, Appimage and other portable format aren't really preferable. they lead to a software ecosystem that amounts to just downloading and running executable binaries off the internet, each with their own overhead.
Which is pretty much what I want, because the alternative is dealing with the bullshit I mentioned above whenever you step outside the package manager's sandbox.
This is what AppImage gets that the rest of Linux doesn't seem to: if an application is a single file/folder, you don't need anything more complicated than a file manager to manage it.
P.S.: after a quick glance at some documentation, I don't see any mechanism that would allow me to install nix packages to arbitrary locations anyway.
Nevertheless it can be done - if you are dedicated, recompile the program with the prefix changed to the mounted root of your separate drive. Presto, automated installs to your external drive. Now, linking up all the bits can still be a right headache, but this is just a bigger nightmare on Windows (what will you DO if your drive letter changes?? You mean I don't have any system to automatically link up random programs on random drives which may or may not be present. Gosh darn, that package manager sounds like a good idea now...)
If you're using a laptop, you're probably due for an upgrade in HDD capacity, or if you're lucky enough to be on Desktop I'd recommend a board with hotplug capability and using LVM. I think no matter your platform you're going to have a hell of a lot of problems doing things your way. If you can patch the package manager to be able to do this, amazing! I don't think any system exists like this, period.
I had similar problem. I joined two physical disks into one logical using LVM and forgot about problem. :-/
Well that's still better, in my opinion, than package managers and all their various restrictions. But ideally I want something like AppImage, where an application is a singular entity that can just be moved at will and run from wherever [0]. Most DOS programs and many Windows programs (if you extract them from the installer) will still work like that.
> I had similar problem. I joined two physical disks into one logical using LVM and forgot about problem. :-/
If you unplug the external disk, your system stops working. This is not what I want, as I mentioned already in the post you're replying to.
[0] classic MacOS, RiscOS, and NeXT all had programs that worked like this too. Linux has yet to achieve the flexibility in application management afforded by the OSs of the 1980s.
LVM can make two disks appear like they're one, but of course if you remove any of them they both fail. Doesn't really solve the underlying "I want to install apps outside of the root partition" problem though.
Generally speaking they have the same problems as the mainstream distros, but with the additional caveat of even less chance of googling solutions and worse or no support at all from non-oss software.
> LVM can make two disks appear like they're one, but of course if you remove any of them they both fail. Doesn't really solve the underlying "I want to install apps outside of the root partition" problem though.
Precisely. The very concept is just so foreign to most of the Linux community that even talking about it gets you strange looks. It is actually possible to do with some significant AUFS-fu, but its a hell of a hoop to jump through for functionality that is pretty natural in every other desktop OS that ever existed.
[0] https://en.wikipedia.org/wiki/GoboLinux
----
What you describe is like installing in $HOME. It's not unusual - python virtualenv, ruby rbenv, node_modules. This comes with trade off - either system knows where to search or one has to define per project. By FHS entire Linux tree is a project. In Windows... configuration is pain.
Flatpak someday.
└── gems
├── irb-1.2.3
│ ├── exe
│ │ └── irb
│ └── lib
│ ├── irb
│ └── irb.rb
└── rack-2.2.2
├── bin
│ └── rackup
└── lib
├── rack
└── rack.rb
vs ├── bin
│ ├── irb
│ └── rackup
└── ruby
├── irb
├── irb.rb
├── rack
└── rack.rb
FHS approach does not support multiple versions, gems approach requires declaring version in code or Gemfile, playing with PATH, considerable slowdown https://github.com/Shopify/bootsnapI still write code in a Linux environment because that's where the ecosystem is, but for my daily driver I've given up on desktop Linux. And I've found that WSL gets me a Linux based development environment side by side with Windows with less pain than dual booting. I've found that when it comes to using Linux smoothly, it's a lot easier to shoehorn myself into the happy paths than to bend my setup into my way of doing things.