1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

Install darwin-uninstall by default, which includes the 'empty' config it switches to

Co-Authored-By: Michael Hoang <enzime@users.noreply.github.com>
This commit is contained in:
Graham Christensen 2023-11-10 12:53:56 -05:00 committed by Michael Hoang
parent e67f2bf515
commit 09284ab00b
5 changed files with 28 additions and 24 deletions

View file

@ -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
@ -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 { };
}

View file

@ -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;

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
let
nix-tools = pkgs.callPackage ../../pkgs/nix-tools {
@ -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;
};
};
}

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ lib, ... }:
with lib;

View file

@ -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 {
@ -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