mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
Update def and implementation of nix.package
to match NixOS module
Also remove `nix.version` option since it's no longer being used anywhere, old irrelevant `nix-info` module, and all support for legacy `nix.profile` option.
This commit is contained in:
parent
490ef80485
commit
5f141365af
4 changed files with 15 additions and 48 deletions
|
@ -10,7 +10,6 @@ in
|
|||
options = {
|
||||
|
||||
networking.networkservices = mkOption { internal = true; default = null; };
|
||||
nix.profile = mkOption { internal = true; default = null; };
|
||||
security.enableAccessibilityAccess = mkOption { internal = true; default = null; };
|
||||
security.accessibilityPrograms = mkOption { internal = true; default = null; };
|
||||
|
||||
|
@ -19,8 +18,7 @@ in
|
|||
config = {
|
||||
|
||||
assertions =
|
||||
[ { assertion = config.nix.profile == null; message = "nix.profile was renamed to nix.package"; }
|
||||
{ assertion = config.security.enableAccessibilityAccess == null; message = "security.enableAccessibilityAccess was removed, it's broken since 10.12 because of SIP"; }
|
||||
[ { assertion = config.security.enableAccessibilityAccess == null; message = "security.enableAccessibilityAccess was removed, it's broken since 10.12 because of SIP"; }
|
||||
{ assertion = config.system.activationScripts.extraPostActivation.text == ""; message = "system.activationScripts.extraPostActivation was renamed to system.activationScripts.postActivation"; }
|
||||
{ assertion = config.system.activationScripts.extraUserPostActivation.text == ""; message = "system.activationScripts.extraUserPostActivation was renamed to system.activationScripts.postUserActivation"; }
|
||||
];
|
||||
|
@ -31,8 +29,6 @@ in
|
|||
|
||||
networking.knownNetworkServices = mkIf (config.networking.networkservices != null) config.networking.networkservices;
|
||||
|
||||
nix.package = mkIf (config.nix.profile != null) config.nix.profile;
|
||||
|
||||
system.activationScripts.extraPostActivation.text = mkDefault "";
|
||||
system.activationScripts.extraUserPostActivation.text = mkDefault "";
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
./networking
|
||||
./nix
|
||||
./nix/nix-darwin.nix
|
||||
./nix/nix-info.nix
|
||||
./nix/nixpkgs.nix
|
||||
./environment
|
||||
./fonts
|
||||
|
|
|
@ -6,7 +6,7 @@ let
|
|||
|
||||
cfg = config.nix;
|
||||
|
||||
isNix20 = versionAtLeast (cfg.version or "<unknown>") "1.12pre";
|
||||
nixPackage = cfg.package.out;
|
||||
|
||||
nixConf =
|
||||
let
|
||||
|
@ -61,9 +61,10 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
imports = mapAttrsToList (oldConf: newConf:
|
||||
mkRenamedOptionModule [ "nix" oldConf ] [ "nix" "settings" newConf ]
|
||||
) legacyConfMappings;
|
||||
imports = [
|
||||
(mkRemovedOptionModule [ "nix" "profile" ] "Use `nix.package` instead.")
|
||||
(mkRemovedOptionModule [ "nix" "version" ] "Consider using `nix.package.version` instead.")
|
||||
] ++ mapAttrsToList (oldConf: newConf: mkRenamedOptionModule [ "nix" oldConf ] [ "nix" "settings" newConf ]) legacyConfMappings;
|
||||
|
||||
###### interface
|
||||
|
||||
|
@ -72,26 +73,14 @@ in
|
|||
nix = {
|
||||
|
||||
package = mkOption {
|
||||
type = types.either types.package types.path;
|
||||
type = types.package;
|
||||
default = pkgs.nix;
|
||||
defaultText = "pkgs.nix";
|
||||
example = literalExpression "pkgs.nixUnstable";
|
||||
defaultText = literalExpression "pkgs.nix";
|
||||
description = ''
|
||||
This option specifies the package or profile that contains the version of Nix to use throughout the system.
|
||||
To keep the version of nix originally installed the default profile can be used.
|
||||
|
||||
eg. /nix/var/nix/profiles/default
|
||||
This option specifies the Nix package instance to use throughout the system.
|
||||
'';
|
||||
};
|
||||
|
||||
# Not in NixOS module
|
||||
version = mkOption {
|
||||
type = types.str;
|
||||
default = "<unknown>";
|
||||
example = "1.11.6";
|
||||
description = "The version of nix. Used to determine what settings to configure in nix.conf";
|
||||
};
|
||||
|
||||
# Not in NixOS module
|
||||
useDaemon = mkOption {
|
||||
type = types.bool;
|
||||
|
@ -475,14 +464,12 @@ in
|
|||
]))
|
||||
];
|
||||
|
||||
|
||||
nix.package = mkIf (config.system.stateVersion < 3)
|
||||
(mkDefault "/nix/var/nix/profiles/default");
|
||||
|
||||
nix.version = mkIf (isDerivation cfg.package) cfg.package.version or "<unknown>";
|
||||
|
||||
environment.systemPackages = mkIf (isDerivation cfg.package)
|
||||
[ cfg.package ];
|
||||
environment.systemPackages =
|
||||
[
|
||||
nixPackage
|
||||
pkgs.nix-info
|
||||
]
|
||||
++ optional (config.programs.bash.enableCompletion) pkgs.nix-bash-completions;
|
||||
|
||||
environment.etc."nix/nix.conf".source = nixConf;
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
nix-info = pkgs.nix-info or null;
|
||||
in
|
||||
|
||||
{
|
||||
config = {
|
||||
|
||||
environment.systemPackages = mkIf (nix-info != null) [ nix-info ];
|
||||
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue