From 6849194702ecbd1b7c38f7e14253cd0a8ddfce36 Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Mon, 13 Jan 2025 16:43:32 +0100 Subject: [PATCH 1/5] Update `deltaflyer` config Still not working --- hosts/default.nix | 10 ++++--- hosts/deltaflyer/default.nix | 33 +++++++++++++-------- hosts/deltaflyer/plasma-mobile.nix | 46 ++++++++++++++++-------------- 3 files changed, 52 insertions(+), 37 deletions(-) diff --git a/hosts/default.nix b/hosts/default.nix index 9b4c7c9..b76a20d 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -14,20 +14,22 @@ deltaflyer = { nixpkgs = let - # keep in sync with https://github.com/NixOS/mobile-nixos/blob/development/pkgs.nix - rev = "44d0940ea560dee511026a53f0e2e2cde489b4d4"; + # keep in sync with https://github.com/mobile-nixos/mobile-nixos/blob/development/npins/sources.json + rev = "d3c42f187194c26d9f0309a8ecc469d6c878ce33"; in builtins.getFlake "github:NixOS/nixpkgs/${rev}"; extraHmModules = [ - # inputs.ccrEmacs.hmModules.default + inputs.catppuccin.homeManagerModules.catppuccin ]; vpn = { ip = "10.100.0.5"; publicKey = "6bzmBx2b5yzMdW0aK0KapoBesNcxTv5+qdo+pGmG+jc="; }; - homeManager = builtins.getFlake "github:nix-community/home-manager/670d9ecc3e46a6e3265c203c2d136031a3d3548e"; + # homeManager = builtins.getFlake "github:nix-community/home-manager/670d9ecc3e46a6e3265c203c2d136031a3d3548e"; extraModules = [ (import "${inputs.mobile-nixos}/lib/configuration.nix" { device = "oneplus-fajita"; }) + inputs.catppuccin.nixosModules.catppuccin + inputs.lix-module.nixosModules.default ]; secrets = { "deltaflyer-wireguard-private-key" = { }; diff --git a/hosts/deltaflyer/default.nix b/hosts/deltaflyer/default.nix index 70f479f..7e68982 100644 --- a/hosts/deltaflyer/default.nix +++ b/hosts/deltaflyer/default.nix @@ -30,6 +30,13 @@ # INSECURE STUFF FIRST # Users and hardcoded passwords. { + nixpkgs.overlays = [ + (prev: final: { + gcc7 = final.gcc; + gcc8 = final.gcc; + }) + ]; + users.users.root.password = "nixos"; # users.users.ccr.password = "1234"; @@ -66,11 +73,13 @@ "git" "shell" "helix" - "hyprland" + # "hyprland" + "niri" "emacs" "firefox" "mpv" "xdg" + "catppuccin" ]; extraGroups = [ "dialout" @@ -99,18 +108,18 @@ ccr.extraModules = [ { programs.fish.loginShellInit = '' - pgrep Hypr >/dev/null || exec dbus-run-session Hyprland - ''; - wayland.windowManager.hyprland.extraConfig = lib.mkAfter '' - monitor = DSI-1, 1080x2340, 0x0, 2, transform, 1 - input { - touchdevice { - transform = 1 - } - } - bind = $mod, r, exec, rotate-screen hor - bind = $mod SHIFT, r, exec, rotate-screen ver + pgrep niri >/dev/null || exec niri-session ''; + # wayland.windowManager.hyprland.extraConfig = lib.mkAfter '' + # monitor = DSI-1, 1080x2340, 0x0, 2, transform, 1 + # input { + # touchdevice { + # transform = 1 + # } + # } + # bind = $mod, r, exec, rotate-screen hor + # bind = $mod SHIFT, r, exec, rotate-screen ver + # ''; home.packages = let rotateScript = pkgs.writeShellApplication { diff --git a/hosts/deltaflyer/plasma-mobile.nix b/hosts/deltaflyer/plasma-mobile.nix index 35c6f86..11eb446 100644 --- a/hosts/deltaflyer/plasma-mobile.nix +++ b/hosts/deltaflyer/plasma-mobile.nix @@ -3,6 +3,7 @@ # { lib, + pkgs, ... }: { @@ -16,35 +17,38 @@ # # desktopManager.plasma5.mobile.enable = true; - # displayManager.autoLogin = { - # enable = true; - # }; + displayManager.autoLogin = { + enable = true; + user = "ccr"; + }; - # displayManager.session = [{ - # manage = "desktop"; - # name = "hyprland"; - # start = '' - # ${pkgs.hyprland}/bin/Hyprland & - # waitPID=$! - # ''; - # }]; + displayManager.session = [ + { + manage = "desktop"; + name = "niri"; + start = '' + ${pkgs.niri}/bin/niri-session & + waitPID=$! + ''; + } + ]; - # displayManager.defaultSession = "hyprland"; + displayManager.defaultSession = "niri"; - # displayManager.lightdm = { - # enable = true; - # # Workaround for autologin only working at first launch. - # # A logout or session crashing will show the login screen otherwise. - # extraSeatDefaults = '' - # session-cleanup-script=${pkgs.procps}/bin/pkill -P1 -fx ${pkgs.lightdm}/sbin/lightdm - # ''; - # }; + displayManager.lightdm = { + enable = true; + # Workaround for autologin only working at first launch. + # A logout or session crashing will show the login screen otherwise. + extraSeatDefaults = '' + session-cleanup-script=${pkgs.procps}/bin/pkill -P1 -fx ${pkgs.lightdm}/sbin/lightdm + ''; + }; libinput.enable = true; }; hardware.bluetooth.enable = true; - hardware.pulseaudio.enable = lib.mkDefault true; # mkDefault to help out users wanting pipewire + hardware.pulseaudio.enable = lib.mkDefault false; # mkDefault to help out users wanting pipewire networking.networkmanager.enable = true; networking.wireless.enable = false; powerManagement.enable = true; From a98b467d26047ef56f07066c203cd8b0e2557591 Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Mon, 13 Jan 2025 16:43:47 +0100 Subject: [PATCH 2/5] Fix swayidle My workaround is not needed anymore and it was preventing it to work --- hmModules/swayidle/default.nix | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hmModules/swayidle/default.nix b/hmModules/swayidle/default.nix index ccd150b..4db2310 100644 --- a/hmModules/swayidle/default.nix +++ b/hmModules/swayidle/default.nix @@ -48,10 +48,4 @@ } ]; }; - - # Otherwise it will start only after Sway and will not work with Hyprland - systemd.user.services.swayidle = { - Unit.PartOf = lib.mkForce [ ]; - Install.WantedBy = lib.mkForce [ "graphical-session-pre.target" ]; - }; } From e21a61c360f492467fdadda890d44fa2cfade486 Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Tue, 14 Jan 2025 17:38:27 +0100 Subject: [PATCH 3/5] Bump all inputs --- flake.lock | 86 +++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/flake.lock b/flake.lock index 7b241b5..0a20f08 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1736199437, - "narHash": "sha256-TdU0a/x8048rbbJmkKWzSY1CtsbbGKNkIJcMdr8Zf4Q=", + "lastModified": 1736711425, + "narHash": "sha256-8hKhPQuMtXfJi+4lPvw3FBk/zSJVHeb726Zo0uF1PP8=", "owner": "nix-community", "repo": "disko", - "rev": "49f8aa791f81ff2402039b3efe0c35b9386c4bcf", + "rev": "f720e64ec37fa16ebba6354eadf310f81555cc07", "type": "github" }, "original": { @@ -156,11 +156,11 @@ "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { - "lastModified": 1736327656, - "narHash": "sha256-vDli473KKyf13uexB4Ja9Jt7KmeUSbHbeuwIDP0M2yM=", + "lastModified": 1736759802, + "narHash": "sha256-XCaIRTC+YlL5nRi9WJHeftyfw2Z0YXwwzEmHThGuR3Q=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "42b7368d193ad1939c32e87b48e970423f22f242", + "rev": "244a2ab1459c72bac32a2db088549f8bc6d7a836", "type": "github" }, "original": { @@ -267,11 +267,11 @@ ] }, "locked": { - "lastModified": 1735774679, - "narHash": "sha256-soePLBazJk0qQdDVhdbM98vYdssfs3WFedcq+raipRI=", + "lastModified": 1736143030, + "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "f2f7418ce0ab4a5309a4596161d154cfc877af66", + "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", "type": "github" }, "original": { @@ -582,11 +582,11 @@ ] }, "locked": { - "lastModified": 1736349537, - "narHash": "sha256-jE6CXoJLBmvuq9bWjv+EQusiEtSxPiNasWbD+N4575U=", + "lastModified": 1736781604, + "narHash": "sha256-nIjcN89nxaI5ZnwU/1gzc3rBVQ/te5sHraYeG4cyJX4=", "owner": "nix-community", "repo": "home-manager", - "rev": "456e599f9101ed153dde268b4401c5d294ba6c8c", + "rev": "9616d81f98032d1ee9bec68ab4b6a8c833add88c", "type": "github" }, "original": { @@ -618,11 +618,11 @@ }, "impermanence": { "locked": { - "lastModified": 1734945620, - "narHash": "sha256-olIfsfJK4/GFmPH8mXMmBDAkzVQ1TWJmeGT3wBGfQPY=", + "lastModified": 1736688610, + "narHash": "sha256-1Zl9xahw399UiZSJ9Vxs1W4WRFjO1SsNdVZQD4nghz0=", "owner": "nix-community", "repo": "impermanence", - "rev": "d000479f4f41390ff7cf9204979660ad5dd16176", + "rev": "c64bed13b562fc3bb454b48773d4155023ac31b7", "type": "github" }, "original": { @@ -687,11 +687,11 @@ "lix": { "flake": false, "locked": { - "lastModified": 1736275188, - "narHash": "sha256-IWu1aN1MeRCtx0PYIKTvG5iDSOx/JVegm4Y+0lAZGTE=", + "lastModified": 1736680332, + "narHash": "sha256-gwidOezQ6FT5q4GHcpD6y2EwKcrtzjAoxaN/9bTGqQw=", "ref": "refs/heads/main", - "rev": "3413ab56292f12ac03ee49270bcaf16038020cb3", - "revCount": 16605, + "rev": "38dd196b03f4163ae3bbb2a1910b8f0f141ca0e2", + "revCount": 16610, "type": "git", "url": "https://git@git.lix.systems/lix-project/lix" }, @@ -754,11 +754,11 @@ "mobile-nixos": { "flake": false, "locked": { - "lastModified": 1735176114, - "narHash": "sha256-PxPYz/EFJDtSVrtca14l7crlASkJG2jVrQNpbMzmAcY=", + "lastModified": 1736638789, + "narHash": "sha256-pkpOkSUNrSf5DePUtYYFt4wGODhY28RlQ4SIJ1e+15M=", "owner": "NixOS", "repo": "mobile-nixos", - "rev": "595d359518864a13483fd3f4f4ad740cb3bae825", + "rev": "72a0601f36a1b424e8b72f17ff53509b990ee060", "type": "github" }, "original": { @@ -776,11 +776,11 @@ "treefmt-nix": "treefmt-nix_2" }, "locked": { - "lastModified": 1736168988, - "narHash": "sha256-jqH3cfg98+mRSB59WmJuWnvsSyOUNIOVZxf16Mh9/8s=", + "lastModified": 1736592044, + "narHash": "sha256-HkaJeIFgxncLm8MC1BaWRTkge9b1/+mjPcbzXTRshoM=", "owner": "Mic92", "repo": "nix-fast-build", - "rev": "a06a8b2c079f7b6dab491a12555387bdb737cc44", + "rev": "906af17fcd50c84615a4660d9c08cf89c01cef7d", "type": "github" }, "original": { @@ -864,11 +864,11 @@ "nixpkgs": "nixpkgs_6" }, "locked": { - "lastModified": 1736085891, - "narHash": "sha256-bTl9fcUo767VaSx4Q5kFhwiDpFQhBKna7lNbGsqCQiA=", + "lastModified": 1736631212, + "narHash": "sha256-mG9lRZBcPiAGiVJ9B97BJoIGQcSBWIVlBiN30QYCtG0=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "ba9b3173b0f642ada42b78fb9dfc37ca82266f6c", + "rev": "6ace2f2d12bdf74235d5cbf9fbd34a71c9716685", "type": "github" }, "original": { @@ -900,11 +900,11 @@ }, "nixosHardware": { "locked": { - "lastModified": 1736283893, - "narHash": "sha256-BG1FfTexFwNty5VhYjaQLMR6CMPfI3QRcaZrFQYu2EM=", + "lastModified": 1736441705, + "narHash": "sha256-OL7leZ6KBhcDF3nEKe4aZVfIm6xQpb1Kb+mxySIP93o=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "4f339f6be2b61662f957c2ee9eda0fa597d8a6d6", + "rev": "8870dcaff63dfc6647fb10648b827e9d40b0a337", "type": "github" }, "original": { @@ -1009,11 +1009,11 @@ }, "nixpkgs-stable_2": { "locked": { - "lastModified": 1736200483, - "narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=", + "lastModified": 1736549401, + "narHash": "sha256-ibkQrMHxF/7TqAYcQE+tOnIsSEzXmMegzyBWza6uHKM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751", + "rev": "1dab772dd4a68a7bba5d9460685547ff8e17d899", "type": "github" }, "original": { @@ -1087,11 +1087,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1736012469, - "narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=", + "lastModified": 1736523798, + "narHash": "sha256-Xb8mke6UCYjge9kPR9o4P1nVrhk7QBbKv3xQ9cj7h2s=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d", + "rev": "130595eba61081acde9001f43de3248d8888ac4a", "type": "github" }, "original": { @@ -1164,11 +1164,11 @@ }, "nixpkgs_9": { "locked": { - "lastModified": 1736012469, - "narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=", + "lastModified": 1736701207, + "narHash": "sha256-jG/+MvjVY7SlTakzZ2fJ5dC3V1PrKKrUEOEE30jrOKA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d", + "rev": "ed4a395ea001367c1f13d34b1e01aa10290f67d6", "type": "github" }, "original": { @@ -1497,11 +1497,11 @@ ] }, "locked": { - "lastModified": 1735905407, - "narHash": "sha256-1hKMRIT+QZNWX46e4gIovoQ7H8QRb7803ZH4qSKI45o=", + "lastModified": 1736154270, + "narHash": "sha256-p2r8xhQZ3TYIEKBoiEhllKWQqWNJNoT9v64Vmg4q8Zw=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "29806abab803e498df96d82dd6f34b32eb8dd2c8", + "rev": "13c913f5deb3a5c08bb810efd89dc8cb24dd968b", "type": "github" }, "original": { From bfa2f177d35415abd76a09852f1715e93122cb59 Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Tue, 14 Jan 2025 17:38:32 +0100 Subject: [PATCH 4/5] Niri floating rule for the experimental Emacs selector --- hmModules/emacs/init.el | 49 +++++++++++++++++++++++++-------------- hmModules/niri/config.kdl | 4 +++- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/hmModules/emacs/init.el b/hmModules/emacs/init.el index 047e4d3..19ac094 100644 --- a/hmModules/emacs/init.el +++ b/hmModules/emacs/init.el @@ -1016,26 +1016,41 @@ This is meant to be an helper to be called from the window manager." ;;; Experiments, remove from here - -(defun ccr/test () - "test" +(defun ccr/test (niri-socket) + "Select a window and focus it based on `niri msg` output." (interactive) - (with-selected-frame - (make-frame '((name . "Emacs Selector") - (minibuffer . only) - (fullscreen . 0) ; no fullscreen - (undecorated . t) ; remove title bar - ;;(auto-raise . t) ; focus on this frame - ;;(tool-bar-lines . 0) - ;;(menu-bar-lines . 0) - (internal-border-width . 10) - (width . 50) - (height . 10))) - (unwind-protect - (completing-read "ciao " '("foo" "bar" "pippo") nil t "") - (delete-frame)))) + (let* ((niri-output (ccr/niri-get-windows niri-socket)) + (display-list (mapcar (lambda (entry) + (let ((title (cdr (assoc 'title entry))) + (app-id (cdr (assoc 'app_id entry))) + (id (cdr (assoc 'id entry)))) + (cons (format "%s - %s" title app-id) id))) + niri-output))) + (with-selected-frame + (make-frame '((name . "Emacs Selector") + (minibuffer . only) + (fullscreen . 0) + (undecorated . t) + (internal-border-width . 10) + (width . 120) + (height . 20))) + (unwind-protect + (let* ((entry (completing-read "Select window: " (mapcar #'car display-list) nil t "")) + (entry-id (cdr (assoc entry display-list))) ;; Get the ID associated with the selected entry + (command (format "NIRI_SOCKET=\"%s\" niri msg action focus-window --id %s" niri-socket entry-id))) + (message command) + (shell-command command)) + (delete-frame))))) +(defun ccr/niri-get-windows (niri-socket) + "Esegue `niri msg --json windows` e parse l'output JSON in una alist." + (let* ((command (format "NIRI_SOCKET=\"%s\" niri msg --json windows" niri-socket)) + (output (shell-command-to-string command)) + (json-object-type 'alist) ; Usa alist per rappresentare gli oggetti JSON + (parsed-json (json-read-from-string output))) + parsed-json)) + (provide 'init) ;;; init.el ends here diff --git a/hmModules/niri/config.kdl b/hmModules/niri/config.kdl index 7d25a06..7fbe4bf 100644 --- a/hmModules/niri/config.kdl +++ b/hmModules/niri/config.kdl @@ -301,7 +301,9 @@ window-rule { } window-rule { - match app-id=r#"^Emacs Selector$"# + match title=r#"^Emacs Selector$"# + opacity 0.95 + open-floating true } From 37888230728dc1dfea57754ec5309d9048c49947 Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Tue, 14 Jan 2025 17:39:03 +0100 Subject: [PATCH 5/5] Simplify `pinentry-rofi` usage --- hmModules/gpg/default.nix | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/hmModules/gpg/default.nix b/hmModules/gpg/default.nix index a894c90..f245f26 100644 --- a/hmModules/gpg/default.nix +++ b/hmModules/gpg/default.nix @@ -2,25 +2,13 @@ { services.gpg-agent = { enable = true; - enableSshSupport = true; - extraConfig = - let - pinentryRofi = pkgs.writeShellApplication { - name = "pinentry-rofi-with-env"; - runtimeInputs = with pkgs; [ - coreutils - rofi-wayland - ]; - text = '' - "${pkgs.pinentry-rofi}/bin/pinentry-rofi" "$@" - ''; - }; - in - '' - allow-emacs-pinentry - allow-loopback-pinentry - pinentry-program ${pinentryRofi}/bin/pinentry-rofi-with-env - ''; + pinentryPackage = pkgs.pinentry-rofi.override { + rofi = pkgs.rofi-wayland; + }; + extraConfig = '' + allow-emacs-pinentry + allow-loopback-pinentry + ''; }; programs.gpg = {