Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conflicting packages #635

Open
AmourAmer opened this issue Mar 30, 2024 · 11 comments
Open

conflicting packages #635

AmourAmer opened this issue Mar 30, 2024 · 11 comments

Comments

@AmourAmer
Copy link

I'm a new user to nixos and thx to your repo I am easily able to use rime-double-pinyin and rime-ice!
Well, more precisely, any one of them, but not simultaneous. Errors like:

         /nix/store/1193ji55d4raiq2jlcjabdn9hg8ksc7j-rime-double-pinyin-69bf85d4dfe8bac139c36abbd68d530b8b6622ea/share/rime-data/double_pinyin.schema.yaml
         /nix/store/pwyblyypwsy2grg5y893b8lbv94msy01-rime-ice-ab648212584a5e54bf72583ba729e9d82c7f4888/share/rime-data/double_pinyin.schema.yaml
error: builder for '/nix/store/n79pz6...-user-environment.drv' failed with exit code 1;

Maybe instead of static files, computed file generated according to profile should be implemented?
不过看上去有点复杂,我自己写的cmdstorm项目就碰到了诸如此类的问题于是停滞了

@linyinfeng
Copy link
Owner

linyinfeng commented Mar 30, 2024

It seems that the rime-ice AUR package solves this issue by splitting different schemas of rime-ice into different packages.

Maybe we can do the same thing with multiple outputs.

@AmourAmer
Copy link
Author

AmourAmer commented Mar 31, 2024

That seems a, not that satisfying, solution.
When I used arch, the rime-ice-git package enabled the word lib(globally), and the double-pinyin-flypy package didn't configure anything, for which I had to write default.custom.yaml by myself. Typically users in arch doesn't have nix-env so necessarily get hands dirty.

Is it possible to compute schema based on chosen pkgs? should be possible I guess? create a common dependency which changes according to profile?
Sorry but, what does multiple outputs mean?

@linyinfeng
Copy link
Owner

That seems a, not that satisfying, solution. When I used arch, the rime-ice-git package enabled the word lib(globally), and the double-pinyin-flypy package didn't configure anything, for which I had to write default.custom.yaml by myself. Typically users in arch doesn't have nix-env so necessarily get hands dirty.

Is it possible to compute schema based on chosen pkgs? should be possible I guess? create a common dependency which changes according to profile? Sorry but, what does multiple outputs mean?

The issue is not related to compile. It happens simply because https://github.com/iDvel/rime-ice and https://github.com/rime/rime-double-pinyin both provide double_pinyin.schema.yaml.

Multiple outputs mean that nix derivation can have multiple output paths.
For example, we can place double_pinyin.schema.yaml and its compiled files into another output path, so that users can choose which schemas to include.

@AmourAmer
Copy link
Author

Like stopping double-pinyin from automatically install schema, but tell user to manually configure yaml instead?
Not sure if it's a good idea, maybe worth a try?

Actually I didn't say anthing about compile. I mean, there can be a schema.drv which computes and generates the schema file according to <rime-*> env vars(which shamefully makes it not supposedly pure)

@linyinfeng
Copy link
Owner

I just added a schemaRegex option to rime-ice in #667, which allows users to choose which schemas of rime-ice to include.

If you want to use https://github.com/rime/rime-double-pinyin and https://github.com/iDvel/rime-ice simultaneously, you may use this option like this:

rimeDataPkgs = with THIS_REPO.rimePackages; withRimeDeps [
  (rime-ice.override {
    schemaRegex = "^rime_ice$";
  })
  rime-double-pinyin
];

@AmourAmer
Copy link
Author

AmourAmer commented Apr 19, 2024 via email

@linyinfeng
Copy link
Owner

linyinfeng commented Apr 19, 2024

~/.config/nix/nix.conf

I'm confused... To use the rime packages in this repository, the expected nixos configuration should be like this:

{ pkgs, ... }:
{
  # nixos configuration
  i18n.inputMethod = {
    enabled = "ibus"/"fcitx5";
    # for ibus
    ibus.engines = with pkgs.ibus-engines; [
      (rime.override {
        rimeDataPkgs = with pkgs.nur.repos.linyinfeng.rimePackages; withRimeDeps [
          rime-ice
          ...
        ];
      })
    ];
    # for fcitx5
    fcitx5.addons = with pkgs; [
      (fcitx5-rime.override {
        rimeDataPkgs = with pkgs.nur.repos.linyinfeng.rimePackages; withRimeDeps [
          rime-ice
          ...
        ];
      })
    ];
  };
}

