summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-03-24 11:17:52 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2025-03-24 11:17:52 +0100
commit73391c83177ad96643aa3df5ace4ca7e424b447e (patch)
tree26698b4b911563f454b4d5ff00f0166919a89c57
parent7e92018047bf5ad06e620466b1062067315718aa (diff)
downloadnixos-73391c83177ad96643aa3df5ace4ca7e424b447e.tar
nixos-73391c83177ad96643aa3df5ace4ca7e424b447e.tar.gz
nixos-73391c83177ad96643aa3df5ace4ca7e424b447e.tar.bz2
nixos-73391c83177ad96643aa3df5ace4ca7e424b447e.tar.xz
nixos-73391c83177ad96643aa3df5ace4ca7e424b447e.zip
...
-rw-r--r--accounts/gkleen@sif/niri/default.nix28
-rw-r--r--modules/envfs.nix77
2 files changed, 10 insertions, 95 deletions
diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix
index e4a93a49..302baea9 100644
--- a/accounts/gkleen@sif/niri/default.nix
+++ b/accounts/gkleen@sif/niri/default.nix
@@ -387,6 +387,8 @@ in {
387 in 387 in
388 [ (flag "prefer-no-csd") 388 [ (flag "prefer-no-csd")
389 389
390 (leaf "screenshot-path" "~/screenshots/%Y-%m-%dT%H:%M:%S.png")
391
390 (plain "hotkey-overlay" [ 392 (plain "hotkey-overlay" [
391 (flag "skip-at-startup") 393 (flag "skip-at-startup")
392 ]) 394 ])
@@ -703,27 +705,17 @@ in {
703 wl-copy "$(cut -d ':' -f 1 <<<"$FUZZEL_RES" | tr -d '\n')" && wtype -k XF86Paste 705 wl-copy "$(cut -d ':' -f 1 <<<"$FUZZEL_RES" | tr -d '\n')" && wtype -k XF86Paste
704 ''; 706 '';
705 })); 707 }));
706 "Print".action = spawn (lib.getExe (pkgs.writeShellApplication { 708 "Print".action = screenshot;
707 name = "screenshot"; 709 "Control+Print".action = screenshot-window;
708 runtimeInputs = with pkgs; [ grim slurp wl-clipboard-rs coreutils ]; 710 # "Shift+Print".action = screenshot-screen;
709 text = ''
710 grim -g "$(slurp -b 00000080 -c FFFFFFFF -s 00000000 -w 1)" - \
711 | tee "$HOME/screenshots/$(date +"%Y-%m-%dT%H:%M:%S").png" \
712 | wl-copy --type image/png
713 '';
714 }));
715 "Shift+Print".action = spawn (lib.getExe (pkgs.writeShellApplication {
716 name = "screenshot";
717 runtimeInputs = with pkgs; [ grim niri gojq wl-clipboard-rs coreutils ];
718 text = ''
719 grim -o "$(niri msg -j workspaces | jq -r '.[] | select(.is_focused) | .output')" - \
720 | tee "$HOME/screenshots/$(date +"%Y-%m-%dT%H:%M:%S").png" \
721 | wl-copy --type image/png
722 '';
723 }));
724 "Mod+B".action = with-select-window-action ".workspace_id == ($active_workspace | tonumber)" "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}"; 711 "Mod+B".action = with-select-window-action ".workspace_id == ($active_workspace | tonumber)" "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}";
725 "Mod+Shift+B".action = with-select-window-action "true" "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}"; 712 "Mod+Shift+B".action = with-select-window-action "true" "{\"Action\":{\"FocusWindow\":{\"id\": .id}}}";
726 713
714 "Mod+Escape" = {
715 allow-inhibiting = false;
716 action = toggle-keyboard-shortcuts-inhibit;
717 };
718
727 "Mod+H".action = focus-column-left; 719 "Mod+H".action = focus-column-left;
728 "Mod+T".action = focus-window-down; 720 "Mod+T".action = focus-window-down;
729 "Mod+N".action = focus-window-up; 721 "Mod+N".action = focus-window-up;
diff --git a/modules/envfs.nix b/modules/envfs.nix
deleted file mode 100644
index b5b453a5..00000000
--- a/modules/envfs.nix
+++ /dev/null
@@ -1,77 +0,0 @@
1{ pkgs, config, lib, ... }:
2
3let
4 cfg = config.services.envfs;
5 mounts = {
6 "/usr/bin" = {
7 device = "none";
8 fsType = "envfs";
9 options = [
10 "bind-mount=/bin"
11 "fallback-path=${pkgs.symlinkJoin {
12 name = "fallback-path";
13 inherit (cfg) paths;
14 }}"
15 "nofail"
16 ];
17 };
18 "/bin" = {
19 device = "/usr/bin";
20 fsType = "none";
21 options = [ "bind" "nofail" ];
22 };
23 };
24in {
25 disabledModules = [ "tasks/filesystems/envfs.nix" ];
26
27 options = {
28 services.envfs = {
29 enable = lib.mkEnableOption "Envfs filesystem" // {
30 default = true;
31 description = ''
32 Fuse filesystem that returns symlinks to executables based on the PATH
33 of the requesting process. This is useful to execute shebangs on NixOS
34 that assume hard coded locations in locations like /bin or /usr/bin
35 etc.
36 '';
37 };
38
39 package = lib.mkOption {
40 type = lib.types.package;
41 default = pkgs.envfs;
42 defaultText = lib.literalExpression "pkgs.envfs";
43 description = "Which package to use for the envfs.";
44 };
45
46 paths = lib.mkOption {
47 type = lib.types.listOf lib.types.package;
48 default = [
49 (pkgs.runCommand "fallback-path-environment" {} ''
50 mkdir -p $out
51 ln -s ${config.environment.usrbinenv} $out/env
52 ln -s ${config.environment.binsh} $out/sh
53 '')
54 ];
55 defaultText = lib.literalExpression ''
56 [ (pkgs.runCommand "fallback-path-environment" {} '''
57 mkdir -p $out
58 ln -s ''${config.environment.usrbinenv} $out/env
59 ln -s ''${config.environment.binsh} $out/sh
60 ''')
61 ]
62 '';
63 description = "Extra packages to join into collection of fallback executables in case not other executable is found";
64 };
65 };
66 };
67
68 config = lib.mkIf (cfg.enable) {
69 environment.systemPackages = [ cfg.package ];
70 # we also want these mounts in virtual machines.
71 fileSystems = if config.virtualisation ? qemu then lib.mkVMOverride mounts else mounts;
72
73 # We no longer need those when using envfs
74 system.activationScripts.usrbinenv = lib.mkForce "";
75 system.activationScripts.binsh = lib.mkForce "";
76 };
77}