1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00

treewide: remove no-ops (#8061)

This commit is contained in:
Benedikt M. Rips 2025-10-26 21:43:53 +01:00 committed by GitHub
parent 879e4d9060
commit f2f1076c1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 302 additions and 414 deletions

View file

@ -17,23 +17,21 @@
lib
pkgs
;
configuration =
{ ... }:
{
imports = modules ++ [
{
programs.home-manager.path = builtins.path {
path = ../.;
name = "source";
};
}
];
configuration = {
imports = modules ++ [
{
programs.home-manager.path = builtins.path {
path = ../.;
name = "source";
};
}
];
nixpkgs = {
config = lib.mkDefault pkgs.config;
nixpkgs = {
config = lib.mkDefault pkgs.config;
inherit (pkgs) overlays;
};
inherit (pkgs) overlays;
};
};
};
}

View file

@ -13,43 +13,40 @@ let
renderSettings = settings: lib.concatStringsSep ";" (lib.mapAttrsToList renderSetting settings);
pluginModule = types.submodule (
{ ... }:
{
options = {
src = mkOption {
type = with types; nullOr path;
example = literalExpression ''
(pkgs.fetchFromGitHub {
owner = "jarun";
repo = "nnn";
rev = "v4.0";
sha256 = "sha256-Hpc8YaJeAzJoEi7aJ6DntH2VLkoR6ToP6tPYn3llR7k=";
}) + "/plugins";
'';
default = null;
description = ''
Path to the plugin folder.
'';
};
mappings = mkOption {
type = with types; attrsOf str;
description = ''
Key mappings to the plugins.
'';
default = { };
example = literalExpression ''
{
c = "fzcd";
f = "finder";
v = "imgview";
};
'';
};
pluginModule = types.submodule ({
options = {
src = mkOption {
type = with types; nullOr path;
example = literalExpression ''
(pkgs.fetchFromGitHub {
owner = "jarun";
repo = "nnn";
rev = "v4.0";
sha256 = "sha256-Hpc8YaJeAzJoEi7aJ6DntH2VLkoR6ToP6tPYn3llR7k=";
}) + "/plugins";
'';
default = null;
description = ''
Path to the plugin folder.
'';
};
}
);
mappings = mkOption {
type = with types; attrsOf str;
description = ''
Key mappings to the plugins.
'';
default = { };
example = literalExpression ''
{
c = "fzcd";
f = "finder";
v = "imgview";
};
'';
};
};
});
in
{
meta.maintainers = with lib.maintainers; [ thiagokokada ];

View file

@ -21,49 +21,45 @@ in
options.services.swayidle =
let
timeoutModule =
{ ... }:
{
options = {
timeout = mkOption {
type = types.ints.positive;
example = 60;
description = "Timeout in seconds.";
};
timeoutModule = {
options = {
timeout = mkOption {
type = types.ints.positive;
example = 60;
description = "Timeout in seconds.";
};
command = mkOption {
type = types.str;
description = "Command to run after timeout seconds of inactivity.";
};
command = mkOption {
type = types.str;
description = "Command to run after timeout seconds of inactivity.";
};
resumeCommand = mkOption {
type = with types; nullOr str;
default = null;
description = "Command to run when there is activity again.";
};
resumeCommand = mkOption {
type = with types; nullOr str;
default = null;
description = "Command to run when there is activity again.";
};
};
};
eventModule =
{ ... }:
{
options = {
event = mkOption {
type = types.enum [
"before-sleep"
"after-resume"
"lock"
"unlock"
];
description = "Event name.";
};
eventModule = {
options = {
event = mkOption {
type = types.enum [
"before-sleep"
"after-resume"
"lock"
"unlock"
];
description = "Event name.";
};
command = mkOption {
type = types.str;
description = "Command to run when event occurs.";
};
command = mkOption {
type = types.str;
description = "Command to run when event occurs.";
};
};
};
in
{

View file

@ -42,7 +42,7 @@ let
if lib.isDerivation value then scrubbedValue // newDrvAttrs else scrubbedValue
else
value;
scrubDerivations = attrs: lib.mapAttrs scrubDerivation attrs;
scrubDerivations = lib.mapAttrs scrubDerivation;
# Globally unscrub a few selected packages that are used by a wide selection of tests.
whitelist =
@ -111,10 +111,7 @@ let
pkgs =
let
overlays =
config.test.stubOverlays
++ lib.optionals (
config.nixpkgs.overlays != null && config.nixpkgs.overlays != [ ]
) config.nixpkgs.overlays;
config.test.stubOverlays ++ lib.optionals (config.nixpkgs.overlays != null) config.nixpkgs.overlays;
stubbedPkgs =
if overlays == [ ] then
scrubbedPkgs

View file

@ -4,30 +4,26 @@
name = "nixos-basics";
meta.maintainers = [ pkgs.lib.maintainers.rycee ];
nodes.machine =
{ ... }:
{
imports = [ ../../../nixos ]; # Import the HM NixOS module.
nodes.machine = {
imports = [ ../../../nixos ]; # Import the HM NixOS module.
virtualisation.memorySize = 2048;
virtualisation.memorySize = 2048;
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
};
home-manager.users.alice =
{ ... }:
{
home.stateVersion = "24.11";
home.file.test.text = "testfile";
# Enable a light-weight systemd service.
services.pueue.enable = true;
};
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
};
home-manager.users.alice = {
home.stateVersion = "24.11";
home.file.test.text = "testfile";
# Enable a light-weight systemd service.
services.pueue.enable = true;
};
};
testScript = ''
def login_as_alice():
machine.wait_until_tty_matches("1", "login: ")

View file

@ -1,4 +1,3 @@
{ ... }:
{
imports = [ ../../../nixos ]; # Import the HM NixOS module.
@ -9,11 +8,9 @@
};
home-manager = {
users.alice =
{ ... }:
{
home.stateVersion = "24.11";
home.file.test.text = "testfile new profile";
};
users.alice = {
home.stateVersion = "24.11";
home.file.test.text = "testfile new profile";
};
};
}

View file

@ -4,52 +4,46 @@
name = "nixos-legacy-profile-management";
meta.maintainers = [ pkgs.lib.maintainers.rycee ];
nodes.machine =
{ ... }:
{
imports = [
# Make the nixpkgs channel available.
"${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix"
# Import the HM NixOS module.
../../../nixos
];
nodes.machine = {
imports = [
# Make the nixpkgs channel available.
"${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix"
# Import the HM NixOS module.
../../../nixos
];
system.stateVersion = "24.11";
system.stateVersion = "24.11";
users.users.alice = {
isNormalUser = true;
};
users.users.alice = {
isNormalUser = true;
};
specialisation = {
legacy.configuration = {
home-manager = {
# Force legacy profile management.
enableLegacyProfileManagement = true;
specialisation = {
legacy.configuration = {
home-manager = {
# Force legacy profile management.
enableLegacyProfileManagement = true;
users.alice =
{ ... }:
{
home.stateVersion = "24.11";
home.file.test.text = "testfile legacy";
};
users.alice = {
home.stateVersion = "24.11";
home.file.test.text = "testfile legacy";
};
};
};
modern.configuration = {
home-manager = {
# Assert that we expect the option to default to false.
enableLegacyProfileManagement = pkgs.lib.mkOptionDefault false;
modern.configuration = {
home-manager = {
# Assert that we expect the option to default to false.
enableLegacyProfileManagement = pkgs.lib.mkOptionDefault false;
users.alice =
{ ... }:
{
home.stateVersion = "24.11";
home.file.test.text = "testfile modern";
};
users.alice = {
home.stateVersion = "24.11";
home.file.test.text = "testfile modern";
};
};
};
};
};
testScript =
{ nodes, ... }:

View file

@ -1,5 +1,3 @@
{ ... }:
{
home.username = "alice";
home.homeDirectory = "/home/alice";

View file

@ -4,28 +4,26 @@
name = "standalone-flake-basics";
meta.maintainers = [ pkgs.lib.maintainers.rycee ];
nodes.machine =
{ ... }:
{
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 3072;
nix = {
registry.home-manager.to = {
type = "path";
path = ../../..;
};
settings.extra-experimental-features = [
"nix-command"
"flakes"
];
};
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
nodes.machine = {
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 3072;
nix = {
registry.home-manager.to = {
type = "path";
path = ../../..;
};
settings.extra-experimental-features = [
"nix-command"
"flakes"
];
};
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
};
};
testScript = ''
start_all()

View file

@ -10,19 +10,17 @@ in
name = "home-with-symbols";
meta.maintainers = [ pkgs.lib.maintainers.rycee ];
nodes.machine =
{ ... }:
{
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
home = nixHome;
};
nodes.machine = {
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
home = nixHome;
};
};
testScript = ''
import shlex

View file

@ -3,18 +3,16 @@
name = "kitty-theme-path";
meta.maintainers = [ pkgs.lib.maintainers.rycee ];
nodes.machine =
{ ... }:
{
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
};
nodes.machine = {
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
};
};
testScript = ''
start_all()

View file

@ -2,18 +2,16 @@
{
name = "mu-store-init";
nodes.machine =
{ ... }:
{
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
};
nodes.machine = {
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
};
};
testScript = ''
start_all()

View file

@ -9,30 +9,28 @@ in
name = "works-with-nh-stable";
meta.maintainers = [ pkgs.lib.maintainers.rycee ];
nodes.machine =
{ ... }:
{
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
environment.systemPackages = [ pkgs.nh ];
nix = {
registry.home-manager.to = {
type = "path";
path = ../../..;
};
settings.extra-experimental-features = [
"nix-command"
"flakes"
];
};
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
inherit home;
nodes.machine = {
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
environment.systemPackages = [ pkgs.nh ];
nix = {
registry.home-manager.to = {
type = "path";
path = ../../..;
};
settings.extra-experimental-features = [
"nix-command"
"flakes"
];
};
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
inherit home;
};
};
testScript = ''
import shlex

View file

@ -24,21 +24,19 @@ in
{
name = "restic";
nodes.machine =
{ ... }:
{
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
};
security.polkit.enable = true;
nodes.machine = {
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
};
security.polkit.enable = true;
};
testScript = ''
start_all()
machine.wait_for_unit("network.target")

View file

@ -4,18 +4,16 @@
name = "standalone-specialisation";
meta.maintainers = [ pkgs.lib.maintainers.rycee ];
nodes.machine =
{ ... }:
{
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
};
nodes.machine = {
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
};
};
testScript = ''
start_all()

View file

@ -4,18 +4,16 @@
name = "standalone-standard-basics";
meta.maintainers = [ pkgs.lib.maintainers.rycee ];
nodes.machine =
{ ... }:
{
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
};
nodes.machine = {
imports = [ "${pkgs.path}/nixos/modules/installer/cd-dvd/channel.nix" ];
virtualisation.memorySize = 2048;
users.users.alice = {
isNormalUser = true;
description = "Alice Foobar";
password = "foobar";
uid = 1000;
};
};
testScript = ''
start_all()

View file

@ -36,35 +36,33 @@ in
};
};
home-cursor-legacy-disabled =
{ ... }:
{
config = {
home.pointerCursor = null;
home-cursor-legacy-disabled = {
config = {
home.pointerCursor = null;
home.stateVersion = "24.11";
home.stateVersion = "24.11";
test.asserts.warnings.expected = [
''
Setting home.pointerCursor to null is deprecated.
Please update your configuration to explicitly set:
test.asserts.warnings.expected = [
''
Setting home.pointerCursor to null is deprecated.
Please update your configuration to explicitly set:
home.pointerCursor.enable = false;
''
];
home.pointerCursor.enable = false;
''
];
nmt.script = ''
assertPathNotExists home-path/share/icons/catppuccin-macchiato-blue-cursors/index.theme
nmt.script = ''
assertPathNotExists home-path/share/icons/catppuccin-macchiato-blue-cursors/index.theme
hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmEnvFile
assertFileNotRegex $hmEnvFile 'XCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileNotRegex $hmEnvFile 'XCURSOR_SIZE="32"'
assertFileNotRegex $hmEnvFile 'HYPRCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileNotRegex $hmEnvFile 'HYPRCURSOR_SIZE="32"'
'';
};
hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmEnvFile
assertFileNotRegex $hmEnvFile 'XCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileNotRegex $hmEnvFile 'XCURSOR_SIZE="32"'
assertFileNotRegex $hmEnvFile 'HYPRCURSOR_THEME="catppuccin-macchiato-blue-standard"'
assertFileNotRegex $hmEnvFile 'HYPRCURSOR_SIZE="32"'
'';
};
};
home-cursor-legacy-disabled-with-enable =
{ config, ... }:

View file

@ -1,21 +1,19 @@
{
i18n =
{ ... }:
{
config = {
nmt.script = ''
hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmEnvFile
assertFileRegex $hmEnvFile \
'^export LOCALE_ARCHIVE_._..=".*/lib/locale/locale-archive"$'
i18n = {
config = {
nmt.script = ''
hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmEnvFile
assertFileRegex $hmEnvFile \
'^export LOCALE_ARCHIVE_._..=".*/lib/locale/locale-archive"$'
envFile=home-files/.config/environment.d/10-home-manager.conf
assertFileExists $envFile
assertFileRegex $envFile \
'^LOCALE_ARCHIVE_._..=.*/lib/locale/locale-archive$'
'';
};
envFile=home-files/.config/environment.d/10-home-manager.conf
assertFileExists $envFile
assertFileRegex $envFile \
'^LOCALE_ARCHIVE_._..=.*/lib/locale/locale-archive$'
'';
};
};
i18n-custom-locales =
{ config, pkgs, ... }:

View file

@ -1,22 +1,8 @@
{ ... }:
{
imports = [
(
{ ... }:
{
config.home.sessionPath = [ "foo" ];
}
)
(
{ ... }:
{
config.home.sessionPath = [
"bar"
"baz"
];
}
)
home.sessionPath = [
"bar"
"baz"
"foo"
];
nmt.script = ''

View file

@ -1,22 +1,8 @@
{ ... }:
{
imports = [
(
{ ... }:
{
config.home.sessionSearchVariables.TEST = [ "foo" ];
}
)
(
{ ... }:
{
config.home.sessionSearchVariables.TEST = [
"bar"
"baz"
];
}
)
home.sessionSearchVariables.TEST = [
"bar"
"baz"
"foo"
];
nmt.script = ''

View file

@ -37,16 +37,14 @@ let
in
{
config = {
home.sessionVariables = {
V1 = "v1";
V2 = "v2-${config.home.sessionVariables.V1}";
};
nmt.script = ''
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
assertFileContent home-path/etc/profile.d/hm-session-vars.sh \
${expected}
'';
home.sessionVariables = {
V1 = "v1";
V2 = "v2-${config.home.sessionVariables.V1}";
};
nmt.script = ''
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
assertFileContent home-path/etc/profile.d/hm-session-vars.sh \
${expected}
'';
}

View file

@ -1,29 +1,26 @@
{ ... }:
{
config = {
xdg.mime.enable = true;
xdg.desktopEntries = {
mime-test = {
# mime info test
name = "mime-test";
mimeType = [
"text/html"
"text/xml"
];
};
xdg.mime.enable = true;
xdg.desktopEntries = {
mime-test = {
# mime info test
name = "mime-test";
mimeType = [
"text/html"
"text/xml"
];
};
nmt.script = ''
assertFileExists home-path/share/applications/mimeinfo.cache # Check that update-desktop-database created file
# Check that update-desktop-database file matches expected
assertFileContent \
home-path/share/applications/mimeinfo.cache \
${./mime-expected.cache}
assertDirectoryExists home-path/share/mime # Check that update-mime-database created directory
assertDirectoryNotEmpty home-path/share/mime # Check that update-mime-database created files
'';
};
nmt.script = ''
assertFileExists home-path/share/applications/mimeinfo.cache # Check that update-desktop-database created file
# Check that update-desktop-database file matches expected
assertFileContent \
home-path/share/applications/mimeinfo.cache \
${./mime-expected.cache}
assertDirectoryExists home-path/share/mime # Check that update-mime-database created directory
assertDirectoryNotEmpty home-path/share/mime # Check that update-mime-database created files
'';
}

View file

@ -1,5 +1,3 @@
{ ... }:
{
programs.ashell = {
enable = true;

View file

@ -1,5 +1,3 @@
{ ... }:
{
programs = {
bash.enable = true;

View file

@ -1,5 +1,3 @@
{ ... }:
{
programs.keepassxc = {
enable = true;

View file

@ -1,5 +1,3 @@
{ ... }:
{
programs.keepassxc = {
enable = true;

View file

@ -1,5 +1,3 @@
{ ... }:
{
programs = {
kubeswitch.enable = true;

View file

@ -1,4 +1,3 @@
{ ... }:
{
programs.lazydocker = {
enable = true;

View file

@ -1,4 +1,3 @@
{ ... }:
{
programs.lazydocker.enable = true;
test.stubs.lazydocker = { };

View file

@ -1,4 +1,3 @@
{ ... }:
{
programs.swaylock.settings = { };

View file

@ -1,4 +1,3 @@
{ ... }:
{
programs.uv = {
enable = true;

View file

@ -1,20 +1,11 @@
{
imports = [
(
{ ... }:
{
config.programs.zsh.history.ignorePatterns = [ "echo *" ];
}
)
(
{ ... }:
{
config.programs.zsh.history.ignorePatterns = [ "rm *" ];
}
)
];
programs.zsh.enable = true;
programs.zsh = {
enable = true;
history.ignorePatterns = [
"echo *"
"rm *"
];
};
nmt.script = ''
assertFileContains home-files/.zshrc "HISTORY_IGNORE='(echo *|rm *)'"

View file

@ -1,5 +1,3 @@
{ ... }:
{
services.clipse = {
enable = true;

View file

@ -1,5 +1,3 @@
{ ... }:
{
services.easyeffects = {
enable = true;

View file

@ -1,5 +1,3 @@
{ ... }:
{
services.easyeffects = {
enable = true;

View file

@ -1,5 +1,3 @@
{ ... }:
{
systemd.user.slices.app-test = {
Unit = {

View file

@ -108,8 +108,7 @@ in
lib.test.mkStubPackage = mkStubPackage;
test.stubOverlays =
[ ]
++ lib.optional (config.test.stubs != { }) (
lib.optional (config.test.stubs != { }) (
self: super:
lib.mapAttrs (
n: v: