mirror of
https://github.com/nix-community/home-manager
synced 2024-11-20 01:59:45 +01: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;
|
with lib;
|
||||||
|
|
||||||
{
|
{
|
||||||
options.specialization = mkOption {
|
imports =
|
||||||
|
[ (mkRenamedOptionModule [ "specialization" ] [ "specialisation" ]) ];
|
||||||
|
|
||||||
|
options.specialisation = mkOption {
|
||||||
type = types.attrsOf (types.submodule {
|
type = types.attrsOf (types.submodule {
|
||||||
options = {
|
options = {
|
||||||
configuration = mkOption {
|
configuration = mkOption {
|
||||||
|
@ -11,10 +14,10 @@ with lib;
|
||||||
extended = extendModules {
|
extended = extendModules {
|
||||||
modules = [{
|
modules = [{
|
||||||
# Prevent infinite recursion
|
# Prevent infinite recursion
|
||||||
specialization = mkOverride 0 { };
|
specialisation = mkOverride 0 { };
|
||||||
|
|
||||||
# If used inside the NixOS/nix-darwin module, we get conflicting definitions
|
# 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
|
# 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.
|
# 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
|
# See discussion at https://github.com/nix-community/home-manager/issues/3716
|
||||||
|
@ -34,19 +37,19 @@ with lib;
|
||||||
description = ''
|
description = ''
|
||||||
A set of named specialized configurations. These can be used to extend
|
A set of named specialized configurations. These can be used to extend
|
||||||
your base configuration with additional settings. For example, you can
|
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.
|
that applies light and dark color theme configurations.
|
||||||
|
|
||||||
</para><para>
|
</para><para>
|
||||||
|
|
||||||
Note, this is an experimental option for now and you therefore have to
|
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
|
script yourself. Note, running the activation script will create a new
|
||||||
Home Manager generation.
|
Home Manager generation.
|
||||||
|
|
||||||
</para><para>
|
</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
|
first look up your current Home Manager generation by running
|
||||||
|
|
||||||
<programlisting language="console">
|
<programlisting language="console">
|
||||||
|
@ -57,7 +60,7 @@ with lib;
|
||||||
then run
|
then run
|
||||||
|
|
||||||
<programlisting language="console">
|
<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
|
Starting Home Manager activation
|
||||||
…
|
…
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
@ -69,14 +72,14 @@ with lib;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (config.specialization != { }) {
|
config = mkIf (config.specialisation != { }) {
|
||||||
home.extraBuilderCommands = let
|
home.extraBuilderCommands = let
|
||||||
link = n: v:
|
link = n: v:
|
||||||
let pkg = v.configuration.home.activationPackage;
|
let pkg = v.configuration.home.activationPackage;
|
||||||
in "ln -s ${pkg} $out/specialization/${n}";
|
in "ln -s ${pkg} $out/specialisation/${n}";
|
||||||
in ''
|
in ''
|
||||||
mkdir $out/specialization
|
mkdir $out/specialisation
|
||||||
${concatStringsSep "\n" (mapAttrsToList link config.specialization)}
|
${concatStringsSep "\n" (mapAttrsToList link config.specialisation)}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -32,7 +32,7 @@ let
|
||||||
./misc/numlock.nix
|
./misc/numlock.nix
|
||||||
./misc/pam.nix
|
./misc/pam.nix
|
||||||
./misc/qt.nix
|
./misc/qt.nix
|
||||||
./misc/specialization.nix
|
./misc/specialisation.nix
|
||||||
./misc/submodule-support.nix
|
./misc/submodule-support.nix
|
||||||
./misc/tmpfiles.nix
|
./misc/tmpfiles.nix
|
||||||
./misc/version.nix
|
./misc/version.nix
|
||||||
|
|
|
@ -53,7 +53,7 @@ import nmt {
|
||||||
./modules/home-environment
|
./modules/home-environment
|
||||||
./modules/misc/fontconfig
|
./modules/misc/fontconfig
|
||||||
./modules/misc/nix
|
./modules/misc/nix
|
||||||
./modules/misc/specialization
|
./modules/misc/specialisation
|
||||||
./modules/programs/aerc
|
./modules/programs/aerc
|
||||||
./modules/programs/alacritty
|
./modules/programs/alacritty
|
||||||
./modules/programs/alot
|
./modules/programs/alot
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{ specialization = ./specialization.nix; }
|
{ specialisation = ./specialisation.nix; }
|
||||||
|
|
|
@ -4,7 +4,7 @@ with lib;
|
||||||
|
|
||||||
{
|
{
|
||||||
home.file.testfile.text = "not special";
|
home.file.testfile.text = "not special";
|
||||||
specialization.test.configuration = {
|
specialisation.test.configuration = {
|
||||||
home.file.testfile.text = "very special";
|
home.file.testfile.text = "very special";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ with lib;
|
||||||
assertFileExists home-files/testfile
|
assertFileExists home-files/testfile
|
||||||
assertFileContains home-files/testfile "not special"
|
assertFileContains home-files/testfile "not special"
|
||||||
|
|
||||||
assertFileExists specialization/test/home-files/testfile
|
assertFileExists specialisation/test/home-files/testfile
|
||||||
assertFileContains specialization/test/home-files/testfile "not special"
|
assertFileContains specialisation/test/home-files/testfile "not special"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue