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