Skip to content

Commit

Permalink
Merge branch 'LnL7:master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
HeinrichApfelmus authored Nov 24, 2023
2 parents 1fe8a5e + 4b9b83d commit fb2a110
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 33 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 { };
}
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
16 changes: 12 additions & 4 deletions modules/nix/nix-darwin.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:

let
nix-tools = pkgs.callPackage ../../pkgs/nix-tools {
Expand All @@ -7,22 +7,30 @@ let
nixPackage = config.nix.package;
};

darwin-uninstaller = pkgs.callPackage ../../pkgs/darwin-uninstaller { };

inherit (nix-tools) darwin-option darwin-rebuild darwin-version;
in

{
config = {
options = {
system.includeUninstaller = lib.mkOption {
type = lib.types.bool;
internal = true;
default = true;
};
};

config = {
environment.systemPackages =
[ # Include nix-tools by default
darwin-option
darwin-rebuild
darwin-version
];
] ++ lib.optional config.system.includeUninstaller darwin-uninstaller;

system.build = {
inherit darwin-option darwin-rebuild darwin-version;
};

};
}
2 changes: 1 addition & 1 deletion pkgs/darwin-uninstaller/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ lib, ... }:

with lib;

Expand Down
28 changes: 12 additions & 16 deletions pkgs/darwin-uninstaller/default.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
{ stdenv, nix, pkgs, nix-darwin }:
{ stdenv, lib, pkgs }:

let
configuration = builtins.path {
name = "nix-darwin-uninstaller-configuration";
path = ./.;
filter = name: _type: name != toString ./default.nix;
uninstallSystem = import ../../eval-config.nix {
inherit lib;
modules = [
./configuration.nix
{
nixpkgs.source = pkgs.path;
nixpkgs.hostPlatform = pkgs.system;
system.includeUninstaller = false;
}
];
};

nixPath = pkgs.lib.concatStringsSep ":" [
"darwin-config=${configuration}/configuration.nix"
"darwin=${nix-darwin}"
"nixpkgs=${pkgs.path}"
"$NIX_PATH"
];
in

stdenv.mkDerivation {
Expand Down Expand Up @@ -62,10 +61,7 @@ stdenv.mkDerivation {
esac
fi
export nix=${nix}
export NIX_PATH=${nixPath}
system=$($nix/bin/nix-build '<darwin>' -A system)
$system/sw/bin/darwin-rebuild switch
${uninstallSystem.system}/sw/bin/darwin-rebuild activate
if test -L /run/current-system; then
sudo rm /run/current-system
Expand Down

0 comments on commit fb2a110

Please sign in to comment.