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

254 commits

Author SHA1 Message Date
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
cc9c8408bb Revert "{activation-scripts,activate-system}: purify environment"
This shouldn’t actually be split out from the Plan because of the
current use of `$HOME` in the defaults for channel‐based setups.

This reverts commit 4bff4bc8ae.
2025-01-28 02:31:59 +00:00
Emily
4bff4bc8ae {activation-scripts,activate-system}: purify environment
This ensures that system activation does not depend on various
details of its process environment, ensuring uniformity across various
invocation contexts and with the `activate-system` daemon. This becomes
more important in a post‐user‐activation world to avoid problematic
dependencies like `$SUDO_USER`, but is a good idea in general.

The `sudoers(5)` defaults on my Sequoia system are:

    Defaults	env_reset
    Defaults	env_keep += "BLOCKSIZE"
    Defaults	env_keep += "COLORFGBG COLORTERM"
    Defaults	env_keep += "__CF_USER_TEXT_ENCODING"
    Defaults	env_keep += "CHARSET LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE"
    Defaults	env_keep += "LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME"
    Defaults	env_keep += "LINES COLUMNS"
    Defaults	env_keep += "LSCOLORS"
    Defaults	env_keep += "SSH_AUTH_SOCK"
    Defaults	env_keep += "TZ"
    Defaults	env_keep += "DISPLAY XAUTHORIZATION XAUTHORITY"
    Defaults	env_keep += "EDITOR VISUAL"
    Defaults	env_keep += "HOME MAIL"

Of these preserved environment variables, the ones that are set in
practice when I run `sudo env` that aren’t set in the activation
script here are:

* `$COLORTERM`
* `$DISPLAY`
* `$EDITOR`
* `$MAIL`
* `$SSH_AUTH_SOCK`
* `$TERM`
* `$__CF_USER_TEXT_ENCODING`

Most of these seem either pointless or actively harmful to set for
the purpose of the system activation script.

This will mean that tools run during activation won’t print output
in the user’s preferred language, but that’s probably the right
trade‐off overall, as that is likely to break activation scripts
that parse command output anyway.
2025-01-27 22:31:15 +00:00
Emily
0e87d3d391 activate-system: don’t KeepAlive
It seems like a bad idea to keep restarting the activation daemon
when it fails.
2025-01-27 22:31:15 +00:00
Michael Hoang
be4c1b897a openssh: init module 2025-01-10 10:23:09 +11:00
thuvasooriya
aefd56bb56
aerospace: add workspace-to-monitor-force-assignment option and fix on-window-detected type #1208
trying to fix #1142

testing requested changes

adding workspace to monitor force assignment

remove formatting

tests pass

proper tests

undo formatting

tests for on-window-detected and workspace-to-monitor-force-assignment

testing submodules

cleanup n if fiz

checking

final

toml null field aerospace callback issue

custom null filter for submodule list

check for no presense of window-regex and if.workspace config check

aerospace: add workspace-to-monitor-force-assignment option and fix
on-window-detected type #1208

trying to fix #1142

testing requested changes

adding workspace to monitor force assignment

remove formatting

tests pass

proper tests

undo formatting

tests for on-window-detected and workspace-to-monitor-force-assignment

testing submodules

cleanup n if fiz

checking

final

toml null field aerospace callback issue

custom null filter for submodule list

check for no presense of window-regex and if.workspace config check

error

formatting mishap

space left

small fix

