1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-06 16:57:08 +00:00
Commit graph

174 commits

Author SHA1 Message Date
Emily
cd445c5465 nix: catch reads of unmanaged defaults
When we’re not managing the Nix installation, these defaults
aren’t used out of the box and won’t accurately represent the
state of any unmanaged Nix or the desired Nix package, so reading
the option defaults is a bug.

This was previously a warning for `nix.package` and a silent failure
for all the others. Now that all the problematic accesses in nix-darwin
have been appropriately conditionalized, and since a throw gives a
backtrace where a warning doesn’t, give throwing defaults to all the
`nix.*` options that don’t reflect reality and that that modules
shouldn’t be reading when `nix.enable` is off.

I’m not in love with the implementation strategy here… ideally
we’d think of something better than this and then upstream it to
NixOS. `nix.nrBuildUsers` growing a fake default that is never used
is particularly unfortunate. But this should hopefully catch mistakes
in module code reasonably reliably.
2025-02-11 20:10:55 +00:00
Emily
d677e3e844 nix-tools: only pass config.nix.nixPath through if nix.enable 2025-02-11 20:10:55 +00:00
Emily
147ed950e3 nixpkgs-flake: check for nix.enable 2025-02-11 20:10:55 +00:00
Emily
7cca8f95f7 linux-builder: check for nix.enable 2025-02-11 20:10:55 +00:00
Emily
a6746213b1
Merge pull request #1313 from emilazy/push-tzwxwyvonslk
nix: add `nix.enable` option to disable Nix management
2025-02-11 19:30:41 +00:00
Emily
adc989f7ec nix: remove nix.configureBuildUsers
We now manage the build users unconditionally when we manage the
Nix installation.
2025-02-07 19:44:59 +00:00
Emily
c796587d2e nix: remove nix.useDaemon
We now assume the daemon is used unconditionally when we manage the
Nix installation.

The `nix.gc` and `nix.optimise` services lose their `$NIX_REMOTE`
setting rather than making it unconditional, as the NixOS `nix.gc`
module does not set it. Possibly it should, but I think uniformity
between the two systems is better than diverging, even though I kind
of hate that the non‐daemon method of access is even a thing.
2025-02-07 19:44:59 +00:00
Emily
e182d8dff6 nix: add nix.enable option to disable Nix management
This is an equivalent of the `nix.enable` option from NixOS
and Home Manager. On NixOS, it mostly serves to allow building
fixed‐configuration systems without any Nix installation at
all. It should work for that purpose with nix-darwin too, and the
implementation is largely the same, but the main use case is more
similar to the Home Manager option: to allow the use of nix-darwin
with an unmanaged system installation of Nix, including when there
is another service expecting to manage it, as with Determinate.

By providing an escape hatch to opt out of Nix management entirely,
this will also allow us to consolidate and simplify our existing Nix
installation management, by being more opinionated about things like
taking ownership of the daemon and the build users. Porting one option
from NixOS lets us drop two that only ever existed in nix-darwin and
reduce overall complexity.
2025-02-07 19:44:59 +00:00
Emily
da3311397a Revert "nixpkgs: make config.nixpkgs.{buildPlatform,hostPlatform} write only"
This was reverted upstream in 0b47fba23078cc01251b136c7af0127abd57112b.

This reverts commit 7c72c013b1.
2025-02-05 22:06:04 +00:00
Emily
9b9c9a57b6 nix: don’t set $NIX_REMOTE
NixOS doesn’t bother doing this, and Nix already matches this
conditional behaviour when `$NIX_REMOTE` is unset.
2025-02-05 15:14:04 +00:00
Emily
8f227c405e nix: fix typo in assertion conditional 2025-02-05 15:14:04 +00:00
Emily
7c72c013b1 nixpkgs: make config.nixpkgs.{buildPlatform,hostPlatform} write only
The description for options.nixpkgs.system already hints at this:

  Neither ${opt.system} nor any other option in nixpkgs.* is meant
  to be read by modules and configurations.
  Use pkgs.stdenv.hostPlatform instead.

We can support this goal by not elaborating the systems anymore, forcing
users to go via pkgs.stdenv.

This will prevent problems when making the top-level package sets
composable in the next commit. For this to work, you should pass a fully
elaborated system to nixpkgs' localSystem or crossSystem options.

