Help setting up screen sharing: File exists

this was my fomer nixos config before i was told i did it wrongly

...
  services = {
    pipewire = {
      enable = true;
      alsa.enable = true;
      alsa.support32Bit = true;
      pulse.enable = true;
      wireplumber.enable = true;
    };
  };
...

  home-manager.users.sacs = {pkgs, ...}: {
    home.username = "sacs";
    home.homeDirectory = "/home/sacs";
    fonts.fontconfig.enable = true;
    home.packages = with pkgs; [
      ...
      xdg-desktop-portal-hyprland
  ];
....

but now i corrected it to this

...
  services = {
    pipewire = {
      enable = true;
      alsa.enable = true;
      alsa.support32Bit = true;
      pulse.enable = true;
      wireplumber.enable = true;
    };
  };
...
  xdg = {
    portal = {
      enable = true;
      extraPortals = with pkgs; [
       xdg-desktop-portal-hyprland
      ];
    };
 };

when i run
sudo nixos-rebuild switch

i get this error

these 4 derivations will be built:
  /nix/store/0kw6sk6x7mrhq4p0pac6l80vijmxbff1-user-units.drv
  /nix/store/apwvimnnphh38d2xp47s05bm2i2gsk0v-system-units.drv
  /nix/store/561lg1xs9klpz6h0qrpp860h54b5qrgb-etc.drv
  /nix/store/2lql1yw4r9fwpmlflvd3f0kff8wwhzaz-nixos-system-nixos-23.11pre509514.9e1960bc196b.drv
building '/nix/store/apwvimnnphh38d2xp47s05bm2i2gsk0v-system-units.drv'...
building '/nix/store/0kw6sk6x7mrhq4p0pac6l80vijmxbff1-user-units.drv'...
ln: failed to create symbolic link '/nix/store/2qywk18bv432ca2znk21964hbm1xkl41-user-units/xdg-desktop-portal-hyprland.service': File exists
error: builder for '/nix/store/0kw6sk6x7mrhq4p0pac6l80vijmxbff1-user-units.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/561lg1xs9klpz6h0qrpp860h54b5qrgb-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/2lql1yw4r9fwpmlflvd3f0kff8wwhzaz-nixos-system-nixos-23.11pre509514.9e1960bc196b.drv' failed to build

Do you use the hyprland module? I think that adds the portal for you, but I’m not sure if that’s causing your issue.

Well, I have the portal running and screen sharing still doesn’t work, so oh well…

whats hyprland module?
how can i check?
but i dont think i have that

modules are kinda to complex and too advance for me just like flakes
so i do everything in one file

Most of what was available in the hyprland module is now available in Nixpkgs, so it shouldn’t be necessary.

all i want to achive is to be able to share my screen in google meet

“Modules” in theory only means files like your configuration.nix - the term is sometimes used to mean such files in the nixpkgs repository, and sometimes files from outside the nixpkgs repository. In this case, it’s unclear which @Adrielus meant :wink:

Looking at the source code of the hyprland module in nixpkgs, it appears @Adrielus may have meant that one, since it already adds the portal: https://github.com/NixOS/nixpkgs/blob/b30c68669df77d981ce4aefd6b9d378563f6fc4e/nixos/modules/programs/hyprland.nix#L77

So, what they are saying is you can completely remove this part of your configuration, it’s duplicated:

Assuming that somewhere else you have:

programs.hyprland.enable = true;

I don’t know if this will fix the actual problem; symlinking into the nix store is odd, even more so that it tries to do so on a file that already exists. It’s also hard to tell without seeing your whole configuration. Make sure you’re not trying to install hyprland with both your home-manager and NixOS configuration at the same time.

1 Like

I assumed they were referring to the NixOS module that is available in the Hyprland repo, as up until recently that was the best way to enable it in NixOS.

On my system I have hyprland enabled with NixOS and Home-Manager so that it is available on my login screen and can also be configured through home-manager’s hyprland options.

@sacsbrainz Please post your entire configuration, as we can use it to analyze the error more thoroughly without having to go back and forth.

2 Likes

i have not removed the

xdg = {
    portal = {
      enable = true;
      extraPortals = with pkgs; [
       xdg-desktop-portal-hyprland
      ];
    };
 };

from my config file
and ran
sudo nixos-rebuild switch --upgrade

so i am expecting this brings in the new update where the portal stuffs default

then i ran

[sacs@nixos:~]$ systemctl --user status xdg-desktop-portal-hyprland
â—‹ xdg-desktop-portal-hyprland.service - Portal service (Hyprland implementation)
     Loaded: loaded (/etc/systemd/user/xdg-desktop-portal-hyprland.service; static)
     Active: inactive (dead)