This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- dev is the device that shall be read (Like "BAT0") | |
-- attr are the attributes that are going to be read ("status" for charging status, "capacity" for charged capacity, and so on) | |
acpi_power :: String -> [String] -> Logger | |
acpi_power dev attr = io $ do | |
attrOut <- mapM (\x -> liftIO $ readFile $ sysFsPath ++ x) attr | |
return $ Just $ filter (/= '\n') (intercalate " " attrOut) | |
where | |
sysFsPath = "/sys/class/power_supply/" ++ dev ++ "/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################# | |
# CORE SETTINGS # | |
################# | |
# | |
# Zim settings | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Define acpi power logger | |
acpi_power :: String -> [String] -> Logger | |
acpi_power dev attr = | |
io $ do | |
attrOut <- mapM (\x -> liftIO $ readFile $ sysFsPath ++ x) attr | |
return $ Just $ filter (/= '\n') (intercalate " " attrOut) | |
where | |
sysFsPath = "/sys/class/power_supply/" ++ dev ++ "/" | |
file_reader :: String -> Logger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BOOTUUID=`blkid -o value $(df /boot | grep "$MOUNTPOINT\$"| cut -f1 -d" ") | head -n 2 | tail -n1`; | |
ROOTUUID=`blkid -o value $(df / | grep "$MOUNTPOINT\$"| cut -f1 -d" ") | head -n 2 | tail -n1`; | |
PREFIX="" | |
if [ "$BOOTUUID" = "$ROOTUUID" ]; then | |
PREFIX="/boot" | |
fi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
#if 0 | |
TMPFILE=$(mktemp); | |
tail -n +10 $0 | gcc -march=native -o $TMPFILE -x c -; | |
$TMPFILE "${@:1}"; | |
RETVAL=$? | |
rm $TMPFILE; | |
exit $RETVAL; | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ lib, pkgs, config, ... }: | |
with lib; | |
let | |
cfg = config.virtualisation.libvirtd; | |
boolToZeroOne = x: if x then "1" else "0"; | |
aclString = with lib.strings; | |
concatMapStringsSep ",\n " escapeNixString cfg.deviceACL; | |
in { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bracket | |
(do | |
sock <- socket AF_UNIX Stream 0 | |
setSocketOption sock ReuseAddr 1 | |
bind sock $ SockAddrUnix s | |
listen sock maxListenQueue | |
return sock | |
) | |
(\sock -> do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
services.udev.extraRules = let | |
camSettings = pkgs.writeShellScript "setup-v4l2.sh" '' | |
${pkgs.v4l-utils}/bin/v4l2-ctl \ | |
--device $1 \ | |
--set-fmt-video=width=1920,height=1080,pixelformat=MJPG \ # Set to 1080p | |
-p 30 \ # Set to 30 FPS | |
--set-ctrl=power_line_frequency=1 \ # Set to 50Hz power line compensation | |
--set-ctrl=focus_auto=0 # Disable autofocus | |
''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
services.postgresql = { | |
enable = true; | |
ensureDatabases = [ "nextcloud" ]; | |
ensureUsers = [ | |
{ name = "nextcloud"; | |
ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES"; | |
} | |
]; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nix-build \ | |
--cores 0 \ | |
'<nixos-unstable/nixos>' \ | |
-I nixos-config=image.nix \ | |
-A config.system.build.sdImage \ | |
-o result-cross \ | |
--show-trace |
OlderNewer