mirror of
https://github.com/nix-community/home-manager
synced 2024-11-24 03:59:46 +01:00
Merge commit '196db18' into release-17.03
This commit is contained in:
commit
3c3f68bf61
13 changed files with 128 additions and 51 deletions
|
@ -286,6 +286,8 @@ in
|
||||||
|
|
||||||
home.activation.linkGeneration = dagEntryAfter ["writeBoundary"] (
|
home.activation.linkGeneration = dagEntryAfter ["writeBoundary"] (
|
||||||
let
|
let
|
||||||
|
pattern = "-home-manager-files/";
|
||||||
|
|
||||||
link = pkgs.writeText "link" ''
|
link = pkgs.writeText "link" ''
|
||||||
newGenFiles="$1"
|
newGenFiles="$1"
|
||||||
shift
|
shift
|
||||||
|
@ -298,6 +300,8 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
cleanup = pkgs.writeText "cleanup" ''
|
cleanup = pkgs.writeText "cleanup" ''
|
||||||
|
. ${./lib-bash/color-echo.sh}
|
||||||
|
|
||||||
newGenFiles="$1"
|
newGenFiles="$1"
|
||||||
oldGenFiles="$2"
|
oldGenFiles="$2"
|
||||||
shift 2
|
shift 2
|
||||||
|
@ -306,6 +310,8 @@ in
|
||||||
targetPath="$HOME/$relativePath"
|
targetPath="$HOME/$relativePath"
|
||||||
if [[ -e "$newGenFiles/$relativePath" ]] ; then
|
if [[ -e "$newGenFiles/$relativePath" ]] ; then
|
||||||
$VERBOSE_ECHO "Checking $targetPath exists"
|
$VERBOSE_ECHO "Checking $targetPath exists"
|
||||||
|
elif [[ ! "$(readlink -e "$targetPath")" =~ "${pattern}" ]] ; then
|
||||||
|
warnEcho "Path '$targetPath' not link into Home Manager generation. Skipping delete."
|
||||||
else
|
else
|
||||||
echo "Checking $targetPath gone (deleting)"
|
echo "Checking $targetPath gone (deleting)"
|
||||||
$DRY_RUN_CMD rm $VERBOSE_ARG "$targetPath"
|
$DRY_RUN_CMD rm $VERBOSE_ARG "$targetPath"
|
||||||
|
|
|
@ -22,8 +22,8 @@ with lib;
|
||||||
systemd.user.services.dunst = {
|
systemd.user.services.dunst = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Dunst notification daemon";
|
Description = "Dunst notification daemon";
|
||||||
Requires = "graphical-session.target";
|
After = [ "graphical-session-pre.target" ];
|
||||||
After = "graphical-session.target";
|
PartOf = [ "graphical-session.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
|
|
|
@ -28,6 +28,7 @@ in
|
||||||
systemd.user.services.gnome-keyring = {
|
systemd.user.services.gnome-keyring = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "GNOME Keyring";
|
Description = "GNOME Keyring";
|
||||||
|
PartOf = [ "graphical-session-pre.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
|
@ -45,7 +46,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
Install = {
|
Install = {
|
||||||
WantedBy = [ "graphical-session.target" ];
|
WantedBy = [ "graphical-session-pre.target" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,41 +29,89 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable (mkMerge [
|
||||||
home.file.".gnupg/gpg-agent.conf".text = concatStringsSep "\n" (
|
{
|
||||||
optional cfg.enableSshSupport
|
home.file.".gnupg/gpg-agent.conf".text = concatStringsSep "\n" (
|
||||||
"enable-ssh-support"
|
optional cfg.enableSshSupport
|
||||||
++
|
"enable-ssh-support"
|
||||||
optional (cfg.defaultCacheTtl != null)
|
++
|
||||||
"default-cache-ttl ${toString cfg.defaultCacheTtl}"
|
optional (cfg.defaultCacheTtl != null)
|
||||||
);
|
"default-cache-ttl ${toString cfg.defaultCacheTtl}"
|
||||||
|
);
|
||||||
|
|
||||||
home.sessionVariables =
|
home.sessionVariables =
|
||||||
optionalAttrs cfg.enableSshSupport {
|
optionalAttrs cfg.enableSshSupport {
|
||||||
SSH_AUTH_SOCK = "\${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh";
|
SSH_AUTH_SOCK = "\${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh";
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.bash.initExtra = ''
|
||||||
|
GPG_TTY="$(tty)"
|
||||||
|
export GPG_TTY
|
||||||
|
gpg-connect-agent updatestartuptty /bye > /dev/null
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# The systemd units below are direct translations of the
|
||||||
|
# descriptions in the
|
||||||
|
#
|
||||||
|
# ${pkgs.gnupg}/share/doc/gnupg/examples/systemd-user
|
||||||
|
#
|
||||||
|
# directory.
|
||||||
|
{
|
||||||
|
systemd.user.services.gpg-agent = {
|
||||||
|
Unit = {
|
||||||
|
Description = "GnuPG cryptographic agent and passphrase cache";
|
||||||
|
Documentation = "man:gpg-agent(1)";
|
||||||
|
Requires = "gpg-agent.socket";
|
||||||
|
After = "gpg-agent.socket";
|
||||||
|
# This is a socket-activated service:
|
||||||
|
RefuseManualStart = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
ExecStart = "${pkgs.gnupg}/bin/gpg-agent --supervised";
|
||||||
|
ExecReload = "${pkgs.gnupg}/bin/gpgconf --reload gpg-agent";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.bash.initExtra = ''
|
systemd.user.sockets.gpg-agent = {
|
||||||
GPG_TTY="$(tty)"
|
Unit = {
|
||||||
export GPG_TTY
|
Description = "GnuPG cryptographic agent and passphrase cache";
|
||||||
gpg-connect-agent updatestartuptty /bye > /dev/null
|
Documentation = "man:gpg-agent(1)";
|
||||||
'';
|
};
|
||||||
|
|
||||||
systemd.user.services.gpg-agent = {
|
Socket = {
|
||||||
Unit = {
|
ListenStream = "%t/gnupg/S.gpg-agent";
|
||||||
Description = "GnuPG private key agent";
|
FileDescriptorName = "std";
|
||||||
IgnoreOnIsolate = true;
|
SocketMode = "0600";
|
||||||
};
|
DirectoryMode = "0700";
|
||||||
|
};
|
||||||
|
|
||||||
Service = {
|
Install = {
|
||||||
Type = "forking";
|
WantedBy = [ "sockets.target" ];
|
||||||
ExecStart = "${pkgs.gnupg}/bin/gpg-agent --daemon";
|
};
|
||||||
Restart = "on-abort";
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
Install = {
|
(mkIf cfg.enableSshSupport {
|
||||||
WantedBy = [ "default.target" ];
|
systemd.user.sockets.gpg-agent-ssh = {
|
||||||
|
Unit = {
|
||||||
|
Description = "GnuPG cryptographic agent (ssh-agent emulation)";
|
||||||
|
Documentation = "man:gpg-agent(1) man:ssh-add(1) man:ssh-agent(1) man:ssh(1)";
|
||||||
|
};
|
||||||
|
|
||||||
|
Socket = {
|
||||||
|
ListenStream = "%t/gnupg/S.gpg-agent.ssh";
|
||||||
|
FileDescriptorName = "ssh";
|
||||||
|
Service = "gpg-agent.service";
|
||||||
|
SocketMode = "0600";
|
||||||
|
DirectoryMode = "0700";
|
||||||
|
};
|
||||||
|
|
||||||
|
Install = {
|
||||||
|
WantedBy = [ "sockets.target" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
})
|
||||||
};
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@ with lib;
|
||||||
systemd.user.services.keepassx = {
|
systemd.user.services.keepassx = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "KeePassX password manager";
|
Description = "KeePassX password manager";
|
||||||
|
After = [ "graphical-session-pre.target" ];
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Install = {
|
Install = {
|
||||||
|
|
|
@ -13,6 +13,8 @@ with lib;
|
||||||
systemd.user.services.network-manager-applet = {
|
systemd.user.services.network-manager-applet = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Network Manager applet";
|
Description = "Network Manager applet";
|
||||||
|
After = [ "graphical-session-pre.target" ];
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Install = {
|
Install = {
|
||||||
|
|
|
@ -42,11 +42,13 @@ in
|
||||||
systemd.user.services.random-background = {
|
systemd.user.services.random-background = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Set random desktop background using feh";
|
Description = "Set random desktop background using feh";
|
||||||
|
After = [ "graphical-session-pre.target" ];
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = "${pkgs.feh}/bin/feh --randomize --bg-fill %h/backgrounds/";
|
ExecStart = "${pkgs.feh}/bin/feh --randomize --bg-fill ${cfg.imageDirectory}";
|
||||||
IOSchedulingClass = "idle";
|
IOSchedulingClass = "idle";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,8 @@ in {
|
||||||
systemd.user.services.redshift = {
|
systemd.user.services.redshift = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Redshift colour temperature adjuster";
|
Description = "Redshift colour temperature adjuster";
|
||||||
|
After = [ "graphical-session-pre.target" ];
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Install = {
|
Install = {
|
||||||
|
|
|
@ -27,6 +27,8 @@ in
|
||||||
systemd.user.services.taffybar = {
|
systemd.user.services.taffybar = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Taffybar desktop bar";
|
Description = "Taffybar desktop bar";
|
||||||
|
After = [ "graphical-session-pre.target" ];
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
|
|
|
@ -13,8 +13,8 @@ with lib;
|
||||||
systemd.user.services.udiskie = {
|
systemd.user.services.udiskie = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Udiskie mount daemon";
|
Description = "Udiskie mount daemon";
|
||||||
Requires = [ "taffybar.service" ];
|
After = [ "graphical-session-pre.target" ];
|
||||||
After = [ "taffybar.service" ];
|
PartOf = [ "graphical-session.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
|
|
|
@ -13,6 +13,8 @@ with lib;
|
||||||
systemd.user.services.xscreensaver = {
|
systemd.user.services.xscreensaver = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "XScreenSaver";
|
Description = "XScreenSaver";
|
||||||
|
After = [ "graphical-session-pre.target" ];
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
|
|
|
@ -7,7 +7,10 @@ let
|
||||||
|
|
||||||
cfg = config.systemd.user;
|
cfg = config.systemd.user;
|
||||||
|
|
||||||
enabled = cfg.services != {} || cfg.targets != {} || cfg.timers != {};
|
enabled = cfg.services != {}
|
||||||
|
|| cfg.sockets != {}
|
||||||
|
|| cfg.targets != {}
|
||||||
|
|| cfg.timers != {};
|
||||||
|
|
||||||
toSystemdIni = (import lib/generators.nix).toINI {
|
toSystemdIni = (import lib/generators.nix).toINI {
|
||||||
mkKeyValue = key: value:
|
mkKeyValue = key: value:
|
||||||
|
@ -50,6 +53,12 @@ in
|
||||||
description = "Definition of systemd per-user service units.";
|
description = "Definition of systemd per-user service units.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sockets = mkOption {
|
||||||
|
default = {};
|
||||||
|
type = types.attrs;
|
||||||
|
description = "Definition of systemd per-user sockets";
|
||||||
|
};
|
||||||
|
|
||||||
targets = mkOption {
|
targets = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
|
@ -72,7 +81,9 @@ in
|
||||||
message =
|
message =
|
||||||
let
|
let
|
||||||
names = concatStringsSep ", " (
|
names = concatStringsSep ", " (
|
||||||
attrNames (cfg.services // cfg.targets // cfg.timers)
|
attrNames (
|
||||||
|
cfg.services // cfg.sockets // cfg.targets // cfg.timers
|
||||||
|
)
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
"Must use Linux for modules that require systemd: " + names;
|
"Must use Linux for modules that require systemd: " + names;
|
||||||
|
@ -87,6 +98,8 @@ in
|
||||||
listToAttrs (
|
listToAttrs (
|
||||||
(buildServices "service" cfg.services)
|
(buildServices "service" cfg.services)
|
||||||
++
|
++
|
||||||
|
(buildServices "socket" cfg.sockets)
|
||||||
|
++
|
||||||
(buildServices "target" cfg.targets)
|
(buildServices "target" cfg.targets)
|
||||||
++
|
++
|
||||||
(buildServices "timer" cfg.timers)
|
(buildServices "timer" cfg.timers)
|
||||||
|
|
|
@ -38,6 +38,8 @@ in
|
||||||
systemd.user.services.setxkbmap = {
|
systemd.user.services.setxkbmap = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Set up keyboard in X";
|
Description = "Set up keyboard in X";
|
||||||
|
After = [ "graphical-session-pre.target" ];
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Install = {
|
Install = {
|
||||||
|
@ -60,19 +62,12 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# For stuff that needs to start just before a graphical session
|
# A basic graphical session target for Home Manager.
|
||||||
# starts.
|
systemd.user.targets.hm-graphical-session = {
|
||||||
systemd.user.targets.graphical-session-pre = {
|
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Pre-graphical session";
|
Description = "Home Manager X session";
|
||||||
};
|
Requires = [ "graphical-session-pre.target" ];
|
||||||
};
|
BindsTo = [ "graphical-session.target" ];
|
||||||
|
|
||||||
# A basic graphical session target. Apparently this will come
|
|
||||||
# standard in future Systemd versions.
|
|
||||||
systemd.user.targets.graphical-session = {
|
|
||||||
Unit = {
|
|
||||||
Description = "Graphical session";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -83,6 +78,9 @@ in
|
||||||
. "$HOME/.profile"
|
. "$HOME/.profile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If there are any running services from a previous session.
|
||||||
|
systemctl --user stop graphical-session.target graphical-session-pre.target
|
||||||
|
|
||||||
systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS
|
systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS
|
||||||
systemctl --user import-environment DISPLAY
|
systemctl --user import-environment DISPLAY
|
||||||
systemctl --user import-environment SSH_AUTH_SOCK
|
systemctl --user import-environment SSH_AUTH_SOCK
|
||||||
|
@ -90,8 +88,7 @@ in
|
||||||
systemctl --user import-environment XDG_DATA_DIRS
|
systemctl --user import-environment XDG_DATA_DIRS
|
||||||
systemctl --user import-environment XDG_RUNTIME_DIR
|
systemctl --user import-environment XDG_RUNTIME_DIR
|
||||||
|
|
||||||
systemctl --user restart graphical-session-pre.target
|
systemctl --user start hm-graphical-session.target
|
||||||
systemctl --user restart graphical-session.target
|
|
||||||
|
|
||||||
${cfg.initExtra}
|
${cfg.initExtra}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue