wip: switch to niri
Some checks failed
/ check (nvimDev) (push) Successful in 5s
/ check (nvimHeadless) (push) Successful in 3s
/ check (nvimNoBundledBins) (push) Successful in 4s
/ check (nvimNoLsp) (push) Successful in 5s
/ check (nvimNoTSGrammars) (push) Successful in 4s
/ check (treefmt) (push) Successful in 2s
/ build (audiomenu) (push) Successful in 1s
/ build (docs) (push) Successful in 2s
/ build (jpassmenu) (push) Successful in 2s
/ build (nixosConfigurations.vm.config.system.build.toplevel) (push) Failing after 3s
/ build (nvim) (push) Successful in 9s
/ report-size (push) Has been skipped

Looks cooler c:
This commit is contained in:
Jalil David Salamé Messina 2025-02-09 19:35:03 +01:00
parent 4f82dc4918
commit b445813904
Signed by: jalil
GPG key ID: F016B9E770737A0B
8 changed files with 179 additions and 51 deletions

View file

@ -16,6 +16,7 @@
nixosModule = {
imports = [
(import ../system { inherit (inputs) stylix; })
inputs.niri.nixosModules.niri
inputs.home-manager.nixosModules.home-manager
] ++ lib.optional (inputs.lix-module != null) inputs.lix-module.nixosModules.default;
home-manager = {

62
flake.lock generated
View file

@ -279,6 +279,50 @@
"url": "https://git.lix.systems/lix-project/nixos-module/archive/2.92.0.tar.gz"
}
},
"niri": {
"inputs": {
"niri-stable": "niri-stable",
"niri-unstable": [],
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": [
"nixpkgs"
],
"xwayland-satellite-stable": "xwayland-satellite-stable",
"xwayland-satellite-unstable": []
},
"locked": {
"lastModified": 1739042449,
"narHash": "sha256-9zLFUpEebwhjCgtznsI61gTzefI3+fuXATHUOFzJi5w=",
"owner": "sodiboo",
"repo": "niri-flake",
"rev": "98e3666a9dc4143cbf93d957a15d749b5acef046",
"type": "github"
},
"original": {
"owner": "sodiboo",
"repo": "niri-flake",
"type": "github"
}
},
"niri-stable": {
"flake": false,
"locked": {
"lastModified": 1736614405,
"narHash": "sha256-AJ1rlgNOPb3/+DbS5hkhm21t6Oz8IgqLllwmZt0lyzk=",
"owner": "YaLTeR",
"repo": "niri",
"rev": "e05bc269e678ecf828b96ae79c991c13b00b38a5",
"type": "github"
},
"original": {
"owner": "YaLTeR",
"ref": "v25.01",
"repo": "niri",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1738843498,
@ -348,6 +392,7 @@
"flake-parts": "flake-parts",
"home-manager": "home-manager",
"lix-module": "lix-module",
"niri": "niri",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim",
"stylix": "stylix",
@ -485,6 +530,23 @@
"repo": "treefmt-nix",
"type": "github"
}
},
"xwayland-satellite-stable": {
"flake": false,
"locked": {
"lastModified": 1730166465,
"narHash": "sha256-nq7bouXQXaaPPo/E+Jbq+wNHnatD4dY8OxSrRqzvy6s=",
"owner": "Supreeeme",
"repo": "xwayland-satellite",
"rev": "a713cf46cb7db84a0d1b57c3a397c610cad3cf98",
"type": "github"
},
"original": {
"owner": "Supreeeme",
"ref": "v0.5",
"repo": "xwayland-satellite",
"type": "github"
}
}
},
"root": "root",

View file