Backport of Nixpkgs commit 0a19371146130c0e2a402fd0c35f8283b0e81910.

Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
2025-02-03 20:54:01 +00:00
Emily
dc1c716ded nixpkgs: format with nixfmt 2025-02-03 20:44:32 +00:00
Emily
80eddf2bf7 nixpkgs: show definition files in config assertion
Backport of Nixpkgs commit 6d9dfef94ffd59a327573eea7bc709a84c44b3d2.

Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
2025-02-03 20:44:32 +00:00
Emily
e84e84a256 nixpkgs: fix config assertion text
The assertion message should include the `nixpkgs.config` value, however
it currently includes the entire `nixpkgs.config` _option_.

This means the type, declarations, definitions, etc were all printed.

Backport of Nixpkgs commit 1bd4da1848cb7b68858ebb2ca1f8b0e5fed46c58.

Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
2025-02-03 20:44:32 +00:00
Emily
bd1d46766a nixpkgs: remove with lib;
Backport of Nixpkgs commit 609e57485d1fa111e3a689498d9d338dc03a7bc5.

Co-authored-by: Felix Buehler <account@buehler.rocks>
2025-02-03 20:44:32 +00:00
Emily
320bf025d2 nixpkgs: link to Nixpkgs manual for global configuration options
Backport of Nixpkgs commit e6057cfd59f278db3aeb058a4e1e0bcc24696267.

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Dominic Mills <dominic.millz27@gmail.com>
2025-02-03 20:44:32 +00:00
Emily
6b81859ed0 nixpkgs: fix determination for cross-compiled nix-darwin system
Since the output of `lib.systems.elaborate` contains functions, an
equality check with `==` does not suffice, `lib.systems.equals` should
be used instead.

Backport of Nixpkgs commit 3794246066409d7baac72e3fdfb0e4f66ef4a013.

Co-authored-by: Jared Baur <jaredbaur@fastmail.com>
2025-02-03 20:44:32 +00:00
Emily
2df9e48110 nixpkgs: use less confusing example systems
system and config shouldn't both be specified — each will be filled in
based on the other when the system is elaborated.

Backport of Nixpkgs commit a3ba0495452cd8e72735ebd4472838e96902a259.

Co-authored-by: Alyssa Ross <hi@alyssa.is>
2025-02-03 20:25:16 +00:00
Emily
3cd3a79f9b nixpkgs: Rewrite overlays option docs
henrik-ch was also here :)

Backport of Nixpkgs commit 11406bdc0e5af9b3c8a8d597da23349238c65277.

Co-authored-by: Silvan Mosberger <silvan.mosberger@tweag.io>
Co-Authored-By: Valentin Gagarin <valentin.gagarin@tweag.io>
2025-02-03 20:25:16 +00:00
Emily
962eb3f1c0 nixpkgs: assert that nixpkgs.config is not set when pkgs is passed in externally
This is a common footgun people hit often. Remove it.

Backport of Nixpkgs commit ce87196a00214a0062ece1c3e03a9a97f563580f.

Co-authored-by: K900 <me@0upti.me>
2025-02-03 20:25:16 +00:00
Emily
5b0cffeec2 nixpkgs: fix undefined variable in assertion
This got mangled in the backport a year and a half ago.

