1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

Remove a few format exceptions

This commit is contained in:
Robert Helgesson 2021-07-18 23:34:50 +02:00
parent 82b06103ae
commit 41903a14b0
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
11 changed files with 283 additions and 374 deletions

10
format
View file

@ -26,25 +26,15 @@ find . -name '*.nix' \
! -path ./modules/lib/file-type.nix \
! -path ./modules/manual.nix \
! -path ./modules/misc/news.nix \
! -path ./modules/misc/nixpkgs.nix \
! -path ./modules/misc/xdg.nix \
! -path ./modules/modules.nix \
! -path ./modules/programs/bash.nix \
! -path ./modules/programs/firefox.nix \
! -path ./modules/programs/gpg.nix \
! -path ./modules/programs/ssh.nix \
! -path ./modules/programs/tmux.nix \
! -path ./modules/programs/zsh.nix \
! -path ./modules/services/gpg-agent.nix \
! -path ./modules/services/mpd.nix \
! -path ./modules/services/sxhkd.nix \
! -path ./modules/systemd.nix \
! -path ./nix-darwin/default.nix \
! -path ./tests/default.nix \
! -path ./tests/modules/home-environment/session-variables.nix \
! -path ./tests/modules/programs/gpg/override-defaults.nix \
! -path ./tests/modules/programs/zsh/session-variables.nix \
! -path ./tests/modules/services/sxhkd/service.nix \
! -path ./tests/modules/systemd/services.nix \
! -path ./tests/modules/systemd/session-variables.nix \
-exec nixfmt $CHECK_ARG {} +

View file

