make home-manager manage xidlhook
This commit is contained in:
parent
3aa2d0fea6
commit
0110393101
10 changed files with 68 additions and 42 deletions
28
flake.lock
28
flake.lock
|
@ -69,20 +69,20 @@
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs-stable"
|
"nixpkgs-nixos-unstable"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1634544068,
|
"lastModified": 1635839387,
|
||||||
"narHash": "sha256-RlRQBaAHfdWqfRyHdWuDPMkplBTYwuyDQqDcNbP/Sog=",
|
"narHash": "sha256-2B6DqfTiwY5w2TljC4+AxEUuVYMTP5Fo2h5iGNIONvk=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "ff2bed9dac84fb202bbb3c49fdcfe30c29d0b12f",
|
"rev": "288faaa5a65e72e37e6027024829b15c8bb69286",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"ref": "release-21.05",
|
"ref": "master",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
@ -139,11 +139,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-nixos-unstable": {
|
"nixpkgs-nixos-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1635403963,
|
"lastModified": 1635844945,
|
||||||
"narHash": "sha256-0actzfzBAXvvDJ/EvPSGbtCPXUwSObQrcq0RpsPWZgA=",
|
"narHash": "sha256-tZcL307dj28jgEU1Wdn+zwG9neyW0H2+ZjdVhvJxh9g=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "2deb07f3ac4eeb5de1c12c4ba2911a2eb1f6ed61",
|
"rev": "b67e752c29f18a0ca5534a07661366d6a2c2e649",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -155,11 +155,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1635456205,
|
"lastModified": 1635933255,
|
||||||
"narHash": "sha256-CLZxFvwec8BhFlB5tkIq08UBDNNrijOY780UF6ubJXc=",
|
"narHash": "sha256-cR4jRaog5/o5U0No0wNVgokfJma9vuiZhtcu3CUcb1M=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "66d6ec6ed2ddc77d08cf677cc8230db39f051793",
|
"rev": "2fd5c69fa6057870687a6589a8c95da955188f91",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -203,11 +203,11 @@
|
||||||
},
|
},
|
||||||
"nur": {
|
"nur": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1635525735,
|
"lastModified": 1636008211,
|
||||||
"narHash": "sha256-XX7nE214023Hw6O79Gn8SIXzxCi8Z07TRUbFJQYiyM4=",
|
"narHash": "sha256-kNy2aQ9uhJ9sXkQn+G90DsmSGgfk22lfSpqlm+CRBKw=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NUR",
|
"repo": "NUR",
|
||||||
"rev": "e47eb508c9c3af5990bec7cc6d969502e58a1336",
|
"rev": "eed6ce5dd4e60583c5c673771caffa3d5425bfa7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
];
|
];
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = { inherit inputs; };
|
||||||
};
|
};
|
||||||
foureighty = mkWorkstation nixpkgs-stable "x86_64-linux" "foureighty";
|
foureighty = mkWorkstation nixpkgs-nixos-unstable "x86_64-linux" "foureighty";
|
||||||
skinnyv = mkWorkstation nixpkgs-stable "x86_64-linux" "skinnyv";
|
skinnyv = mkWorkstation nixpkgs-stable "x86_64-linux" "skinnyv";
|
||||||
thinky = mkWorkstation nixpkgs-stable "x86_64-linux" "thinky";
|
thinky = mkWorkstation nixpkgs-stable "x86_64-linux" "thinky";
|
||||||
bolty = mkServer nixpkgs-nixos-unstable "x86_64-linux" "bolty";
|
bolty = mkServer nixpkgs-nixos-unstable "x86_64-linux" "bolty";
|
||||||
|
@ -78,9 +78,9 @@
|
||||||
type = "github";
|
type = "github";
|
||||||
owner = "nix-community";
|
owner = "nix-community";
|
||||||
repo = "home-manager";
|
repo = "home-manager";
|
||||||
ref = "release-21.05";
|
ref = "master";
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.follows = "nixpkgs-stable";
|
nixpkgs.follows = "nixpkgs-nixos-unstable";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,33 @@
|
||||||
|
|
||||||
sound.enable = true;
|
sound.enable = true;
|
||||||
|
|
||||||
networking.networkmanager.enable = true;
|
networking.networkmanager = {
|
||||||
|
enable = true;
|
||||||
|
dispatcherScripts = [
|
||||||
|
{
|
||||||
|
source = pkgs.writeText "upHook" ''
|
||||||
|
enable_disable_wifi ()
|
||||||
|
{
|
||||||
|
result=$(nmcli dev | grep "ethernet" | grep -w "connected")
|
||||||
|
if [ -n "$result" ]; then
|
||||||
|
nmcli radio wifi off
|
||||||
|
else
|
||||||
|
nmcli radio wifi on
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$2" = "up" ]; then
|
||||||
|
enable_disable_wifi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$2" = "down" ]; then
|
||||||
|
enable_disable_wifi
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
type = "basic";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
hardware.enableRedistributableFirmware = true;
|
hardware.enableRedistributableFirmware = true;
|
||||||
hardware.cpu.intel.updateMicrocode = true;
|
hardware.cpu.intel.updateMicrocode = true;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
(vscode-with-extensions.override {
|
(vscode-with-extensions.override {
|
||||||
vscodeExtensions = with vscode-extensions; [
|
vscodeExtensions = with vscode-extensions; [
|
||||||
bbenoist.Nix
|
|
||||||
ms-python.python
|
ms-python.python
|
||||||
(
|
(
|
||||||
vscode-utils.buildVscodeExtension {
|
vscode-utils.buildVscodeExtension {
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
go.enable = true;
|
go.enable = true;
|
||||||
bat.enable = true;
|
bat.enable = true;
|
||||||
browserpass.enable = true;
|
browserpass.enable = true;
|
||||||
obs-studio.enable = true;
|
|
||||||
lsd.enable = true;
|
lsd.enable = true;
|
||||||
lsd.enableAliases = true;
|
lsd.enableAliases = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
./dunst.nix
|
./dunst.nix
|
||||||
./rofi.nix
|
./rofi.nix
|
||||||
./kdeconnect.nix
|
./kdeconnect.nix
|
||||||
|
./xidlehook.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
|
|
|
@ -14,7 +14,6 @@ in
|
||||||
startup = [
|
startup = [
|
||||||
{ command = "exec hsetroot -solid '#002b36'"; always = true; notification = false; }
|
{ command = "exec hsetroot -solid '#002b36'"; always = true; notification = false; }
|
||||||
{ command = "exec setxkbmap -layout pl"; always = true; notification = false; }
|
{ command = "exec setxkbmap -layout pl"; always = true; notification = false; }
|
||||||
{ command = "exec $HOME/dev/dotfiles/nixos/i3/lock.sh"; always = false; notification = false; }
|
|
||||||
{ command = "exec $HOME/dev/dotfiles/nixos/i3/battery-popup.sh"; always = false; notification = false; }
|
{ command = "exec $HOME/dev/dotfiles/nixos/i3/battery-popup.sh"; always = false; notification = false; }
|
||||||
{ command = "exec xdg-mime default org.gnome.Evince.desktop application/pdf"; always = false; notification = false; }
|
{ command = "exec xdg-mime default org.gnome.Evince.desktop application/pdf"; always = false; notification = false; }
|
||||||
{ command = "exec ${pkgs.autorandr}/bin/autorandr -c"; always = false; notification = false; }
|
{ command = "exec ${pkgs.autorandr}/bin/autorandr -c"; always = false; notification = false; }
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
export PRIMARY_DISPLAY="$(xrandr | awk '/ primary/{print $1}')"
|
|
||||||
|
|
||||||
xset s off
|
|
||||||
xset -dpms
|
|
||||||
|
|
||||||
xidlehook \
|
|
||||||
--not-when-fullscreen \
|
|
||||||
--not-when-audio \
|
|
||||||
--timer 60 \
|
|
||||||
'xrandr --output "$PRIMARY_DISPLAY" --brightness .1' \
|
|
||||||
'xrandr --output "$PRIMARY_DISPLAY" --brightness 1' \
|
|
||||||
--timer 600 \
|
|
||||||
'xrandr --output "$PRIMARY_DISPLAY" --brightness 1; systemctl suspend' \
|
|
||||||
''
|
|
|
@ -4,8 +4,6 @@
|
||||||
programs.rofi = {
|
programs.rofi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
font = "Fira Code Nerd Font 16";
|
font = "Fira Code Nerd Font 16";
|
||||||
separator = "solid";
|
|
||||||
scrollbar = false;
|
|
||||||
theme = "solarized";
|
theme = "solarized";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
23
nixos/i3/xidlehook.nix
Normal file
23
nixos/i3/xidlehook.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.xidlehook = {
|
||||||
|
enable = true;
|
||||||
|
not-when-audio = true;
|
||||||
|
not-when-fullscreen = true;
|
||||||
|
environment = {
|
||||||
|
"PRIMARY_DISPLAY" = "$(xrandr | awk '/ primary/{print $1}')";
|
||||||
|
};
|
||||||
|
timers = [
|
||||||
|
{
|
||||||
|
delay = 60;
|
||||||
|
command = "xrandr --output \"$PRIMARY_DISPLAY\" --brightness .1";
|
||||||
|
canceller = "xrandr --output \"$PRIMARY_DISPLAY\" --brightness 1";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
delay = 600;
|
||||||
|
command = "xrandr --output \"$PRIMARY_DISPLAY\" --brightness 1; systemctl suspend";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue