1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00
Commit graph

17 commits

Author SHA1 Message Date
Jade Lovelace
8714f9e285
flake: put nixpkgs in NIX_PATH and system registry for flake configs
Currently there are a bunch of really wacky hacks required to get
nixpkgs path correctly set up under flake configs such that `nix run
nixpkgs#hello` and `nix run -f '<nixpkgs>' hello` hit the nixpkgs that
the system was built with. In particular you have to use specialArgs or
an anonymous module, and everyone has to include this hack in their own
configs.

We can do this for users automatically.

NixOS/nixpkgs@e456032add

Co-authored-by: Antoine Cotten <hello@acotten.com>
2024-09-11 08:24:41 +02:00
Graham Christensen
09284ab00b Install darwin-uninstall by default, which includes the 'empty' config it switches to
Co-Authored-By: Michael Hoang <enzime@users.noreply.github.com>
2023-11-16 17:47:24 +11:00
Michael Hoang
0dafe2170d Add darwin-version command 2023-07-14 23:06:46 +10:00
Michael Hoang
5288a72354 Allow flaky installation with darwin-rebuild 2023-07-11 18:59:05 +10:00
Michael Hoang
f70f90c422 flake: add packages.darwin-{option,rebuild} 2023-07-11 18:59:05 +10:00
Michael Hoang
aeaafcc88a flake: add packages.darwin-uninstaller 2023-07-11 18:59:05 +10:00
Emily
f9724c4543 eval-config: rationalize handling of Nixpkgs
This is a big change that disentangles a lot of mistaken assumptions
about mixing multiple versions of Nixpkgs, treating external flake
inputs as gospel for the source of Nixpkgs and nix-darwin, etc.;
the end result should be much simpler conceptually, but it will be a
breaking change for anyone using `eval-config.nix` directly. Hopefully
that shouldn't be a big issue, as it is more of an internal API and
it's quite likely that existing uses may have been broken in the same
way the internal ones were.

It was previously easy to get into a state where your `lib` comes
from nix-darwin's `nixpkgs` input or a global channel and your
`pkgs` comes from another major version of Nixpkgs. This is pretty
fundamentally broken due to the coupling of `pkgs` to its corresponding
`lib`, but the brokenness was hidden much of the time until something
surfaced it. Now there is exactly one mandatory `lib` input to system
evaluation, and the handling of various additional options like `pkgs`
and `system` can be done modularly; maintaining backwards compatibility
with the previous calling convention is punted to the `default.nix`
and `lib.darwinSystem` entry points. `inputs` is no longer read by
nix-darwin or special in any way, merely a convention for user code,
and the argument is retained in the entry points only for backwards
compatibility.

All correct invocations of the entry points should keep working
after this change, and some previously-broken ones should be fixed
too. The documentation and template have been adjusted to show the
newly-recommended modular way of specifying various things, but no
deprecation warnings have been introduced yet by this change.

There is one potential, mostly cosmetic regression:
`system.nixpkgsRevision` and related options are less likely to be
set than before, in cases where it is not possible to determine the
origin of the package set. Setting `nixpkgs.source` explicitly will
make this work again, and I hope to look into sending changes upstream
to Nixpkgs to make `lib.trivial.revisionWithDefault` behave properly
under flakes, which would fix this regression and potentially allow
reducing some of the complexity.

Fixes: #669
2023-07-09 11:21:40 +01:00
Emily
d37abf456b flake.nix: remove the nixpkgs pin
The Markdown transition is over and our compatibility with
`nixpkgs-unstable` is restored.
2023-06-24 10:48:55 +01:00
Emily
f8c61f0098 flake.nix: add checks for the docs
Except for `manualEpub`, which is going away.
2023-06-24 09:03:26 +01:00
Emily
b7ccefadf9 flake.nix: temporarily pin nixpkgs version
This is the last bump of the nixpkgs-unstable channel before the
DocBookalypse.
2023-06-24 06:33:18 +01:00
Michael Hoang
fc955520dd flake: add template with basic flake config 2023-06-17 22:09:38 +10:00
Michael Hoang
5528b36698 eval-config: Support passing in pkgs
This is useful for flake users as they will usually already have an
instantiated Nixpkgs e.g.

    let
      pkgs = import nixpkgs {
        config.allowUnfree = true;
        overlays = [ ... ];
      }
    in darwin.lib.darwinSystem {
      inherit pkgs;
    }

This change makes `nix-darwin` match the behaviour of NixOS and
`home-manager`.
2022-02-04 21:32:40 +11:00
Daiderd Jordan
e1a3f7292f
improve flakes missing system error message 2021-09-15 20:22:23 +02:00
Drew Hess
9f7e95887f
Pass system to darwinSystem rather than eval-config.
This allows us to specify what kind of darwinSystem we want to build,
rather than determining it at evaluation time.
2021-09-08 13:05:18 +01:00
Daiderd Jordan
1216e9e0aa
split out flake overrides into a separate module 2020-10-25 12:55:55 +01:00
Daiderd Jordan
4a31cba84c
add flake versions 2020-10-21 18:30:56 +02:00
Daiderd Jordan
c4bc63d2b9
add flake and split evalConfig 2020-10-21 18:30:56 +02:00