Trying out Niri

pull/75/head
Tudor Roman 2024-04-01 13:55:17 +02:00
parent 51797a6c63
commit 980fd19316
Signed by: tudor
SSH Key Fingerprint: SHA256:3CwS9plgXBecpXImPGxDIaSktUXBejbV/zerZMqzzBk
9 changed files with 684 additions and 23 deletions

View File

@ -25,6 +25,81 @@
"type": "github"
}
},
"cachix": {
"inputs": {
"devenv": [
"niri",
"crate2nix"
],
"flake-compat": [
"niri",
"crate2nix"
],
"nixpkgs": "nixpkgs",
"pre-commit-hooks": [
"niri",
"crate2nix"
]
},
"locked": {
"lastModified": 1704717040,
"narHash": "sha256-d9BohugsKajvjNgt+VyXHuDdLOFKr9mhwpdUNkpIP3s=",
"owner": "cachix",
"repo": "cachix",
"rev": "759c8e6e7fd99ee132d95753c100777811e63415",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "latest",
"repo": "cachix",
"type": "github"
}
},
"crate2nix": {
"inputs": {
"cachix": "cachix",
"crate2nix_stable": "crate2nix_stable",
"devshell": "devshell",
"flake-compat": "flake-compat_3",
"flake-parts": "flake-parts_2",
"nix-test-runner": "nix-test-runner",
"nixpkgs": "nixpkgs_2",
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1710450631,
"narHash": "sha256-frfM5jdRvnhU4w+omLhkdfesP2Bwf7qB86vLXWO/cIk=",
"owner": "nix-community",
"repo": "crate2nix",
"rev": "e494b56b7445ba59ef049bcfdc889f5c558768d4",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "crate2nix",
"type": "github"
}
},
"crate2nix_stable": {
"inputs": {
"flake-utils": "flake-utils"
},
"locked": {
"lastModified": 1702842982,
"narHash": "sha256-A9AowkHIjsy1a4LuiPiVP88FMxyCWK41flZEZOUuwQM=",
"owner": "nix-community",
"repo": "crate2nix",
"rev": "75ac2973affa6b9b4f661a7b592cba6e4f51d426",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "0.12.0",
"repo": "crate2nix",
"type": "github"
}
},
"deploy-rs": {
"inputs": {
"flake-compat": "flake-compat",
@ -47,6 +122,29 @@
"type": "github"
}
},
"devshell": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": [
"niri",
"crate2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1705332421,
"narHash": "sha256-USpGLPme1IuqG78JNqSaRabilwkCyHmVWY0M9vYyqEA=",
"owner": "numtide",
"repo": "devshell",
"rev": "83cb93d6d063ad290beee669f4badf9914cc16ec",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@ -80,6 +178,20 @@
}
},
"flake-compat_3": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1696426674,
@ -95,7 +207,7 @@
"type": "github"
}
},
"flake-compat_4": {
"flake-compat_5": {
"flake": false,
"locked": {
"lastModified": 1696426674,
@ -131,7 +243,101 @@
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"niri",
"crate2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1706830856,
"narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_3": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1709336216,
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_5"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_4": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
@ -146,9 +352,9 @@
"type": "github"
}
},
"flake-utils_2": {
"flake-utils_5": {
"inputs": {
"systems": "systems_3"
"systems": "systems_6"
},
"locked": {
"lastModified": 1705309234,
@ -164,9 +370,9 @@
"type": "github"
}
},
"flake-utils_3": {
"flake-utils_6": {
"inputs": {
"systems": "systems_4"
"systems": "systems_7"
},
"locked": {
"lastModified": 1710146030,
@ -183,6 +389,29 @@
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"niri",
"crate2nix",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1703887061,
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gitignore_2": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
@ -285,9 +514,82 @@
"type": "github"
}
},
"niri": {
"inputs": {
"crate2nix": "crate2nix",
"flake-parts": "flake-parts_3",
"niri-stable": "niri-stable",
"niri-unstable": "niri-unstable",
"nixpkgs": [
"unstable"
]
},
"locked": {
"lastModified": 1711873637,
"narHash": "sha256-wvOvxa5T8rHsjlg6SjCI4ek8ZQx/9mI0Ki9f7fW5Stw=",
"owner": "sodiboo",
"repo": "niri-flake",
"rev": "a25c4f3165ff11f844c97b5446cf55ae7a1a2ad5",
"type": "github"
},
"original": {
"owner": "sodiboo",
"repo": "niri-flake",
"type": "github"
}
},
"niri-stable": {
"flake": false,
"locked": {
"lastModified": 1711790754,
"narHash": "sha256-lkGIQIMWfg71UOkT/TST8O6hD0IfslENj6oFPevUGl4=",
"owner": "YaLTeR",
"repo": "niri",
"rev": "7ff2de19b9304b3afdadb44aeeee4e85dfcb5218",
"type": "github"
},
"original": {
"owner": "YaLTeR",
"ref": "v0.1.4",
"repo": "niri",
"type": "github"
}
},
"niri-unstable": {
"flake": false,
"locked": {
"lastModified": 1711870564,
"narHash": "sha256-UwjhUi34dp1+INrYoyHtiKQtklfROvZdbntOVdh7Lqc=",
"owner": "YaLTeR",
"repo": "niri",
"rev": "fe79a6a4e2a213c618f3d842f82075c151e2d6c3",
"type": "github"
},
"original": {
"owner": "YaLTeR",
"repo": "niri",
"type": "github"
}
},
"nix-test-runner": {
"flake": false,
"locked": {
"lastModified": 1588761593,
"narHash": "sha256-FKJykltAN/g3eIceJl4SfDnnyuH2jHImhMrXS2KvGIs=",
"owner": "stoeffel",
"repo": "nix-test-runner",
"rev": "c45d45b11ecef3eb9d834c3b6304c05c49b06ca2",
"type": "github"
},
"original": {
"owner": "stoeffel",
"repo": "nix-test-runner",
"type": "github"
}
},
"nixgl": {
"inputs": {
"flake-utils": "flake-utils",
"flake-utils": "flake-utils_4",
"nixpkgs": [
"nixpkgs"
]
@ -324,8 +626,8 @@
},
"nixos-wsl": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_2",
"flake-compat": "flake-compat_4",
"flake-utils": "flake-utils_5",
"nixpkgs": [
"nixpkgs"
]
@ -346,16 +648,34 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1711460390,
"narHash": "sha256-akSgjDZL6pVHEfSE6sz1DNSXuYX6hq+P/1Z5IoYWs7E=",
"owner": "nixos",
"lastModified": 1700612854,
"narHash": "sha256-yrQ8osMD+vDLGFX7pcwsY/Qr5PUd6OmDMYJZzZi0+zc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "44733514b72e732bd49f5511bd0203dea9b9a434",
"rev": "19cbff58383a4ae384dea4d1d0c823d72b49d614",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-23.11",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1709237383,
"narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -376,11 +696,75 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1707743206,
"narHash": "sha256-AehgH64b28yKobC/DAWYZWkJBxL/vP83vkY+ag2Hhy4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2d627a2a704708673e56346fcb13d25344b8eaf3",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1711460390,
"narHash": "sha256-akSgjDZL6pVHEfSE6sz1DNSXuYX6hq+P/1Z5IoYWs7E=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "44733514b72e732bd49f5511bd0203dea9b9a434",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_4",
"flake-compat": [
"niri",
"crate2nix",
"flake-compat"
],
"flake-utils": "flake-utils_3",
"gitignore": "gitignore",
"nixpkgs": [
"niri",
"crate2nix",
"nixpkgs"
],
"nixpkgs-stable": [
"niri",
"crate2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1707297608,
"narHash": "sha256-ADjo/5VySGlvtCW3qR+vdFF4xM9kJFlRDqcC9ZGI8EA=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "0db2e67ee49910adfa13010e7f012149660af7f0",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"pre-commit-hooks_2": {
"inputs": {
"flake-compat": "flake-compat_5",
"flake-utils": "flake-utils_6",
"gitignore": "gitignore_2",
"nixpkgs": [
"nixpkgs"
],
@ -410,11 +794,12 @@
"home-manager": "home-manager",
"home-manager-unstable": "home-manager-unstable",
"hypr-contrib": "hypr-contrib",
"niri": "niri",
"nixgl": "nixgl",
"nixos-hardware": "nixos-hardware",
"nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks",
"nixpkgs": "nixpkgs_3",
"pre-commit-hooks": "pre-commit-hooks_2",
"unstable": "unstable",
"yarr-nix": "yarr-nix"
}
@ -479,6 +864,51 @@
"type": "github"
}
},
"systems_5": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_6": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_7": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"unstable": {
"locked": {
"lastModified": 1711523803,

View File

@ -45,6 +45,11 @@
flake = false;
};
niri = {
url = "github:sodiboo/niri-flake";
inputs.nixpkgs.follows = "unstable";
};
nixos-wsl = {
url = "github:nix-community/NixOS-WSL";
inputs.nixpkgs.follows = "nixpkgs";

View File

@ -1,3 +1,4 @@
{inputs}: [
inputs.agenix.homeManagerModules.default
inputs.niri.homeModules.config
]

View File

@ -40,11 +40,24 @@ in
wl-clipboard
];
systemd.user.targets.wl-session = {
Unit = {
Description = "wayland compositor session";
BindsTo = ["graphical-session.target"];
Wants = ["graphical-session-pre.target" "xdg-desktop-autostart.target"];
After = ["graphical-session-pre.target"];
Before = ["xdg-desktop-autostart.target"];
};
};
# notification daemon
services.mako.enable = true;
# clipboard manager. keeps the contents once the original program quits.
services.copyq.enable = true;
services.copyq = {
enable = true;
systemdTarget = "wl-session.target";
};
# blue light remover. adjusts the red tint based on the time of day.
services.gammastep = {

View File

@ -2,6 +2,7 @@
imports = [
./disable-animations.nix
./common.nix
./niri.nix
./fonts.nix
./foot.nix
./sway.nix

View File

@ -0,0 +1,212 @@
{
config,
flake,
lib,
pkgs,
...
}: let
cfg = config.homeModules.desktop.niri;
cfgCommon = config.homeModules.desktop.common;
in
with lib; {
options = {
homeModules.desktop.niri = {
enable = mkEnableOption "Enable niri";
};
};
config = let
origPkg = config.programs.niri.package;
nixGL = cfgCommon.nixGLPackage;
patchedNiri =
if nixGL != null
then
(pkgs.runCommand "niri-nixgl-wrapper" {} ''
mkdir $out
ln -s ${origPkg}/* $out
rm $out/bin
mkdir $out/bin
ln -s ${origPkg}/bin/* $out/bin/
rm $out/bin/niri
cat > $out/bin/niri <<EOF
. "\$HOME/.profile"
exec ${lib.getExe nixGL} ${origPkg}/bin/niri \$@
EOF
chmod +x $out/bin/niri
'')
else origPkg;
prefNiri = patchedNiri;
in
mkIf cfg.enable {
nixpkgs.overlays = [
flake.inputs.niri.overlays.niri
];
homeModules.desktop = {
common.enable = true;
waybar = {
enable = true;
};
};
home.packages = [prefNiri pkgs.cage];
# niri doesn't support xwayland
systemd.user.services.copyq.Service.Environment = lib.mkAfter ["QT_QPA_PLATFORM=wayland"];
programs.niri.settings = {
input = {
keyboard.xkb.layout = "ro";
touchpad = {
tap = true;
tap-button-map = "left-right-middle";
natural-scroll = true;
};
};
spawn-at-startup = [
{
command = [
"${pkgs.dbus}/bin/dbus-update-activation-environment"
"--systemd"
"DISPLAY"
"WAYLAND_DISPLAY"
"SWAYSOCK"
"XDG_CURRENT_DESKTOP"
"XDG_SESSION_TYPE"
"NIXOS_OZONE_WL"
"XCURSOR_THEME"
"XCURSOR_SIZE"
"XDG_DATA_DIRS"
];
}
{
command = [
"systemctl"
"--user"
"start"
"wl-session.target"
];
}
{
command = [
(lib.getExe pkgs.swaybg)
"-i"
"${cfgCommon.wallpaperPath}"
"-m"
"fill"
];
}
{
command = [
"1password"
"--enable-features=UseOzonePlatform"
"--ozone-platform=wayland"
"--silent"
];
}
];
binds = with config.lib.niri.actions; let
exe = lib.getExe;
exe' = lib.getExe';
wpctl = "${pkgs.wireplumber}/bin/wpctl";
in
lib.mkOptionDefault ({
"Mod+Shift+E".action = quit;
"Mod+Shift+Slash".action = show-hotkey-overlay;
"Mod+Shift+Q".action = close-window;
"Mod+H".action = focus-column-left;
"Mod+J".action = focus-window-down;
"Mod+K".action = focus-window-up;
"Mod+L".action = focus-column-right;
"Mod+Shift+H".action = move-column-left;
"Mod+Shift+J".action = move-window-down;
"Mod+Shift+K".action = move-window-up;
"Mod+Shift+L".action = move-column-right;
"Mod+Ctrl+H".action = focus-monitor-left;
"Mod+Ctrl+J".action = focus-monitor-down;
"Mod+Ctrl+K".action = focus-monitor-up;
"Mod+Ctrl+L".action = focus-monitor-right;
"Mod+Shift+Ctrl+H".action = move-column-to-monitor-left;
"Mod+Shift+Ctrl+J".action = move-column-to-monitor-down;
"Mod+Shift+Ctrl+K".action = move-column-to-monitor-up;
"Mod+Shift+Ctrl+L".action = move-column-to-monitor-right;
"Mod+Comma".action = consume-window-into-column;
"Mod+Period".action = expel-window-from-column;
"Mod+R".action = switch-preset-column-width;
"Mod+F".action = maximize-column;
"Mod+Shift+F".action = fullscreen-window;
"Mod+C".action = center-column;
"Print".action = screenshot-screen;
"Shift+Print".action = screenshot;
"Alt+Print".action = screenshot-window;
"Mod+Return".action = spawn (exe config.programs.foot.package);
"Mod+D".action = spawn (exe pkgs.fuzzel);
"Mod+semicolon".action = spawn (exe' pkgs.emote "emote");
"XF86AudioRaiseVolume".action = spawn wpctl "set-volume" "@DEFAULT_AUDIO_SINK@" "0.05+";
"XF86AudioLowerVolume".action = spawn wpctl "set-volume" "@DEFAULT_AUDIO_SINK@" "0.05-";
"XF86MonBrightnessUp".action = spawn (exe pkgs.brightnessctl) "set" "5%+";
"XF86MonBrightnessDown".action = spawn (exe pkgs.brightnessctl) "set" "5%-";
}
// (lib.attrsets.mergeAttrsList (map (x: let
xStr = builtins.toString x;
in {
"Mod+${xStr}".action = focus-workspace x;
"Mod+Shift+${xStr}".action = move-column-to-workspace x;
}) [1 2 3 4 5 6 7 8 9])));
layout = {
preset-column-widths = [
{proportion = 1.0 / 3.0;}
{proportion = 1.0 / 2.0;}
{proportion = 2.0 / 3.0;}
];
default-column-width = {proportion = 1.0 / 2.0;};
};
prefer-no-csd = true;
outputs = {
"eDP-1" = {
# scale = 1.25;
scale = 1.0;
position = {
x = 1080 + 1920;
y = 0;
};
};
"DP-6" = {
scale = 2.0;
position = {
x = 0;
y = 0;
};
transform.rotation = 90;
};
"DP-9" = {
scale = 2.0;
position = {
x = 1080;
y = 0;
};
};
};
};
};
}

View File

@ -28,7 +28,7 @@ in
# status bar
waybar = {
enable = true;
systemdTarget = "sway-session.target";
# systemdTarget = "sway-session.target";
};
};
@ -37,9 +37,6 @@ in
# this key is set here only to make it start when sway starts.
services.kanshi.systemdTarget = "sway-session.target";
# clipboard manager. keeps the contents once the original program quits.
services.copyq.systemdTarget = "sway-session.target";
# does things if the computer is left untouched for a while
services.swayidle = let
swaymsg = "${config.wayland.windowManager.sway.package}/bin/swaymsg";
@ -250,6 +247,7 @@ in
};
extraConfigEarly = ''
exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd XDG_DATA_DIRS"
exec systemctl --user start wl-session.target
'';
extraConfig = ''
title_align center

View File

@ -15,7 +15,7 @@ in
type = types.str;
description = "Enable Waybar as part of a systemd target";
example = "sway-session.target";
default = "";
default = "wl-session.target";
};
};
};

View File

@ -51,6 +51,7 @@ in {
};
foot.enable = true;
sway.enable = true;
niri.enable = true;
};
};