diff --git a/environments/river/default.nix b/environments/river/default.nix index 9f2ea96..948012e 100644 --- a/environments/river/default.nix +++ b/environments/river/default.nix @@ -3,6 +3,9 @@ ../../modules/wm ]; + # this is called manually in the river init script. + services.xserver.desktopManager.runXdgAutostartIfNone = true; + services.greetd = { enable = true; settings = { diff --git a/environments/river/home.nix b/environments/river/home.nix index bc3bfcd..e03d302 100644 --- a/environments/river/home.nix +++ b/environments/river/home.nix @@ -72,11 +72,10 @@ in { }; }; - border-color-focused = "0x94e2d5"; - border-color-unfocused = "0x00000000"; - border-color-urgent = "0xcba6f7"; - border-width = 2; - + border-color-focused = "0x94e2d5"; + border-color-unfocused = "0x00000000"; + border-color-urgent = "0xcba6f7"; + border-width = 2; rule-add = { "-app-id" = { @@ -129,7 +128,7 @@ in { // common_binds; locked = common_binds; passthrough = { - "Super+Shift Backslash" = "enter-mode normal"; + "Super+Shift Backslash" = "enter-mode normal"; }; }; map-pointer = { @@ -143,58 +142,30 @@ in { for i in $(seq 1 9) do tags=$((1 << (i - 1))) - riverctl map normal Super "$i" set-focused-tags $tags + riverctl map normal Super "$i" set-focused-tags -alternate $tags riverctl map normal Super+Shift "$i" set-view-tags $tags riverctl map normal Super+Control "$i" toggle-focused-tags $tags riverctl map normal Super+Shift+Control "$i" toggle-view-tags $tags done all_tags=$(((1 << 32) - 1)) - riverctl map normal Super 0 set-focused-tags "$all_tags" + riverctl map normal Super 0 set-focused-tags -alternate "$all_tags" riverctl map normal Super+Shift 0 set-view-tags "$all_tags" + + hyprlock --immediate ''; + systemd = { - # Only import env vars, do not use their systemctl --user start river-session.target that we override below. enable = true; + runInService = true; extraCommands = [ - "systemd-notify --ready" - "hyprlock --immediate" + "${pkgs.systemd}/bin/systemctl --user start xdg-autostart-if-no-desktop-manager.target" ]; }; }; # Run river in systemd directly and not by hand. Failing to do so will make graphical-session.target never stop. # So a big wait time when shutting down & graphical services are not restarted when starting river again. - systemd.user.targets.river-session = { - Unit = { - Description = "river compositor session"; - Documentation = ["man:systemd.special(7)"]; - BindsTo = ["graphical-session.target"]; - Before = ["graphical-session.target"]; - Wants = ["graphical-session-pre.target"]; - After = ["graphical-session-pre.target"]; - RefuseManualStart = "yes"; - StopWhenUnneeded = "yes"; - }; - }; - - systemd.user.services.river = { - Unit = { - Description = "River compositor"; - Documentation = "man:river(1)"; - BindsTo = ["river-session.target"]; - Before = ["river-session.target"]; - }; - - Service = { - Type = "notify"; - # used to get env/session vars (and path). - ExecStart = "/bin/sh -lc ${pkgs.river}/bin/river"; - TimeoutStopSec = 10; - NotifyAccess = "all"; - ExecStopPost = "${pkgs.systemd}/bin/systemctl --user unset-environment ${builtins.concatStringsSep " " config.wayland.windowManager.river.systemd.variables}"; - }; - }; home.packages = with pkgs; [ gnome-control-center diff --git a/flake.lock b/flake.lock index f4a7bca..0bdcdf3 100644 --- a/flake.lock +++ b/flake.lock @@ -335,17 +335,17 @@ ] }, "locked": { - "lastModified": 1720045378, - "narHash": "sha256-lmE7B+QXw7lWdBu5GQlUABSpzPk3YBb9VbV+IYK5djk=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "0a30138c694ab3b048ac300794c2eb599dc40266", - "type": "github" + "lastModified": 1720601689, + "narHash": "sha256-G6MgCUWjJAonm9vgd1zR0rOF7A0YxN83gcXyEs/tWzY=", + "ref": "refs/heads/master", + "rev": "04216763901f904e7e59afe23d30bb814d6c5d14", + "revCount": 3642, + "type": "git", + "url": "file:///home/zoriya/projects/home-manager" }, "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" + "type": "git", + "url": "file:///home/zoriya/projects/home-manager" } }, "impermanence": { @@ -521,6 +521,22 @@ "type": "github" } }, + "river-src": { + "flake": false, + "locked": { + "lastModified": 1720674112, + "narHash": "sha256-DIgE19Vo8c6clz2BDHCWkQyu4XegYAh/f6/arLYuVxk=", + "owner": "zoriya", + "repo": "river", + "rev": "7b9b4b6cd6401f7f094dcc19be61069d87fdca5b", + "type": "github" + }, + "original": { + "owner": "zoriya", + "repo": "river", + "type": "github" + } + }, "root": { "inputs": { "astal-river": "astal-river", @@ -532,7 +548,8 @@ "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", "nixos-wsl": "nixos-wsl", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "river-src": "river-src" } }, "systems": { diff --git a/flake.nix b/flake.nix index 9614802..85491e3 100644 --- a/flake.nix +++ b/flake.nix @@ -4,7 +4,8 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; home-manager = { - url = "github:nix-community/home-manager"; + # url = "github:zoriya/home-manager"; + url = "/home/zoriya/projects/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; impermanence.url = "github:nix-community/impermanence"; @@ -32,6 +33,10 @@ url = "github:zoriya/astal-river"; inputs.nixpkgs.follows = "nixpkgs"; }; + river-src = { + url = "github:zoriya/river"; + flake = false; + }; }; outputs = { @@ -41,6 +46,7 @@ nixpkgs, ghostty, flood, + river-src, impermanence, nixos-hardware, nix-index-database, @@ -58,7 +64,7 @@ (./environments + "/${de}") { nixpkgs.overlays = [ - (import ./overlays {inherit flood;}) + (import ./overlays {inherit flood river-src;}) neovim-nightly.overlays.default ]; } diff --git a/modules/cli/nix.nix b/modules/cli/nix.nix index b18b31e..8b68cb0 100644 --- a/modules/cli/nix.nix +++ b/modules/cli/nix.nix @@ -1,8 +1,13 @@ -{lib, inputs, config,...}: { +{ + lib, + inputs, + config, + ... +}: { nix = { # This will add each flake input as a registry # To make nix3 commands consistent with your flake - registry = lib.mapAttrs (_: value: { flake = value; }) inputs; + registry = lib.mapAttrs (_: value: {flake = value;}) inputs; # This will additionally add your inputs to the system's legacy channels # Making legacy nix commands consistent as well, awesome! @@ -12,6 +17,15 @@ auto-optimise-store = true; warn-dirty = false; experimental-features = ["nix-command" "flakes"]; + use-xdg-base-directories = true; + substituters = [ + "https://nix-community.cachix.org" + "https://ghostty.cachix.org" + ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "ghostty.cachix.org-1:QB389yTa6gTyneehvqG58y0WnHjQOqgnA+wBnpWWxns=" + ]; }; gc = { automatic = true; diff --git a/modules/cli/nvim/lua/settings.lua b/modules/cli/nvim/lua/settings.lua index e40eb5b..2ea2211 100644 --- a/modules/cli/nvim/lua/settings.lua +++ b/modules/cli/nvim/lua/settings.lua @@ -113,3 +113,5 @@ vim.api.nvim_create_autocmd('TextYankPost', { }) end, }) + +vim.g.zig_fmt_autosave = 0 diff --git a/modules/wm/home.nix b/modules/wm/home.nix index 60bef27..1941a88 100644 --- a/modules/wm/home.nix +++ b/modules/wm/home.nix @@ -88,9 +88,63 @@ in { ]; }; }; - systemd.user.services.hypridle = { + + systemd.user.services.polkit-gnome-authentication-agent-1 = { Unit = { + Description = "polkit-gnome-authentication-agent-1"; + WantedBy = ["graphical-session.target"]; + Wants = ["graphical-session.target"]; After = ["graphical-session.target"]; }; + Service = { + Type = "simple"; + ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; + + i18n.inputMethod = { + enabled = "fcitx5"; + fcitx5 = { + addons = with pkgs; [ + fcitx5-mozc + fcitx5-gtk + ]; + }; + }; + + xdg.configFile."fcitx5/config" = { + force = true; + text = '' + [Hotkey/TriggerKeys] + 0=Super+space + + [Behavior] + ShowInputMethodInformation=False + CompactInputMethodInformation=False + ShowFirstInputMethodInformation=False + ''; + }; + xdg.configFile."fcitx5/profile" = { + force = true; + text = '' + [Groups/0] + Name=Default + Default Layout=us + DefaultIM=mozc + + [Groups/0/Items/0] + Name=keyboard-us + Layout= + + [Groups/0/Items/1] + Name=mozc + Layout= + + [GroupOrder] + 0=Default + ''; }; } diff --git a/overlays/default.nix b/overlays/default.nix index 65009e1..2484f5d 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,4 +1,7 @@ -{flood}: self: super: let +{ + flood, + river-src, +}: self: super: let wrapProgram = drv: bins: wrapProgramFlags: super.symlinkJoin { name = drv.name; @@ -37,6 +40,11 @@ in { }; }; + river = super.river.overrideAttrs { + src = river-src; + deps = self.callPackage ./river.build.zig.zon.nix { }; + }; + # Gnome-control-center can only be launched if XDG_CURRENT_DESKTOP is GNOME. gnome-control-center = wrapProgram super.gnome.gnome-control-center ["gnome-control-center"] "--set XDG_CURRENT_DESKTOP GNOME"; diff --git a/overlays/river.build.zig.zon.nix b/overlays/river.build.zig.zon.nix new file mode 100644 index 0000000..975eb7f --- /dev/null +++ b/overlays/river.build.zig.zon.nix @@ -0,0 +1,35 @@ +# generated by zon2nix (https://github.com/nix-community/zon2nix) + +{ linkFarm, fetchzip }: + +linkFarm "zig-packages" [ + { + name = "1220687c8c47a48ba285d26a05600f8700d37fc637e223ced3aa8324f3650bf52242"; + path = fetchzip { + url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.2.0.tar.gz"; + hash = "sha256-dvit+yvc0MnipqWjxJdfIsA6fJaJZOaIpx4w4woCxbE="; + }; + } + { + name = "12208383c1cf42e9b932b90f68cd4f378582cf966355a6377fd8f913852e7bc2d7c6"; + path = fetchzip { + url = "https://codeberg.org/ifreund/zig-wlroots/archive/084736cd92364b5fa7d8161611d085ce272fa707.tar.gz"; + hash = "sha256-Pf2kiOwavmw4dcXZyRtdp3knhkb9dSbkvBVcQxCP1uo="; + }; + } + { + name = "12209db20ce873af176138b76632931def33a10539387cba745db72933c43d274d56"; + path = fetchzip { + url = "https://codeberg.org/ifreund/zig-pixman/archive/v0.2.0.tar.gz"; + hash = "sha256-zcfZEMnipWDPuptl9UN0PoaJDjy2EHc7Wwi4GQq3hkY="; + }; + } + { + name = "1220c90b2228d65fd8427a837d31b0add83e9fade1dcfa539bb56fd06f1f8461605f"; + path = fetchzip { + url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.2.0.tar.gz"; + hash = "sha256-T+EZiStBfmxFUjaX05WhYkFJ8tRok/UQtpc9QY9NxZk="; + }; + } +] +