1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-05 02:39:45 +01:00
Commit graph

48 commits

Author SHA1 Message Date
Moises Nessim
2f58d0a3de
nix: add support for nix profile
PR #2833

Co-authored-by: David Arnold <dar@xoe.solutions>
Co-authored-by: Florian Franzen <Florian.Franzen@gmail.com>
2022-03-26 15:11:28 +01:00
Robert Helgesson
171702dd88
files: avoid cleanup if old home-files is missing 2022-03-26 15:05:43 +01:00
Robert Helgesson
9bcad20013
home-manager: add basic i18n support
The support for translated strings is, for now, limited to strings
generated in Bash code.
2021-12-13 21:47:28 +01:00
Smaug123
bb72555852
files: quote cmp file arguments
Before this change, a warning would be printed to the console if you
tried to manage a file in a path containing a space. For example,
`vscodium`'s `userSettings` file on Darwin is at
`~/Library/Application Support/VSCodium/User/settings.json`.
2021-10-30 19:15:34 +02:00
Samuel Ainsworth
562449b503
files: clarify "Please move the above files" message 2021-09-15 00:25:00 +02:00
Naïm Favier
5569770d1e
files: move dry run logic out of onChange hooks
Fixes #751
2021-08-17 22:14:32 +02:00
piegames
7f976da068
files: ignore conflict when files are identical
When the target file exists but has the exact same content then we
will now skip creation of the link from the source file.

Fixes #1213
2021-07-29 23:01:52 +02:00
Robert Helgesson
9b7a90daa1
files: minor cleanup 2021-06-28 23:17:00 +02:00
Robert Helgesson
2aeaf65e8f
files: assert that target files are unique
Fixes #1807
2021-06-27 17:10:45 +02:00
bb010g
c982c19f53
files: properly escape shell arguments 2021-06-14 23:10:19 +02:00
Robert Helgesson
d2aaeac42c
files: remove assertion on recursive onChange
See discussion in

  https://github.com/nix-community/home-manager/pull/2031
2021-05-30 11:54:33 +02:00
Robert Helgesson
07ad6a4f76
files: fix use of onChange with directory source
Previously, the comparison would not handle directory comparison
correctly, always finding that the source and target differed. This
would trigger the `onChange` script on each activation.

Fixes #2004
2021-05-29 21:52:37 +02:00
Robert Helgesson
4fe5afa755
files: make sure the target file name is escaped
The previous implementation would allow variables to sneak into the
file names. This commit makes sure the resulting target file path
exactly matches the expected path.
2020-08-29 18:22:03 +02:00
zowoq
3b33862b04
files: reference lndir through xorg
The xlibs attribute set is deprecated and is an alias for xorg.

PR #1304
2020-06-06 13:24:51 +02:00
piegames
6c7a031367
files: print source path for detected collision
PR #1236
2020-05-17 21:49:18 +02:00
Cole Helbling
645149d77b
files: fix warning message
PR #1241
2020-05-17 21:20:40 +02:00
Robert Helgesson
91551c09d4
files: add helper function mkOutOfStoreSymlink
Using this function it is possible to make `home.file` create a
symlink to a path outside the Nix store. For example, a Home Manager
configuration containing

    home.file."foo".source = config.lib.file.mkOutOfStoreSymlink ./bar;

would upon activation create a symlink `~/foo` that points to the
absolute path of the `bar` file relative the configuration file.

PR #1211
2020-05-02 01:22:14 +02:00
Robert Helgesson
37694e9f51
files: add force flag
Enabling this flag for a `home.file` entry causes the target to be
unconditionally overwritten. The option is not visible in
documentation for now and shouldn't be relied on for general use.
2020-03-17 23:42:26 +01:00
Robert Helgesson
7a3e2cc063
files: use nix-env to create profile links 2020-02-15 23:53:39 +01:00
Robert Helgesson
6e4b9af080
Switch to extended Nixpkg's lib
This change makes use of the `extend` function inside `lib` to inject
a new `hm` field containing the Home Manager library functions. This
simplifies use of the Home Manager library in the modules and reduces
the risk of accidental infinite recursion.

PR #994
2020-01-21 20:47:04 +01:00
Philip Stears
0e9b7aab3c
files: additional support for symlinked /nix
In the case where `/nix` is a link, for example, on macOS Catalina,
`builtins.storeDir` returns `/nix`, not the canonical location.

This causes tests on existing files to result in Home Manager thinking
those files are outside of the store.

This change uses `readlink` on the store path so that the tests work
as intended.
2019-11-26 22:22:19 +01:00
Anton Plotnikov
b1dd373f5a
files: update script to support linked Nix store 2019-11-22 20:16:42 +01:00
Judson
f82246171b
files: backup file collisions
When a configuration file would be written to an existing file, rather
than failing switch (and having the user have to move or delete those
files), move the files automatically to a new path.

