Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fork-fix-launchd-…
Browse files Browse the repository at this point in the history
…calendar-interval
  • Loading branch information
steveej committed May 17, 2024
2 parents 72d647c + ffc0118 commit 9f51e37
Show file tree
Hide file tree
Showing 135 changed files with 2,512 additions and 1,075 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:

env:
CURRENT_STABLE_CHANNEL: nixpkgs-23.05-darwin
CURRENT_STABLE_CHANNEL: nixpkgs-23.11-darwin

jobs:
test-stable:
Expand All @@ -13,9 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install nix corresponding to latest stable channel
uses: cachix/install-nix-action@v22
uses: cachix/install-nix-action@v23
with:
install_url: https://github.com/nix-community/nix-unstable-installer/releases/download/nix-2.10.0pre20220822_7c3ab57/install
install_url: https://releases.nixos.org/nix/nix-2.13.6/install
- run: nix-build ./release.nix -I nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }} -I darwin=. -A tests
- run: nix-build ./release.nix -I nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }} -I darwin=. -A manpages
- run: nix-build ./release.nix -I nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }} -I darwin=. -A examples.simple
Expand All @@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install nix from current unstable channel
uses: cachix/install-nix-action@v22
uses: cachix/install-nix-action@v23
- run: nix-build ./release.nix -I nixpkgs=channel:nixpkgs-unstable -I darwin=. -A tests
- run: nix-build ./release.nix -I nixpkgs=channel:nixpkgs-unstable -I darwin=. -A manpages
- run: nix-build ./release.nix -I nixpkgs=channel:nixpkgs-unstable -I darwin=. -A examples.simple
Expand All @@ -37,9 +37,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install nix corresponding to latest stable channel
uses: cachix/install-nix-action@v22
uses: cachix/install-nix-action@v23
with:
install_url: https://github.com/nix-community/nix-unstable-installer/releases/download/nix-2.10.0pre20220822_7c3ab57/install
install_url: https://releases.nixos.org/nix/nix-2.13.6/install
nix_path: nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }}
- name: Install ${{ env.CURRENT_STABLE_CHANNEL }} channel
run: |
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install nix from current unstable channel
uses: cachix/install-nix-action@v22
uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Install nixpkgs-unstable channel
Expand Down Expand Up @@ -126,9 +126,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install nix version corresponding to latest stable channel
uses: cachix/install-nix-action@v22
uses: cachix/install-nix-action@v23
with:
install_url: https://github.com/nix-community/nix-unstable-installer/releases/download/nix-2.10.0pre20220822_7c3ab57/install
install_url: https://releases.nixos.org/nix/nix-2.13.6/install
- name: Install nix-darwin
run: |
mkdir -p ~/.config/nix-darwin
Expand Down Expand Up @@ -209,7 +209,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install nix from current unstable channel
uses: cachix/install-nix-action@v22
uses: cachix/install-nix-action@v23
- name: Install nix-darwin
run: |
mkdir -p ~/.config/nix-darwin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- name: Build manual
run: |
nix-build ./release.nix -I nixpkgs=channel:nixpkgs-23.05-darwin -I darwin=. -A manualHTML
nix-build ./release.nix -I nixpkgs=channel:nixpkgs-23.11-darwin -I darwin=. -A manualHTML
- name: Push update to manual
run: |
Expand Down
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ nix-darwin is built up around [Nixpkgs](https://github.com/NixOS/nixpkgs), quite

To install nix-darwin, a working installation of [Nix](https://github.com/NixOS/nix#installation) is required.

> NOTE: Using `darwin-installer` is no longer necessary on flake based systems.
If you wish to use nix-darwin with flakes, please refer to the [flakes](#flakes) section.

```bash
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
Expand Down Expand Up @@ -69,10 +69,9 @@ Configuration lives in `~/.nixpkgs/darwin-configuration.nix`. Check out
}
```

## Flakes (experimental)
## Flakes

There is also preliminary support for building your configuration using a [flake](https://nixos.wiki/wiki/Flakes). This
is mostly based on the flake support that was added to NixOS.
nix-darwin aims for both non-flake and flake configurations to be well supported despite flakes being an experimental feature in Nix.

### Step 1. Creating `flake.nix`

Expand All @@ -86,11 +85,10 @@ If you don't have an existing `configuration.nix`, you can run the following com
mkdir -p ~/.config/nix-darwin
cd ~/.config/nix-darwin
nix flake init -t nix-darwin
sed -i '' "s/simple/$(scutil --get LocalHostName)/" flake.nix
```

Make sure to replace all occurrences of `simple` with your short hostname which you can find by running `hostname -s`.

> NOTE: Make sure to change `nixpkgs.hostPlatform` to `aarch64-darwin` if you are using Apple Silicon.
Make sure to change `nixpkgs.hostPlatform` to `aarch64-darwin` if you are using Apple Silicon.

</details>

Expand All @@ -105,8 +103,8 @@ Add the following to `flake.nix` in the same folder as `configuration.nix`:
description = "John's darwin system";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-23.05-darwin";
nix-darwin.url = "github:LnL7/nix-darwin/master";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-23.11-darwin";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
};
Expand All @@ -118,9 +116,9 @@ Add the following to `flake.nix` in the same folder as `configuration.nix`:
}
```

Make sure to replace `Johns-MacBook` with your short hostname which you can find by running `hostname -s`.
Make sure to replace `Johns-MacBook` with your hostname which you can find by running `scutil --get LocalHostName`.

> NOTE: Make sure to set `nixpkgs.hostPlatform` in your `configuration.nix` to either `x86_64-darwin` (Intel) or `aarch64-darwin` (Apple Silicon).
Make sure to set `nixpkgs.hostPlatform` in your `configuration.nix` to either `x86_64-darwin` (Intel) or `aarch64-darwin` (Apple Silicon).

</details>

Expand Down Expand Up @@ -174,7 +172,7 @@ export NIX_PATH=darwin=$HOME/.nix-defexpr/darwin:darwin-config=$HOME/.nixpkgs/da
cp ~/.nix-defexpr/darwin/modules/examples/simple.nix ~/.nixpkgs/darwin-configuration.nix

# you can also use this to rebootstrap nix-darwin in case
# darwin-rebuild is to old to activate the system.
# darwin-rebuild is too old to activate the system.
$(nix-build '<darwin>' -A system --no-out-link)/sw/bin/darwin-rebuild build
$(nix-build '<darwin>' -A system --no-out-link)/sw/bin/darwin-rebuild switch

Expand Down
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let
};
};

# The source code of this repo needed by the [un]installers.
# The source code of this repo needed by the installer.
nix-darwin = lib.cleanSource (
lib.cleanSourceWith {
# We explicitly specify a name here otherwise `cleanSource` will use the
Expand All @@ -30,5 +30,5 @@ in

eval // {
installer = pkgs.callPackage ./pkgs/darwin-installer { inherit nix-darwin; };
uninstaller = pkgs.callPackage ./pkgs/darwin-uninstaller { inherit nix-darwin; };
uninstaller = pkgs.callPackage ./pkgs/darwin-uninstaller { };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Generated by https://github.com/DeterminateSystems/nix-installer.
# See `/nix/nix-installer --version` for the version details.

build-users-group = nixbld
experimental-features = nix-command flakes repl-flake
bash-prompt-prefix = (nix:$name)\040
max-jobs = auto
extra-nix-path = nixpkgs=flake:nixpkgs
upgrade-nix-store-path-url = https://install.determinate.systems/nix-upgrade/stable/universal
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Generated by https://github.com/DeterminateSystems/nix-installer.
# See `/nix/nix-installer --version` for the version details.

build-users-group = nixbld
experimental-features = nix-command flakes repl-flake
bash-prompt-prefix = (nix:$name)\040
max-jobs = auto
extra-nix-path = nixpkgs=flake:nixpkgs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generated by https://github.com/DeterminateSystems/nix-installer, version 0.14.0.
build-users-group = nixbld
experimental-features = nix-command flakes repl-flake
bash-prompt-prefix = (nix:$name)\040
max-jobs = auto
extra-nix-path = nixpkgs=flake:nixpkgs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

# Set up Nix only on SSH connections
# See: https://github.com/DeterminateSystems/nix-installer/pull/714
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ] && [ -n "${SSH_CONNECTION}" ] && [ "${SHLVL}" -eq 1 ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
2 changes: 0 additions & 2 deletions doc/manual/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ in rec {
mkdir -p $dst
cp $styles/style.css $dst
cp $styles/overrides.css $dst
cp -r ${pkgs.documentation-highlighter} $dst/highlightjs
substitute ${./manual.md} manual.md \
Expand All @@ -86,7 +85,6 @@ in rec {
--revision ${lib.escapeShellArg revision} \
--generator "nixos-render-docs ${lib.version}" \
--stylesheet style.css \
--stylesheet overrides.css \
--stylesheet highlightjs/mono-blue.css \
--script ./highlightjs/highlight.pack.js \
--script ./highlightjs/loader.js \
Expand Down
1 change: 1 addition & 0 deletions eval-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ in
{
inherit (eval._module.args) pkgs;
inherit (eval) options config;
inherit (eval) _module;

system = eval.config.system.build.toplevel;
}
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
overlays.default = final: prev: {
inherit (prev.callPackage ./pkgs/nix-tools { }) darwin-rebuild darwin-option darwin-version;

darwin-uninstaller = prev.callPackage ./pkgs/darwin-uninstaller { nix-darwin = self; };
darwin-uninstaller = prev.callPackage ./pkgs/darwin-uninstaller { };
};

darwinModules.hydra = ./modules/examples/hydra.nix;
Expand Down
8 changes: 4 additions & 4 deletions modules/documentation/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ in
documentation.enable = mkOption {
type = types.bool;
default = true;
description = lib.mdDoc ''
description = ''
Whether to install documentation of packages from
{option}`environment.systemPackages` into the generated system path.
Expand All @@ -100,7 +100,7 @@ in
documentation.man.enable = mkOption {
type = types.bool;
default = true;
description = lib.mdDoc ''
description = ''
Whether to install manual pages and the {command}`man` command.
This also includes "man" outputs.
'';
Expand All @@ -109,7 +109,7 @@ in
documentation.info.enable = mkOption {
type = types.bool;
default = true;
description = lib.mdDoc ''
description = ''
Whether to install info pages and the {command}`info` command.
This also includes "info" outputs.
'';
Expand All @@ -118,7 +118,7 @@ in
documentation.doc.enable = mkOption {
type = types.bool;
default = true;
description = lib.mdDoc ''
description = ''
Whether to install documentation distributed in packages' `/share/doc`.
Usually plain text and/or HTML.
This also includes "doc" outputs.
Expand Down
28 changes: 14 additions & 14 deletions modules/environment/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ in
type = types.listOf types.package;
default = [];
example = literalExpression "[ pkgs.curl pkgs.vim ]";
description = lib.mdDoc ''
description = ''
The set of packages that appear in
/run/current-system/sw. These packages are
automatically available to all users, and are
Expand All @@ -34,39 +34,39 @@ in

environment.systemPath = mkOption {
type = types.listOf (types.either types.path types.str);
description = lib.mdDoc "The set of paths that are added to PATH.";
description = "The set of paths that are added to PATH.";
apply = x: if isList x then makeDrvBinPath x else x;
};

environment.profiles = mkOption {
type = types.listOf types.str;
description = lib.mdDoc "A list of profiles used to setup the global environment.";
description = "A list of profiles used to setup the global environment.";
};

environment.postBuild = mkOption {
type = types.lines;
default = "";
description = lib.mdDoc "Commands to execute when building the global environment.";
description = "Commands to execute when building the global environment.";
};

environment.extraOutputsToInstall = mkOption {
type = types.listOf types.str;
default = [];
example = [ "doc" "info" "devdoc" ];
description = lib.mdDoc "List of additional package outputs to be symlinked into {file}`/run/current-system/sw`.";
description = "List of additional package outputs to be symlinked into {file}`/run/current-system/sw`.";
};

environment.pathsToLink = mkOption {
type = types.listOf types.str;
default = [];
example = [ "/share/doc" ];
description = lib.mdDoc "List of directories to be symlinked in {file}`/run/current-system/sw`.";
description = "List of directories to be symlinked in {file}`/run/current-system/sw`.";
};

environment.darwinConfig = mkOption {
type = types.either types.path types.str;
default = "$HOME/.nixpkgs/darwin-configuration.nix";
description = lib.mdDoc ''
description = ''
The path of the darwin configuration.nix used to configure the system,
this updates the default darwin-config entry in NIX_PATH. Since this
changes an environment variable it will only apply to new shells.
Expand All @@ -79,14 +79,14 @@ in
environment.loginShell = mkOption {
type = types.str;
default = "$SHELL -l";
description = lib.mdDoc "Configure default login shell.";
description = "Configure default login shell.";
};

environment.variables = mkOption {
type = types.attrsOf (types.either types.str (types.listOf types.str));
default = {};
example = { EDITOR = "vim"; LANG = "nl_NL.UTF-8"; };
description = lib.mdDoc ''
description = ''
A set of environment variables used in the global environment.
These variables will be set on shell initialisation.
The value of each variable can be either a string or a list of
Expand All @@ -100,7 +100,7 @@ in
type = types.attrsOf types.str;
default = {};
example = { ll = "ls -l"; };
description = lib.mdDoc ''
description = ''
An attribute set that maps aliases (the top level attribute names in
this option) to command strings or directly to build outputs. The
alises are added to all users' shells.
Expand All @@ -110,7 +110,7 @@ in
environment.extraInit = mkOption {
type = types.lines;
default = "";
description = lib.mdDoc ''
description = ''
Shell script code called during global environment initialisation
after all variables and profileVariables have been set.
This code is asumed to be shell-independent, which means you should
Expand All @@ -120,7 +120,7 @@ in

environment.shellInit = mkOption {
default = "";
description = lib.mdDoc ''
description = ''
Shell script code called during shell initialisation.
This code is asumed to be shell-independent, which means you should
stick to pure sh without sh word split.
Expand All @@ -130,7 +130,7 @@ in

environment.loginShellInit = mkOption {
default = "";
description = lib.mdDoc ''
description = ''
Shell script code called during login shell initialisation.
This code is asumed to be shell-independent, which means you should
stick to pure sh without sh word split.
Expand All @@ -140,7 +140,7 @@ in

environment.interactiveShellInit = mkOption {
default = "";
description = lib.mdDoc ''
description = ''
Shell script code called during interactive shell initialisation.
This code is asumed to be shell-independent, which means you should
stick to pure sh without sh word split.
Expand Down
Loading

0 comments on commit 9f51e37

Please sign in to comment.