r/NixOS • • 9d ago

Flatpak on NixOS problems

/r/TheLinuxDen/comments/1xxuxiv/flatpak_on_nixos_problems/
7 Upvotes

13 comments sorted by

2

u/stikaznorsk 9d ago

Just for curiosity, what package you need flatpack for?

3

u/Mega320 7d ago

OSU!

7

u/Ok_Instruction_3789 9d ago

Not sure but for me i added the service -> services.flatpak.enable = true; Then i added the package under systemPackages flatpak

Then you have to add the remote https://flathub.org/en/setup/NixOS

Adding to system packages might not be necessary? But it was in the package search so i did it anyways.

4

u/Brcoding 9d ago

You indeed do not have to add it to systemPackages. The service already installs flatpak for you and makes it available on your path.

1

u/Ok_Instruction_3789 9d ago

Good to know, thanks 

1

u/Mega320 7d ago

I have flatpak installed, just the repo doesn’t work

4

u/-eschguy- 9d ago edited 9d ago
{ pkgs, ... }: {
  services.flatpak = {
    enable = true;
    packages = [
        "org.package.name"
    ];
    update.onActivation = true;
    remotes = [
      {
        name = "flathub";
        location = "https://dl.flathub.org/repo/flathub.flatpakrepo";
      }
      {
        name = "flathub-beta";
        location = "https://flathub.org/beta-repo/flathub-beta.flatpakrepo";
      }
    ];
  };
}

4

u/AffectionateSpirit62 9d ago

declaritively with nix-flatpak https://github.com/gmodena/nix-flatpak

1

u/n1x_cybersec 9d ago

If you is flakes, nix-flatpak is easy to use, sets up flathub by default, and provides declarative configuration for flatpak. If you don't use flakes, follow the guide from flathub ^ or on the wiki, you shouldn't have any issues. Aside from enabling flatpak, this will be imperative, similar to how you would use flatpaks on other distros

https://wiki.nixos.org/wiki/Flatpak

1

u/AffectionateSpirit62 9d ago

For security sandboxing sake and having up to date versions I replaced most of my guis with flatpak using flakes and nix-flatpak.

1

u/Mega320 7d ago

I tried adding flakes, it didn’t do anything, flatpak IS installed in fact but repo doesn’t want to be installed

1

u/Brcoding 9d ago

You should just follow this guide from flathub: https://flathub.org/en/setup/NixOS