Closes #585
2019-06-09 14:26:12 +02:00
Will Dietz
f56256f488
files: fix find invocation broken in c94eaa0e
Add parens to expression so the `-exec` includes files matching both.

Otherwise (before this change) the `-exec` is only invoked for
links (`-type l`):

    file or (link -> doexec)
      =>
    (file or link) -> doexec
2019-04-30 15:07:47 +02:00
Robert Helgesson
c94eaa0e6c
files: replace unnecessary use of xargs 2019-04-27 13:48:57 +02:00
Robert Helgesson
70d4cf2cd9
Remove some use of mkDerivation
Instead use `runCommand`, which by default uses `stdenvNoCC` resulting
in a reduced dependency footprint.

Fixes #612
2019-03-18 23:09:54 +01:00
Robert Helgesson
7c04351a57
files: allow a wider range of source file names
In particular support source files whose name start with `.` or
contain characters not allowed in the nix store, such as spaces.

Also add some test cases for `home.file`.
2019-01-19 12:44:58 +01:00
Robert Helgesson
99c900946d
Avoid substitution for some derivations
In particular, don't bother attempting to do substitution of the home
files and home generation derivations since these rarely, if ever,
could be substituted.

Fixes #330
2018-07-31 21:16:36 +02:00
Andrew Scott
30cba446f2
files: add onChange option
This option allows execution of arbitrary shell code when a file that
is linked into the home directory has been changed between
generations.
2018-07-27 22:07:12 +02:00
Robert Helgesson
f0d207f380
Add dag library to config.lib
Also replace all imports of `dag.nix` by the entry in `config.lib`.
2017-12-26 17:27:21 +01:00
Silvan Mosberger
8d360c5a57
systemd: remove filename hack 2017-12-12 18:05:04 +01:00
Cornelius Mika
f6900f0689
files: improve 'target not in $HOME' check
Check for prefix instead of inclusion.
2017-12-12 17:46:48 +01:00
Robert Helgesson
6764c26954
files: remove mode option
This option was deprecated >1 month ago and is therefore removed as
per the corresponding news entry.
2017-12-11 15:14:45 +01:00
Robert Helgesson
4fce730326
files: log when creating home file links 2017-11-15 18:31:04 +01:00
Robert Helgesson
9206f363ff
files: fix order of activation actions
Specifically, move the cleanup phase to before we switch over the
generation links in `gcroots` and `profiles`.

Fixes https://github.com/rycee/home-manager/issues/134
2017-11-15 18:26:42 +01:00
Robert Helgesson
7a9c873093
files: add special handling of systemd files
Unfortunately systemd derives nonsensical unit names when the unit
file is a link to a link to a file. This commit ensures that any file
whose target path matches the pattern `*/systemd/user/*` will be
reachable with only one link hop.

This also reverts f52ec0df7c, which
contained a temporary fix. This commit is an improvements in that it
is more explicit and also handles unit files given directly as a home
file source.
2017-11-12 00:56:34 +01:00
Robert Helgesson
d7537777c3
files: improve keyword for inheriting executable bit 2017-11-12 00:13:29 +01:00
Robert Helgesson
145aefc9d1
files: simplify cleanup script slightly
The cleanup script now takes relative paths as arguments, not absolute
paths into the old generation. This uses a GNU specific feature of
find.
2017-11-11 14:21:11 +01:00
Robert Helgesson
54043df8fb
files: support recursive linking of directory 2017-11-07 17:18:00 +01:00
Robert Helgesson
4f842d9f1b
files: extract type of home.file into own file 2017-11-06 14:24:04 +01:00
Cornelius Mika
9627fe6be6
files: link home files instead of copying
Only copy files that need their execute bit changed or use the
deprecated `mode` option.
2017-11-06 14:24:04 +01:00
Cornelius Mika
b8ddb11796
use buildCommand for single phase builds 2017-11-06 14:24:04 +01:00
Cornelius Mika
811bc1b8e5
files: extract common variable
Also improve the pattern used to determine whether a symlink target
points to a Home Manager file path.
2017-11-06 14:24:04 +01:00
Cornelius Mika
ccb291ce66
files: add option 'executable'
This also deprecates the `home.file.<name?>.mode` option, which is
misleading because the Nix store only allows modes 'r--' and 'r-x'.
2017-11-06 14:24:04 +01:00
Cornelius Mika
676f5c4b31 files: allow arbitrary paths as home file names
By sanitizing the home file name in the derivation name, the home file
name is no longer exposed to the naming restrictions for nix store
paths.

For example, it is now possible to define home files with spaces in
their names without providing a target or source attribute.
2017-11-06 10:34:45 +01:00
Robert Helgesson
a4c0fead1f
files: be less verbose when linking a directory 2017-10-29 01:21:40 +02:00
Silvan Mosberger
d81276607c
files: support absolute home directory path 2017-10-15 17:15:16 +02:00
Silvan Mosberger
f0a1d69f50
Separate home files module from home-environment.nix 2017-10-15 17:14:32 +02:00