mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
specialisation: renamed from specialization
Renamed to be consistent with NixOS. Fixes #4074
This commit is contained in:
parent
b01eb1eb3b
commit
c8dafb187b
5 changed files with 20 additions and 17 deletions
|
@ -3,7 +3,10 @@
|
|||
with lib;
|
||||
|
||||
{
|
||||
options.specialization = mkOption {
|
||||
imports =
|
||||
[ (mkRenamedOptionModule [ "specialization" ] [ "specialisation" ]) ];
|
||||
|
||||
options.specialisation = mkOption {
|
||||
type = types.attrsOf (types.submodule {
|
||||
options = {
|
||||
configuration = mkOption {
|
||||
|
@ -11,10 +14,10 @@ with lib;
|
|||
extended = extendModules {
|
||||
modules = [{
|
||||
# Prevent infinite recursion
|
||||
specialization = mkOverride 0 { };
|
||||
specialisation = mkOverride 0 { };
|
||||
|
||||
# If used inside the NixOS/nix-darwin module, we get conflicting definitions
|
||||
# of `name` inside the specialization: one is the user name coming from the
|
||||
# of `name` inside the specialisation: one is the user name coming from the
|
||||
# NixOS module definition and the other is `configuration`, the name of this
|
||||
# option. Thus we need to explicitly wire the former into the module arguments.
|
||||
# See discussion at https://github.com/nix-community/home-manager/issues/3716
|
||||
|
@ -34,19 +37,19 @@ with lib;
|
|||
description = ''
|
||||
A set of named specialized configurations. These can be used to extend
|
||||
your base configuration with additional settings. For example, you can
|
||||
have specializations named <quote>light</quote> and <quote>dark</quote>
|
||||
have specialisations named <quote>light</quote> and <quote>dark</quote>
|
||||
that applies light and dark color theme configurations.
|
||||
|
||||
</para><para>
|
||||
|
||||
Note, this is an experimental option for now and you therefore have to
|
||||
activate the specialization by looking up and running the activation
|
||||
activate the specialisation by looking up and running the activation
|
||||
script yourself. Note, running the activation script will create a new
|
||||
Home Manager generation.
|
||||
|
||||
</para><para>
|
||||
|
||||
For example, to activate the <quote>dark</quote> specialization. You can
|
||||
For example, to activate the <quote>dark</quote> specialisation. You can
|
||||
first look up your current Home Manager generation by running
|
||||
|
||||
<programlisting language="console">
|
||||
|
@ -57,7 +60,7 @@ with lib;
|
|||
then run
|
||||
|
||||
<programlisting language="console">
|
||||
$ /nix/store/jy…ac-home-manager-generation/specialization/dark/activate
|
||||
$ /nix/store/jy…ac-home-manager-generation/specialisation/dark/activate
|
||||
Starting Home Manager activation
|
||||
…
|
||||
</programlisting>
|
||||
|
@ -69,14 +72,14 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
config = mkIf (config.specialization != { }) {
|
||||
config = mkIf (config.specialisation != { }) {
|
||||
home.extraBuilderCommands = let
|
||||
link = n: v:
|
||||
let pkg = v.configuration.home.activationPackage;
|
||||
in "ln -s ${pkg} $out/specialization/${n}";
|
||||
in "ln -s ${pkg} $out/specialisation/${n}";
|
||||
in ''
|
||||
mkdir $out/specialization
|
||||
${concatStringsSep "\n" (mapAttrsToList link config.specialization)}
|
||||
mkdir $out/specialisation
|
||||
${concatStringsSep "\n" (mapAttrsToList link config.specialisation)}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -32,7 +32,7 @@ let
|
|||
./misc/numlock.nix
|
||||
./misc/pam.nix
|
||||
./misc/qt.nix
|
||||
./misc/specialization.nix
|
||||
./misc/specialisation.nix
|
||||
./misc/submodule-support.nix
|
||||
./misc/tmpfiles.nix
|
||||
./misc/version.nix
|
||||
|
|
|
@ -53,7 +53,7 @@ import nmt {
|
|||
./modules/home-environment
|
||||
./modules/misc/fontconfig
|
||||
./modules/misc/nix
|
||||
./modules/misc/specialization
|
||||
./modules/misc/specialisation
|
||||
./modules/programs/aerc
|
||||
./modules/programs/alacritty
|
||||
./modules/programs/alot
|
||||
|
|
|
@ -1 +1 @@
|
|||
{ specialization = ./specialization.nix; }
|
||||
{ specialisation = ./specialisation.nix; }
|
||||
|
|
|
@ -4,7 +4,7 @@ with lib;
|
|||
|
||||
{
|
||||
home.file.testfile.text = "not special";
|
||||
specialization.test.configuration = {
|
||||
specialisation.test.configuration = {
|
||||
home.file.testfile.text = "very special";
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@ with lib;
|
|||
assertFileExists home-files/testfile
|
||||
assertFileContains home-files/testfile "not special"
|
||||
|
||||
assertFileExists specialization/test/home-files/testfile
|
||||
assertFileContains specialization/test/home-files/testfile "not special"
|
||||
assertFileExists specialisation/test/home-files/testfile
|
||||
assertFileContains specialisation/test/home-files/testfile "not special"
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue