linyinfeng / nur-packages

My personal NUR repository
MIT License
6 stars 2 forks source link

conflicting packages #635

Open AmourAmer opened 5 months ago

AmourAmer commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 4 months ago

I just added a schemaRegex option to rime-ice in https://github.com/linyinfeng/nur-packages/pull/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 commented 4 months ago

Thanks!Unfortunately I'm quite new to nix. I've tried to replace THIS_REPO with nur.repos.linyinfeng and put the block in ~/.config/nix/nix.conf or ~/.config/nixpkgs/conf.nix, and both failed.An hour's searching and reading didn't help me out. Seems getting needed info of nix is never easy. I really don't want to bother but could you please tell me how to apply that?Envoyé depuis mon téléphone Huawei-------- Message original --------De : Lin Yinfeng @.>Date : ven. 19 avr. 2024 à 19:50À : linyinfeng/nur-packages @.>Cc : AmourAmer @.>, Author @.>Objet : Re: [linyinfeng/nur-packages] conflicting packages (Issue #635) 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 ];

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

linyinfeng commented 4 months ago

~/.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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 1 week ago

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?