snowfallorg / snowflakeos-modules

MIT License
11 stars 4 forks source link

gsconnect module install nautilus-python at the same time and make Firefox ready to work with its gsconnect extension #4

Open Thatoo opened 8 months ago

Thatoo commented 8 months ago

It would be nice if nautilus-python package was install at the same time than gsconnect to be able to send file directly from Nautilus.

Thatoo commented 8 months ago

Actually, just installing nautilus-python throw the nixSoftware Center isn't enough... Maybe it needs to look at this PR : https://github.com/NixOS/nixpkgs/pull/240780

Thatoo commented 8 months ago

No, it's enough but it should be install system wise and not only as a user.

Thatoo commented 8 months ago

I'm very new to nixOS world so I don't dare to make a PR to https://github.com/snowfallorg/snowflakeos-modules/blob/main/modules/nixos/gnome/default.nix

Would it be something like adding environment.systemPackages = with pkgs; [ gnome.nautilus-python ]; ? like :

    programs.kdeconnect = mkIf cfg.gsconnect.enable {
      package = pkgs.gnomeExtensions.gsconnect;
      enable = true;
      environment.systemPackages = with pkgs; [ gnome.nautilus-python ];
    };
Thatoo commented 8 months ago

GSconnect firefox extension doesn't work. I wonder if it's not related to https://github.com/NixOS/nixpkgs/issues/47340

Thatoo commented 8 months ago

I find a way to make GSconnect work with nautilus and Firefox (through the firefox extension). Below is the content of my default.nix file. I had to change the way Firefox is installed so it is really out of my scope to help to change the GSconnect module in order for it to offer the best integration to the user (in Gnome Shell, nautilus and Firefox) :

I had to comment firefox in the List packages installed in system profile but add gnome.nautilus-python to it. And then I had to add the following lines :

  programs.firefox.enable = true;
  programs.firefox.nativeMessagingHosts.packages = with pkgs; [ browserpass gnomeExtensions.gsconnect ];

The full file is :

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
  imports =
    [
      # Include the results of the hardware scan.
      ./hardware.nix
      ./modules.nix
    ];

    # Define your hostname.
  networking.hostName = "snowflakeos";

  # Select internationalisation properties.
  i18n.defaultLocale = "fr_FR.UTF-8";

  # Set the keyboard layout.
  services.xserver.layout = "fr";
  console.useXkbConfig = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users."username" = {
    isNormalUser = true;
    description = "Username";
    extraGroups = [ "wheel" "networkmanager" "dialout" ];
  };

  # Allow unfree packages
  environment.sessionVariables.NIXPKGS_ALLOW_UNFREE = "1";

    # List packages installed in system profile.
  environment.systemPackages = with pkgs; [
    # firefox
    gnome.nautilus-python
  ];

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
    system.stateVersion = "23.11"; # Did you read the comment?

  programs.nix-data = {
    enable = true;
    systemconfig = "/etc/nixos/systems/x86_64-linux/snowflakeos/default.nix";
    flake = "/etc/nixos/flake.nix";
    flakearg = "snowflakeos";
  };
  programs.firefox.enable = true;
  programs.firefox.nativeMessagingHosts.packages = with pkgs; [ browserpass gnomeExtensions.gsconnect ];
}
Thatoo commented 6 months ago

To make that easier, I opened an issue upstream on Gnome ISO : https://github.com/NixOS/nixpkgs/issues/300577

Thatoo commented 6 months ago

If upstream Gnome ISO decide to install firefox the proper way, I mean like

programs.firefox = {
   enable = true;
   package = pkgs.firefox;
   nativeMessagingHosts.packages = with pkgs; [
     browserpass
   ];
 };

instead of

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.username = {
    isNormalUser = true;
    description = "Username";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
      firefox
    #  thunderbird
    ];
  };

then the gsconnect module would only have to add (on top of what it already does) gnomeExtensions.gsconnect to nativeMessagingHosts.packages like

programs.firefox = {
   enable = true;
   package = pkgs.firefox;
   nativeMessagingHosts.packages = with pkgs; [
     browserpass
     gnomeExtensions.gsconnect
   ];
 };

and gnome.nautilus-python to either environment.systemPackages or to users.users.username.packages.

Thatoo commented 6 months ago

Actually I might be wrong. The problem might not need to be change upstream but in icicle : https://github.com/snowfallorg/icicle/blob/8e3776886fa391473d9c5421a7334d04638cb75f/src/utils/install.rs#L559