← Back to context

Comment by kombine

4 days ago

Could you setup distrobox to run regular Linux programs?

Yeah, that's exactly what I did for a while, but really once you get the hang of nix it's kind of unnecessary. I keep this bit of nix to hand for anything that I need to run

   #!/usr/bin/env nix-shell

   { pkgs ? import <nixpkgs> { } }:

  (
    let base = pkgs.appimageTools.defaultFhsEnvArgs; in
    pkgs.buildFHSUserEnv (base // {
      name = "FHS";
      targetPkgs = pkgs: (with pkgs; [
        /* add additional packages here e.g */
        pcre
        tzdata
      ]);
      runScript = "bash";
      extraOutputsToInstall = [ "dev" ];
    })
  ).env

Running `nix-shell` will drop you into a bash shell that looks just like a normal linux distribution with a lot of common libraries (thanks to `pkgs.appimageTools.defaultFhsEnvArgs`) and after trying to run your application you can shove whatever you need in the extra packages when it complains about a dependency being missing.

Obviously it's a bit more work than other distros, but once nix gets it's claws into you, you'll find it hard to go back to old ways.

Almost certainly, though I've never tried.

I'm technical enough to where making a Flake doesn't really bother me, and it's really not as hard as I was making it out if you're already familiar with functional programming, I'm just saying it's an annoyance.

That said, I might need to play with Distrobox, it looks like it's in nixpkgs.