Commit graph

31 commits

Author SHA1 Message Date
zowoq
36fed93cf5 fold -> foldr
deprecated in f4d36941eb
2025-11-26 19:41:19 +10:00
Michael Hoang
cd6a8a796d config/system-path: restructure to mirror NixOS
2795c506fe/nixos/modules/config/system-path.nix
2025-05-25 14:06:56 +10:00
Robert Hensing
acf6b46011 system.build: Treat as variables, make lazy
This fixes an unnecessary evaluation dependency that prevented the
custom and much appreciated primaryUser error from popping up.

Specifically:

       … while evaluating the option `system.build':

       … while evaluating definitions from `/nix/store/lc6n4bhxj9255kzfn9pnpx65583a8cgc-source/modules/environment':

       … while evaluating definitions from `/nix/store/lc6n4bhxj9255kzfn9pnpx65583a8cgc-source/modules/nix':

       … while evaluating the option `environment.darwinConfig':

       … while evaluating the option `system.primaryUserHome':

       error: expected a string but found null: null
       at /nix/store/lc6n4bhxj9255kzfn9pnpx65583a8cgc-source/modules/system/primary-user.nix:26:30:
           25|       default =
           26|         config.users.users.${config.system.primaryUser}.home or "/Users/${config.system.primaryUser}";
             |                              ^
           27|     };

While it did have some indication as to the cause, it lets the good
error message go to waste.

**Context**

`lazyAttrsOf` is the better choice when you use an attrset as individual
variables instead of in aggregate (e.g. `attrNames`, `toJSON`).

The reason is that an expression like `a.b` is strict in `a`, which
entails the evaluating the _whole_ set of attribute _names_ in `a`.
In the `attrsOf` this means evaluating all `mkIf` conditions, which
in turn also means evaluating all the regular definitions to the
smallest degree (WHNF) to determine that they're not `mkIf`s.

`lazyAttrsOf` simply assumes that all attributes aren't `mkIf false`,
and throws an error in the attribute value if necessary.
This would be a problem with `toJSON` and such, but is completely
fine when the attributes are treated as variables of a lazy program,
as is the case here.

**NixOS**

NixOS made `system.build` a submodule with a `freeformType`, allowing
the things inside of it to be declared, and for them to have niceties
like documentation and merging behavior.
nix-darwin could probably adopt this.
2025-05-23 12:00:51 +02:00
Siddhartha Sahu
24952f03f9
Update default.nix 2025-05-17 12:15:49 -04:00
Emily
2ca294741f activation-scripts: get rid of user activation
🎉

Closes: #96
2025-05-16 16:34:31 +01:00
Emily
e1976612f0 system: tweak ShellCheck settings 2025-01-18 19:34:21 +00:00
Michael Hoang
3ea1144938 system: run shellcheck on activate and activate-user scripts 2024-11-07 17:15:22 +11:00
Weijia Wang
def1e23be8 treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00
Domen Kožar
8caf3af927
Create $out/darwin-version
This fixes backwards compatibility with code that expects it.
2023-09-19 09:54:27 +01:00
Michael Hoang
0dafe2170d Add darwin-version command 2023-07-14 23:06:46 +10:00
Marco Rebhan
b70656affa Add system.systemBuilderCommands and systemBuilderArgs
These are the equivalents of the
NixOS options with the same name, introduced in
d3ac0938a7.
Allows running extra commands while building the system configuration
output, for example to add extra files into the output directory,
and passing arguments to the system builder's mkDerivation.
2023-07-10 16:05:55 +02:00
Emily
e65131e69c treewide: convert all option docs to Markdown
This process was automated by [my fork of `nix-doc-munge`]; thanks
to @pennae for writing this tool! It automatically checks that the
resulting documentation doesn't change, although my fork loosens
this a little to ignore some irrelevant whitespace and typographical
differences.

As of this commit there is no DocBook remaining in the options
documentation.

You can play along at home if you want to reproduce this commit:

    $ NIX_PATH=nixpkgs=flake:nixpkgs/c1bca7fe84c646cfd4ebf3482c0e6317a0b13f22 \
      nix shell nixpkgs#coreutils \
      -c find . -name '*.nix' \
      -exec nix run github:emilazy/nix-doc-munge/0a7190f600027bf7baf6cb7139e4d69ac2f51062 \
      {} +

[my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge
2023-06-24 10:48:55 +01:00
Daiderd Jordan
77121650d4
system: add patches module 2020-05-29 21:29:20 +02:00
Daiderd Jordan
23d8c6ca3d
documentation: add module for darwin manual
Fixes #72
2019-05-04 15:38:17 +02:00
Daiderd Jordan
4d892e7774
fonts: rewrite activation
The new implementation is a bit smarter and only updates fonts that
changed.  But more importantly /run/current-system isn't used anymore
which breaks initial activation and installs the previous set of fonts
instead of the one in the new system.

Fixes #115
2019-02-17 11:31:40 +01:00
Daiderd Jordan
bf72128177
toplevel: don't depend on NIX_PATH for the CHANGELOG 2018-01-13 14:20:13 +01:00
Daiderd Jordan
e8355cdd93
system-build: change type of setEnvironment and setAliases
On NixOS system.build.setEnvironment also is a writeText
2017-10-07 12:41:33 +02:00
Daiderd Jordan
cf9f74596a
system-version: add system.stateVersion option 2017-10-01 16:37:51 +02:00
Daiderd Jordan
b5e0b273c4
darwin: show CHANGELOG during activation 2017-07-23 18:56:37 +02:00
Daiderd Jordan
290b1d8aad
system-packages: link applications to ~/Applications 2017-05-20 14:23:05 +02:00
Daiderd Jordan
00315bcc9e
launchd: don't use $HOME 2017-05-11 23:43:05 +02:00
Daiderd Jordan
93581740af
launchd: unload and stop disabled services 2017-05-11 21:27:06 +02:00
Daiderd Jordan
0cbdc2f8f9
launchd: add user agents 2017-01-25 22:35:06 +01:00
Daiderd Jordan
4c7f6b61bc
add support for assertions and warnings 2017-01-08 13:11:02 +01:00
Daiderd Jordan
58e4f7d0cf
use nixpkgsVersion as default system.darwinLabel 2016-12-19 21:09:10 +01:00
Daiderd Jordan
6af52615ed
add activate-user script 2016-12-14 12:32:20 +01:00
Daiderd Jordan
033499c0ed
only activate system profile with sudo 2016-12-07 23:06:18 +01:00
Daiderd Jordan
7b3ace08c5
add service module for system activation 2016-12-04 10:38:21 +01:00
Daiderd Jordan
61a91d3c99
improve system activation 2016-12-02 23:54:46 +01:00
Daiderd Jordan
81b8a44e40
add /Library/LaunchDaemons to system 2016-11-07 21:00:23 +01:00
Daiderd Jordan
926395d628
reorganize modules 2016-11-06 22:38:31 +01:00
Renamed from modules/system.nix (Browse further)