1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-05 01:19:46 +01:00
Commit graph

37 commits

Author SHA1 Message Date
Kareem-Medhat
4be0464472
home-manager: fix missing string context
The `home-manager` package was being passed a `path` string pointing a
store path while the string didn't have context. As a result the
`home-manager` derivation was created without this path as an input
source allowing it to be garbage collected even though it it being
used by the `home-manager` script. This in turn caused certain
warnings and errors to occur.
2024-04-02 02:05:46 +02:00
Robert Helgesson
043ba285c6
tests: add basic integration tests
This introduces some rudimentary integration tests using the NixOS
test framework. The intent is to better catch regressions when doing
more elaborate changes that may affect overall Home Manager behavior.
Note, the tests are currently not run automatically.
2024-02-14 15:10:53 +01:00
Manuel
8c3b2a0cab
flake: update release notes URL
The old URL providing information on deprecated
attributes (`extraModules` etc.) did not work anymore. This one,
"xhtml" instead of "html", does.
2024-01-15 20:30:59 +01:00
Robert Helgesson
be97e96dab
flake: add packages for tests
With this it is possible to build a specific test by running

    $ nix build -L .#test-{test name}

For example

    $ nix build -L .#test-files-text
2023-12-14 08:05:51 +01:00
Gerg-L
b2a2133c9a
flake: fix nixpkgs config
Fixes #2942
2023-10-07 01:32:49 +02:00
Emily
60e4228504 flake: remove temporary nixpkgs pin
Now that the Markdown migration is complete, everything should work
with the latest `nixpkgs-unstable`.
2023-07-17 18:49:09 +01:00
Emily
59b933653a docs: use nixosOptionsDoc
Output is mostly unchanged aside from some minor typographical and
formatting changes, along with better source links.

