feat: added images

This commit is contained in:
Patrick 2023-09-27 20:49:09 +02:00
parent 36d225c0ea
commit b237a21359
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
10 changed files with 95 additions and 24 deletions

View file

@ -36,12 +36,12 @@
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1695588239,
"narHash": "sha256-FMeJBXADlrWqJlBCEkfsOz4b2yzjMUwAD0zYGkLhAXQ=",
"owner": "oddlama",
"repo": "agenix-rekey",
"rev": "e33d9479671a9e253790c8b2b09bbe3072ecf289",
"type": "github"
"dirtyRev": "da8fc11d2e83a7cdba24cfd43ca39bf866d0e56a-dirty",
"dirtyShortRev": "da8fc11-dirty",
"lastModified": 1695737316,
"narHash": "sha256-WAZMw/HqNqaCRCx/DDPWzITDIV8ui9c3PaiTzxYPoTE=",
"type": "git",
"url": "file:///home/patrick/repos/nix/agenix-rekey"
},
"original": {
"owner": "oddlama",

BIN
img/mic.png.age Normal file

Binary file not shown.

BIN
img/qr.png.age Normal file

Binary file not shown.

View file

@ -7,6 +7,7 @@
imports = [
inputs.stylix.nixosModules.stylix
./fonts.nix
./images.nix
];
stylix = {

View file

@ -0,0 +1,65 @@
{
lib,
config,
...
}: let
inherit
(lib)
mkEnableOption
mkMerge
attrNames
flip
filterAttrs
mkIf
mkOption
types
removeSuffix
hasPrefix
mapAttrs'
listToAttrs
;
in {
home-manager.sharedModules = [
{
options.images = {
enable = mkEnableOption "Enable images";
images = mkOption {
type = types.attrsOf types.path;
readOnly = true;
default = flip mapAttrs' (filterAttrs (n: _: hasPrefix "images-" n) config.age.secrets) (
name: value: {
inherit (value) name;
value = value.path;
}
);
};
};
}
];
imports = [
{
age.secrets = mkMerge (
flip map
(attrNames config.home-manager.users)
(
user:
mkIf config.home-manager.users.${user}.images.enable (
listToAttrs (flip map (attrNames (filterAttrs (_: type: type == "regular") (builtins.readDir ../../img)))
(
file: {
name = "images-${user}-${file}";
value = {
name = removeSuffix ".age" file;
rekeyFile = ../../img/${file};
owner = user;
group = user;
};
}
))
)
)
);
}
];
}

View file

@ -16,9 +16,10 @@ lib.optionalAttrs (!minimal) {
age.secrets.secureboot.rekeyFile = ../../hosts/${config.node.name}/secrets/secureboot.tar.age;
system.activationScripts.securebootuntar = {
text = ''
rm -r /run/secureboot || true
mkdir -p /run/secureboot
${pkgs.gnutar}/bin/tar xf ${config.age.secrets.secureboot.path} -C /run/secureboot || true
rm -r /run/secureboot || true
mkdir -p /run/secureboot
chmod 700 /run/secureboot
${pkgs.gnutar}/bin/tar xf ${config.age.secrets.secureboot.path} -C /run/secureboot || true
'';
deps = ["agenix"];
};

View file

@ -31,7 +31,12 @@
${maim} | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png
''
);
"${cfg.modifier}+F10" =
"${cfg.modifier}+F10" = let
nsend = '' ${pkgs.libnotify}/bin/notify-send \
-h string:category:Screenshot\
-h string:image-path:"${config.images.images."qr.png"}" \
'';
in
"exec "
+ toString (
pkgs.writeShellScript "clipboard-qr-screenshot" ''
@ -43,15 +48,15 @@
fi
case "$return" in
"0")
${pkgs.libnotify}/bin/notify-send -h string:category:"Screenshot" "Copied qr to clipboard"
${nsend} "Copied qr to clipboard"
${pkgs.xclip}/bin/xclip -selection clipboard -f <<< ''${qr%"''${qr##*[![:space:]]}"}
exit 0
;;
"4")
${pkgs.libnotify}/bin/notify-send -h string:category:"Screenshot" "No qr found"
${nsend} "No qr found"
;;
*)
${pkgs.libnotify}/bin/notify-send -h string:category:"Screenshot" "Failure scanning qr"
${nsend} "Failure scanning qr"
;;
esac
''

View file

@ -1,4 +1,4 @@
{
{config, ...}: {
programs.streamdeck-ui = {
enable = true;
settings = {
@ -12,7 +12,8 @@
# keyInput to press
keys = "F7";
# Text shown on button
text = "mute";
#text = "mute";
icon = config.images.images."mic.png";
# Text position
text_vertical_align = "middle-bottom";
};
@ -21,14 +22,6 @@
text = "deafen";
text_vertical_align = "middle-bottom";
};
"7" = {
# background picture
icon = "/home/patrick/ms.jpg";
# command to execute on press
command = "echo lol";
# background fill colour
background_color = "#000000";
};
};
};
brightness = 99; # brighness value between 0 and 99

View file

@ -33,7 +33,12 @@ lib.optionalAttrs (!minimal) {
# xournalpp needs this or else it will crash
gnome3.adwaita-icon-theme
];
age.secrets.smb-creds.rekeyFile = ../../secrets/smb.cred.age;
age.secrets = {
smb-creds = {
owner = "patrick";
rekeyFile = ../../secrets/smb.cred.age;
};
};
programs.dconf.enable = true;
home-manager.users.patrick = {

View file

@ -1,4 +1,5 @@
{pkgs, ...}: {
images.enable = true;
home = {
packages = with pkgs; [
nextcloud-client