formatting mishaps
2024-12-29 16:57:26 +05:30
Michael Hoang
8752b6ae3c github-runner: add instructions for triggering a runner registration 2024-12-07 13:08:55 +11:00
Michael Hoang
22cde06f49 github-runner: fix service not starting 2024-12-07 13:06:22 +11:00
Michael Hoang
06e1d77068 github-runner: use lib.getExe{,'} 2024-12-07 13:01:21 +11:00
Michael Hoang
d8255f09da github-runner: remove with lib; 2024-12-07 12:54:17 +11:00
z0al
9a59556018
fix(aerospace): allow startup commands 2024-12-04 19:03:03 +00:00
Michael Hoang
caa23e878f github-runner: make umask quiet 2024-11-22 11:19:46 +11:00
Michael Hoang
698414e409 nix-daemon: enable by default
Single user installs have been unsupported by the official Nix installer
since 2.4.
2024-11-16 23:19:11 +11:00
Michael Hoang
d2498644fd nix-daemon: remove with lib; 2024-11-16 23:19:11 +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
Yuriy Taraday
110d49af63 github-runner: Fix labels for different nixpkgs versions
Changes to escapeShellArg introduced in
https://github.com/NixOS/nixpkgs/pull/333744 made different versions of
nixpkgs behave differently. If current nix-darwin is used with nixpkgs
before that change, labels end up having labels quoted twice
(see https://github.com/LnL7/nix-darwin/issues/1085), but without
changes from https://github.com/LnL7/nix-darwin/pull/1055, with new
nixpkgs, labels end up not quoted at all, and ShellCheck ends up
complaining that commas might have been used as array item separator
(see https://www.shellcheck.net/wiki/SC2054).

Use the old version of escapeShellArg to always escape the list of
labels and make nix-darwin work with both old and new versions of
nixpkgs.

Fixes https://github.com/LnL7/nix-darwin/issues/1085
2024-11-07 11:46:08 +01:00
Michael Hoang
79608947e2 buildkit-agents: don't use mkdir -p -m
As `cfg.dataDir` will be the `home` of the Buildkite Agent user, it is
guaranted to exist so we don't need to use the `-p` flag.
2024-11-07 17:31:22 +11:00
Michael Hoang
3b738c765d github-runner: replace mkdir -p -m with umask
`mkdir -p -m` only applies the mode on the deepest directory which could
be a security issue so we use umask to be more careful.
2024-11-07 17:31:22 +11:00
Michael Hoang
569153467b ofborg: automatically add ofborg to known{Users,Groups} 2024-11-07 11:41:51 +11:00
Emily
84d14d4043 prometheus-node-exporter: fix log permissions
The daemon won’t start as the assigned user doesn’t have
permissions to create the log file.
2024-11-05 03:00:55 +00:00
Emily
189d2d422c
Merge pull request #1129 from mweinelt/node-exporter
module: add prometheus-node-exporter service
2024-11-04 05:40:01 +00:00
Benoît de Chezelles
331fd8d3b5 karabiner-elements: allow use of custom package 2024-10-31 16:51:05 +01:00
Martin Weinelt
6c8d45fb20
module: add prometheus-node-exporter service 2024-10-31 02:08:34 +01:00
Ihar Hrachyshka
445c6bfc65 Add keepalive flag for emacs service 2024-10-26 13:05:25 -04:00
Nick Hu
7ebf95a73e
style fixes 2024-10-19 10:49:55 +01:00
Nick Hu
72e93853c2
module: add aerospace service 2024-10-16 22:50:44 +01:00
Michael Hoang
6347a9dcd1 skhd: add skhd to PATH 2024-10-14 17:18:08 +11:00
Michael Hoang
fd0e3ed30b
Merge pull request #794 from fesplugas/patch-1
fix: postgresql service initdb
2024-10-13 08:39:35 +11:00
Michael Hoang
8c8388ade7
Merge pull request #1095 from aspauldingcode/master
jankyborders service option order above or below
2024-10-04 09:48:17 +10:00
Michael Hoang
c266b57bbe
Merge pull request #1077 from rsrohitsingh682/add-netadata
feat: add netdata service
2024-10-04 09:44:43 +10:00
Rohit Singh
239d802869 netdata: add netdata service in nix-darwin. 2024-10-03 23:42:10 +05:30
Alex S.
5cd9995215
Update modules/services/jankyborders/default.nix
Co-authored-by: Michael Hoang <Enzime@users.noreply.github.com>
2024-10-02 10:38:08 -06:00
aspauldingcode
af95f7b7ec add JankyBorders option order and set below by default (values: above/below) 2024-10-01 17:47:30 -06:00
will
3d19b90fc7
fix: karabiner elements virtualhiddeviceclient
- command needed to be quoted
2024-09-28 15:13:31 +10: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
Sirio Balmelli
c334175319
nixos/github-runner: quote comma separators so as to pass shellcheck
Shellcheck complains:

       > args=(
       >      ^-- SC2054 (warning): Use spaces, not commas, to separate array elements.

Quote the --labels argument to resolve.

Signed-off-by: Sirio Balmelli <sirio@b-ad.ch>
2024-09-06 14:57:35 +02:00
Michael Hoang
dc8e1f4839 github-runners: move workDir outside of /run
As `/run` gets recreated every reboot and we can't specify dependencies
for launchd, creating the `workDir` every reboot will require extra
complexity with a separate daemon that runs as `root` otherwise it won't
have sufficient privileges.

As we clean the `workDir` when the service first starts anyway, it ends
up being the same.
2024-07-27 10:41:18 +10:00
Michael Hoang
5c8fb55182 Revert "github-runnners: fix workDir missing on reboot"
This reverts commit fe99aa9699.
2024-07-27 10:26:37 +10:00
Michael Hoang
fe99aa9699 github-runnners: fix workDir missing on reboot 2024-07-23 11:06:40 +10:00
Nikola Milojević
199cf34012
chore: removing deprecations for 25.05 nix 2024-07-22 13:37:17 +02:00
Emily
33bf7df5bb
Merge pull request #973 from amsynist/modules/services/jankyborders
module : `jankyborders` for window borders Configuration
2024-07-21 09:21:06 +01:00
Prav!n
fa0d64721f module: add jankyborders service
- Added the jankyborders service.
- Introduced changes for whitelist and blacklist options and assertions.
- emoved path reference from launchd argument.
- Corrected missing trailing newline in default.nix.
2024-07-21 02:54:45 +05:30
Henrique Goncalves
e2a85731a0
nextdns: fix argument handling 2024-07-08 16:36:31 -03:00
Nikola Milojević
e00896468a
chore: remove mkpackageoptionmd deprecation 2024-07-01 16:24:41 +02:00
Tyler Miller
861af0fc94
fix(launchd): improve StartCalendarInterval
Stricter launchd -> StartCalendarInterval type:

- Verify that the integers passed to `Minute`, `Hour`, etc. are within
  range.

- When provided, the value for StartCalendarInterval must be a non-empty
  list of calendar intervals and must not contain duplicates entries
  (throw an error otherwise).

- For increased flexibility and backwards-compatibility, allow an
  attrset to be passed as well (which will be type-checked and is
  functionally equivalent to passing a singleton list). Allowing an
  attrset or list is precisely in-line with what `launchd.plist(5)`
  accepts for StartCalendarInterval.

Migrate `nix.gc.interval` and `nix.optimise.interval` over to use this
new type, and update their defaults to run weekly instead of daily.

Create `modules/launchd/types.nix` file for easier/modular use of
launchd types needed in multiple files.

Documentation:

- Update and improve wording/documentation of launchd's
  `StartCalendarInterval`.

- Improve wording/documentation of `nix.gc.interval` and
  `nix.optimise.interval` ("time interval" can be misleading as it's
  actually a "calendar interval"; e.g. `{ Hour = 3; Minute = 15;}`
  runs daily, not every 3.25 hours).
2024-06-09 11:20:15 -07:00
zowoq
251eaabfa0 hercules-ci-agent: fix crash calling security
this applies the same fix that was used for the cachix agent in e043606b50
2024-05-21 23:16:46 +10:00
Sander
e043606b50
cachix-agent: fix crash calling security
One of cachix-agent's dependencies, `hs-certificate`, makes calls to
`security`. This lives in `/usr/bin`, which isn't available from
launchd. This commit makes the system paths available to cachix-agent.

Fixes #924.
2024-05-16 18:04:33 +04:00
zowoq
ec06ea8837 nix-daemon: increase SoftResourceLimits.NumberOfFiles
1048576 matches the nixos/nix plist

e3a4e40a35/misc/launchd/org.nixos.nix-daemon.plist.in (L29)
2024-04-24 16:03:49 +10:00
Weijia Wang
def1e23be8 treewide: remove lib.mdDoc 2024-04-19 04:05:50 +02:00