mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-05 16:27:03 +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:
parent
e67f2bf515
commit
09284ab00b
5 changed files with 28 additions and 24 deletions
|
@ -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 (
|
nix-darwin = lib.cleanSource (
|
||||||
lib.cleanSourceWith {
|
lib.cleanSourceWith {
|
||||||
# We explicitly specify a name here otherwise `cleanSource` will use the
|
# We explicitly specify a name here otherwise `cleanSource` will use the
|
||||||
|
@ -30,5 +30,5 @@ in
|
||||||
|
|
||||||
eval // {
|
eval // {
|
||||||
installer = pkgs.callPackage ./pkgs/darwin-installer { inherit nix-darwin; };
|
installer = pkgs.callPackage ./pkgs/darwin-installer { inherit nix-darwin; };
|
||||||
uninstaller = pkgs.callPackage ./pkgs/darwin-uninstaller { inherit nix-darwin; };
|
uninstaller = pkgs.callPackage ./pkgs/darwin-uninstaller { };
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
overlays.default = final: prev: {
|
overlays.default = final: prev: {
|
||||||
inherit (prev.callPackage ./pkgs/nix-tools { }) darwin-rebuild darwin-option darwin-version;
|
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;
|
darwinModules.hydra = ./modules/examples/hydra.nix;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
nix-tools = pkgs.callPackage ../../pkgs/nix-tools {
|
nix-tools = pkgs.callPackage ../../pkgs/nix-tools {
|
||||||
|
@ -7,22 +7,30 @@ let
|
||||||
nixPackage = config.nix.package;
|
nixPackage = config.nix.package;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
darwin-uninstaller = pkgs.callPackage ../../pkgs/darwin-uninstaller { };
|
||||||
|
|
||||||
inherit (nix-tools) darwin-option darwin-rebuild darwin-version;
|
inherit (nix-tools) darwin-option darwin-rebuild darwin-version;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
config = {
|
options = {
|
||||||
|
system.includeUninstaller = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
internal = true;
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
environment.systemPackages =
|
environment.systemPackages =
|
||||||
[ # Include nix-tools by default
|
[ # Include nix-tools by default
|
||||||
darwin-option
|
darwin-option
|
||||||
darwin-rebuild
|
darwin-rebuild
|
||||||
darwin-version
|
darwin-version
|
||||||
];
|
] ++ lib.optional config.system.includeUninstaller darwin-uninstaller;
|
||||||
|
|
||||||
system.build = {
|
system.build = {
|
||||||
inherit darwin-option darwin-rebuild darwin-version;
|
inherit darwin-option darwin-rebuild darwin-version;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ lib, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
{ stdenv, nix, pkgs, nix-darwin }:
|
{ stdenv, lib, pkgs }:
|
||||||
|
|
||||||
let
|
let
|
||||||
configuration = builtins.path {
|
uninstallSystem = import ../../eval-config.nix {
|
||||||
name = "nix-darwin-uninstaller-configuration";
|
inherit lib;
|
||||||
path = ./.;
|
modules = [
|
||||||
filter = name: _type: name != toString ./default.nix;
|
./configuration.nix
|
||||||
};
|
{
|
||||||
|
nixpkgs.source = pkgs.path;
|
||||||
nixPath = pkgs.lib.concatStringsSep ":" [
|
nixpkgs.hostPlatform = pkgs.system;
|
||||||
"darwin-config=${configuration}/configuration.nix"
|
system.includeUninstaller = false;
|
||||||
"darwin=${nix-darwin}"
|
}
|
||||||
"nixpkgs=${pkgs.path}"
|
|
||||||
"$NIX_PATH"
|
|
||||||
];
|
];
|
||||||
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
|
@ -62,10 +61,7 @@ stdenv.mkDerivation {
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export nix=${nix}
|
${uninstallSystem.system}/sw/bin/darwin-rebuild activate
|
||||||
export NIX_PATH=${nixPath}
|
|
||||||
system=$($nix/bin/nix-build '<darwin>' -A system)
|
|
||||||
$system/sw/bin/darwin-rebuild switch
|
|
||||||
|
|
||||||
if test -L /run/current-system; then
|
if test -L /run/current-system; then
|
||||||
sudo rm /run/current-system
|
sudo rm /run/current-system
|
||||||
|
|
Loading…
Add table
Reference in a new issue