We temporarily export `options.docBookForMigration` to allow
`nix-doc-munge` to check its conversions.
2023-07-17 16:49:35 +01:00
Emily
82c157f255 flake: temporarily pin nixpkgs version
This is the last bump of the `nixos-unstable` channel before the
DocBookalypse.
2023-07-17 16:49:35 +01:00
Naïm Favier
9dd107a1d5
flake: add formatter (#3620)
* format: improve argument handling

For now, fail if the user tries to format a specific file/directory,
or runs the formatter from within a subdirectory.

Handling these situations is slightly tricky because `find -path` is
not very flexible.

* flake: add formatter

This allows running the formatter with `nix fmt`, added in Nix 2.8.

* format: use git ls-files

This is cleaner than `find` and allows us to restrict formatting to
particular files or subdirectories.
2023-06-27 23:32:30 +02:00
Robert Helgesson
a834ddf88c
flake: set source path in home-manager tool
This makes sure that a NIX_PATH entry is added for use by non-flake
commands, for example `home-manager uninstall`.

Fixes #3948
2023-05-07 11:26:13 +02:00
oxalica
43ba4489bd
flake: unwrap devShells.*.tests
This reverts commit 6f9781b1b0 to fix
errors of `nix flake check` and `nix flake show`.

The `devShells` attribute is expected to be an attrset of derivations,
not nested attrsets.
2023-04-28 08:23:29 +02:00
Yuriy Taraday
6f9781b1b0
flake: Move tests back to devShells.*.tests (#3905)
I assume it was erroneously lost during flake-utils removal in
https://github.com/nix-community/home-manager/pull/3860
2023-04-24 12:46:10 +02:00
Anderson Torres
17198cf5ae
flake.nix: get rid of flake-utils
The function `flake-utils.lib.eachDefaultSystem` is superfluous and can be
substituted by native `nixpkgs.lib` functionality.
2023-04-14 12:42:03 +02:00
Robert Helgesson
d68cd7f7df
flake: avoid recursive set 2023-02-26 17:07:30 +01:00
Zack
782cb855b2
home-manager: edit homeManagerConfiguration err (#3632)
* home-manager: edit `homeManagerConfiguration` err

This adds https://nix-community.github.io/home-manager/release-notes.html#sec-release-22.11-highlights
to the homeManagerConfiguration arguments error.

* home-manager: `homeManagerConfiguration` indent

Moved URL of the release notes for 22.11 to the same line so that
./format doesn't add extra whitespace

---------

Co-authored-by: zaporter <opensource@zackporter.com>
2023-02-01 11:25:13 +01:00
Andrew Marshall
cc58d31953
flake: Expose tests to allow running purely (#3412)
* flake: Expose tests to allow running purely

The existing way to run tests with `nix-shell` relies on impure usage of
`<nixpkgs>`. This can lead to failures when the local nixpkgs is
incompatible with the locked one. I.e., where CI is passing but a
contributor may experience a failure.

So, expose tests as `devShells.tests` to use the locked nixpkgs and
allow easy invocation via `nix develop`.

* tests: Remove impure path

With Nix 2.10+ and pure evaluation mode e.g.

```
nix run nixpkgs/nixos-unstable#nixVersions.nix_2_10 -- develop -i .#tests.zplug-modules
```

this test would fail with:

> error: the path '~/.customZplugHome' can not be resolved in pure mode

Since the test only cares that it is a path, rather than anything about
its contents, use a dummy empty directory.
2022-11-27 01:37:24 +01:00
aameen-tulip
6dc8a43f39
flake: list deprecated args in throw
The use of `throwIf` was retained on the off chance that someone
intentionally overrides it.
2022-09-27 15:50:32 +02:00
MaxCan-Code
8e4220e6c6
flake: add templates (#2892)
Add example flakes from `docs/nix-flakes.adoc` as templates.
2022-08-26 22:37:16 -04:00
Noah Fontes
1d3380afba
flake: fix self referential lib output
In https://github.com/nix-community/home-manager/pull/2859, the
library became self-referential, so we need to use the stdlib-extended
helper instead of importing directly.
2022-07-24 14:38:51 +02:00
Robert Helgesson
9550595502
docs,tests: fetch nmd and nmt using fetchTarball
This simplifies the code a bit and avoids using experimental Flake
functionality. If Flakes become stable before NixOS 22.11 then we can
consider having nmd and nmt as Flake inputs. Maybe could then also
avoid the need for flake-compat.
2022-06-26 22:22:46 +02:00
Naïm Favier
f26946858e
flake: remove superfluous arguments
Remove `stateVersion`, `username`, and `homeDirectory` as they can be
set in the configuration directly. Together with the previous commit,
this makes setting `stateVersion` explicitly mandatory.

Also replace `configuration` by `modules`, which expects a list of
Home Manager modules.

Also remove `system` which was made useless by #3028.
2022-06-26 01:01:57 +02:00
Naïm Favier
69e804839e
flake: don't reinstantiate nixpkgs
See https://zimbatm.com/notes/1000-instances-of-nixpkgs for
motivation.
2022-06-19 00:45:09 +02:00
Naïm Favier
2ff38c646f
flake: make pkgs required in homeManagerConfiguration
Prevents Home Manager from pinning Nixpkgs on behalf of users, see

  https://github.com/nix-community/home-manager/pull/2971#discussion_r898556798
2022-06-19 00:44:29 +02:00
Naïm Camille Favier
64ab7d6e8d
Prepare inclusion in nixos-search (#2971)
* Add flake.lock and clean up flake.nix

Add a lockfile to work around https://github.com/NixOS/nix/issues/6541
(and because it's a good idea anyway).

Also use flake-utils, and restrict ourselves to the five platforms
supported by nixpkgs. Otherwise, the IFD for nmd fails on weird
platforms. This fixes `nix flake check`.

Remove the redundant `apps` output, see https://github.com/nix-community/home-manager/pull/2442#issuecomment-1133670487

* nixos,nix-darwin: factor out into a common module

* nixos,nix-darwin: make `home-managers.users` shallowly visible

Make sure the option is included in the NixOS/nix-darwin manual (but the
HM submodule options aren't).

Also add a static description to the HM submodule type so that we don't need to
evaluate the submodules just to build the option manual. This makes
nixos-search able to index the home-manager flake.

Also clean up some TODOs.

* flake: add nmd and nmt

This avoids having to use `pkgs.fetchFromGitLab` in an IFD, which causes
issues when indexing packages with nixos-search because `pkgs` is
instantiated with every platform.
2022-06-07 20:45:06 +02:00
Sandro
93a69d0738
Simplify function (#2903) 2022-04-20 14:18:39 -04:00
Luc Chabassier
5ac84ebeef
Add lib argument to homeManagerConfiguration (#2753) 2022-04-17 18:14:41 -04:00
Otavio Salvador
cfab869fce
flake: add packages.<system>.default (#2835) 2022-04-02 18:38:18 +02:00
Sandro
b23bb05890
flake: only support linux + darwin
This is to prevent errors with `flake check` because for example
cygwin can't even build bash.

Closes #2829
2022-03-27 00:53:49 +01:00
contrun
c4c761ba55
add flake attribute apps to make it easier to run (#2442)
Home Manager can be ran with
`nix run --no-write-lock-file github:nix-community/home-manager`.

This is useful for people who want to try out Home Manager or,
want to bootstrap their home-environment.
2021-11-23 01:36:55 -05:00
Samuel Gräfenstein
4320399a3e
flake: add docs to packages output 2021-09-21 22:12:55 +02:00
Terje Larsen
0c236e13bc
flake: add extraModules option, inherit nixpkgs config and overlays in homeManagerConfiguration (#1767)
* flake: ensure passed pkgs with overlays and config is used

In the pkgsModule inside modules/modules.nix it will try to use the
<nixpkgs> from NIX_PATH if home.stateVersion is not set. This is not
available when using flakes so we need to require at least 20.09 and we
might as well default to that.

Also if you have added overlays and config to your pkgs it will be lost
so we need to transfer those as well.

This is an alternative to passing pkgs to extraSpecialArgs which will
break the usage of things like nixpkgs.config.packageOverrides.

* flake: add extraModules

If you want to add some extra home-manager modules, you have to mix them
with the configuration as such:

configuration = {
  imports = [
    emacs-config.homeManagerModules.emacsConfig
    ./home.nix
  ];
};

Instead of:
configuration = ./home.nix;
extraModules = [ emacs-config.homeManagerModules.emacsConfig ];

Which separates these two concerns.
2021-04-20 16:19:24 -04:00
Imran Hossain
0a6227d667
flake.nix: Add packages and defaultPackages outputs (#1913) 2021-04-11 17:46:27 -04:00
Naïm Favier
920ea74afe
flake.nix: add nixosModule and darwinModule to outputs (#1858) 2021-03-16 21:19:01 -04:00
mlatus
cf5dad76c1
flake: add extraSpecialArgs
This allows flake user to pass extra arguments to all modules.
2021-01-07 21:13:28 +01:00
Roosembert Palacios
6dc8de259a
flake: expose Home Manager lib 2020-12-14 21:02:15 +01:00
Nicolas Berbiche
1f34c048b3
flake: add nix-darwin module 2020-09-04 14:34:37 +02:00
Tony Olagbaiye
6cf6b587b5
flake: add flake.nix
No flake.lock is added because the only input (nixpkgs) will almost
always be overridden, and currently Home Manager's testing and
verification is not flake based.

PR #1455
2020-08-26 23:49:12 +02:00