Improve COSMIC support on NixOS#369113
Conversation
- Switch from `makeBinaryWrapper` to `libcosmicAppHook` - Bump version of all cosmic packages to 'epoch-1.0.0-alpha.4' - Add 'thefossguy' to the maintainer for every updated package - Initialize `cosmic-idle`, `cosmic-player` and `cosmic-reader`
|
I'm pretty sure that the COSMIC upstreaming effort is being coordinated by the COSMIC team. This is a massive PR and it'll be really hard to review this, especially since it seems to be a spur of the moment thing. |
|
Not exactly a spur of the moment thing. I have been working this since the 4th alpha dropped. I couldn't work before because I didn't have a spare machine to test my changes on. There have been some refactors too. On your second point, yes this is a big PR. I understand that this is quite some work but I would really appreciate some time for a good review in hopes of merging it into nixpkgs. |
|
By spur of the moment I meant that you worked on this without the COSMIC people. (Notably, Lily, since this is based on her work primarily.) I'm sure that the COSMIC team had a very good reason to not upstream the flake yet. |
|
Neither the files nor the commits contain any attribution to the original authors of this code, which is a copyright issue; you’ll at least need I would strongly suggest this kind of work proceed incrementally rather than in one huge PR; there’s little chance it will be reviewed and merged in its current state. |
|
That I admit, this was very much done without Lily. The reason why this isn't merged in nixpkgs by Lily is because she is no longer interacting with nixpkgs after the nix drama. She is maintaining her out-of-tree flake for that reason. |
|
@emilazy Noted. I'll talk to Lily about getting her approval on a Marking current PR as a draft for now. |
SigmaSquadron
left a comment
There was a problem hiding this comment.
This diff is really hard to read. (Did you reorder attributes for some reason?)
You should really split this in separate PRs to facilitate merging. (Broken stuff won't block working stuff)
| - [COSMIC DE](https://system76.com/cosmic/), the COSMIC desktop environment by Pop!_OS. | ||
|
|
There was a problem hiding this comment.
Feel free to bump this to highlights. A new desktop environment is very notable.
|
|
||
| options = { | ||
| services.desktopManager.cosmic = { | ||
| enable = lib.mkEnableOption "COSMIC desktop environment"; |
There was a problem hiding this comment.
| enable = lib.mkEnableOption "COSMIC desktop environment"; | |
| enable = lib.mkEnableOption "the COSMIC desktop environment"; |
mkEnableOption doesn't add the article.
| services.desktopManager.cosmic = { | ||
| enable = lib.mkEnableOption "COSMIC desktop environment"; | ||
|
|
||
| unstable.protocols.enable = lib.mkEnableOption "Enable the [currently unstable] cosmic-protocols" // { |
There was a problem hiding this comment.
| unstable.protocols.enable = lib.mkEnableOption "Enable the [currently unstable] cosmic-protocols" // { | |
| unstable.protocols.enable = lib.mkEnableOption "Enable the currently unstable `cosmic-protocols`" // { |
| enable = lib.mkEnableOption "COSMIC desktop environment"; | ||
|
|
||
| unstable.protocols.enable = lib.mkEnableOption "Enable the [currently unstable] cosmic-protocols" // { | ||
| default = false; |
There was a problem hiding this comment.
| default = false; |
mkEnableOption options are false by default.
| default = false; | ||
| }; | ||
|
|
||
| xwayland.enable = lib.mkEnableOption "Xwayland support for cosmic-comp" // { |
There was a problem hiding this comment.
| xwayland.enable = lib.mkEnableOption "Xwayland support for cosmic-comp" // { | |
| xwayland.enable = lib.mkEnableOption "Xwayland support for `cosmic-comp`" // { |
| }; | ||
|
|
||
| environment.cosmic.excludePackages = lib.mkOption { | ||
| description = "List of COSMIC packages to exclude from the default environment"; |
There was a problem hiding this comment.
| description = "List of COSMIC packages to exclude from the default environment"; | |
| description = "List of COSMIC packages to exclude from the default environment."; |
| assertions = [ | ||
| { | ||
| assertion = lib.elem "libcosmic-app-hook" ( | ||
| lib.map ( | ||
| drv: lib.optionalString (lib.isDerivation drv) (lib.getName drv) | ||
| ) pkgs.cosmic-comp.nativeBuildInputs | ||
| ); | ||
| message = '' | ||
| It looks like the provided `pkgs` to the NixOS COSMIC module is not usable for a working COSMIC | ||
| desktop environment. | ||
|
|
||
| If you are erroneously passing in `pkgs` to `specialArgs` somewhere in your system configuration, | ||
| this is is often unnecessary and has unintended consequences for all NixOS modules. Please either | ||
| remove that in favor of configuring the NixOS `pkgs` instance via `nixpkgs.config` and | ||
| `nixpkgs.overlays`. | ||
|
|
||
| If you must instantiate your own `pkgs`, then please include the overlay from the NixOS COSMIC flake | ||
| when instantiating `pkgs` and be aware that the `nixpkgs.config` and `nixpkgs.overlays` options will | ||
| not function for any NixOS modules. | ||
|
|
||
| Note that the COSMIC packages in Nixpkgs are still largely broken as of 2024-10-16 and will not be | ||
| usable for having a fully functional COSMIC desktop environment. The overlay is therefore necessary. | ||
| ''; |
There was a problem hiding this comment.
| assertions = [ | |
| { | |
| assertion = lib.elem "libcosmic-app-hook" ( | |
| lib.map ( | |
| drv: lib.optionalString (lib.isDerivation drv) (lib.getName drv) | |
| ) pkgs.cosmic-comp.nativeBuildInputs | |
| ); | |
| message = '' | |
| It looks like the provided `pkgs` to the NixOS COSMIC module is not usable for a working COSMIC | |
| desktop environment. | |
| If you are erroneously passing in `pkgs` to `specialArgs` somewhere in your system configuration, | |
| this is is often unnecessary and has unintended consequences for all NixOS modules. Please either | |
| remove that in favor of configuring the NixOS `pkgs` instance via `nixpkgs.config` and | |
| `nixpkgs.overlays`. | |
| If you must instantiate your own `pkgs`, then please include the overlay from the NixOS COSMIC flake | |
| when instantiating `pkgs` and be aware that the `nixpkgs.config` and `nixpkgs.overlays` options will | |
| not function for any NixOS modules. | |
| Note that the COSMIC packages in Nixpkgs are still largely broken as of 2024-10-16 and will not be | |
| usable for having a fully functional COSMIC desktop environment. The overlay is therefore necessary. | |
| ''; |
This isn't applicable in Nixpkgs. It's also up to you to fix the bugs that this assertion tries to warn users about.
| ); | ||
| }; | ||
|
|
||
| meta = with lib; { |
There was a problem hiding this comment.
| meta = with lib; { | |
| meta = { |
For every other package as well.
There was a problem hiding this comment.
This should go to by-name.
| owner = "pop-os"; | ||
| repo = "cosmic-icons"; | ||
| rev = "epoch-1.0.0-alpha.3"; | ||
| rev = "refs/tags/epoch-1.0.0-alpha.4"; |
There was a problem hiding this comment.
| rev = "refs/tags/epoch-1.0.0-alpha.4"; | |
| tag = "epoch-1.0.0-alpha.4"; |
Ditto for every other package.
lilyinstarlight
left a comment
There was a problem hiding this comment.
This needs to follow terms of MIT license if you're going to be copy-pasting this code
It would help to have much more assurance of anyone here's intent and ability to maintain the copy-pasted code and work with COSMIC upstream on stuff, because as far as I know mostly me and @alyssais and @ahoneybun (who works for sys76) have bothered with that
| xdg-user-dirs | ||
| ] | ||
| ++ lib.optionals cfg.unstable.protocols.enable [ | ||
| cosmic-protocols |
There was a problem hiding this comment.
This does not do anything useful as far as I know...?
|
|
||
| xdg.portal = { | ||
| enable = true; | ||
| extraPortals = lib.mkBefore [ pkgs.xdg-desktop-portal-cosmic ]; |
There was a problem hiding this comment.
What is the mkBefore fixing here?
| xdg.portal = { | ||
| enable = true; | ||
| extraPortals = lib.mkBefore [ pkgs.xdg-desktop-portal-cosmic ]; | ||
| configPackages = lib.mkDefault ([ pkgs.xdg-desktop-portal-cosmic ]); |
There was a problem hiding this comment.
What is mkDefault solving here? It should be matching the prio level of other DEs
Thank you for helping with this review! |
There was a problem hiding this comment.
Please revert the changes to this file, except for the maintainer list update if you want to be added. The current derivation functions as expected and has some improvements over the one in the flake. If you'd like to make specific changes, we can discuss them, but don't blindly paste the code from lily's flake, especially since she explicitly asked for me to rewrite it myself.
|
@thefossguy Are you still working on this? |
|
@nyabinary Given that the cosmic greeter from nixpkgs doesn't work, I intend to. I'm not sure if I should rebase this branch with requested changes or individual PRs for each commit. |
|
Individual PRs for each package is probably the best way to go. This will also encourage making your own changes as you go (e.g. changing |
|
What is left over (after merge of e.g. #380312 ) of this MR? Could you rebase? |
I noticed that COSMIC from nixpkgs was not working well on my rock-5b and in x86 and aarch64 VMs. The screen would stay grey. I switched from COSMIC using Lily Foster's flake and it worked perfectly. This is my effort in upstreaming Lily's out of tree code into nixpkgs.
cc: @nyabinary @a-kenji @ahoneybun @alyssais
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.