Fixes: e25eeff158
2025-02-03 20:25:16 +00:00
Emily
62ba0a2242
Merge pull request #1282 from emilazy/push-uqnyoyklywvo
nix-tools: drop `nixPackage`, overwrite `$PATH` rather than prepending, set `$NIX_PATH`
2025-01-26 21:26:41 +00:00
Emily
b5b7888793 nix-tools: set $NIX_PATH
This will be important once most users are running `sudo
darwin-rebuild` and therefore not getting their environment’s
`$NIX_PATH` passed through.
2025-01-20 05:29:44 +00:00
Emily
02232f71c5 nix-tools: drop nixPackage
We already put `/nix/var/nix/profiles/default/bin` on the `$PATH`,
and whatever `nix.package` is set to already gets installed into
`/run/current-system/sw/bin`, so this is pointless.
2025-01-18 20:31:54 +00:00
Emily
e1976612f0 system: tweak ShellCheck settings 2025-01-18 19:34:21 +00:00
Emily
87131f51f8
Merge pull request #1266 from emilazy/push-qwtkyltnunqn
checks: check `/etc/nix/nix.custom.conf` hash
2025-01-18 01:12:15 +00:00
Emily
8abb2e7244 nix: add hashes for Determinate Systems installer v0.33.0 and v0.34.0 2025-01-17 03:34:11 +00:00
Emily
2fe899db70 nix: check /etc/nix/nix.custom.conf hash 2025-01-17 03:34:11 +00:00
Michael Hoang
9e856ad0c1 nix: merge nix.settings.trusted-users by default
Backport of https://github.com/NixOS/nixpkgs/pull/318635
2025-01-08 14:27:40 +11:00
Domen Kožar
a35b08d09e
Merge pull request #1202 from Enzime/push-voxzmynopkkp
linux-builder: default `maxJobs` to amount of cores for Linux builder
2024-12-07 11:27:23 +00:00
Alex James
0f9576cedc
nix: fix Lix version detection in auto-optimise-store assertion 2024-12-04 02:06:23 -06:00
Michael Hoang
70957ab0c6 linux-builder: default maxJobs to amount of cores for Linux builder 2024-11-28 14:16:47 +11:00
Michael Hoang
6d20de4ed6 nix: remove outdated note requiring managed daemon for distributedBuilds
For Nix 1, some environment variables were set when using distributed
builds requiring the Nix daemon to be managed by nix-darwin. However,
support for Nix 1 has been removed and no other environment variables
for Nix are set by default.
2024-11-17 01:11:27 +11:00
Michael Hoang
dae702993d activate-system: remove enable option
Disabling this is not supported as `/run` gets cleared out on every
reboot so it is necessary for ensuring that the `/run/current-system`
symlink exists.
2024-11-15 14:10:48 +11:00
Michael Hoang
f0a1269297 nix: don't allow using auto-optimise-store as it can corrupt the store 2024-11-08 12:48:15 +11:00
isabel
c9fd4820d5
programs/bash: move to completion.*
a port of https://github.com/NixOS/nixpkgs/pull/291552 for darwin
2024-10-08 10:05:26 +01:00
will
034c45dd0c
feat: use wait4path with script launchd option
addresses https://github.com/LnL7/nix-darwin/issues/1043

fix: use exec in launchd daemon config

fix: dont use a script thats in the nix store

fix: remove manual wait4path in linux-builder

fix: remove manual wait4path in karabiner elements

fix: remove manual wait4path in nix-daemon

fix: remove manual wait4path in nix-optimise

fix: remove manual wait4path in tailscaled

fix: autossh test

Revert "fix: remove manual wait4path in nix-daemon"

This reverts commit 6aec084fa5d095666e81676e78f7054c83703faa.

fix: remove bad exec

Reapply "fix: remove manual wait4path in nix-daemon"

This reverts commit c8f136ecc555f803124af471324bc6ed1163d6dd.

fix: update autossh test

to reflect changes in f86e6133d957becb1958da638516b0860fbd7491

fix: services-activate-system-changed-label-prefix test

fix: services-buildkite-agent test

fix: services-activate-system test

fix: escape ampersand

fix: services-lorri test

fix: services-nix-optimise test

fix: services-nix-gc test

refactor: use script rather than command in daemon

fix: use config.command for clarity

style: fix indentation

fix: use lib.getExe rather than directly pointing to file

revert: a87fc7bbbbdb7c25c5ad6721c93990ea035affdd

- mistaken refactor meant that service waited for nix store and not the relevant path
2024-09-22 15:30:21 +10:00
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
Michael Hoang
e1b6f307ec linux-builder: make package.nixosConfig accurate 2024-09-05 13:54:53 +10:00
Corey Jewett
544db3691c Add sha256 for DeterminateSystems Nix installer 0.22.0 2024-08-29 10:51:52 -07:00
Michael Hoang
ac5694a0b8
Merge pull request #1044 from Enzime/add/known-hash
etc: add known hash for DetSys installer 0.20.0+
2024-08-25 14:56:10 +10:00
Michael Hoang
2bd4949af3 etc: add known hash for DetSys installer 0.20.0+ 2024-08-25 14:36:37 +10:00
isabel
c06794de03
feat: system.disableInstallerTools 2024-08-21 14:29:54 +01:00
Alice Carroll
5afa71b413
fix: respect user nixPath configuration 2024-08-17 02:51:01 +03:00
Alice Carroll
691a590bff
feat: allow disabling channels 2024-08-17 02:51:01 +03:00
Thane Gill
395e4d3794
Update modules/nix/linux-builder.nix
Co-authored-by: Michael Hoang <Enzime@users.noreply.github.com>
2024-07-12 09:50:57 -07:00
Thane Gill
b34d1bee48 Add User and already generated IdentityFile to ssh_config for nix.linux-builder 2024-07-09 13:16:19 -07:00
Ian Chamberlain
b7e112cdf9
Add lix-installer to known files 2024-07-06 18:04:06 -04:00
Michael Hoang
29b3096a6e
Merge pull request #974 from nicknovitski/linux-builder-crossarch 2024-06-17 22:17:38 +00:00