diff --git a/flake.lock b/flake.lock index b27b635..7e47b55 100644 --- a/flake.lock +++ b/flake.lock @@ -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", diff --git a/img/mic.png.age b/img/mic.png.age new file mode 100644 index 0000000..1075672 Binary files /dev/null and b/img/mic.png.age differ diff --git a/img/qr.png.age b/img/qr.png.age new file mode 100644 index 0000000..aa2550e Binary files /dev/null and b/img/qr.png.age differ diff --git a/modules/graphical/default.nix b/modules/graphical/default.nix index 05fd1ee..713b2d1 100644 --- a/modules/graphical/default.nix +++ b/modules/graphical/default.nix @@ -7,6 +7,7 @@ imports = [ inputs.stylix.nixosModules.stylix ./fonts.nix + ./images.nix ]; stylix = { diff --git a/modules/graphical/images.nix b/modules/graphical/images.nix new file mode 100644 index 0000000..d530246 --- /dev/null +++ b/modules/graphical/images.nix @@ -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; + }; + } + )) + ) + ) + ); + } + ]; +} diff --git a/modules/optional/secureboot.nix b/modules/optional/secureboot.nix index ce3e4a6..088eb1a 100644 --- a/modules/optional/secureboot.nix +++ b/modules/optional/secureboot.nix @@ -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"]; }; diff --git a/users/common/graphical/Xorg/i3.nix b/users/common/graphical/Xorg/i3.nix index a6579cb..270b00d 100644 --- a/users/common/graphical/Xorg/i3.nix +++ b/users/common/graphical/Xorg/i3.nix @@ -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 '' diff --git a/users/common/programs/streamdeck.nix b/users/common/programs/streamdeck.nix index 10a8c00..89d7993 100644 --- a/users/common/programs/streamdeck.nix +++ b/users/common/programs/streamdeck.nix @@ -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 diff --git a/users/patrick/default.nix b/users/patrick/default.nix index f805f37..7ba8e73 100644 --- a/users/patrick/default.nix +++ b/users/patrick/default.nix @@ -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 = { diff --git a/users/patrick/patrick.nix b/users/patrick/patrick.nix index 6b13d7a..ea82067 100644 --- a/users/patrick/patrick.nix +++ b/users/patrick/patrick.nix @@ -1,4 +1,5 @@ {pkgs, ...}: { + images.enable = true; home = { packages = with pkgs; [ nextcloud-client