lilyinstarlight / nixos-cosmic

Flake for using COSMIC on NixOS
MIT License
433 stars 27 forks source link

Cannot Enable it with some DEs #17

Closed RAVENz46 closed 4 months ago

RAVENz46 commented 8 months ago

Fail to rebuild system with this error. Currently I use gnome.

ln: failed to create symbolic link '/nix/store/vjxzcqsv9ddsbk98pr0sx494fax1a1by-user-units/xdg-desktop-portal-gtk.service': File exists

edit: I realized that unset nix.settings.auto-optimise-store = true; can avoid it temporary.

lilyinstarlight commented 8 months ago

edit: I realized that unset nix.settings.auto-optimise-store = true; can avoid it temporary.

That... sounds highly suspicious 🤔

Can you share more details of your config? I'll try to repro when i get time

RAVENz46 commented 8 months ago

Here is part of my config. I hope reproduce issue only with these. Please let me know if you need entire my config, I will upload it (I haven't uploaded it to github yet because I still need to brush up).

And I also realized that I cannot finish build even unset nix.settings.auto-optimise-store = true;. I'll have to try it after remove gnome and see what happen.

flake.nix ```nix { nixConfig = { extra-substituters = [ "https://cosmic.cachix.org" ]; extra-trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ]; }; inputs = { nixos-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.follows = "nixos-unstable"; }; outputs = { self, nixpkgs, ... } @ inputs: let inherit (self) outputs; systems = [ "aarch64-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ]; pkgsFor = system: import nixpkgs { inherit system; }; forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f (pkgsFor system)); in { nixosConfigurations = { nixos = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs outputs; }; modules = [ ./configuration.nix ]; }; }; }; } ```
configration.nix ```nix { config, pkgs, lib, inputs, outputs, ... }: { imports = [ ./cosmic.nix ./gnome.nix ]; nixpkgs = { config = { allowUnfree = true; allowUnfreePredicate = _: true; }; }; nix = { package = pkgs.nixFlakes; settings = { experimental-features = [ "nix-command" "flakes" "repl-flake" ]; #auto-optimise-store = true; }; registry = lib.mapAttrs (_: value: { flake = value; }) inputs; #nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; nixPath = [ "nixpkgs=${inputs.nixpkgs.outPath}" ]; }; services.flatpak.enable = true; } ```
cosmic.nix ```nix { config, pkgs, inputs, outputs, ... }: { imports = [ inputs.nixos-cosmic.nixosModules.default ]; services.xserver.desktopManager.cosmic.enable = true; environment.cosmic.excludePackages = with pkgs; [ cosmic-edit cosmic-files cosmic-term ]; } ```
gnome.nix ```nix { config, pkgs, ... }: { # Enable the X11 windowing system. services.xserver = { displayManager.gdm.enable = true; desktopManager.gnome.enable = true; excludePackages = with pkgs; [ xterm ]; }; # Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229 systemd.services."getty@tty1".enable = false; systemd.services."autovt@tty1".enable = false; environment.systemPackages = with pkgs; [ gnome.nautilus-python gnome.dconf-editor gnome.gnome-tweaks nautilus-open-any-terminal #gnomeExtensions.advanced-alttab-window-switcher #gnomeExtensions.alttab-mod gnomeExtensions.app-hider #gnomeExtensions.app-icons-taskbar gnomeExtensions.appindicator #gnomeExtensions.arcmenu gnomeExtensions.blur-my-shell #gnomeExtensions.containers gnomeExtensions.custom-hot-corners-extended #gnomeExtensions.dash-to-panel gnomeExtensions.forge #gnomeExtensions.gesture-improvements #gnomeExtensions.gsconnect #gnomeExtensions.improved-osk gnomeExtensions.just-perfection gnomeExtensions.quick-settings-tweaker #gnomeExtensions.sermon gnomeExtensions.top-bar-organizer gnomeExtensions.unite gnomeExtensions.workspaces-indicator-by-open-apps ]; environment.gnome.excludePackages = with pkgs.gnome; [ baobab cheese eog epiphany evince file-roller geary gnome-calculator gnome-calendar #gnome-characters gnome-clocks gnome-contacts gnome-disk-utility gnome-font-viewer gnome-logs gnome-maps gnome-music pkgs.gnome-connections pkgs.gnome-console pkgs.gnome-photos pkgs.gnome-text-editor pkgs.gnome-tour gnome-system-monitor gnome-weather #nautilus seahorse simple-scan totem yelp ]; } ```
RAVENz46 commented 8 months ago

After removing gnome, everything works fine, so issue is caused by gnome. And in gnome module, it does

        (pkgs.xdg-desktop-portal-gtk.override {
          # Do not build portals that we already have.
          buildPortalsInGnome = false;
        })
BobbyByrne commented 8 months ago

Any suggestions on how to get around this? I'm hoping to have both gnome and cosmic available at the login screen, so that I can jump between testing and a stable DE.

lilyinstarlight commented 8 months ago

Any suggestions on how to get around this? I'm hoping to have both gnome and cosmic available at the login screen, so that I can jump between testing and a stable DE.

I'm planning to implement a work-around tonight hopefully. It's really annoying that GNOME does this though as it'll impact any DEs that use the GTK portal (i.e. it's not a this-repo-specific or even a COSMIC-specific problem)

BobbyByrne commented 8 months ago

Yeah I was wondering if the snippet @RAVENz46 pointed out, would impact other DEs. Thanks and no rush. Still learning the nix language, so probably not much of a help for PRs. Can help with testing though.

cafetestrest commented 8 months ago

I get the following error:

