1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2025-03-15 18:35:11 +01:00
home-manager/modules
Luflosi be9177fcf4
files: don't handle symlinks in a special way when home.file.<name>.recursive is set to true
I'm using `pass` as my password manager.
In order to use it in Firefox, I use the passff extension.
The passff extension needs the `passff-host` native messaging host to access the passwords.
Here is what the file structure of the `passff-host` package looks like:
```
result
├── etc
│   ├── chromium
│   │   └── native-messaging-hosts
│   │       └── passff.json -> ../../../share/passff-host/passff.json
│   ├── opt
│   │   └── chrome
│   │       └── native-messaging-hosts
│   │           └── passff.json -> ../../../../share/passff-host/passff.json
│   └── vivaldi
│       └── native-messaging-hosts
│           └── passff.json -> ../../../share/passff-host/passff.json
├── lib
│   ├── librewolf
│   │   └── native-messaging-hosts
│   │       └── passff.json -> ../../../share/passff-host/passff.json
│   └── mozilla
│       └── native-messaging-hosts
│           └── passff.json -> ../../../share/passff-host/passff.json
└── share
    └── passff-host
        ├── passff.json
        └── passff.py
```
As you can see, `lib/mozilla/native-messaging-hosts/passff.json` is a relative symlink. This is perfectly reasonable.
When adding `programs.firefox.nativeMessagingHosts = [ pkgs.passff-host ]` to the home-manager configuration, the firefox module first joins all the `nativeMessagingHosts` using `symlinkJoin` and stores the result in a variable called `nativeMessagingHostsJoined`.
This creates `ff_native-messaging-hosts` in the Nix store:
```
/nix/store/bv62k5yl7jwzkhyci838ir3vgz59gqsa-ff_native-messaging-hosts
├── bin
│   └── firefox -> /nix/store/0zqxaz44w75gjq32xj53i32jl2j91pzy-firefox-125.0.1/bin/firefox
├── etc
│   ├── chromium
│   │   └── native-messaging-hosts
│   │       └── passff.json -> ../../../share/passff-host/passff.json
│   ├── opt
│   │   └── chrome
│   │       └── native-messaging-hosts
│   │           └── passff.json -> ../../../../share/passff-host/passff.json
│   └── vivaldi
│       └── native-messaging-hosts
│           └── passff.json -> ../../../share/passff-host/passff.json
├── lib
│   ├── [...]
│   ├── librewolf
│   │   └── native-messaging-hosts
│   │       └── passff.json -> ../../../share/passff-host/passff.json
│   └── mozilla
│       ├── native-messaging-hosts
│       │   └── passff.json -> ../../../share/passff-host/passff.json
│       └── pkcs11-modules
└── share
    ├── [...]
    └── passff-host
        ├── passff.json -> /nix/store/pag1akgbmls1xa63h6rzmb0h6xxwwzmy-passff-host-1.2.4/share/passff-host/passff.json
        └── passff.py -> /nix/store/pag1akgbmls1xa63h6rzmb0h6xxwwzmy-passff-host-1.2.4/share/passff-host/passff.py
```
Still perfectly fine.
Then the `firefox` module sets
```nix
home.file.".mozilla/native-messaging-hosts" = {
  source = "${nativeMessagingHostsJoined}/lib/mozilla/native-messaging-hosts";
  recursive = true;
}
```
The `file` module then calls `lndir -silent "/nix/store/bv62k5yl7jwzkhyci838ir3vgz59gqsa-ff_native-messaging-hosts/lib/mozilla/native-messaging-hosts" ".mozilla/native-messaging-hosts"`
To see the problem, here is the resulting directory tree:
```
.mozilla
├── [...]
└── native-messaging-hosts
    └── passff.json -> ../../../share/passff-host/passff.json
```
Obviously this symlink doesn't go anywhere. `lndir` created a broken symlink.
To fix this, add the `-ignorelinks` argument to `lndir`, which causes it to instead just create a symlink to the symlink in `ff_native-messaging-hosts`:
```
.mozilla
├── [...]
└── native-messaging-hosts
    └── passff.json -> /nix/store/bv62k5yl7jwzkhyci838ir3vgz59gqsa-ff_native-messaging-hosts/lib/mozilla/native-messaging-hosts/passff.json
```
2024-05-06 14:12:39 +02:00
..
accounts vdirsyncer: add urlCommand and userNameCommand options 2024-03-22 16:56:17 +01:00
config home-cursor: fix typo in XDG data directory link 2023-11-07 09:21:58 +01:00
files files: make collision error message more helpful 2024-04-30 00:41:45 +02:00
i18n/input-method kime: remove documentation dependency on config 2024-03-18 22:13:07 +01:00
launchd treewide: deprecate DRY_RUN_CMD and DRY_RUN_NULL 2024-01-24 13:36:05 +01:00
lib maintainers: add kaleocheng 2024-04-30 23:56:41 +02:00
lib-bash home-manager: fix nix-build option -q 2024-03-22 19:46:20 +01:00
misc gnome-shell: add module 2024-05-06 09:44:34 +02:00
po Translate using Weblate (Persian) 2024-05-02 12:58:30 +02:00
programs gnome-shell: add module 2024-05-06 09:44:34 +02:00
services wlsunset: update options 2024-05-05 19:59:14 +02:00
targets targets/generic-linux: use xdg path for defexpr 2024-03-09 13:43:12 +01:00
default.nix home-manager: set module class to "homeManager" 2024-04-27 09:28:21 +02:00
files.nix files: don't handle symlinks in a special way when home.file.<name>.recursive is set to true 2024-05-06 14:12:39 +02:00
home-environment.nix home-environment: fix formatting 2024-03-28 12:33:23 +01:00
manual.nix docs: add style sheets and scrubDerivations 2024-02-01 01:10:58 +01:00
modules.nix gnome-shell: add module 2024-05-06 09:44:34 +02:00
systemd-activate.rb Revert "systemd: use sd-switch" 2020-08-04 19:38:14 +02:00
systemd-activate.sh home-manager: remove the export of run 2024-01-28 10:53:09 +01:00
systemd.nix systemd: add enable option 2024-04-16 21:12:47 +02:00
xresources.nix treewide: remove now-redundant lib.mdDoc calls 2023-07-17 18:49:09 +01:00
xsession.nix xsession: allow xplugd to restart on failure 2024-01-16 08:07:00 +01:00