mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:59:23 +08:00
Merge branch 'main' into next
This commit is contained in:
@@ -91,7 +91,7 @@ inputs:
|
||||
putty virt-viewer
|
||||
wl-clipboard-x11 parallel lsof duperemove mlocate kmscon hdparm bat gnuplot whois zoom traceroute tcping-go
|
||||
tcpdump nmap mtr-gui simplescreenrecorder obs-studio
|
||||
signal-desktop dbeaver ftxui yaml-cpp wl-mirror poppler_utils imagemagick
|
||||
signal-desktop dbeaver ftxui yaml-cpp wl-mirror poppler_utils imagemagick gimp
|
||||
]
|
||||
++ (with inputs.lib; filter isDerivation (attrValues inputs.pkgs.plasma5Packages.kdeGear));
|
||||
programs.wireshark = { enable = true; package = inputs.pkgs.wireshark; };
|
||||
|
||||
@@ -14,12 +14,12 @@ inputs:
|
||||
virsh = "${inputs.pkgs.libvirt}/bin/virsh";
|
||||
hibernate = inputs.pkgs.writeShellScript "libvirt-hibernate"
|
||||
''
|
||||
if [ "$(LANG=C ${virsh} domstate "$1")" = 'running' ]
|
||||
if [ "$(LANG=C ${virsh} domstate $1)" = 'running' ]
|
||||
then
|
||||
if ${virsh} dompmsuspend "$1" disk
|
||||
then
|
||||
echo "Waiting for $1 to suspend"
|
||||
while ! [ "$(LANG=C ${virsh} domstate "$1")" = 'shut off' ]
|
||||
while ! [ "$(LANG=C ${virsh} domstate $1)" = 'shut off' ]
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
@@ -32,12 +32,12 @@ inputs:
|
||||
'';
|
||||
resume = inputs.pkgs.writeShellScript "libvirt-resume"
|
||||
''
|
||||
if [ "$(LANG=C ${virsh} domstate "$1")" = 'shut off' ] && [ -f "/tmp/libvirt.$1.suspended" ]
|
||||
if [ "$(LANG=C ${virsh} domstate $1)" = 'shut off' ] && [ -f "/tmp/libvirt.$1.suspended" ]
|
||||
then
|
||||
if virsh start "$1"
|
||||
if ${virsh} start "$1"
|
||||
then
|
||||
echo "Waiting for $1 to resume"
|
||||
while ! [ "$(LANG=C ${virsh} domstate "$1")" = 'running' ]
|
||||
while ! [ "$(LANG=C ${virsh} domstate $1)" = 'running' ]
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
@@ -48,40 +48,24 @@ inputs:
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
makeServices = machine:
|
||||
{
|
||||
"libvirt-hibernate-${machine}" =
|
||||
{
|
||||
description = "libvirt hibernate ${machine}";
|
||||
wantedBy = [ "systemd-hibernate.service" "systemd-suspend.service" ];
|
||||
before = [ "systemd-hibernate.service" "systemd-suspend.service" ];
|
||||
serviceConfig = { Type = "oneshot"; ExecStart = "${hibernate} ${machine}"; };
|
||||
};
|
||||
"libvirt-resume-${machine}" =
|
||||
{
|
||||
description = "libvirt resume ${machine}";
|
||||
wantedBy = [ "systemd-hibernate.service" "systemd-suspend.service" ];
|
||||
after = [ "systemd-hibernate.service" "systemd-suspend.service" ];
|
||||
serviceConfig = { Type = "oneshot"; ExecStart = "${resume} ${machine}"; };
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
"libvirt-hibernate@" =
|
||||
{
|
||||
description = "libvirt hibernate";
|
||||
before = [ "systemd-hibernate.service" "systemd-suspend.service" ];
|
||||
serviceConfig = { Type = "oneshot"; ExecStart = "${hibernate} %i"; };
|
||||
};
|
||||
"libvirt-resume@" =
|
||||
{
|
||||
description = "libvirt resume";
|
||||
after = [ "systemd-hibernate.service" "systemd-suspend.service" ];
|
||||
serviceConfig = { Type = "oneshot"; ExecStart = "${resume} %i"; };
|
||||
};
|
||||
"libvirt-hibernate@win10" =
|
||||
{
|
||||
wantedBy = [ "systemd-hibernate.service" "systemd-suspend.service" ];
|
||||
overrideStrategy = "asDropin";
|
||||
};
|
||||
"libvirt-resume@win10" =
|
||||
{
|
||||
wantedBy = [ "systemd-hibernate.service" "systemd-suspend.service" ];
|
||||
overrideStrategy = "asDropin";
|
||||
};
|
||||
"libvirt-hibernate@hardconnect" =
|
||||
{
|
||||
wantedBy = [ "systemd-hibernate.service" "systemd-suspend.service" ];
|
||||
overrideStrategy = "asDropin";
|
||||
};
|
||||
"libvirt-resume@hardconnect" =
|
||||
{
|
||||
wantedBy = [ "systemd-hibernate.service" "systemd-suspend.service" ];
|
||||
overrideStrategy = "asDropin";
|
||||
};
|
||||
};
|
||||
(makeServices "win10") // (makeServices "hardconnect");
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user