diff --git a/flake.lock b/flake.lock index 0b61a68..96790c1 100644 --- a/flake.lock +++ b/flake.lock @@ -78,7 +78,7 @@ }, "flake-utils": { "inputs": { - "systems": "systems" + "systems": "systems_2" }, "locked": { "lastModified": 1731533236, @@ -115,6 +115,62 @@ "type": "github" } }, + "niri": { + "inputs": { + "niri-stable": "niri-stable", + "niri-unstable": "niri-unstable", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable", + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, + "locked": { + "lastModified": 1777208146, + "narHash": "sha256-yPMA3dP/5DEpQBmcue5Yc0/uBbNpzGLOJO2tDCI8CrQ=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "87d5bfc548b10178bee7331f9f5a466b50e16196", + "type": "github" + }, + "original": { + "owner": "sodiboo", + "repo": "niri-flake", + "type": "github" + } + }, + "niri-stable": { + "flake": false, + "locked": { + "lastModified": 1756556321, + "narHash": "sha256-RLD89dfjN0RVO86C/Mot0T7aduCygPGaYbog566F0Qo=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "01be0e65f4eb91a9cd624ac0b76aaeab765c7294", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "ref": "v25.08", + "repo": "niri", + "type": "github" + } + }, + "niri-unstable": { + "flake": false, + "locked": { + "lastModified": 1777204994, + "narHash": "sha256-PHwfKjDSe1TtW7ndaZbsGbx/nv2ZN+mkst1dquS8vqo=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "83e839762fa208b3631163e85d760e0e89fe8fe3", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -158,16 +214,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1776734388, - "narHash": "sha256-vl3dkhlE5gzsItuHoEMVe+DlonsK+0836LIRDnm6MXQ=", - "owner": "nixos", + "lastModified": 1776877367, + "narHash": "sha256-EHq1/OX139R1RvBzOJ0aMRT3xnWyqtHBRUBuO1gFzjI=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "10e7ad5bbcb421fe07e3a4ad53a634b0cd57ffac", + "rev": "0726a0ecb6d4e08f6adced58726b95db924cef57", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-25.11", + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -187,6 +243,22 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1776734388, + "narHash": "sha256-vl3dkhlE5gzsItuHoEMVe+DlonsK+0836LIRDnm6MXQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "10e7ad5bbcb421fe07e3a4ad53a634b0cd57ffac", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1776949667, @@ -204,6 +276,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1776734388, + "narHash": "sha256-vl3dkhlE5gzsItuHoEMVe+DlonsK+0836LIRDnm6MXQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "10e7ad5bbcb421fe07e3a4ad53a634b0cd57ffac", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1768127708, "narHash": "sha256-1Sm77VfZh3mU0F5OqKABNLWxOuDeHIlcFjsXeeiPazs=", @@ -219,10 +307,54 @@ "type": "github" } }, + "noctalia": { + "inputs": { + "nixpkgs": [ + "nixpkgs-unstable" + ], + "noctalia-qs": "noctalia-qs" + }, + "locked": { + "lastModified": 1777079905, + "narHash": "sha256-TvYEXwkZnRFQRuFyyqTNSfPnU2tMdhtiBOXSk2AWLJA=", + "owner": "noctalia-dev", + "repo": "noctalia-shell", + "rev": "a50c92167c8d438000270f7eca36f6eea74f388e", + "type": "github" + }, + "original": { + "owner": "noctalia-dev", + "repo": "noctalia-shell", + "type": "github" + } + }, + "noctalia-qs": { + "inputs": { + "nixpkgs": [ + "noctalia", + "nixpkgs" + ], + "systems": "systems", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1776585574, + "narHash": "sha256-j35EWhKoGhKrfcXcAOpoRVgXEPQt41Eukji/h59cnjk=", + "owner": "noctalia-dev", + "repo": "noctalia-qs", + "rev": "75d180c28a9ab4470e980f3d6f706ad6c5213add", + "type": "github" + }, + "original": { + "owner": "noctalia-dev", + "repo": "noctalia-qs", + "type": "github" + } + }, "opnix": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1768270397, @@ -244,10 +376,12 @@ "fenix": "fenix", "flake-parts": "flake-parts", "home-manager": "home-manager", + "niri": "niri", "nix-index-database": "nix-index-database", "nixos-wsl": "nixos-wsl", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", + "noctalia": "noctalia", "opnix": "opnix" } }, @@ -269,6 +403,21 @@ } }, "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_2": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -282,6 +431,61 @@ "repo": "default", "type": "github" } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "noctalia", + "noctalia-qs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775636079, + "narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "xwayland-satellite-stable": { + "flake": false, + "locked": { + "lastModified": 1755491097, + "narHash": "sha256-m+9tUfsmBeF2Gn4HWa6vSITZ4Gz1eA1F5Kh62B0N4oE=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "388d291e82ffbc73be18169d39470f340707edaa", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "ref": "v0.7", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "xwayland-satellite-unstable": { + "flake": false, + "locked": { + "lastModified": 1773622265, + "narHash": "sha256-wToKwH7IgWdGLMSIWksEDs4eumR6UbbsuPQ42r0oTXQ=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "a879e5e0896a326adc79c474bf457b8b99011027", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 0beae0b..4cfd1f0 100644 --- a/flake.nix +++ b/flake.nix @@ -19,6 +19,13 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + niri.url = "github:sodiboo/niri-flake"; + + noctalia = { + url = "github:noctalia-dev/noctalia-shell"; + inputs.nixpkgs.follows = "nixpkgs-unstable"; + }; + # Catppuccin # https://github.com/catppuccin/nix catppuccin = { diff --git a/homes/_modules/desktop/default.nix b/homes/_modules/desktop/default.nix index 8a63329..e3c6af3 100644 --- a/homes/_modules/desktop/default.nix +++ b/homes/_modules/desktop/default.nix @@ -8,22 +8,26 @@ let cfg = config.modules.desktop; in { + imports = [ + ./niri + ]; + options.modules.desktop = { enable = lib.mkEnableOption "desktop applications"; }; config = lib.mkIf cfg.enable { programs = { - discord.enable = true; firefox.enable = true; + fuzzel.enable = true; + swaylock.enable = true; + vesktop.enable = true; ghostty = { enable = true; - enableFishIntegration = true; settings = { + confirm-close-surface = false; link-url = true; - - window-width = 160; - window-height = 50; + maximize = true; }; }; @@ -32,5 +36,17 @@ in package = pkgs.unstable.vscode; }; }; + services = { + mako.enable = true; # notification daemon + swayidle.enable = true; # idle management daemon + polkit-gnome.enable = true; # polkit + }; + + home.packages = with pkgs; [ + nerd-fonts.fira-code + nerd-fonts.monaspace + swaybg + xfce.thunar + ]; }; } diff --git a/homes/_modules/desktop/niri/applications.nix b/homes/_modules/desktop/niri/applications.nix new file mode 100644 index 0000000..e5fae6d --- /dev/null +++ b/homes/_modules/desktop/niri/applications.nix @@ -0,0 +1,10 @@ +{ + pkgs, +}: + +{ + browser = "${pkgs.firefox}/bin/firefox"; + terminal = "ghostty"; + fileManager = "thunar"; + appLauncher = "${pkgs.fuzzel}/bin/fuzzel"; +} diff --git a/homes/_modules/desktop/niri/autostart.nix b/homes/_modules/desktop/niri/autostart.nix new file mode 100644 index 0000000..731d7a9 --- /dev/null +++ b/homes/_modules/desktop/niri/autostart.nix @@ -0,0 +1,9 @@ +{ + ... +}: + +{ + programs.niri.settings.spawn-at-startup = [ + { command = [ "noctalia-shell" ]; } + ]; +} diff --git a/homes/_modules/desktop/niri/default.nix b/homes/_modules/desktop/niri/default.nix new file mode 100644 index 0000000..195cc33 --- /dev/null +++ b/homes/_modules/desktop/niri/default.nix @@ -0,0 +1,12 @@ +{ + ... +}: +{ + imports = [ + ./autostart.nix + ./keybinds.nix + ./noctalia.nix + ./rules.nix + ./settings.nix + ]; +} diff --git a/homes/_modules/desktop/niri/keybinds.nix b/homes/_modules/desktop/niri/keybinds.nix new file mode 100644 index 0000000..4b1695d --- /dev/null +++ b/homes/_modules/desktop/niri/keybinds.nix @@ -0,0 +1,68 @@ +{ + config, + pkgs, + ... +}: +let + noctalia = + cmd: + [ + "noctalia-shell" + "ipc" + "call" + ] + ++ (pkgs.lib.splitString " " cmd); + + apps = import ./applications.nix { inherit pkgs; }; +in +{ + programs.niri.settings.binds = with config.lib.niri.actions; { + # Volume + "XF86AudioRaiseVolume".action.spawn = noctalia "volume increase"; # output increase + "XF86AudioLowerVolume".action.spawn = noctalia "volume decrease"; # output decrease + "XF86AudioMute".action.spawn = noctalia "volume muteOutput"; # output mute + "shift+XF86AudioRaiseVolume".action.spawn = noctalia "volume increaseInput"; # input increase + "shift+XF86AudioLowerVolume".action.spawn = noctalia "volume decreaseInput"; # input decrease + "shift+XF86AudioMute".action.spawn = noctalia "volume muteInput"; # input mute + "control+XF86AudioMute".action.spawn = noctalia "volume togglePanel"; # open volume panel + + # Brightness + "XF86MonBrightnessUp".action.spawn = noctalia "brightness increase"; + "XF86MonBrightnessDown".action.spawn = noctalia "brightness decrease"; + + # Media + "XF86AudioPlay".action.spawn = noctalia "media playPause"; + "XF86AudioNext".action.spawn = noctalia "media next"; + "XF86AudioPrev".action.spawn = noctalia "media previous"; + + "super+Space".action.spawn = noctalia "launcher toggle"; + "super+q".action = close-window; + "super+b".action = spawn apps.browser; + "super+Return".action = spawn apps.terminal; + "super+E".action = spawn apps.fileManager; + "super+L".action.spawn = noctalia "lockScreen lock"; + + # 1Passord quick access + "super+p".action = spawn [ + "${pkgs._1password-gui}/bin/1password" + "--quick-access" + ]; + + "super+f".action = fullscreen-window; + "super+t".action = toggle-window-floating; + + "super+Left".action = focus-column-left; + "super+Right".action = focus-column-right; + "super+Down".action = focus-workspace-down; + "super+Up".action = focus-workspace-up; + + "super+Shift+Left".action = move-column-left; + "super+Shift+Right".action = move-column-right; + "super+Shift+Down".action = move-column-to-workspace-down; + "super+Shift+Up".action = move-column-to-workspace-up; + + "super+1".action = focus-workspace "main"; + "super+2".action = focus-workspace "browser"; + "super+3".action = focus-workspace "discord"; + }; +} diff --git a/homes/_modules/desktop/niri/noctalia.nix b/homes/_modules/desktop/niri/noctalia.nix new file mode 100644 index 0000000..a2d52be --- /dev/null +++ b/homes/_modules/desktop/niri/noctalia.nix @@ -0,0 +1,109 @@ +{ + config, + lib, + ... +}: +let + cfg = config.modules.desktop.noctalia; +in +{ + options.modules.desktop.noctalia = { + enable = lib.mkEnableOption "noctalia shell"; + }; + + config = lib.mkIf cfg.enable { + programs.noctalia-shell = { + enable = true; + + settings = { + bar = { + density = "compact"; + position = "top"; + barType = "simple"; + showCapsule = true; + widgets = { + left = [ + { + id = "Launcher"; + } + { + id = "Clock"; + formatHorizontal = "HH:mm ddd, MMM dd"; + formatVertical = "HH mm"; + } + { + id = "SystemMonitor"; + } + { + id = "ActiveWindow"; + } + { + id = "MediaMini"; + } + ]; + center = [ + { + id = "Workspace"; + hideUnoccupied = false; + labelMode = "index+name"; + } + ]; + right = [ + { + id = "Tray"; + } + { + id = "NotificationHistory"; + } + { + id = "Battery"; + displayMode = "icon-always"; + showNoctaliaPerformance = true; + showPowerProfiles = true; + } + { + id = "Volume"; + } + { + id = "Brightness"; + } + { + id = "Network"; + } + { + id = "ControlCenter"; + useDistroLogo = true; + } + ]; + }; + }; + + brightness = { + brightnessStep = 5; + enforceMinimum = true; + }; + + colorSchemes = { + predefinedScheme = "Catppuccin"; + schedulingMode = "location"; + }; + + general = { + avatarImage = "/home/${config.home.username}/.face"; + }; + + idle = { + enabled = true; + screenOffTimeout = 300; + lockTimeout = 330; + suspendTimeout = 1800; + fadeDuration = 5; + }; + + location = { + name = "Forsand, Sandnes, Norway"; + }; + }; + }; + }; +} diff --git a/homes/_modules/desktop/niri/rules.nix b/homes/_modules/desktop/niri/rules.nix new file mode 100644 index 0000000..6b4ee11 --- /dev/null +++ b/homes/_modules/desktop/niri/rules.nix @@ -0,0 +1,50 @@ +{ + ... +}: + +{ + programs.niri.settings = { + window-rules = [ + { + matches = [ + { app-id = "firefox"; } + ]; + open-on-workspace = "browser"; + } + { + matches = [ + { app-id = "ghostty"; } + { app-id = "vscode"; } + ]; + open-on-workspace = "main"; + open-maximized = true; + } + { + matches = [ + { app-id = "^1password$"; } + ]; + open-floating = true; + open-on-workspace = "high"; + } + + # Discord + { + matches = [ + { app-id = "vesktop"; } + ]; + open-on-workspace = "discord"; + } + + { + matches = [ { } ]; + geometry-corner-radius = { + top-left = 20.0; + top-right = 20.0; + bottom-left = 20.0; + bottom-right = 20.0; + }; + clip-to-geometry = true; + } + ]; + }; +} diff --git a/homes/_modules/desktop/niri/settings.nix b/homes/_modules/desktop/niri/settings.nix new file mode 100644 index 0000000..b30e0d1 --- /dev/null +++ b/homes/_modules/desktop/niri/settings.nix @@ -0,0 +1,40 @@ +{ + pkgs, + ... +}: +let + noctalia = + cmd: + [ + "noctalia-shell" + "ipc" + "call" + ] + ++ (pkgs.lib.splitString " " cmd); +in +{ + programs.niri = { + enable = true; + package = pkgs.niri; + settings = { + workspaces = { + "main" = { }; + "browser" = { }; + "discord" = { }; + }; + + switch-events = { + lid-close.action.spawn = noctalia "sessionMenu lockAndSuspend"; + }; + + hotkey-overlay = { + skip-at-startup = true; + }; + + # Uncomment this line to ask the clients to omit their client-side decorations if possible. + # If the client will specifically ask for CSD, the request will be honored. + # Additionally, clients will be informed that they are tiled, removing some rounded corners. + prefer-no-csd = true; + }; + }; +} diff --git a/homes/stianrs/assets/profile.jpg b/homes/stianrs/assets/profile.jpg new file mode 100644 index 0000000..c1f1a4a Binary files /dev/null and b/homes/stianrs/assets/profile.jpg differ diff --git a/homes/stianrs/default.nix b/homes/stianrs/default.nix index 68ac20f..ab7da31 100644 --- a/homes/stianrs/default.nix +++ b/homes/stianrs/default.nix @@ -8,7 +8,7 @@ let git_name = "Stian R. Sporaland"; git_email = "mail@stian.rs"; git_signingKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBACoz3DyvP3a6ujHA2MLlzKKlW9VAJ2V8+fa9mMzC0x"; - + hostConfig = ./hosts + "/${hostname}.nix"; in { @@ -18,6 +18,7 @@ in desktop = lib.mkIf (!isWSL) { enable = true; + noctalia.enable = true; }; security = { diff --git a/homes/stianrs/hosts/gamer.nix b/homes/stianrs/hosts/gamer.nix new file mode 100644 index 0000000..dd7204d --- /dev/null +++ b/homes/stianrs/hosts/gamer.nix @@ -0,0 +1,71 @@ +{ ... }: +{ + config = { + modules = { + kubernetes.enable = false; + development.go.enable = false; + development.rust.enable = false; + }; + + programs.niri.settings = { + outputs = { + "DP-1" = { + enable = true; + position = { + x = 0; + y = -1440; + }; + }; + "DP-2" = { + enable = true; + focus-at-startup = true; + position = { + x = 0; + y = -0; + }; + }; + "DP-3" = { + enable = true; + transform = { + rotation = 270; + }; + position = { + x = 2560; + y = -200; + }; + }; + }; + + workspaces = { + "main" = { + open-on-output = "DP-2"; + }; + "browser" = { + open-on-output = "DP-2"; + }; + "discord" = { + open-on-output = "DP-3"; + }; + "high" = { + open-on-output = "DP-1"; + }; + }; + }; + + programs.noctalia-shell.settings = { + general = { + lockScreenMonitors = [ "DP-2" ]; + }; + + notifications = { + monitors = [ "DP-2" ]; + }; + + osd = { + monitors = [ "DP-2" ]; + }; + }; + + home.file.".face".source = ../assets/profile.jpg; + }; +} diff --git a/homes/stianrs/hosts/laptop.nix b/homes/stianrs/hosts/laptop.nix new file mode 100644 index 0000000..8c943b4 --- /dev/null +++ b/homes/stianrs/hosts/laptop.nix @@ -0,0 +1,12 @@ +{ ... }: +{ + config = { + modules = { + kubernetes.enable = false; + development.go.enable = false; + development.rust.enable = false; + }; + + home.file.".face".source = ../assets/profile.jpg; + }; +} diff --git a/hosts/_modules/nixos/desktop/default.nix b/hosts/_modules/nixos/desktop/default.nix index 5e62d51..c197a66 100644 --- a/hosts/_modules/nixos/desktop/default.nix +++ b/hosts/_modules/nixos/desktop/default.nix @@ -32,18 +32,28 @@ in LC_TIME = "nb_NO.UTF-8"; }; - programs.appimage = { + programs.niri.enable = true; + services.tuned.enable = true; + services.upower.enable = true; + + services.greetd = { enable = true; - binfmt = true; + settings = { + default_session = { + command = "${config.programs.niri.package}/bin/niri-session"; + user = "stianrs"; + }; + }; }; - services.xserver.enable = true; - services.displayManager.sddm.enable = true; - services.desktopManager.plasma6.enable = true; + environment.pathsToLink = ["/share/applications" "/share/xdg-desktop-portal"]; - services.xserver.xkb = { - layout = "no"; - variant = "nodeadkeys"; + services.xserver = { + enable = true; + xkb = { + layout = "no"; + variant = "nodeadkeys"; + }; }; console.keyMap = "no"; diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix index adab4c9..15b79f5 100644 --- a/hosts/laptop/default.nix +++ b/hosts/laptop/default.nix @@ -20,7 +20,11 @@ LIBVA_DRIVER_NAME = "iHD"; }; - services.printing.enable = true; + environment.systemPackages = with pkgs; [ + brightnessctl + ]; + + hardware.bluetooth.enable = true; services.fprintd.enable = true; modules = { diff --git a/lib/mkSystem.nix b/lib/mkSystem.nix index 4a5d188..bdc3db0 100644 --- a/lib/mkSystem.nix +++ b/lib/mkSystem.nix @@ -7,6 +7,8 @@ let sharedModules = [ inputs.catppuccin.homeModules.catppuccin inputs.nix-index-database.homeModules.nix-index + inputs.niri.homeModules.niri + inputs.noctalia.homeModules.default inputs.opnix.homeManagerModules.default ]; in @@ -25,6 +27,7 @@ in } inputs.home-manager.nixosModules.home-manager inputs.nix-index-database.nixosModules.nix-index + inputs.noctalia.nixosModules.default inputs.opnix.nixosModules.default { home-manager = {