@ -23,6 +23,15 @@
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
niri = {
url = "github:sodiboo/niri-flake";
inputs = {
nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs";
niri-unstable.follows = "";
xwayland-satellite-unstable.follows = "";
};
};
stylix = {
url = "github:danth/stylix/release-24.11";
inputs = {

View file

@ -146,13 +146,55 @@ in
};
# Window Manager
wayland.windowManager.sway = {
inherit (cfg.sway) enable;
package = swayPkg; # no sway package if it comes from the OS
config = import ./sway-config.nix { inherit config pkgs; };
systemd = {
enable = true;
xdgAutostart = true;
niri = {
package = pkgs.niri; # use nixpkgs' package instead of the flake's
settings = {
binds =
let
# Modifier key
mod = "Mod";
# Available workspaces (1..=9)
workspaces = lib.range 1 9;
# Run function for each workspace
perWorkspace = f: lib.mergeAttrsList (builtins.map f workspaces);
in
with config.lib.niri.actions;
{
# Open Terminal
"${mod}+Return".action.spawn = config.jhome.gui.terminalCommand;
# Open menu
"${mod}+D".action =
spawn "${lib.getExe pkgs.fuzzel}" "--terminal"
"${builtins.concatStringSep " " terminalCommand}";
# Close Window
"${mod}+Q".action = close-window;
# Fullscreen
"${mod}+F".action = fullscreen-window;
# Hotkey help menu
"${mod}+Shift+/".action = show-hotkey-overlay;
# Media Keys
"XF86AudioRaiseVolume" = {
action = spawn "${pkgs.avizo}/bin/volumectl" "up";
allow-when-locked = true;
};
"XF86AudioLowerVolume" = {
action = spawn "${pkgs.avizo}/bin/volumectl" "down";
allow-when-locked = true;
};
"XF86AudioMute" = {
action = spawn "${pkgs.avizo}/bin/volumectl" "toggle-mute";
allow-when-locked = true;
};
# Lock screen
"XF86ScreenSaver".action = spawn "swaylock" "--image" "${cfg.background}";
# Screen brightness
"XF86MonBrightnessUp".action = spawn "${pkgs.avizo}/bin/lightctl" "up";
"XF86MonBrightnessDown".action = spawn "${pkgs.avizo}/bin/lightctl" "down";
}
// perWorkspace (workspace: {
# Focus workspace N
"${mod}+${builtins.toString workspace}".action = focus-workspace workspace;
});
};
};

View file

@ -2,14 +2,7 @@
let
cfg = config.jhome.gui.sway;
modifier = "Mod4";
inherit (config.jhome.gui) terminal;
termCmd =
if terminal == "wezterm" then
"wezterm start"
else if terminal == "alacritty" then
"alacritty -e"
else
builtins.abort "no command configured for ${terminal}";
termCmd = builtins.concatStringsSep " " config.jhome.gui.terminalCommand;
menu = "${pkgs.fuzzel}/bin/fuzzel --terminal '${termCmd}'";
# currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
@ -45,7 +38,8 @@ let
};
in
{
inherit modifier terminal menu;
inherit (config.jhome.gui) terminal;
inherit modifier menu;
keybindings = import ./keybindings.nix { inherit config pkgs; };
# Appearance
bars = [ ]; # Waybar is started as a systemd service

View file

@ -136,33 +136,58 @@ let
};
};
gui.options = {
enable = lib.mkEnableOption "GUI applications" // {
default = fromConfig [
"gui"
"enable"
] false;
gui.options =
let
cfg = attrs.config.jhome.gui;
in
{
enable = lib.mkEnableOption "GUI applications" // {
default = fromConfig [
"gui"
"enable"
] false;
};
tempInfo = lib.mkOption {
description = "Temperature info to display in the statusbar.";
default = null;
type = types.nullOr (types.submodule tempInfo);
};
sway = lib.mkOption {
description = "Sway window manager configuration.";
default = { };
type = types.submodule sway;
};
terminal = lib.mkOption {
description = "The terminal emulator to use.";
default = "alacritty";
example = "wezterm";
type = types.enum [
"wezterm"
"alacritty"
];
};
terminalCommand = lib.mkOption {
description = "The command to run in order to start the terminal.";
default =
if cfg.terminal == "wezterm" then
[
"wezterm"
"start"
]
else if cfg.terminal == "alacritty" then
[
"alacritty"
"-e"
]
else
builtins.abort "no command configured for ${cfg.terminal}";
example = [
"wezterm"
"start"
];
type = types.listOf types.str;
};
};
tempInfo = lib.mkOption {
description = "Temperature info to display in the statusbar.";
default = null;
type = types.nullOr (types.submodule tempInfo);
};
sway = lib.mkOption {
description = "Sway window manager configuration.";
default = { };
type = types.submodule sway;
};
terminal = lib.mkOption {
description = "The terminal emulator to use.";
default = "alacritty";
example = "wezterm";
type = types.enum [
"wezterm"
"alacritty"
];
};
};
in
{
options.jhome = lib.mkOption {

View file

@ -45,14 +45,9 @@ in
fonts.fontDir.enable = true;
programs = {
dconf.enable = true;
sway = {
enable = cfg.sway;
# No extra packages (by default it adds foot, dmenu, and other stuff)
extraPackages = [ ];
wrapperFeatures = {
base = true;
gtk = true;
};
niri = {
enable = cfg.windowManager;
package = pkgs.niri; # use nixpkgs' package instead of the flake's
};
};
security = {

View file

@ -37,7 +37,7 @@ let
options.autoStart = mkDisableOption "autostarting ydotool at login";
};
};
sway = mkDisableOption "sway";
windowManager = mkDisableOption "window manager";
};
styling.options = {