Compare commits
2 commits
4bc5176a5c
...
87c74d3f0b
Author | SHA1 | Date | |
---|---|---|---|
87c74d3f0b | |||
376dbda242 |
3 changed files with 80 additions and 5 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
# From https://github.com/fzakaria/nix-home/blob/framework-laptop/modules/nixos/fprint-laptop-lid.nix
|
||||||
# Originally this file was based on
|
# Originally this file was based on
|
||||||
# https://unix.stackexchange.com/questions/678609/how-to-disable-fingerprint-authentication-when-laptop-lid-is-closed
|
# https://unix.stackexchange.com/questions/678609/how-to-disable-fingerprint-authentication-when-laptop-lid-is-closed
|
||||||
# However I found this not to work as the fprintd is started via dbus and masking it doesn't seem to do anything.
|
# However I found this not to work as the fprintd is started via dbus and masking it doesn't seem to do anything.
|
||||||
|
@ -12,18 +13,18 @@
|
||||||
let
|
let
|
||||||
cfg = config.mySystem.system.fingerprint-reader-on-laptop-lid;
|
cfg = config.mySystem.system.fingerprint-reader-on-laptop-lid;
|
||||||
laptop-lid = pkgs.writeShellScript "laptop-lid" ''
|
laptop-lid = pkgs.writeShellScript "laptop-lid" ''
|
||||||
lock=$HOME/fingerprint-reader-disabled
|
lock=/var/lock/fingerprint-reader-disabled
|
||||||
|
|
||||||
# match for either display port or hdmi port
|
# match for either display port or hdmi port
|
||||||
if grep -Fq closed /proc/acpi/button/lid/LID0/state &&
|
if grep -Fq closed /proc/acpi/button/lid/LID0/state &&
|
||||||
(grep -Fxq connected /sys/class/drm/card1-DP-*/status ||
|
(grep -Fxq connected /sys/class/drm/card*-DP-*/status ||
|
||||||
grep -Fxq connected /sys/class/drm/card1-HDMI-*/status)
|
grep -Fxq connected /sys/class/drm/card*-HDMI-*/status)
|
||||||
then
|
then
|
||||||
touch "$lock"
|
touch "$lock"
|
||||||
echo 0 > /sys/bus/usb/devices/1-4/authorized
|
echo 0 > /sys/bus/usb/devices/5-4.1/authorized
|
||||||
elif [ -f "$lock" ]
|
elif [ -f "$lock" ]
|
||||||
then
|
then
|
||||||
echo 1 > /sys/bus/usb/devices/1-4/authorized
|
echo 1 > /sys/bus/usb/devices/5-4.1/authorized
|
||||||
rm "$lock"
|
rm "$lock"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
70
nixos/overlays/charm-mods/default.nix
Normal file
70
nixos/overlays/charm-mods/default.nix
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
buildGoModule,
|
||||||
|
installShellFiles,
|
||||||
|
fetchFromGitHub,
|
||||||
|
gitUpdater,
|
||||||
|
testers,
|
||||||
|
mods,
|
||||||
|
}:
|
||||||
|
|
||||||
|
buildGoModule rec {
|
||||||
|
pname = "mods";
|
||||||
|
version = "1.5.0";
|
||||||
|
commitHash = "820b22023653d1066f49b3b817dbfb3bcefbe2a1";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "charmbracelet";
|
||||||
|
repo = "mods";
|
||||||
|
rev = commitHash;
|
||||||
|
# hash = "sha256-Niap2qsIJwlDRITkPD2Z7NCiJubkyy8/pvagj5Beq84=";
|
||||||
|
hash = "sha256-VYe6qEDcsgr1E/Gtt+4lad2qtPeMKGINmhEk5Ed98Pw=";
|
||||||
|
};
|
||||||
|
|
||||||
|
vendorHash = "sha256-sLpFOoZq/xE0co5XegScUIOt8Ax/N3ROwQJIPvu8jts=";
|
||||||
|
# vendorHash = "sha256-DaSbmu1P/umOAhG901aC+TKa3xXSvUbpYsaiYTr2RJs=";
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
installShellFiles
|
||||||
|
];
|
||||||
|
|
||||||
|
ldflags = [
|
||||||
|
"-s"
|
||||||
|
"-w"
|
||||||
|
"-X=main.Version=${version}-${commitHash}"
|
||||||
|
];
|
||||||
|
|
||||||
|
# These tests require internet access.
|
||||||
|
checkFlags = [ "-skip=^TestLoad/http_url$|^TestLoad/https_url$" ];
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
updateScript = gitUpdater {
|
||||||
|
rev-prefix = "v";
|
||||||
|
ignoredVersions = ".(rc|beta).*";
|
||||||
|
};
|
||||||
|
|
||||||
|
tests.version = testers.testVersion {
|
||||||
|
package = mods;
|
||||||
|
command = "HOME=$(mktemp -d) mods -v";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
export HOME=$(mktemp -d)
|
||||||
|
$out/bin/mods man > mods.1
|
||||||
|
$out/bin/mods completion bash > mods.bash
|
||||||
|
$out/bin/mods completion fish > mods.fish
|
||||||
|
$out/bin/mods completion zsh > mods.zsh
|
||||||
|
|
||||||
|
installManPage mods.1
|
||||||
|
installShellCompletion mods.{bash,fish,zsh}
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "AI on the command line";
|
||||||
|
homepage = "https://github.com/charmbracelet/mods";
|
||||||
|
license = licenses.mit;
|
||||||
|
maintainers = with maintainers; [ dit7ya caarlos0 ];
|
||||||
|
mainProgram = "mods";
|
||||||
|
};
|
||||||
|
}
|
|
@ -9,11 +9,15 @@ let
|
||||||
termiusOverlay = self: super: {
|
termiusOverlay = self: super: {
|
||||||
termius = super.callPackage ./termius { };
|
termius = super.callPackage ./termius { };
|
||||||
};
|
};
|
||||||
|
modsOverlay = self: super: {
|
||||||
|
mods = super.callPackage ./charm-mods { };
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nur = inputs.nur.overlay;
|
nur = inputs.nur.overlay;
|
||||||
vivaldi = vivaldiOverlay;
|
vivaldi = vivaldiOverlay;
|
||||||
termius = termiusOverlay;
|
termius = termiusOverlay;
|
||||||
|
mods = modsOverlay;
|
||||||
|
|
||||||
# The unstable nixpkgs set (declared in the flake inputs) will
|
# The unstable nixpkgs set (declared in the flake inputs) will
|
||||||
# be accessible through 'pkgs.unstable'
|
# be accessible through 'pkgs.unstable'
|
||||||
|
|
Loading…
Reference in a new issue