nix-community / nix-on-droid

Nix-enabled environment for your Android device. [maintainers=@t184256,@Gerschtli]
https://nix-on-droid.unboiled.info
MIT License
1.25k stars 69 forks source link

error: packages '/nix/store/yvr7hjdxj1b5jcjk3pgh9z4gmwn78lql-home-manager-path/etc/man_db.conf' and '/nix/store/naig9qc4bmx1gp4nmsmxwmnllx0cjlvc-nix-on-droid-path/etc/man_db.conf' have the same priority 5 #65

Closed bbigras closed 2 years ago

bbigras commented 4 years ago
Activating linkBinSh
Activating linkUsrBinEnv
Activating installLogin
Activating installLoginInner
Activating installPackages
GC Warning: Couldn't read /proc/stat
replacing old 'nix-on-droid-path'
installing 'nix-on-droid-path'
Activating installProotStatic
Activating setUpEtc
Activating homeManager
Starting home manager activation
GC Warning: Couldn't read /proc/stat
GC Warning: Couldn't read /proc/stat
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating installPackages
GC Warning: Couldn't read /proc/stat
installing 'home-manager-path'
building '/nix/store/1w8d8qzqzcrfnbjk1879lg7abai7gznm-user-environment.drv'...
error: packages '/nix/store/yvr7hjdxj1b5jcjk3pgh9z4gmwn78lql-home-manager-path/etc/man_db.conf' and '/nix/store/naig9qc4bmx1gp4nmsmxwmnllx0cjlvc-nix-on-droid-path/etc/man_db.conf' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' to change the priority of one of the conflicting packages (0 being the highest priority)
builder for '/nix/store/1w8d8qzqzcrfnbjk1879lg7abai7gznm-user-environment.drv' failed with exit code 1
error: build of '/nix/store/1w8d8qzqzcrfnbjk1879lg7abai7gznm-user-environment.drv' failed
Gerschtli commented 4 years ago

That is strange, do you install a package in nix-on-droid and home-manager? Maybe share your current config.

It would help, if we know, what package is causing the conflict, so if you have ~/.nix-profile/etc/man_db.conf already present, could you run a ls -l for it, that we see the link target?

bbigras commented 4 years ago

I installed openssh with nix-env and I have this:

-bash-4.4$ ls -l ~/.nix-profile/etc/man_db.conf
lrwxrwxrwx 1 nix-on-droid nix-on-droid 82 Jan  1  1970 /data/data/com.termux.nix/files/home/.nix-profile/etc/man_db.conf -> /nix/store/naig9qc4bmx1gp4nmsmxwmnllx0cjlvc-nix-on-droid-path/etc/man_db.conf

config

{ pkgs, ... }:

{
  # Simply install just the packages
  environment.packages = with pkgs; [
    # User-facing stuff that you really really want to have
    vim  # or some other editor, e.g. nano or neovim

    # Some common stuff that people expect to have
    diffutils
    findutils
    utillinux
    tzdata
    hostname
    man
    gnugrep
    gnupg
    gnused
    gnutar
    bzip2
    gzip
    xz
    zip
    unzip
  ];

  # Backup etc files instead of failing to activate generation if a file already exists in /etc
  environment.etcBackupExtension = ".bak";

  # Read the changelog before changing this value
  system.stateVersion = "20.03";

  # After installing home-manager channel like
  #   nix-channel --add https://github.com/rycee/home-manager/archive/release-20.03.tar.gz home-manager
  #   nix-channel --update
  # you can configure home-manager in here like
  home-manager.config =
   { pkgs, ... }:
   {

     programs.bat.enable = true;
     programs.command-not-found.enable = true;
     programs.fzf.enable = true;
     programs.starship.enable = true;

     home.packages = [
       pkgs.neofetch
     ];

   };
}

# vim: ft=nix

channels

home-manager https://github.com/rycee/home-manager/archive/release-20.03.tar.gz
nix-on-droid https://github.com/t184256/nix-on-droid/archive/release-20.03.tar.gz
nixpkgs https://nixos.org/channels/nixos-20.03
bbigras commented 4 years ago

It seems fine if I remove man from environment.packages

Gerschtli commented 4 years ago

Maybe there is an implicit reference of man in your home-manager config.. You could also use the option home-manager.useUserPackages, which may fix this issue for you too.

bbigras commented 4 years ago

Thanks!

ShamrockLee commented 4 years ago

You could also use the option home-manager.useUserPackages, which may fix this issue for you too.

This approach definitely needs documentation. This is a common issue with high reproducibility.

Gerschtli commented 4 years ago

Maybe we should also consider changing the default value for home-manager.useUserPackages to true.

t184256 commented 4 years ago

@Gerschtli, what would be the downsides?

Gerschtli commented 4 years ago

Can't think of any.. Maybe someone depends on this in his custom config so a conditional default value based on the stateVersion seems to be the most apprpriate options besides adding a small comment in the README that this option is recommended to be set to true.

t184256 commented 4 years ago

@Gerschtli, is it OK to bump stateVersion at any moment or should we wait until the next NixOS release?

Gerschtli commented 4 years ago

You mean the default value? I think we should never change it. We should add a conditional switch to enable useUserPackages if stateVersion is higher or equal than 20.09. That is the default behaviour of nixos and home-manager too. And of course add this change to a not yet created changelog.

Gerschtli commented 4 years ago

I have to correct myself: I have just checked and nixos sets stateVersion default to current release, home-manager never changes its default value.

I think the most consistent and predictable way to handle this is the home-manager way: The user has to manually update the stateVersion because essentially this value should not have any default value at all and is just set to provide backwards compatibility for system installations before introducing this option.

t184256 commented 4 years ago

I meant, should I introduce an intermediate 20.08 to make the change sooner, or rather do it in some staging-20.09 and only fold it back to master when 20.09 is out. Now I see us both leaning towards 20.09.

Gerschtli commented 4 years ago

Ah okay, now I understand.

How about adding it to master (aka the unstable bleeding edge channel) and when 20.09 is released creating a new channel? Of course you could create a staging-20.09 but I don't see the real benefit.

The only problem could be that users of nix-on-droid use the master channel and don't know of the stable ones, but I would consider it minor and just provide a Changelog or a short Paragraph in the Readme for all possible channels and branches (and maybe a date for end of support).

573 commented 3 years ago

I see similar output when doing:

nix-channel --update
nix-env -iA nixpkgs.nix

error: packages '/nix/store/m3zf69cqn7a85y2bjvg5rn7a9llf0d9w-nix-on-droid-path/share/nix/sandbox/sandbox-network.sb' and '/nix/store/g4d6n09a189ird2rnr6ab79pbbz3vfm9-nix-2.3.6/share/nix/sandbox/sandbox-network.sb' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' to change the priority of one of the conflicting packages (0 being the highest priority)

Gerschtli commented 3 years ago

But why do you want to do this? nix is already included in nix-on-droid-path

573 commented 3 years ago

@Gerschtli basically want to upgrade it. Pls correct me if I misunderstood something ?

Gerschtli commented 3 years ago

nix-on-droid-path contains the nix package of the installed nixpkgs channel. If you want another version of nix, you should add an overlay where you change the nix package to the latest version.

For reference, nix is installed in modules/environment/path.nix, an overlay would be the best option to change the version.

Gerschtli commented 2 years ago

For future reference: If you want to use a different nix package, use config.nix.package option.

I will close this issue as it seems to be solved. Feel free to reopen if necessary.