Files
nix-flake/modules/hosts/takamaki/takamaki.nix
T
greyweather 023fc0c424 add features.applications.shellScripts option
uses a custom function from my helper flake to convert a basic attrset of strings into a format `home.file` will accept
2026-08-30 02:54:08 +01:00

93 lines
2.8 KiB
Nix

{ inputs, self, ... }: {
flake.homeConfigurations.takamaki = inputs.home-manager.lib.homeManagerConfiguration {
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
modules = with self.homeModules; [
takamaki
inputs.stylix.homeModules.stylix
];
extraSpecialArgs = { inherit inputs; };
};
flake.homeModules.takamaki = { pkgs, config, lib, ... }: {
imports = with self.homeModules; [
global
graphics
];
info = {
rootPath = "/home/grey/flake";
hostName = "takamaki";
stateVersion = "26.11";
};
services.gpg-agent = {
enable = true;
extraConfig = ''
pinentry-program /usr/bin/pinentry
'';
};
features = {
shells.zsh = {
enable = true;
antidote.enable = true;
};
applications = {
cli = {
fastfetch.enable = true;
};
gui = {
vscode.enable = true;
};
shellScripts = {
switch-os = ''
sudo efibootmgr --bootnext 0000
sudo reboot
'';
universal-reboot = ''
sudo reboot
'';
universal-shutdown = ''
sudo systemctl poweroff
'';
};
extraPackages = with pkgs; [
(writeShellScriptBin "increase-brightness" ''
LOOP_COUNTER=0
DEVICE=$1
PRETTY_NAME=$(sudo ddccontrol dev:$DEVICE 2>&1 >/dev/null | grep -oP "/usr/share/ddccontrol-db/monitor/\K.+\.xml" | sed 's/.xml//')
while
RESULT=$(sudo ddccontrol -r 0x10 -W +5 dev:$DEVICE 2> /dev/null)
WRITTEN=$(echo $RESULT | grep -oP "Writing.+\(\K\d{1,3}\)" | sed 's/)//')
CONTROL=$(echo $RESULT | grep -oP "Control.+\+/\K\d{1,3}/100" | sed 's/\/100//')
LOOP_COUNTER=$(($LOOP_COUNTER + 1))
[[ "$WRITTEN" != "$CONTROL" ]] && [ $LOOP_COUNTER -lt 5 ]
do true; done
noctalia msg notification-show "Set brightness to $WRITTEN for display $PRETTY_NAME"
'')
(writeShellScriptBin "decrease-brightness" ''
LOOP_COUNTER=0
DEVICE=$1
PRETTY_NAME=$(sudo ddccontrol dev:$DEVICE 2>&1 >/dev/null | grep -oP "/usr/share/ddccontrol-db/monitor/\K.+\.xml" | sed 's/.xml//')
while
RESULT=$(sudo ddccontrol -r 0x10 -W -5 dev:$DEVICE 2> /dev/null)
WRITTEN=$(echo $RESULT | grep -oP "Writing.+\(\K\d{1,3}\)" | sed 's/)//')
CONTROL=$(echo $RESULT | grep -oP "Control.+\+/\K\d{1,3}/100" | sed 's/\/100//')
LOOP_COUNTER=$(($LOOP_COUNTER + 1))
[[ "$WRITTEN" != "$CONTROL" ]] && [ $LOOP_COUNTER -lt 5 ]
do true; done
noctalia msg notification-show "Set brightness to $WRITTEN for display $PRETTY_NAME"
'')
];
};
};
};
}