@ -6,40 +6,31 @@ with lib;
let
isConfig = x:
builtins.isAttrs x || builtins.isFunction x;
isConfig = x: builtins.isAttrs x || builtins.isFunction x;
optCall = f: x:
if builtins.isFunction f
then f x
else f;
optCall = f: x: if builtins.isFunction f then f x else f;
mergeConfig = lhs_: rhs_:
let
lhs = optCall lhs_ { inherit pkgs; };
rhs = optCall rhs_ { inherit pkgs; };
in
lhs // rhs //
optionalAttrs (lhs ? packageOverrides) {
in lhs // rhs // optionalAttrs (lhs ? packageOverrides) {
packageOverrides = pkgs:
optCall lhs.packageOverrides pkgs //
optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs;
} //
optionalAttrs (lhs ? perlPackageOverrides) {
optCall lhs.packageOverrides pkgs
// optCall (attrByPath [ "packageOverrides" ] ({ }) rhs) pkgs;
} // optionalAttrs (lhs ? perlPackageOverrides) {
perlPackageOverrides = pkgs:
optCall lhs.perlPackageOverrides pkgs //
optCall (attrByPath ["perlPackageOverrides"] ({}) rhs) pkgs;
optCall lhs.perlPackageOverrides pkgs
// optCall (attrByPath [ "perlPackageOverrides" ] ({ }) rhs) pkgs;
};
configType = mkOptionType {
name = "nixpkgs-config";
description = "nixpkgs config";
check = x:
let traceXIfNot = c:
if c x then true
else lib.traceSeqN 1 x false;
let traceXIfNot = c: if c x then true else lib.traceSeqN 1 x false;
in traceXIfNot isConfig;
merge = args: fold (def: mergeConfig def.value) {};
merge = args: fold (def: mergeConfig def.value) { };
};
overlayType = mkOptionType {
@ -49,13 +40,9 @@ let
merge = lib.mergeOneOption;
};
_pkgs = import pkgsPath (
filterAttrs (n: v: v != null) config.nixpkgs
);
_pkgs = import pkgsPath (filterAttrs (n: v: v != null) config.nixpkgs);
in
{
in {
options.nixpkgs = {
config = mkOption {
default = null;
@ -91,8 +78,7 @@ in
overlays = mkOption {
default = null;
example = literalExample
''
example = literalExample ''
[ (self: super: {
openssh = super.openssh.override {
hpnSupport = true;
@ -144,9 +130,10 @@ in
_module.args = {
pkgs = mkOverride modules.defaultPriority _pkgs;
pkgs_i686 =
if _pkgs.stdenv.isLinux && _pkgs.stdenv.hostPlatform.isx86
then _pkgs.pkgsi686Linux
else { };
if _pkgs.stdenv.isLinux && _pkgs.stdenv.hostPlatform.isx86 then
_pkgs.pkgsi686Linux
else
{ };
};
};
}

View file

@ -16,14 +16,10 @@ let
defaultDataHome = "${config.home.homeDirectory}/.local/share";
getXdgDir = name: fallback:
let
value = builtins.getEnv name;
in
if value != "" then value else fallback;
let value = builtins.getEnv name;
in if value != "" then value else fallback;
in
{
in {
options.xdg = {
enable = mkEnableOption "management of XDG base directories";
@ -37,7 +33,7 @@ in
configFile = mkOption {
type = fileType "<varname>xdg.configHome</varname>" cfg.configHome;
default = {};
default = { };
description = ''
Attribute set of files to link into the user's XDG
configuration home.
@ -54,7 +50,7 @@ in
dataFile = mkOption {
type = fileType "<varname>xdg.dataHome</varname>" cfg.dataHome;
default = {};
default = { };
description = ''
Attribute set of files to link into the user's XDG
data home.

View file

@ -1,14 +1,13 @@
{ pkgs
# Note, this should be "the standard library" + HM extensions.
# Note, this should be "the standard library" + HM extensions.
, lib
# Whether to enable module type checking.
# Whether to enable module type checking.
, check ? true
# If disabled, the pkgs attribute passed to this function is used instead.
, useNixpkgsModule ? true
}:
# If disabled, the pkgs attribute passed to this function is used instead.
, useNixpkgsModule ? true }:
with lib;
@ -237,8 +236,8 @@ let
pkgsModule = { config, ... }: {
config = {
_module.args.baseModules = modules;
_module.args.pkgsPath = lib.mkDefault (
if versionAtLeast config.home.stateVersion "20.09" then
_module.args.pkgsPath = lib.mkDefault
(if versionAtLeast config.home.stateVersion "20.09" then
pkgs.path
else
<nixpkgs>);
@ -250,6 +249,4 @@ let
};
};
in
modules ++ [ pkgsModule ]
in modules ++ [ pkgsModule ]

View file

@ -9,19 +9,15 @@ let
cfg = config.programs.firefox;
mozillaConfigPath =
if isDarwin
then "Library/Application Support/Mozilla"
else ".mozilla";
if isDarwin then "Library/Application Support/Mozilla" else ".mozilla";
firefoxConfigPath =
if isDarwin
then "Library/Application Support/Firefox"
else "${mozillaConfigPath}/firefox";
firefoxConfigPath = if isDarwin then
"Library/Application Support/Firefox"
else
"${mozillaConfigPath}/firefox";
profilesPath =
if isDarwin
then "${firefoxConfigPath}/Profiles"
else firefoxConfigPath;
if isDarwin then "${firefoxConfigPath}/Profiles" else firefoxConfigPath;
# The extensions path shared by all profiles; will not be supported
# by future Firefox versions.
@ -32,24 +28,17 @@ let
paths = cfg.extensions;
};
profiles =
flip mapAttrs' cfg.profiles (_: profile:
profiles = flip mapAttrs' cfg.profiles (_: profile:
nameValuePair "Profile${toString profile.id}" {
Name = profile.name;
Path =
if isDarwin
then "Profiles/${profile.path}"
else profile.path;
Path = if isDarwin then "Profiles/${profile.path}" else profile.path;
IsRelative = 1;
Default = if profile.isDefault then 1 else 0;
}
) // {
General = {
StartWithLastProfile = 1;
};
}) // {
General = { StartWithLastProfile = 1; };
};
profilesIni = generators.toINI {} profiles;
profilesIni = generators.toINI { } profiles;
mkUserJs = prefs: extraPrefs: ''
// Generated by Home Manager.
@ -61,17 +50,15 @@ let
${extraPrefs}
'';
in
{
in {
meta.maintainers = [ maintainers.rycee ];
imports = [
(mkRemovedOptionModule ["programs" "firefox" "enableAdobeFlash"]
(mkRemovedOptionModule [ "programs" "firefox" "enableAdobeFlash" ]
"Support for this option has been removed.")
(mkRemovedOptionModule ["programs" "firefox" "enableGoogleTalk"]
(mkRemovedOptionModule [ "programs" "firefox" "enableGoogleTalk" ]
"Support for this option has been removed.")
(mkRemovedOptionModule ["programs" "firefox" "enableIcedTea"]
(mkRemovedOptionModule [ "programs" "firefox" "enableIcedTea" ]
"Support for this option has been removed.")
];
@ -81,10 +68,10 @@ in
package = mkOption {
type = types.package;
default =
if versionAtLeast config.home.stateVersion "19.09"
then pkgs.firefox
else pkgs.firefox-unwrapped;
default = if versionAtLeast config.home.stateVersion "19.09" then
pkgs.firefox
else
pkgs.firefox-unwrapped;
defaultText = literalExample "pkgs.firefox";
example = literalExample ''
pkgs.firefox.override {
@ -106,7 +93,7 @@ in
extensions = mkOption {
type = types.listOf types.package;
default = [];
default = [ ];
example = literalExample ''
with pkgs.nur.repos.rycee.firefox-addons; [
https-everywhere
@ -141,7 +128,7 @@ in
};
profiles = mkOption {
type = types.attrsOf (types.submodule ({config, name, ...}: {
type = types.attrsOf (types.submodule ({ config, name, ... }: {
options = {
name = mkOption {
type = types.str;
@ -159,7 +146,7 @@ in
settings = mkOption {
type = with types; attrsOf (either bool (either int str));
default = {};
default = { };
example = literalExample ''
{
"browser.startup.homepage" = "https://nixos.org";
@ -224,7 +211,7 @@ in
};
};
}));
default = {};
default = { };
description = "Attribute set of Firefox profiles.";
};
@ -243,36 +230,27 @@ in
config = mkIf cfg.enable {
assertions = [
(
let
(let
defaults =
catAttrs "name" (filter (a: a.isDefault) (attrValues cfg.profiles));
in {
assertion = cfg.profiles == {} || length defaults == 1;
message =
"Must have exactly one default Firefox profile but found "
+ toString (length defaults)
+ optionalString (length defaults > 1)
assertion = cfg.profiles == { } || length defaults == 1;
message = "Must have exactly one default Firefox profile but found "
+ toString (length defaults) + optionalString (length defaults > 1)
(", namely " + concatStringsSep ", " defaults);
}
)
})
(
let
duplicates =
filterAttrs (_: v: length v != 1)
(zipAttrs
(mapAttrsToList (n: v: { "${toString v.id}" = n; })
(cfg.profiles)));
(let
duplicates = filterAttrs (_: v: length v != 1) (zipAttrs
(mapAttrsToList (n: v: { "${toString v.id}" = n; }) (cfg.profiles)));
mkMsg = n: v: " - ID ${n} is used by ${concatStringsSep ", " v}";
in {
assertion = duplicates == {};
message =
"Must not have Firefox profiles with duplicate IDs but\n"
+ concatStringsSep "\n" (mapAttrsToList mkMsg duplicates);
}
)
assertion = duplicates == { };
message = ''
Must not have Firefox profiles with duplicate IDs but
'' + concatStringsSep "\n" (mapAttrsToList mkMsg duplicates);
})
];
warnings = optional (cfg.enableGnomeExtensions or false) ''
@ -282,65 +260,53 @@ in
its example for how to do this.
'';
home.packages =
let
home.packages = let
# The configuration expected by the Firefox wrapper.
fcfg = {
enableGnomeExtensions = cfg.enableGnomeExtensions;
};
fcfg = { enableGnomeExtensions = cfg.enableGnomeExtensions; };
# A bit of hackery to force a config into the wrapper.
browserName = cfg.package.browserName
or (builtins.parseDrvName cfg.package.name).name;
browserName = cfg.package.browserName or (builtins.parseDrvName
cfg.package.name).name;
# The configuration expected by the Firefox wrapper builder.
bcfg = setAttrByPath [browserName] fcfg;
bcfg = setAttrByPath [ browserName ] fcfg;
package =
if isDarwin then
package = if isDarwin then
cfg.package
else if versionAtLeast config.home.stateVersion "19.09" then
cfg.package.override (old: { cfg = old.cfg or {} // fcfg; })
cfg.package.override (old: { cfg = old.cfg or { } // fcfg; })
else
(pkgs.wrapFirefox.override { config = bcfg; }) cfg.package { };
in
[ package ];
in [ package ];
home.file = mkMerge (
[{
"${mozillaConfigPath}/${extensionPath}" = mkIf (cfg.extensions != []) {
home.file = mkMerge ([{
"${mozillaConfigPath}/${extensionPath}" = mkIf (cfg.extensions != [ ]) {
source = "${extensionsEnvPkg}/share/mozilla/${extensionPath}";
recursive = true;
};
"${firefoxConfigPath}/profiles.ini" = mkIf (cfg.profiles != {}) {
text = profilesIni;
};
}]
++ flip mapAttrsToList cfg.profiles (_: profile: {
"${firefoxConfigPath}/profiles.ini" =
mkIf (cfg.profiles != { }) { text = profilesIni; };
}] ++ flip mapAttrsToList cfg.profiles (_: profile: {
"${profilesPath}/${profile.path}/.keep".text = "";
"${profilesPath}/${profile.path}/chrome/userChrome.css" =
mkIf (profile.userChrome != "") {
text = profile.userChrome;
};
mkIf (profile.userChrome != "") { text = profile.userChrome; };
"${profilesPath}/${profile.path}/chrome/userContent.css" =
mkIf (profile.userContent != "") {
text = profile.userContent;
};
mkIf (profile.userContent != "") { text = profile.userContent; };
"${profilesPath}/${profile.path}/user.js" =
mkIf (profile.settings != {} || profile.extraConfig != "") {
mkIf (profile.settings != { } || profile.extraConfig != "") {
text = mkUserJs profile.settings profile.extraConfig;
};
"${profilesPath}/${profile.path}/extensions" = mkIf (cfg.extensions != []) {
"${profilesPath}/${profile.path}/extensions" =
mkIf (cfg.extensions != [ ]) {
source = "${extensionsEnvPkg}/share/mozilla/${extensionPath}";
recursive = true;
force = true;
};
})
);
}));
};
}

View file

@ -1,4 +1,4 @@
{config, lib, pkgs, ...}:
{ config, lib, pkgs, ... }:
with lib;
@ -6,21 +6,15 @@ let
cfg = config.services.sxhkd;
keybindingsStr = concatStringsSep "\n" (
mapAttrsToList (hotkey: command:
keybindingsStr = concatStringsSep "\n" (mapAttrsToList (hotkey: command:
optionalString (command != null) ''
${hotkey}
${command}
''
)
cfg.keybindings
);
'') cfg.keybindings);
in
{
in {
imports = [
(mkRemovedOptionModule ["services" "sxhkd" "extraPath"]
(mkRemovedOptionModule [ "services" "sxhkd" "extraPath" ]
"This option is no longer needed and can be removed.")
];
@ -31,19 +25,21 @@ in
type = types.package;
default = pkgs.sxhkd;
defaultText = "pkgs.sxhkd";
description = "Package containing the <command>sxhkd</command> executable.";
description =
"Package containing the <command>sxhkd</command> executable.";
};
extraOptions = mkOption {
type = types.listOf types.str;
default = [ ];
description = "Command line arguments to invoke <command>sxhkd</command> with.";
description =
"Command line arguments to invoke <command>sxhkd</command> with.";
example = literalExample ''[ "-m 1" ]'';
};
keybindings = mkOption {
type = types.attrsOf (types.nullOr types.str);
default = {};
default = { };
description = "An attribute set that assigns hotkeys to commands.";
example = literalExample ''
{
@ -72,13 +68,10 @@ in
home.packages = [ cfg.package ];
xdg.configFile."sxhkd/sxhkdrc".text = concatStringsSep "\n" [
keybindingsStr
cfg.extraConfig
];
xdg.configFile."sxhkd/sxhkdrc".text =
concatStringsSep "\n" [ keybindingsStr cfg.extraConfig ];
xsession.initExtra =
let
xsession.initExtra = let
sxhkdCommand = "${cfg.package}/bin/sxhkd ${toString cfg.extraOptions}";
in ''
systemctl --user stop sxhkd.scope 2> /dev/null || true

View file

@ -7,27 +7,28 @@ let
inherit (lib) getAttr hm isBool literalExample mkIf mkMerge mkOption types;
# From <nixpkgs/nixos/modules/system/boot/systemd-lib.nix>
mkPathSafeName = lib.replaceChars ["@" ":" "\\" "[" "]"] ["-" "-" "-" "" ""];
mkPathSafeName =
lib.replaceChars [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ];
enabled = cfg.services != {}
|| cfg.slices != {}
|| cfg.sockets != {}
|| cfg.targets != {}
|| cfg.timers != {}
|| cfg.paths != {}
|| cfg.mounts != {}
|| cfg.automounts != {}
|| cfg.sessionVariables != {};
enabled = cfg.services != { } # \
|| cfg.slices != { } # \
|| cfg.sockets != { } # \
|| cfg.targets != { } # \
|| cfg.timers != { } # \
|| cfg.paths != { } # \
|| cfg.mounts != { } # \
|| cfg.automounts != { } # \
|| cfg.sessionVariables != { };
toSystemdIni = lib.generators.toINI {
listsAsDuplicateKeys = true;
mkKeyValue = key: value:
let
value' =
if isBool value then (if value then "true" else "false")
else toString value;
in
"${key}=${value'}";
value' = if isBool value then
(if value then "true" else "false")
else
toString value;
in "${key}=${value'}";
};
buildService = style: name: serviceCfg:
@ -43,30 +44,24 @@ let
destination = lib.escapeShellArg "/${filename}";
} + "/${filename}";
wantedBy = target:
{
wantedBy = target: {
name = "systemd/user/${target}.wants/${filename}";
value = { inherit source; };
};
in
lib.singleton {
in lib.singleton {
name = "systemd/user/${filename}";
value = { inherit source; };
}
++
map wantedBy (serviceCfg.Install.WantedBy or []);
} ++ map wantedBy (serviceCfg.Install.WantedBy or [ ]);
buildServices = style: serviceCfgs:
lib.concatLists (lib.mapAttrsToList (buildService style) serviceCfgs);
servicesStartTimeoutMs = builtins.toString cfg.servicesStartTimeoutMs;
unitType = unitKind: with types;
let
primitive = either bool (either int str);
in
attrsOf (attrsOf (attrsOf (either primitive (listOf primitive))))
// {
unitType = unitKind:
with types;
let primitive = either bool (either int str);
in attrsOf (attrsOf (attrsOf (either primitive (listOf primitive)))) // {
description = "systemd ${unitKind} unit configuration";
};
@ -82,7 +77,8 @@ let
</citerefentry>.
'';
unitExample = type: literalExample ''
unitExample = type:
literalExample ''
{
${lib.toLower type}-name = {
Unit = {
@ -97,16 +93,13 @@ let
};
'';
sessionVariables = mkIf (cfg.sessionVariables != {}) {
"environment.d/10-home-manager.conf".text =
lib.concatStringsSep "\n" (
lib.mapAttrsToList (n: v: "${n}=${toString v}") cfg.sessionVariables
) + "\n";
sessionVariables = mkIf (cfg.sessionVariables != { }) {
"environment.d/10-home-manager.conf".text = lib.concatStringsSep "\n"
(lib.mapAttrsToList (n: v: "${n}=${toString v}") cfg.sessionVariables)
+ "\n";
};
in
{
in {
meta.maintainers = [ lib.maintainers.rycee ];
options = {
@ -123,56 +116,56 @@ in
};
services = mkOption {
default = {};
default = { };
type = unitType "service";
description = unitDescription "service";
example = unitExample "Service";
};
slices = mkOption {
default = {};
default = { };
type = unitType "slices";
description = unitDescription "slices";
example = unitExample "Slices";
};
sockets = mkOption {
default = {};
default = { };
type = unitType "socket";
description = unitDescription "socket";
example = unitExample "Socket";
};
targets = mkOption {
default = {};
default = { };
type = unitType "target";
description = unitDescription "target";
example = unitExample "Target";
};
timers = mkOption {
default = {};
default = { };
type = unitType "timer";
description = unitDescription "timer";
example = unitExample "Timer";
};
paths = mkOption {
default = {};
default = { };
type = unitType "path";
description = unitDescription "path";
example = unitExample "Path";
};
mounts = mkOption {
default = {};
default = { };
type = unitType "mount";
description = unitDescription "mount";
example = unitExample "Mount";
};
automounts = mkOption {
default = {};
default = { };
type = unitType "automount";
description = unitDescription "automount";
example = unitExample "Automount";
@ -180,10 +173,9 @@ in
startServices = mkOption {
default = "suggest";
type = with types; either bool (enum ["suggest" "legacy" "sd-switch"]);
apply = p:
if isBool p then if p then "legacy" else "suggest"
else p;
type = with types;
either bool (enum [ "suggest" "legacy" "sd-switch" ]);
apply = p: if isBool p then if p then "legacy" else "suggest" else p;
description = ''
Whether new or changed services that are wanted by active targets
should be started. Additionally, stop obsolete services from the
@ -231,7 +223,7 @@ in
};
sessionVariables = mkOption {
default = {};
default = { };
type = with types; attrsOf (either int str);
example = { EDITOR = "vim"; };
description = ''
@ -248,44 +240,34 @@ in
config = mkMerge [
{
assertions = [
{
assertions = [{
assertion = enabled -> pkgs.stdenv.isLinux;
message =
let
names = lib.concatStringsSep ", " (
lib.attrNames (
cfg.services // cfg.slices // cfg.sockets // cfg.targets
// cfg.timers // cfg.paths // cfg.mounts // cfg.sessionVariables
)
);
in
"Must use Linux for modules that require systemd: " + names;
}
];
message = let
names = lib.concatStringsSep ", " (lib.attrNames ( # \
cfg.services # \
// cfg.slices # \
// cfg.sockets # \
// cfg.targets # \
// cfg.timers # \
// cfg.paths # \
// cfg.mounts # \
// cfg.sessionVariables));
in "Must use Linux for modules that require systemd: " + names;
}];
}
# If we run under a Linux system we assume that systemd is
# available, in particular we assume that systemctl is in PATH.
(mkIf pkgs.stdenv.isLinux {
xdg.configFile = mkMerge [
(lib.listToAttrs (
(buildServices "service" cfg.services)
++
(buildServices "slices" cfg.slices)
++
(buildServices "socket" cfg.sockets)
++
(buildServices "target" cfg.targets)
++
(buildServices "timer" cfg.timers)
++
(buildServices "path" cfg.paths)
++
(buildServices "mount" cfg.mounts)
++
(buildServices "automount" cfg.automounts)
))
(lib.listToAttrs ((buildServices "service" cfg.services)
++ (buildServices "slices" cfg.slices)
++ (buildServices "socket" cfg.sockets)
++ (buildServices "target" cfg.targets)
++ (buildServices "timer" cfg.timers)
++ (buildServices "path" cfg.paths)
++ (buildServices "mount" cfg.mounts)
++ (buildServices "automount" cfg.automounts)))
sessionVariables
];
@ -294,8 +276,8 @@ in
# running this from the NixOS module then XDG_RUNTIME_DIR is not
# set and systemd commands will fail. We'll therefore have to
# set it ourselves in that case.
home.activation.reloadSystemd = hm.dag.entryAfter ["linkGeneration"] (
let
home.activation.reloadSystemd = hm.dag.entryAfter [ "linkGeneration" ]
(let
cmd = {
suggest = ''
PATH=${dirOf cfg.systemctlPath}:$PATH \
@ -306,10 +288,8 @@ in
${pkgs.ruby}/bin/ruby ${./systemd-activate.rb} \
"''${oldGenPath=}" "$newGenPath" "${servicesStartTimeoutMs}"
'';
sd-switch =
let
timeoutArg =
if cfg.servicesStartTimeoutMs != 0 then
sd-switch = let
timeoutArg = if cfg.servicesStartTimeoutMs != 0 then
"--timeout " + servicesStartTimeoutMs
else
"";
@ -321,11 +301,11 @@ in
'';
};
ensureRuntimeDir = "XDG_RUNTIME_DIR=\${XDG_RUNTIME_DIR:-/run/user/$(id -u)}";
ensureRuntimeDir =
"XDG_RUNTIME_DIR=\${XDG_RUNTIME_DIR:-/run/user/$(id -u)}";
systemctl = "${ensureRuntimeDir} ${cfg.systemctlPath}";
in
''
in ''
systemdStatus=$(${systemctl} --user is-system-running 2>&1 || true)
if [[ $systemdStatus == 'running' || $systemdStatus == 'degraded' ]]; then
@ -342,8 +322,7 @@ in
fi
unset systemdStatus
''
);
'');
})
];
}

View file

@ -13,11 +13,8 @@ with lib;
};
};
nixpkgs.overlays = [
(self: super: {
zsh = pkgs.writeScriptBin "dummy-zsh" "";
})
];
nixpkgs.overlays =
[ (self: super: { zsh = pkgs.writeScriptBin "dummy-zsh" ""; }) ];
nmt.script = ''
assertFileExists home-files/.zshrc

View file

@ -9,7 +9,9 @@
services.sxhkd = {
enable = true;
package = pkgs.runCommandLocal "dummy-package" { } "mkdir $out" // { outPath = "@sxhkd@"; };
package = pkgs.runCommandLocal "dummy-package" { } "mkdir $out" // {
outPath = "@sxhkd@";
};
extraOptions = [ "-m 1" ];
};

View file

@ -5,9 +5,7 @@ with lib;
{
config = {
systemd.user.services."test-service@" = {
Unit = {
Description = "A basic test service";
};
Unit = { Description = "A basic test service"; };
Service = {
Environment = [ "VAR1=1" "VAR2=2" ];
@ -19,7 +17,8 @@ with lib;
serviceFile=home-files/.config/systemd/user/test-service@.service
assertFileExists $serviceFile
assertFileContent $serviceFile \
${builtins.toFile "services-expected.conf" ''
${
builtins.toFile "services-expected.conf" ''
[Service]
Environment=VAR1=1
Environment=VAR2=2
@ -27,7 +26,8 @@ with lib;
[Unit]
Description=A basic test service
''}
''
}
'';
};
}

View file

@ -10,11 +10,13 @@
nmt.script = ''
envFile=home-files/.config/environment.d/10-home-manager.conf
assertFileExists $envFile
assertFileContent $envFile ${pkgs.writeText "expected" ''
assertFileContent $envFile ${
pkgs.writeText "expected" ''
LOCALE_ARCHIVE_2_27=${pkgs.glibcLocales}/lib/locale/locale-archive
V_int=1
V_str=2
''}
''
}
'';
};
}