If you install these packages with nix-env or nix-profile, it has no effect.

@linyinfeng
Copy link
Owner

librime only works with three directories:

user_data_dir    ~/.config/ibus/rime
shared_data_dir  /usr/share/rime-data
staging_dir      ~/.config/ibus/rime/build

The rimeDataPkgs argument of ibus-engines.rime and fcitx5-rime sets the shared_data_dir to a customized rime data package.
That's why installing these packages using other methods has no effect.

@AmourAmer
Copy link
Author

Thanks for that! At least something has changed, it's just, seems to be some font issue and I need to further debug
Before that, may I confirm that if my conf is like this:
https://github.com/AmourAmer/debug/tree/ac7db96
all yamls in fcitx5/rime/ included
When I input "luoxiayuguwuqifei", it should be 落霞与孤鹜齐飞 对吧?
以及输入 feiji 的时候应该会有个选项是✈️?但是都没有,我在arch上的时候只需要安装rime-ice-git包这些就都有了,我是还需要手动改什么文件么?

@linyinfeng
Copy link
Owner

Thanks for that! At least something has changed, it's just, seems to be some font issue and I need to further debug Before that, may I confirm that if my conf is like this: https://github.com/AmourAmer/debug/tree/ac7db96 all yamls in fcitx5/rime/ included When I input "luoxiayuguwuqifei", it should be 落霞与孤鹜齐飞 对吧? 以及输入 feiji 的时候应该会有个选项是✈️?但是都没有,我在arch上的时候只需要安装rime-ice-git包这些就都有了,我是还需要手动改什么文件么?

No, fcitx5-rime should work out-of-box.

{
  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  outputs = { self, nixpkgs }: {
    nixosConfigurations.test = nixpkgs.lib.nixosSystem {
      modules = [
        ({ config, pkgs, ... }: {
          users.users.test = {
            isNormalUser = true;
            password = "12345678";
          };
          services.xserver.enable = true;
          services.displayManager.sddm.enable = true;
          services.xserver.desktopManager.plasma5.enable = true;
          i18n.inputMethod = {
            enabled = "fcitx5";
            fcitx5.addons = with pkgs; [ fcitx5-rime ];
          };
          nixpkgs.hostPlatform = { system = "x86_64-linux"; };
          system.stateVersion = "24.05";
        })
      ];
    };
  };
}

nix run .#nixosConfigurations.test.config.system.build.vm -- -m 4G

image

And to enable rime-ice you should follow the instructions described in https://github.com/iDvel/rime-ice?tab=readme-ov-file#arch-linux.

# flake.nix
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nur.url = "github:nix-community/nur";
  };
  outputs = { self, nixpkgs, nur }: {
    nixosConfigurations.test = nixpkgs.lib.nixosSystem {
      modules = [
        nur.nixosModules.nur
        ({ config, pkgs, ... }: {
          users.users.test = {
            isNormalUser = true;
            password = "12345678";
          };
          services.xserver.enable = true;
          services.displayManager.sddm.enable = true;
          services.xserver.desktopManager.plasma5.enable = true;
          i18n.inputMethod = {
            enabled = "fcitx5";
            fcitx5.addons = with pkgs;
              [
                (fcitx5-rime.override {
                  rimeDataPkgs = with config.nur.repos.linyinfeng.rimePackages;
                    withRimeDeps [
                      (rime-ice.override { schemaRegex = "^rime_ice$"; })
                      rime-double-pinyin
                    ];
                })
              ];
          };
          nixpkgs.hostPlatform = { system = "x86_64-linux"; };
          system.stateVersion = "24.05";
        })
      ];
    };
  };
}
# default.custom.yaml
patch:
  __include: rime_ice_suggestion:/
  schema_list/+:
    - schema: double_pinyin

nix run .#nixosConfigurations.test.config.system.build.vm -- -m 4G

image

@AmourAmer
Copy link
Author

It does solve the installation conflict. However, it behaves weird.
Here's what I got with double_pinyin_flypy/luna pinyin and rime-ice on/off. The only normal line is input with luna pinyin and rime-ice:
buggy
Similarly double_pinyin behaves.

Maybe I can try to help? As I want to install fcitx-sogou for my friend. But I can't even know how to run NUR repo like yours locally. Can you help a bit, plz? Nix does have very bad documentation.
Here're some relevant links:

Maybe this should another issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants