This commit is contained in:
Hadi 2024-05-09 10:54:19 +02:00
parent e58fda9896
commit a26fbaa2c3
4 changed files with 129 additions and 67 deletions

View File

@ -97,6 +97,21 @@
"type": "github"
}
},
"flake-root": {
"locked": {
"lastModified": 1713493429,
"narHash": "sha256-ztz8JQkI08tjKnsTpfLqzWoKFQF4JGu2LRz8bkdnYUk=",
"owner": "srid",
"repo": "flake-root",
"rev": "bc748b93b86ee76e2032eecda33440ceb2532fcd",
"type": "github"
},
"original": {
"owner": "srid",
"repo": "flake-root",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
@ -198,11 +213,11 @@
]
},
"locked": {
"lastModified": 1714679908,
"narHash": "sha256-KzcXzDvDJjX34en8f3Zimm396x6idbt+cu4tWDVS2FI=",
"lastModified": 1715077503,
"narHash": "sha256-AfHQshzLQfUqk/efMtdebHaQHqVntCMjhymQzVFLes0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "9036fe9ef8e15a819fa76f47a8b1f287903fb848",
"rev": "6e277d9566de9976f47228dd8c580b97488734d4",
"type": "github"
},
"original": {
@ -219,11 +234,11 @@
]
},
"locked": {
"lastModified": 1714679908,
"narHash": "sha256-KzcXzDvDJjX34en8f3Zimm396x6idbt+cu4tWDVS2FI=",
"lastModified": 1715077503,
"narHash": "sha256-AfHQshzLQfUqk/efMtdebHaQHqVntCMjhymQzVFLes0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "9036fe9ef8e15a819fa76f47a8b1f287903fb848",
"rev": "6e277d9566de9976f47228dd8c580b97488734d4",
"type": "github"
},
"original": {
@ -264,45 +279,47 @@
"hyprland": {
"inputs": {
"hyprcursor": "hyprcursor",
"hyprland-protocols": "hyprland-protocols",
"hyprlang": "hyprlang",
"hyprwayland-scanner": "hyprwayland-scanner",
"nixpkgs": "nixpkgs_2",
"systems": "systems_2",
"wlroots": "wlroots",
"xdph": "xdph"
},
"locked": {
"lastModified": 1714851003,
"narHash": "sha256-U5waSzulVM9LnoRgkqCGBEWkiAG/F9gK69gDgaY82qo=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "a3309b51a254f142c535022615be6f76eb23fa9b",
"type": "github"
"lastModified": 1715203037,
"narHash": "sha256-yWsrCPhBpin7AXVI66/EAE+YPJTweS8CDCZJQliB10k=",
"ref": "refs/heads/main",
"rev": "e4e84064f2d07810e0c150bce1369a0a00503e9a",
"revCount": 4638,
"submodules": true,
"type": "git",
"url": "https://github.com/hyprwm/Hyprland"
},
"original": {
"owner": "hyprwm",
"repo": "Hyprland",
"type": "github"
"submodules": true,
"type": "git",
"url": "https://github.com/hyprwm/Hyprland"
}
},
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
"hyprland",
"xdph",
"nixpkgs"
],
"systems": [
"hyprland",
"xdph",
"systems"
]
},
"locked": {
"lastModified": 1691753796,
"narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=",
"lastModified": 1714869498,
"narHash": "sha256-vbLVOWvQqo4n1yvkg/Q70VTlPbMmTiCQfNTgcWDCfJM=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03",
"rev": "e06482e0e611130cd1929f75e8c1cf679e57d161",
"type": "github"
},
"original": {
@ -370,11 +387,11 @@
]
},
"locked": {
"lastModified": 1714755542,
"narHash": "sha256-D0pg+ZRwrt4lavZ97Ca8clsgbPA3duLj8iEM7riaIFY=",
"lastModified": 1715090986,
"narHash": "sha256-FXpQvmS9R7alwZ47XK5UIcAbC9YKSxc0+GOVYqwa0jM=",
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"rev": "1270ebaa539e56d61b708c24b072b09cbbd3a828",
"rev": "94e32ec37e7215b16d5c1b41b1773ff6742e704b",
"type": "github"
},
"original": {
@ -406,11 +423,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1714746424,
"narHash": "sha256-Jdyw7VcM+jQ0uSXgjFj8UdXZ229yOvPNlYkKyKyHA4s=",
"lastModified": 1715148395,
"narHash": "sha256-lRxjTxY3103LGMjWdVqntKZHhlmMX12QUjeFrQMmGaE=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "3f017311191fe6d501ca2496a835d012f656ee9c",
"rev": "a4e2b7909fc1bdf30c30ef21d388fde0b5cdde4a",
"type": "github"
},
"original": {
@ -438,11 +455,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1713638189,
"narHash": "sha256-q7APLfB6FmmSMI1Su5ihW9IwntBsk2hWNXh8XtSdSIk=",
"lastModified": 1714858427,
"narHash": "sha256-tCxeDP4C1pWe2rYY3IIhdA40Ujz32Ufd4tcrHPSKx2M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "74574c38577914733b4f7a775dd77d24245081dd",
"rev": "b980b91038fc4b09067ef97bbe5ad07eecca1e76",
"type": "github"
},
"original": {
@ -470,11 +487,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1714635257,
"narHash": "sha256-4cPymbty65RvF1DWQfc+Bc8B233A1BWxJnNULJKQ1EY=",
"lastModified": 1715087517,
"narHash": "sha256-CLU5Tsg24Ke4+7sH8azHWXKd0CFd4mhLWfhYgUiDBpQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "63c3a29ca82437c87573e4c6919b09a24ea61b0f",
"rev": "b211b392b8486ee79df6cdfb1157ad2133427a29",
"type": "github"
},
"original": {
@ -521,19 +538,21 @@
"devshell": "devshell",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"flake-root": "flake-root",
"home-manager": "home-manager_2",
"nix-darwin": "nix-darwin",
"nixpkgs": [
"nixpkgs"
],
"pre-commit-hooks": "pre-commit-hooks"
"pre-commit-hooks": "pre-commit-hooks",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1714730761,
"narHash": "sha256-TjxlzjUl+wf3xw1+NKJSMZ/yWO+HE7X8aP1Qey77R2o=",
"lastModified": 1715115147,
"narHash": "sha256-oREqXPEtuYbOdBKbsDQzr2V01EzK4kD8MTdwO9ljTnU=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "c05fba47c733445098847399b61ddfd81ecbde55",
"rev": "f7f255afe22fcca0c07177c3707fd61fa0c85835",
"type": "github"
},
"original": {
@ -671,11 +690,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1713892811,
"narHash": "sha256-uIGmA2xq41vVFETCF1WW4fFWFT2tqBln+aXnWrvjGRE=",
"lastModified": 1715244550,
"narHash": "sha256-ffOZL3eaZz5Y1nQ9muC36wBCWwS1hSRLhUzlA9hV2oI=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "f1b0adc27265274e3b0c9b872a8f476a098679bd",
"rev": "0dc50257c00ee3c65fef3a255f6564cfbfe6eb7f",
"type": "github"
},
"original": {
@ -808,6 +827,27 @@
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1714058656,
"narHash": "sha256-Qv4RBm4LKuO4fNOfx9wl40W2rBbv5u5m+whxRYUMiaA=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "c6aaf729f34a36c445618580a9f95a48f5e4e03f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_6"
@ -826,29 +866,9 @@
"type": "github"
}
},
"wlroots": {
"flake": false,
"locked": {
"lastModified": 1713731601,
"narHash": "sha256-bdcKdtLkusvv85DNuJsajZLFeq7bXp+x5AGP1Sd4wD8=",
"owner": "hyprwm",
"repo": "wlroots-hyprland",
"rev": "5c1d51c5a2793480f5b6c4341ad0797052aec2ea",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "wlroots-hyprland",
"rev": "5c1d51c5a2793480f5b6c4341ad0797052aec2ea",
"type": "github"
}
},
"xdph": {
"inputs": {
"hyprland-protocols": [
"hyprland",
"hyprland-protocols"
],
"hyprland-protocols": "hyprland-protocols",
"hyprlang": [
"hyprland",
"hyprlang"

View File

@ -18,7 +18,7 @@
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
hyprland.url = "github:hyprwm/Hyprland";
hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
rose-pine-hyprcursor.url = "github:ndom91/rose-pine-hyprcursor";
};

View File

@ -0,0 +1,42 @@
{ pkgs, ... }:
let
notify-system = pkgs.writeShellScriptBin "notify-system" ''
function minute() {
while true;do
battery-plugged &
battery-level &
sleep 60
done
}
minute &
'';
battery-plugged = pkgs.writeShellScriptBin "battery-plugged" ''
BATTERY_STATUS=$(cat /sys/class/power_supply/BAT*/status | head -n1)
OLD_BATTERY_STATUS=$(cat /tmp/old_battery_status 2>/dev/null || echo "Unknown")
if [[ $BATTERY_STATUS != $OLD_BATTERY_STATUS ]]; then
if [[ $BATTERY_STATUS == "Discharging" ]]; then
${pkgs.libnotify}/bin/notify-send "󰁻 " "Battery is unplugged"
else
${pkgs.libnotify}/bin/notify-send "󰁻 " "Battery is plugged in"
fi
fi
echo $BATTERY_STATUS > /tmp/old_battery_status
'';
battery-level = pkgs.writeShellScriptBin "battery-level" ''
BATTERY_LEVEL=$(cat /sys/class/power_supply/BAT*/capacity | head -n1)
BATTERY_STATUS=$(cat /sys/class/power_supply/BAT*/status | head -n1)
if [[ $BATTERY_LEVEL -le 20 ]] && [[ $BATTERY_STATUS == "Discharging" ]]; then
${pkgs.libnotify}/bin/notify-send "󰁻 Low battery" "Battery level is $BATTERY_LEVEL%"
elif [[ $BATTERY_LEVEL -le 10 ]] && [[ $BATTERY_STATUS == "Discharging" ]]; then
${pkgs.libnotify}/bin/notify-send --urgency=critical "󰁺 Very low battery" "Battery level is $BATTERY_LEVEL%"
fi
'';
in {
home.packages = with pkgs; [ notify-system battery-plugged battery-level ];
}

View File

@ -13,11 +13,11 @@
on-resume = ${pkgs.libnotify}/bin/notify-send "Welcome back ${config.home.username}!"
}
# Suspend
listener {
timeout = 660
on-timeout = systemctl suspend
# Suspend (not working on my laptop)
#listener {
# timeout = 660
# on-timeout = systemctl suspend
# on-resume = ${pkgs.libnotify}/bin/notify-send "Welcome back to your desktop!"
}
#}
'';
}