error: builder for '/nix/store/0m1biyldhinwcdh3wklpss96xpv2mz0c-iced_core-0.12.0.drv' failed with exit code 1;
       last 10 log lines:
       > Traceback (most recent call last):
       >   File "/nix/store/r4rksmam6h4bc72nf3dpwgq79yixcykc-replace-workspace-values", line 108, in <module>
       >     main()
       >   File "/nix/store/r4rksmam6h4bc72nf3dpwgq79yixcykc-replace-workspace-values", line 88, in main
       >     changed |= replace_key(
       >                ^^^^^^^^^^^^
       >   File "/nix/store/r4rksmam6h4bc72nf3dpwgq79yixcykc-replace-workspace-values", line 32, in replace_key
       >     workspace_copy = workspace_manifest[section][key]
       >                      ~~~~~~~~~~~~~~~~~~^^^^^^^^^
       > KeyError: 'package'
       For full logs, run 'nix log /nix/store/0m1biyldhinwcdh3wklpss96xpv2mz0c-iced_core-0.12.0.drv'.
error: 1 dependencies of derivation '/nix/store/illlax0r0pjg6kr1fgj7j86xy6aq75wh-cargo-vendor-dir.drv' failed to build
error: 1 dependencies of derivation '/nix/store/xishanf9rpf0h8lm9mbkcn0pgk92smcm-cargo-vendor-dir.drv' failed to build
error: 1 dependencies of derivation '/nix/store/z3y2aacf1n7ljpkr8j9q87wfpycr8ggs-cargo-vendor-dir.drv' failed to build
error: 1 dependencies of derivation '/nix/store/bx8harjb5jb5d0dakvdkfwxaxsazlbrn-cosmic-applets-0-unstable-2024-03-12.drv' failed to build
error: 1 dependencies of derivation '/nix/store/pwjyddc0v8nhl1wivbx7byr64pjr7pa4-cosmic-bg-0-unstable-2024-03-12.drv' failed to build
error: 1 dependencies of derivation '/nix/store/97c7cz5avkb59c5rmhni9w844irz43rv-cosmic-settings-0-unstable-2024-03-12.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ky6jw5ppkbzm2fw6a804qk60kl8yvba7-cosmic-applets-0-unstable-2024-03-12_fish-completions.drv' failed to build
error: 1 dependencies of derivation '/nix/store/55sr1gbcyaj19ci65cx3xkx9jhz120ir-man-paths.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ajdp408qmfmhj3xp1gghqsa9sf6xdhhm-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/nj9s5wxa302bryhbajz61f080899q85s-wrap-cosmic-apps-hook.drv' failed to build
error: 1 dependencies of derivation '/nix/store/v0ds3m08vldnkadsvm0ncwqg4yiv9a3x-nixos-system-nixos-23.11.20240305.880992d.drv' failed to build

But my flake.nix inputs does look like so:

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";

    nixos-cosmic = {
      url = "github:lilyinstarlight/nixos-cosmic";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };
  };
lilyinstarlight commented 8 months ago

@cafetestrest You need to use nixos-unstable for your system for COSMIC for now, not just nixos-23.11 (setting the flake input follows is insufficient and won't change what the NixOS module uses)

Feel free to open a new issue if you continue to have issues with nixos-unstable as well!

RAVENz46 commented 8 months ago

I checked other DEs modules.

xdg-desktop-portal-gtk with override

xdg-desktop-portal-gtk without override

So this issue may happen with the former.

noverby commented 7 months ago

@lilyinstarlight did you find a workaround?

lxwntr commented 5 months ago

I ran into the same issue with Cosmic and Gnome enabled. Changing https://github.com/lilyinstarlight/nixos-cosmic/blob/f7b84cb8a0c081a36c2692cbdcb6aee122f27e77/nixos/cosmic/module.nix#L65-L68 to

extraPortals = with pkgs; [ 
   xdg-desktop-portal-cosmic 
 ] ++ lib.optional (!config.services.xserver.desktopManager.gnome.enable) pkgs.xdg-desktop-portal-gtk;

fixes it for Gnome.

Seems like build fails whenever one DE uses xdg-desktop-portal-gtk as-is and one with override buildPortalsInGnome = false;.

Thatoo commented 5 months ago

@lxwntr could you make a PR to help @lilyinstarlight and help all nixos users to be able to benefit from your work?

lxwntr commented 5 months ago

My change currently only works for Gnome but I could expand it to other DEs on @RAVENz46 s list and create a PR. It would be a workaround for a problem better solved in nixpkgs, but I assume the Cosmic portals will at one point replace all functionality of the GTK portals, so it would be temporary.

Side note: I just tried to build a few combinations of DEs from the above list and they failed with a environment.sessionVariables.NIX_GSETTINGS_OVERRIDES_DIR option conflict before getting a chance to fail with the portal conflict. Trying out a different (GTK-based) DEs in NixOS currently seems to require switching between different generations.

lilyinstarlight commented 5 months ago

Trying out a different (GTK-based) DEs in NixOS currently seems to require switching between different generations.

You can use specialisations instead as well to keep multiple in the same generation

jmatsushita commented 4 months ago

Trying out a different (GTK-based) DEs in NixOS currently seems to require switching between different generations.

You can use specialisations instead as well to keep multiple in the same generation

@lxwntr 's PR has the advantage of allowing to switch from the display manager instead of having to reboot :) (at least it seems to work for me with gdm)

lilyinstarlight commented 4 months ago

You can use specialisations instead as well to keep multiple in the same generation

@lxwntr 's PR has the advantage of allowing to switch from the display manager instead of having to reboot :) (at least it seems to work for me with gdm)

I mean you can hack that up yourself with specialisations (they've never required reboot), but it is unfortunately manual

157 will be merged and let you have a slightly broken setup to allow what you're wanting as soon as CI finishes