xdg-user-dirs: allow paths and define sessionVariables#2757
xdg-user-dirs: allow paths and define sessionVariables#2757berbiche merged 1 commit intonix-community:masterfrom
Conversation
berbiche
left a comment
There was a problem hiding this comment.
AFAIK, the reason paths are not allowed is because it would lead to the entire path being imported in the nix store or prevent building on Flake configurations (Flake's can only refer to paths available in the git index).
f4f26c0 to
76c2e63
Compare
|
The paths being copied to the Nix store was not a problem because currently there isn't any antiquotation happening with those values. But ideally, this should be forward compatible. The second point was indeed a problem. I added |
| type = with types; attrsOf (either str path); | ||
| apply = builtins.mapAttrs (_: toString); | ||
| default = { }; | ||
| example = { XDG_MISC_DIR = "$HOME/Misc"; }; |
There was a problem hiding this comment.
let's fix this while you are at it already
| example = { XDG_MISC_DIR = "$HOME/Misc"; }; | |
| example = literalExpression '' | |
| { | |
| XDG_MISC_DIR = "$HOME/Misc"; | |
| } | |
| ''; |
76c2e63 to
ea52bff
Compare
| type = with types; attrsOf (either str path); | ||
| apply = builtins.mapAttrs (_: toString); |
There was a problem hiding this comment.
| type = with types; attrsOf (either str path); | |
| apply = builtins.mapAttrs (_: toString); | |
| type = with types; attrsOf (coercedTo path toString str); |
minor nitpick, I think coercedTo is better suited here as only type coercion is happening, rather than transformation of the option value.
There was a problem hiding this comment.
Thank you. I wasn't aware of the coercedTo type.
ea52bff to
0d92dc3
Compare
Changed option types to `either str path` to allow using path values. The related session variable is defined for the default and the extra user directories now.
0d92dc3 to
f21803d
Compare
…#2757) Changed option types to `either str path` to allow using path values. The related session variable is defined for the default and the extra user directories now.
…#2757) Changed option types to `either str path` to allow using path values. The related session variable is defined for the default and the extra user directories now.
…#2757) Changed option types to `either str path` to allow using path values. The related session variable is defined for the default and the extra user directories now.
Changed the type of the user directory options from
strto(either str pathcoercedTo path toString str) to allow using path values.The related session variable is defined for the default and the extra user directories now.
Closes #2694
Description
Checklist
Change is backwards compatible.
Code formatted with
./format.Code tested through
nix-shell --pure tests -A run.all.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Added myself as module maintainer. See example.
Added myself and the module files to
.github/CODEOWNERS.