From 3857c4aee91d5eaae68e40d12b4af0dab069b2d6 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 6 Sep 2024 17:53:26 +0900 Subject: [PATCH 001/197] Use zed for VISUAL editor in both NixOS and macOS (#772) * Use zed for VISUAL editor in both NixOS and macOS * Fix to apply --wait for zed execution as I did in vscode * Install iceberg without enabling * Fix zed path in darwin --- config/zed/settings.json | 3 ++- home-manager/common.nix | 1 - home-manager/darwin.nix | 9 +++++++++ home-manager/packages.nix | 4 ++++ nixos/configuration.nix | 4 +++- 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/config/zed/settings.json b/config/zed/settings.json index 95b2e9f2..c0aa8b41 100644 --- a/config/zed/settings.json +++ b/config/zed/settings.json @@ -22,6 +22,7 @@ "toml": true, "lua": true, "basher": true, - "base16": true + "base16": true, + "iceberg": true } } diff --git a/home-manager/common.nix b/home-manager/common.nix index d84d9954..fca7ad55 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -46,7 +46,6 @@ # Do NOT set GIT_EDITOR, it overrides `core.editor` in git config # https://unix.stackexchange.com/questions/4859/visual-vs-editor-what-s-the-difference EDITOR = lib.getExe pkgs.helix; - VISUAL = lib.getExe pkgs.helix; # vscode is heavy even if in VISUAL use PAGER = "less"; # https://github.com/sharkdp/bat/blob/v0.24.0/README.md?plain=1#L201-L219 diff --git a/home-manager/darwin.nix b/home-manager/darwin.nix index afa21dbd..2706bd82 100644 --- a/home-manager/darwin.nix +++ b/home-manager/darwin.nix @@ -3,6 +3,15 @@ # https://github.com/nix-community/home-manager/issues/414#issuecomment-427163925 lib.mkMerge [ (lib.mkIf pkgs.stdenv.isDarwin { + home = { + sessionVariables = { + # * Do not specify Nix store path for zed in macOS + # https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219 + # * `cli: install` action installs into this path in macOS + VISUAL = "/usr/local/bin/zed --wait"; + }; + }; + # https://github.com/NixOS/nixpkgs/issues/240819#issuecomment-1616760598 # https://github.com/midchildan/dotfiles/blob/fae87a3ef327c23031d8081333678f9472e4c0ed/nix/home/modules/gnupg/default.nix#L38 xdg.dataFile."gnupg/gpg-agent.conf".text = '' diff --git a/home-manager/packages.nix b/home-manager/packages.nix index 0cc4c74c..7f9a5f0c 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -162,4 +162,8 @@ with pkgs; source-han-code-jp # Includes many definitions, useful for fallback inconsolata + + # Don't add zed in macOS with nixpkgs + # https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219 + # edge-pkgs.zed-editor ]) diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 26d0c2bb..a4da7e7a 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -126,7 +126,7 @@ EDITOR = lib.getExe pkgs.helix; SYSTEMD_EDITOR = lib.getExe pkgs.helix; - VISUAL = lib.getExe pkgs.helix; + VISUAL = "${lib.getExe edge-pkgs.zed-editor} --wait"; }; # List packages installed in system profile. To search, run: @@ -204,6 +204,8 @@ ## Unfree packages + # TODO: Consider using vscodium again + # TODO: Consider to drop the unuseful vscode until fixed the Wayland problems (edge-pkgs.vscode.override (prev: { # https://wiki.archlinux.org/title/Wayland#Electron # https://github.com/NixOS/nixpkgs/blob/3f8b7310913d9e4805b7e20b2beabb27e333b31f/pkgs/applications/editors/vscode/generic.nix#L207-L214 From 6af2f8002c08be76fe5392f274f73523f4a0b047 Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Sat, 7 Sep 2024 20:02:26 +0000 Subject: [PATCH 002/197] flake.lock: Update (#774) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/12228ff1752d7b7624a54e9c1af4b222b3c1073b?narHash=sha256-Ym04C5%2BqovuQDYL/rKWSR%2BWESseQBbNAe5DsXNx5trY%3D' (2024-08-31) → 'github:NixOS/nixpkgs/574d1eac1c200690e27b8eb4e24887f8df7ac27c?narHash=sha256-v3rIhsJBOMLR8e/RNWxr828tB%2BWywYIoajrZKFM%2B0Gg%3D' (2024-09-06) • Updated input 'home-manager': 'github:nix-community/home-manager/e1391fb22e18a36f57e6999c7a9f966dc80ac073?narHash=sha256-A0vrUB6x82/jvf17qPCpxaM%2BulJnD8YZwH9Ci0BsAzE%3D' (2024-07-03) → 'github:nix-community/home-manager/208df2e558b73b6a1f0faec98493cb59a25f62ba?narHash=sha256-tDgM4d8mLK0Hd6YMB2w1BqMto1XBXADOzPEaLl10VI4%3D' (2024-09-07) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/6e99f2a27d600612004fbd2c3282d614bfee6421?narHash=sha256-eV%2B63gK0Mp7ygCR0Oy4yIYSNcum2VQwnZamHxYTNi%2BM%3D' (2024-08-30) → 'github:NixOS/nixpkgs/6f6c45b5134a8ee2e465164811e451dcb5ad86e3?narHash=sha256-tiN5Rlg/jiY0tyky%2BsoJZoRzLKbPyIdlQ77xVgREDNM%3D' (2024-09-03) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 7f2706cc..fc738b54 100644 --- a/flake.lock +++ b/flake.lock @@ -42,11 +42,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1725103162, - "narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=", + "lastModified": 1725634671, + "narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b", + "rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c", "type": "github" }, "original": { @@ -133,11 +133,11 @@ ] }, "locked": { - "lastModified": 1720042825, - "narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", + "lastModified": 1725703823, + "narHash": "sha256-tDgM4d8mLK0Hd6YMB2w1BqMto1XBXADOzPEaLl10VI4=", "owner": "nix-community", "repo": "home-manager", - "rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", + "rev": "208df2e558b73b6a1f0faec98493cb59a25f62ba", "type": "github" }, "original": { @@ -387,11 +387,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1725001927, - "narHash": "sha256-eV+63gK0Mp7ygCR0Oy4yIYSNcum2VQwnZamHxYTNi+M=", + "lastModified": 1725407940, + "narHash": "sha256-tiN5Rlg/jiY0tyky+soJZoRzLKbPyIdlQ77xVgREDNM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6e99f2a27d600612004fbd2c3282d614bfee6421", + "rev": "6f6c45b5134a8ee2e465164811e451dcb5ad86e3", "type": "github" }, "original": { From 9d6b6bec15930fe0e1b213840324175a6a17941e Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 8 Sep 2024 05:15:51 +0900 Subject: [PATCH 003/197] Uninstall blur-my-shell to fix flicker on GNOME Fixes GH-775 --- home-manager/gnome.nix | 2 +- nixos/configuration.nix | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index da6658d3..5eb24dbf 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -27,7 +27,7 @@ in with pkgs.gnomeExtensions; [ appindicator - blur-my-shell + # blur-my-shell # Don't use this extension, it often makes flicker. See GH-775 pop-shell clipboard-history kimpanel diff --git a/nixos/configuration.nix b/nixos/configuration.nix index a4da7e7a..2bc5d549 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -233,7 +233,6 @@ ] ++ (with pkgs.gnomeExtensions; [ appindicator - blur-my-shell # Should be changed from default CSS to another to avoid https://github.com/pop-os/shell/issues/132 # https://github.com/pop-os/shell/blob/cfa0c55e84b7ce339e5ce83832f76fee17e99d51/light.css#L20-L24 From ee0b35f15e7eac7f1538ecaf837b2b49f3173618 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 8 Sep 2024 05:58:42 +0900 Subject: [PATCH 004/197] Ignore *.lock files in treefmt --- treefmt.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/treefmt.toml b/treefmt.toml index 5d243bdf..23df6616 100644 --- a/treefmt.toml +++ b/treefmt.toml @@ -8,6 +8,7 @@ excludes = [ "dist/*", "result/*", "dependencies/*", + "*.lock", ] [formatter.dprint] From 49fd11ce3b928f12e8cb18a002d21cffc317998b Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 8 Sep 2024 05:58:53 +0900 Subject: [PATCH 005/197] Bump cloudflare-warp and note troubleshooting Closes GH-749 --- nixos/WARP.md | 10 ++++++++++ nixos/configuration.nix | 2 ++ nixos/gui.nix | 9 +++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/nixos/WARP.md b/nixos/WARP.md index e1a9d719..3397e652 100644 --- a/nixos/WARP.md +++ b/nixos/WARP.md @@ -25,3 +25,13 @@ Or use with accessing to Date: Sun, 8 Sep 2024 14:15:48 +0900 Subject: [PATCH 006/197] Downgrade broken Google Chrome on NixOS Fixes GH-776 --- nixos/configuration.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 256139b9..975acd3c 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -221,9 +221,12 @@ ]; })) + # Don't use latest chrome - See GH-776 + # In the first place, it does not run even through it having crucial fixes + # # if you changed hostname and chrome doesn't run, see https://askubuntu.com/questions/476918/google-chrome-wont-start-after-changing-hostname # `rm -rf ~/.config/google-chrome/Singleton*` - (edge-pkgs.google-chrome.override (prev: { + (google-chrome.override (prev: { # https://wiki.archlinux.org/title/Chromium#Native_Wayland_support # Similar as https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/chromium.nix commandLineArgs = (prev.commandLineArgs or [ ]) ++ [ From 6636994ef74fa3b47eb455705471d0e9841c95e2 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 8 Sep 2024 14:16:44 +0900 Subject: [PATCH 007/197] Fix comment about PWA --- nixos/configuration.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 975acd3c..e0936292 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -116,7 +116,7 @@ ]; packages = [ # Don't install spotify, it does not activate IME and no binary cache with the unfree license. - # Use the Web Player via Firefox + # Use Web Player or PWA ]; }; }; From bac93e8944f929d55ff65f1c678a26883b7d122a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 8 Sep 2024 15:06:14 +0900 Subject: [PATCH 008/197] Fix todo command with no query Since 73d723b9ce808c96c7aa9be284fd696c6b74d580 --- pkgs/todo/todo.bash | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/todo/todo.bash b/pkgs/todo/todo.bash index 3375d729..a7b55033 100644 --- a/pkgs/todo/todo.bash +++ b/pkgs/todo/todo.bash @@ -1,6 +1,12 @@ +if [ $# -ge 1 ]; then + query="$1" +else + query='' +fi + # open bat with line number in preview: https://github.com/sharkdp/bat/issues/1185#issuecomment-1301473901 # shellcheck disable=SC2016 git grep --perl-regexp --line-number --column --color=always '\b(?<=TODO|FIXME|BUG)\b\S+' | - fzf --ansi --delimiter : --nth 4.. --query "$@" \ + fzf --ansi --delimiter : --nth 4.. --query "$query" \ --preview 'bat {1} --color=always --highlight-line={2}' --preview-window='~3,+{2}+3/4' \ --bind 'enter:become(command "$EDITOR" {1}:{2}:{3})' From 083750734132e76543c8d8373e87f0f871f8c81d Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 8 Sep 2024 15:15:37 +0900 Subject: [PATCH 009/197] Pin all chromium apps like vscode to stable channel Follow GH-776 --- nixos/configuration.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nixos/configuration.nix b/nixos/configuration.nix index e0936292..6a58d08e 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -179,6 +179,8 @@ firefox + # Don't use unstable channel. It frequently backported to stable channel + # - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/applications/networking/instant-messengers/signal-desktop/signal-desktop.nix (signal-desktop.overrideAttrs (prev: { preFixup = prev.preFixup @@ -208,7 +210,9 @@ # TODO: Consider using vscodium again # TODO: Consider to drop the unuseful vscode until fixed the Wayland problems - (edge-pkgs.vscode.override (prev: { + # Don't use unstable channel. It frequently backported to stable channel + # - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/applications/editors/vscode/vscode.nix + (vscode.override (prev: { # https://wiki.archlinux.org/title/Wayland#Electron # https://github.com/NixOS/nixpkgs/blob/3f8b7310913d9e4805b7e20b2beabb27e333b31f/pkgs/applications/editors/vscode/generic.nix#L207-L214 commandLineArgs = (prev.commandLineArgs or [ ]) ++ [ @@ -221,8 +225,9 @@ ]; })) - # Don't use latest chrome - See GH-776 - # In the first place, it does not run even through it having crucial fixes + # Don't use unstable channel. It frequently backported to stable channel + # - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/by-name/go/google-chrome/package.nix + # - Actually unstable is/was broken. See GH-776 # # if you changed hostname and chrome doesn't run, see https://askubuntu.com/questions/476918/google-chrome-wont-start-after-changing-hostname # `rm -rf ~/.config/google-chrome/Singleton*` From fafd1a0b2d3e4ebbdd741517e6e56cd2dc66eb5a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 8 Sep 2024 19:40:42 +0900 Subject: [PATCH 010/197] Make shfmt respect editorconfig in vscode treefmt and zed are working as this --- .vscode/settings.json | 3 ++- config/vscode/settings.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index b3e50629..b72633e8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -26,5 +26,6 @@ "gopls": { "build.buildFlags": ["-tags=linux,windows,darwin"] }, - "stylua.searchBinaryInPATH": true + "stylua.searchBinaryInPATH": true, + "shellformat.useEditorConfig": true } diff --git a/config/vscode/settings.json b/config/vscode/settings.json index febc7e28..00b80af4 100644 --- a/config/vscode/settings.json +++ b/config/vscode/settings.json @@ -102,5 +102,6 @@ "editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?", "workbench.colorTheme": "Blueberry Brackets dark theme", "stylua.searchBinaryInPATH": true, + "shellformat.useEditorConfig": true, "editor.cursorSurroundingLines": 5 } From 50011e1c40681da141e762b0cf3a941843a2835e Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 00:38:36 +0000 Subject: [PATCH 011/197] flake.lock: Update (#778) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/6f6c45b5134a8ee2e465164811e451dcb5ad86e3?narHash=sha256-tiN5Rlg/jiY0tyky%2BsoJZoRzLKbPyIdlQ77xVgREDNM%3D' (2024-09-03) → 'github:NixOS/nixpkgs/68e7dce0a6532e876980764167ad158174402c6f?narHash=sha256-ZPzhebbWBOr0zRWW10FfqfbJlan3G96/h3uqhiFqmwg%3D' (2024-09-07) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index fc738b54..703e39f0 100644 --- a/flake.lock +++ b/flake.lock @@ -387,11 +387,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1725407940, - "narHash": "sha256-tiN5Rlg/jiY0tyky+soJZoRzLKbPyIdlQ77xVgREDNM=", + "lastModified": 1725693463, + "narHash": "sha256-ZPzhebbWBOr0zRWW10FfqfbJlan3G96/h3uqhiFqmwg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6f6c45b5134a8ee2e465164811e451dcb5ad86e3", + "rev": "68e7dce0a6532e876980764167ad158174402c6f", "type": "github" }, "original": { From bdd6679ca4ef7f65a91b4a665c1021fe3f985e2c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 13:20:20 +0000 Subject: [PATCH 012/197] Bump golang.org/x/sys from 0.24.0 to 0.25.0 (#780) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.24.0 to 0.25.0. - [Commits](https://github.com/golang/sys/compare/v0.24.0...v0.25.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 89204898..87d157d6 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.22.6 require ( golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b - golang.org/x/sys v0.24.0 + golang.org/x/sys v0.25.0 ) diff --git a/go.sum b/go.sum index 587e3dbf..d3a3f955 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,4 @@ golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b h1:r+vk0EmXNmekl0S0BascoeeoHk/L7wmaW2QF90K+kYI= golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 5cafcfa6d655193e5de9370a475a53dae939b70f Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 10 Sep 2024 04:26:53 +0900 Subject: [PATCH 013/197] Attemp to fix the unstable xremap daemon (#779) * Introduce xremap-gnome * Enable debug logging in xremap For a preparation part for GH-773 * Manually install xremap-gnome extension * Disable xremap debug logging for now --- home-manager/gnome.nix | 1 + nixos/configuration.nix | 1 + nixos/xremap.nix | 59 ++++++++++++++++++++++++----------------- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 5eb24dbf..43827936 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -41,6 +41,7 @@ in just-perfection dash-to-dock # color-picker # Don't enable by default. It conflicts with clipboard-history + xremap ] ); diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 6a58d08e..0977ea07 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -259,6 +259,7 @@ just-perfection dash-to-dock color-picker + xremap ]); # https://github.com/NixOS/nixpkgs/issues/33282#issuecomment-523572259 diff --git a/nixos/xremap.nix b/nixos/xremap.nix index 8650f3a2..879d381a 100644 --- a/nixos/xremap.nix +++ b/nixos/xremap.nix @@ -1,30 +1,41 @@ { # Modmap for single key rebinds - services.xremap.config = { - modmap = [ - { - name = "Global"; - remap = { - "CapsLock" = "Ctrl_L"; - "Alt_L" = { - "held" = "Alt_L"; - "alone" = "Muhenkan"; - "alone_timeout_millis" = 500; + services.xremap = { + enable = true; + # https://github.com/xremap/xremap-gnome + # https://github.com/xremap/nix-flake/blob/3717cb0539f4967010ba540baa439a4cf6ea8576/lib/default.nix#L64-L65 + withGnome = true; + + # Enable when you investigate GH-773 + # You can check the logs with `journalctl -f` + debug = false; + + config = { + modmap = [ + { + name = "Global"; + remap = { + "CapsLock" = "Ctrl_L"; + "Alt_L" = { + "held" = "Alt_L"; + "alone" = "Muhenkan"; + "alone_timeout_millis" = 500; + }; + "Alt_R" = "Henkan"; }; - "Alt_R" = "Henkan"; - }; - } - ]; + } + ]; - # Disabled while using Alt-Space for pop-shell launcher - # Keymap for key combo rebinds - # keymap = [ - # { - # name = "Gnome lancher"; - # remap = { - # "Alt-Space" = "LEFTMETA"; - # }; - # } - # ]; + # Disabled while using Alt-Space for pop-shell launcher + # Keymap for key combo rebinds + # keymap = [ + # { + # name = "Gnome lancher"; + # remap = { + # "Alt-Space" = "LEFTMETA"; + # }; + # } + # ]; + }; }; } From 6690cd70d6851eb087d19b5f08033375c743f7b9 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 10 Sep 2024 12:58:26 +0900 Subject: [PATCH 014/197] Install zed typos extension --- config/zed/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/config/zed/settings.json b/config/zed/settings.json index c0aa8b41..87547a1e 100644 --- a/config/zed/settings.json +++ b/config/zed/settings.json @@ -20,6 +20,7 @@ "auto_install_extensions": { "nix": true, "toml": true, + "typos": true, "lua": true, "basher": true, "base16": true, From 4aba681c6246a54c3a238b35da87ec974ae160eb Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 10 Sep 2024 13:09:18 +0900 Subject: [PATCH 015/197] Install zed ruby and kdl extensions --- config/zed/settings.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/zed/settings.json b/config/zed/settings.json index 87547a1e..40792b38 100644 --- a/config/zed/settings.json +++ b/config/zed/settings.json @@ -21,7 +21,9 @@ "nix": true, "toml": true, "typos": true, + "ruby": true, "lua": true, + "kdl": true, "basher": true, "base16": true, "iceberg": true From 11bfe437d230092ff6b89dc9222b9fc931ca0f5a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 10 Sep 2024 13:14:16 +0900 Subject: [PATCH 016/197] Set Iceberg for default theme in zed --- config/zed/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/zed/settings.json b/config/zed/settings.json index 40792b38..4f9fdfeb 100644 --- a/config/zed/settings.json +++ b/config/zed/settings.json @@ -7,7 +7,7 @@ // custom settings, run the `open default settings` command // from the command palette or from `Zed` application menu. { - "theme": "Base16 Oxocarbon Dark", + "theme": "Iceberg", "telemetry": { "metrics": false }, From fead6e8ce1ec33e272219b2f2d949f1e5d3867f8 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 10 Sep 2024 13:32:11 +0900 Subject: [PATCH 017/197] Install zed powershell and fish extensions --- config/zed/settings.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/zed/settings.json b/config/zed/settings.json index 4f9fdfeb..0a3a337d 100644 --- a/config/zed/settings.json +++ b/config/zed/settings.json @@ -25,6 +25,8 @@ "lua": true, "kdl": true, "basher": true, + "powershell": true, + "fish": true, "base16": true, "iceberg": true } From 917fa2fb03482744ff34c73476c63d6f58eaed80 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 10 Sep 2024 13:52:09 +0900 Subject: [PATCH 018/197] Enable file icons on tab --- config/zed/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/config/zed/settings.json b/config/zed/settings.json index 0a3a337d..c7be89b5 100644 --- a/config/zed/settings.json +++ b/config/zed/settings.json @@ -17,6 +17,7 @@ "ui_font_size": 16, "buffer_font_family": "PlemolJP Console NF", "buffer_font_size": 16, + "file_icons": true, "auto_install_extensions": { "nix": true, "toml": true, From ae380db3a51dc6569a39c66fa0a847a975cad2ad Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 10 Sep 2024 14:25:38 +0900 Subject: [PATCH 019/197] Make zed in nixpkgs respect FHS Fixes GH-781 --- nixos/configuration.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 0977ea07..3911f4a3 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -10,6 +10,17 @@ lib, ... }: +let + # https://github.com/NixOS/nixpkgs/issues/309662#issuecomment-2155122284 + zed-fhs = pkgs.buildFHSUserEnv { + name = "zed"; + targetPkgs = pkgs: [ + # version in nixos-24.05 does not enable IME + edge-pkgs.zed-editor + ]; + runScript = "zed"; + }; +in { imports = [ ./modules/cloudflare-warp.nix @@ -128,7 +139,7 @@ EDITOR = lib.getExe pkgs.helix; SYSTEMD_EDITOR = lib.getExe pkgs.helix; - VISUAL = "${lib.getExe edge-pkgs.zed-editor} --wait"; + VISUAL = "${zed-fhs} --wait"; }; # List packages installed in system profile. To search, run: @@ -139,7 +150,7 @@ vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. helix micro - edge-pkgs.zed-editor # version in nixos-24.05 does not enable IME + zed-fhs lapce # IME is not working on Windows, but stable even around IME on Wayland than vscode usbutils # `lsusb` to get IDs From 7f026b865d7385a23644daac3d0892b5a12eb485 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 10 Sep 2024 14:39:35 +0900 Subject: [PATCH 020/197] Enable dprint json schema in zed --- dprint.json | 1 + 1 file changed, 1 insertion(+) diff --git a/dprint.json b/dprint.json index b392223d..aefa5516 100644 --- a/dprint.json +++ b/dprint.json @@ -1,4 +1,5 @@ { + "$schema": "https://dprint.dev/schemas/v0.json", "json": { "trailingCommas": "never" }, From ac941acb63113813e0ae168818e91ca292ccd5c0 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 10 Sep 2024 14:40:56 +0900 Subject: [PATCH 021/197] Fix missing commit Follow ae380db3a51dc6569a39c66fa0a847a975cad2ad and GH-781 --- nixos/configuration.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 3911f4a3..ec0d16fd 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -139,7 +139,7 @@ in EDITOR = lib.getExe pkgs.helix; SYSTEMD_EDITOR = lib.getExe pkgs.helix; - VISUAL = "${zed-fhs} --wait"; + VISUAL = "${lib.getExe zed-fhs} --wait"; }; # List packages installed in system profile. To search, run: From 5ff40d2a765142a6e65aceb0061c52ac3e346043 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 10 Sep 2024 14:46:17 +0900 Subject: [PATCH 022/197] Fix to specify tab option No json schema is hell for this --- config/zed/settings.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/zed/settings.json b/config/zed/settings.json index c7be89b5..5727407a 100644 --- a/config/zed/settings.json +++ b/config/zed/settings.json @@ -17,7 +17,9 @@ "ui_font_size": 16, "buffer_font_family": "PlemolJP Console NF", "buffer_font_size": 16, - "file_icons": true, + "tabs": { + "file_icons": true + }, "auto_install_extensions": { "nix": true, "toml": true, From 0308732e732579fa432889e4d3428e42cd04477f Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 11 Sep 2024 00:32:09 +0900 Subject: [PATCH 023/197] Prefer compact bar also in dotfiles zellij layout --- config/zellij/layouts/dotfiles.kdl | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/config/zellij/layouts/dotfiles.kdl b/config/zellij/layouts/dotfiles.kdl index 66456077..51aa1950 100644 --- a/config/zellij/layouts/dotfiles.kdl +++ b/config/zellij/layouts/dotfiles.kdl @@ -1,10 +1,7 @@ layout { tab focus=true name="Filer" { - pane size=2 borderless=true { - plugin location="zellij:status-bar" - } pane size=1 borderless=true { - plugin location="zellij:tab-bar" + plugin location="zellij:compact-bar" } pane split_direction="horizontal" { pane size="80%" command="yazi" { @@ -16,11 +13,8 @@ layout { } } tab name="BPS" { - pane size=2 borderless=true { - plugin location="zellij:status-bar" - } pane size=1 borderless=true { - plugin location="zellij:tab-bar" + plugin location="zellij:compact-bar" } pane split_direction="vertical" { pane size="70%" { @@ -33,11 +27,8 @@ layout { } } tab name="dconf" { - pane size=2 borderless=true { - plugin location="zellij:status-bar" - } pane size=1 borderless=true { - plugin location="zellij:tab-bar" + plugin location="zellij:compact-bar" } pane name="edit" edit="home-manager/gnome.nix" size="70%" pane split_direction="vertical" size="30%" { @@ -48,4 +39,13 @@ layout { pane name="blank" } } + tab name="Help" { + pane size=1 borderless=true { + plugin location="zellij:tab-bar" + } + pane + pane size=2 borderless=true { + plugin location="zellij:status-bar" + } + } } From 04f2bf86648e61705dcc363bd125d4f5e55a482d Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 11 Sep 2024 00:33:18 +0900 Subject: [PATCH 024/197] Replace all zellij tab-bar with compact-bar to realize adjusted panes --- config/zellij/layouts/dotfiles.kdl | 2 +- config/zellij/layouts/regular.kdl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/zellij/layouts/dotfiles.kdl b/config/zellij/layouts/dotfiles.kdl index 51aa1950..7585424a 100644 --- a/config/zellij/layouts/dotfiles.kdl +++ b/config/zellij/layouts/dotfiles.kdl @@ -41,7 +41,7 @@ layout { } tab name="Help" { pane size=1 borderless=true { - plugin location="zellij:tab-bar" + plugin location="zellij:compact-bar" } pane pane size=2 borderless=true { diff --git a/config/zellij/layouts/regular.kdl b/config/zellij/layouts/regular.kdl index 9333ecba..7dac10ca 100644 --- a/config/zellij/layouts/regular.kdl +++ b/config/zellij/layouts/regular.kdl @@ -55,7 +55,7 @@ layout { // plugin location="zellij:compact-bar" // } pane size=1 borderless=true { - plugin location="zellij:tab-bar" + plugin location="zellij:compact-bar" } pane pane size=2 borderless=true { From 893b70971fbed3f454d24f6b4eece0820783ca5d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 00:32:23 +0000 Subject: [PATCH 025/197] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/574d1eac1c200690e27b8eb4e24887f8df7ac27c?narHash=sha256-v3rIhsJBOMLR8e/RNWxr828tB%2BWywYIoajrZKFM%2B0Gg%3D' (2024-09-06) → 'github:NixOS/nixpkgs/1355a0cbfeac61d785b7183c0caaec1f97361b43?narHash=sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE%3D' (2024-09-10) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/68e7dce0a6532e876980764167ad158174402c6f?narHash=sha256-ZPzhebbWBOr0zRWW10FfqfbJlan3G96/h3uqhiFqmwg%3D' (2024-09-07) → 'github:NixOS/nixpkgs/44a71ff39c182edaf25a7ace5c9454e7cba2c658?narHash=sha256-RVhD9hnlTT2nJzPHlAqrWqCkA7T6CYrP41IoVRkciZM%3D' (2024-09-10) --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 703e39f0..9382ff98 100644 --- a/flake.lock +++ b/flake.lock @@ -42,11 +42,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1725634671, - "narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=", + "lastModified": 1725983898, + "narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c", + "rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43", "type": "github" }, "original": { @@ -387,11 +387,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1725693463, - "narHash": "sha256-ZPzhebbWBOr0zRWW10FfqfbJlan3G96/h3uqhiFqmwg=", + "lastModified": 1725930920, + "narHash": "sha256-RVhD9hnlTT2nJzPHlAqrWqCkA7T6CYrP41IoVRkciZM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "68e7dce0a6532e876980764167ad158174402c6f", + "rev": "44a71ff39c182edaf25a7ace5c9454e7cba2c658", "type": "github" }, "original": { From 9e58be4e2a27a9681a96ff2f88ce51fd7aa24da4 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 12 Sep 2024 13:04:08 +0900 Subject: [PATCH 026/197] Use latest gitleaks in action --- .github/workflows/gitleaks.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml index c4e55281..315dfa61 100644 --- a/.github/workflows/gitleaks.yml +++ b/.github/workflows/gitleaks.yml @@ -12,3 +12,6 @@ jobs: - uses: gitleaks/gitleaks-action@44c470ffc35caa8b1eb3e8012ca53c2f9bea4eb5 # v2.3.6 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # No this env uses hardcoded old version. + # https://github.com/gitleaks/gitleaks-action/blob/2ec8b9f617b48c888d0653fb5925820e0de9c674/README.md?plain=1#L59C4-L59C20 + GITLEAKS_VERSION: 'latest' From 051cd711020d862985fcacc8e1b309579adc7017 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 12 Sep 2024 13:33:46 +0900 Subject: [PATCH 027/197] Clarify gitleaks false positive in `facebook-page-access-token` rule --- .github/workflows/gitleaks.yml | 5 +++++ .gitleaks.toml | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 .gitleaks.toml diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml index 315dfa61..ef08fa9e 100644 --- a/.github/workflows/gitleaks.yml +++ b/.github/workflows/gitleaks.yml @@ -15,3 +15,8 @@ jobs: # No this env uses hardcoded old version. # https://github.com/gitleaks/gitleaks-action/blob/2ec8b9f617b48c888d0653fb5925820e0de9c674/README.md?plain=1#L59C4-L59C20 GITLEAKS_VERSION: 'latest' + # action README says it will respect `gitleaks.toml`, however ths CLI respects only `.gitleaks.toml` + # I don't know which is correct or just a typo, so clarifying the path here + # https://github.com/gitleaks/gitleaks/blob/e93a7c0d2604fd1bcc43ac9cac6144a62387a8a4/cmd/root.go#L33C18-L33C27 + # https://github.com/gitleaks/gitleaks-action/blob/2ec8b9f617b48c888d0653fb5925820e0de9c674/README.md?plain=1#L56 + GITLEAKS_CONFIG: '.gitleaks.toml' diff --git a/.gitleaks.toml b/.gitleaks.toml new file mode 100644 index 00000000..f9c0708f --- /dev/null +++ b/.gitleaks.toml @@ -0,0 +1,14 @@ +[extend] +# useDefault will extend the base configuration with the default gitleaks config: +# https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml +useDefault = true + +[allowlist] +stopwords = [ + # This pattern was detected in `facebook-page-access-token`, but I believe this is a false positive. + # See GH-783 for detail + # https://github.com/kachick/dotfiles/pull/783#issuecomment-2345176253 + # https://gist.github.com/cocopon/a04be63f5e0856daa594702299c13160#file-iceberg-terminal-L170 + # https://github.com/gitleaks/gitleaks/pull/1372 + '''EAAC2z2Rlc2MAAAAAAAAAFklFQyBodHRwOi8vd3d3LmllYy5j''', +] From 991aa64d11492d50d51a797d7c2d508bc016d5d0 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 12 Sep 2024 13:35:33 +0900 Subject: [PATCH 028/197] Fix English --- .github/workflows/gitleaks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml index ef08fa9e..b5fda49c 100644 --- a/.github/workflows/gitleaks.yml +++ b/.github/workflows/gitleaks.yml @@ -12,7 +12,7 @@ jobs: - uses: gitleaks/gitleaks-action@44c470ffc35caa8b1eb3e8012ca53c2f9bea4eb5 # v2.3.6 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # No this env uses hardcoded old version. + # Without this env uses hardcoded old version. # https://github.com/gitleaks/gitleaks-action/blob/2ec8b9f617b48c888d0653fb5925820e0de9c674/README.md?plain=1#L59C4-L59C20 GITLEAKS_VERSION: 'latest' # action README says it will respect `gitleaks.toml`, however ths CLI respects only `.gitleaks.toml` From 0546b8e2fc713715f2ddb7e2b40064a19ef12bb0 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 13 Sep 2024 02:08:07 +0900 Subject: [PATCH 029/197] Change xremap service mode with "user" I hop\e this fixes GH-773 :pray: --- nixos/xremap.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nixos/xremap.nix b/nixos/xremap.nix index 879d381a..7a26d005 100644 --- a/nixos/xremap.nix +++ b/nixos/xremap.nix @@ -2,6 +2,9 @@ # Modmap for single key rebinds services.xremap = { enable = true; + + # If xremap does not start or down with some reasons, try `systemctl --user start xremap` + # # https://github.com/xremap/xremap-gnome # https://github.com/xremap/nix-flake/blob/3717cb0539f4967010ba540baa439a4cf6ea8576/lib/default.nix#L64-L65 withGnome = true; @@ -10,6 +13,11 @@ # You can check the logs with `journalctl -f` debug = false; + # `"system"` mode does not support Gnome + serviceMode = "user"; + userName = "kachick"; + watch = true; + config = { modmap = [ { From e66f7ddf836eb658d1e214b07a22a3785e7cf3aa Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 13 Sep 2024 02:16:38 +0900 Subject: [PATCH 030/197] Suppress zed-fhs getExe warning with re-applying mainProgram --- nixos/configuration.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/configuration.nix b/nixos/configuration.nix index ec0d16fd..ef99c0e8 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -19,6 +19,7 @@ let edge-pkgs.zed-editor ]; runScript = "zed"; + meta.mainProgram = "zed"; }; in { From 0b942ffade0c0eb142876745de5091e2d87c2d59 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 13 Sep 2024 02:28:33 +0900 Subject: [PATCH 031/197] Update command snippet with the mode change --- nixos/xremap.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/xremap.nix b/nixos/xremap.nix index 7a26d005..7812216a 100644 --- a/nixos/xremap.nix +++ b/nixos/xremap.nix @@ -10,10 +10,10 @@ withGnome = true; # Enable when you investigate GH-773 - # You can check the logs with `journalctl -f` debug = false; # `"system"` mode does not support Gnome + # You can check the log with `journalctl --user --unit xremap --reverse` serviceMode = "user"; userName = "kachick"; watch = true; From 62131c8c811721a2bde0fd1298bf4b353b9347c3 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 10 Sep 2024 04:44:59 +0900 Subject: [PATCH 032/197] Limit boot loader history more I have faced now... --- nixos/hosts/algae/default.nix | 2 +- nixos/hosts/moss/default.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/hosts/algae/default.nix b/nixos/hosts/algae/default.nix index 09ddf5ba..16a21745 100644 --- a/nixos/hosts/algae/default.nix +++ b/nixos/hosts/algae/default.nix @@ -19,7 +19,7 @@ boot.loader.systemd-boot = { enable = true; - configurationLimit = 42; + configurationLimit = 20; }; services.xserver.videoDrivers = [ "amdgpu" ]; diff --git a/nixos/hosts/moss/default.nix b/nixos/hosts/moss/default.nix index e2f0f1c0..68cf0a7c 100644 --- a/nixos/hosts/moss/default.nix +++ b/nixos/hosts/moss/default.nix @@ -20,7 +20,7 @@ boot.loader.systemd-boot = { enable = true; - configurationLimit = 42; + configurationLimit = 20; }; services.xserver.videoDrivers = [ "amdgpu" ]; From da728ae395f4c7d1cac8211c5edfaf565a44efa3 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 13 Sep 2024 16:42:51 +0900 Subject: [PATCH 033/197] Install and prefer btop rather than bottom --- home-manager/gnome.nix | 2 +- home-manager/packages.nix | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 43827936..019b00b8 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -167,7 +167,7 @@ in "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = { name = "Resource Monitor - TUI"; binding = "r"; - command = "${lib.getExe pkgs.alacritty} --command=${lib.getExe pkgs.bottom} --title='Resource Monitor(btm)'"; + command = "${lib.getExe pkgs.alacritty} --command=${lib.getExe pkgs.btop} --title='Resource Monitor'"; }; # https://github.com/pop-os/shell/blob/master_noble/schemas/org.gnome.shell.extensions.pop-shell.gschema.xml diff --git a/home-manager/packages.nix b/home-manager/packages.nix index 7f9a5f0c..4f9b0273 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -66,6 +66,7 @@ with pkgs; fd # alt find du-dust # `dust`, alt du procs + btop # alt top bottom # `btm`, alt top xh # alt HTTPie zellij From 4ee60d768f7aaff44d1c9b431cf632966d08a4fb Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 13 Sep 2024 17:21:26 +0900 Subject: [PATCH 034/197] Attempt to assign btop for another desktop --- home-manager/gnome.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 019b00b8..4bac7e32 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -167,7 +167,8 @@ in "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = { name = "Resource Monitor - TUI"; binding = "r"; - command = "${lib.getExe pkgs.alacritty} --command=${lib.getExe pkgs.btop} --title='Resource Monitor'"; + # https://askubuntu.com/questions/5172/running-a-desktop-file-in-the-terminal + command = "gtk-launch btop.desktop"; }; # https://github.com/pop-os/shell/blob/master_noble/schemas/org.gnome.shell.extensions.pop-shell.gschema.xml @@ -239,6 +240,7 @@ in "org/gnome/shell/extensions/auto-move-windows" = { application-list = [ + "btop.desktop:2" # FIXME: Not working "${spotify-pwa-file}:3" "org.gnome.Rhythmbox3.desktop:3" ]; From ab4b5e420ca1ad2a75a9221d2b93e8a0ecfb0fc8 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 15 Sep 2024 19:22:01 +0900 Subject: [PATCH 035/197] Expose cozette package for `nix build` https://github.com/kachick/dotfiles/pull/721#discussion_r1760009102 --- flake.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flake.nix b/flake.nix index 21b17d1f..c4c07d57 100644 --- a/flake.nix +++ b/flake.nix @@ -101,6 +101,10 @@ } ); + packages = forAllSystems (system: { + cozette = homemade-packages.${system}.cozette; + }); + apps = forAllSystems ( system: builtins.listToAttrs ( From b3de3ba805a12b39dd8e6fda39a371ca65f779e9 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 16 Sep 2024 03:25:47 +0900 Subject: [PATCH 036/197] Disable capslock with udev (#786) * Disable capslock remapper in xremap * Disable capslock with udev with specifying the device names * Don't depend on broken services.udev.extraHwdb --- nixos/hardware.nix | 30 ++++++++++++++++++++++++++++++ nixos/hosts/algae/default.nix | 1 + nixos/hosts/moss/default.nix | 1 + nixos/xremap.nix | 2 +- 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 nixos/hardware.nix diff --git a/nixos/hardware.nix b/nixos/hardware.nix new file mode 100644 index 00000000..0177dfa7 --- /dev/null +++ b/nixos/hardware.nix @@ -0,0 +1,30 @@ +{ ... }: +{ + # services.udev = { + # enable = true; + # # Settings keyremap in raw layer than X. See GH-784 + + # # Specify hardware names even if `evdev:input:*` working for mostcase + # extraHwdb = '' + # evdev:name:Topre REALFORCE 87 US:* + # # original: capslock + # KEYBOARD_KEY_70039=leftctrl + # ''; + # }; + + # Settings keyremap in raw layer than X. See GH-784 + # Don't use `services.udev.extraHwdb`, it does not create the file at least in NixOS 24.05 + # See https://github.com/NixOS/nixpkgs/issues/182966 for detail + # + # - Specify hardware names even if `evdev:input:*` working for mostcase. I should care both US and JIS layout + # - How to get the KEYBOARD_KEY_700??: `showkey --scancodes` in VT + # - How to get the hardware name:: `udevadm info --attribute-walk /dev/input/event?? | grep -F 'ATTRS{name}'` + # - How to apply?: After nixos-rebuild switch `sudo systemd-hwdb update && sudo udevadm trigger` + environment.etc."udev/hwdb.d/99-local.hwdb".text = '' + evdev:name:Topre REALFORCE 87 US:* + KEYBOARD_KEY_70039=leftctrl # original: capslock + + evdev:name:Lenovo ThinkPad Compact USB Keyboard with TrackPoint:* # Both US and JIS have same name + KEYBOARD_KEY_70039=leftctrl # original: capslock, Both US and JIS have same keycode for capslock + ''; +} diff --git a/nixos/hosts/algae/default.nix b/nixos/hosts/algae/default.nix index 16a21745..c2b6ad3f 100644 --- a/nixos/hosts/algae/default.nix +++ b/nixos/hosts/algae/default.nix @@ -6,6 +6,7 @@ imports = [ ../../configuration.nix ../../gui.nix + ../../hardware.nix ./hardware-configuration.nix diff --git a/nixos/hosts/moss/default.nix b/nixos/hosts/moss/default.nix index 68cf0a7c..0e82a97a 100644 --- a/nixos/hosts/moss/default.nix +++ b/nixos/hosts/moss/default.nix @@ -6,6 +6,7 @@ imports = [ ../../configuration.nix ../../gui.nix + ../../hardware.nix ./hardware-configuration.nix ./fingerprint.nix diff --git a/nixos/xremap.nix b/nixos/xremap.nix index 7812216a..3c47785f 100644 --- a/nixos/xremap.nix +++ b/nixos/xremap.nix @@ -23,7 +23,7 @@ { name = "Global"; remap = { - "CapsLock" = "Ctrl_L"; + # "CapsLock" = "Ctrl_L"; # Avoid using xremap to kill capslock for stability. See GH-784 "Alt_L" = { "held" = "Alt_L"; "alone" = "Muhenkan"; From 5bd7927e2e4bef6ea83608f47ffc355aa89a62e7 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 16 Sep 2024 04:00:19 +0900 Subject: [PATCH 037/197] Set laptop specific keyremap with udev https://github.com/kachick/dotfiles/pull/786#discussion_r1760249559 --- nixos/hardware.nix | 7 +++---- nixos/hosts/moss/default.nix | 8 ++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/nixos/hardware.nix b/nixos/hardware.nix index 0177dfa7..b8bffe2b 100644 --- a/nixos/hardware.nix +++ b/nixos/hardware.nix @@ -13,14 +13,13 @@ # }; # Settings keyremap in raw layer than X. See GH-784 - # Don't use `services.udev.extraHwdb`, it does not create the file at least in NixOS 24.05 - # See https://github.com/NixOS/nixpkgs/issues/182966 for detail + # Use another filename of "99-local.hwdb"", it is preserved for each host # # - Specify hardware names even if `evdev:input:*` working for mostcase. I should care both US and JIS layout - # - How to get the KEYBOARD_KEY_700??: `showkey --scancodes` in VT + # - How to get the KEYBOARD_KEY_700??: `nix run nixpkgs#evtest -- /dev/input/event??` # - How to get the hardware name:: `udevadm info --attribute-walk /dev/input/event?? | grep -F 'ATTRS{name}'` # - How to apply?: After nixos-rebuild switch `sudo systemd-hwdb update && sudo udevadm trigger` - environment.etc."udev/hwdb.d/99-local.hwdb".text = '' + environment.etc."udev/hwdb.d/98-keyboards.hwdb".text = '' evdev:name:Topre REALFORCE 87 US:* KEYBOARD_KEY_70039=leftctrl # original: capslock diff --git a/nixos/hosts/moss/default.nix b/nixos/hosts/moss/default.nix index 0e82a97a..11d8b3e9 100644 --- a/nixos/hosts/moss/default.nix +++ b/nixos/hosts/moss/default.nix @@ -25,4 +25,12 @@ }; services.xserver.videoDrivers = [ "amdgpu" ]; + + # Settings keyremap in raw layer than X. See GH-784 + # Don't use `services.udev.extraHwdb`, it does not create the file at least in NixOS 24.05 + # See https://github.com/NixOS/nixpkgs/issues/182966 for detail + environment.etc."udev/hwdb.d/99-local.hwdb".text = '' + evdev:name:AT Translated Set 2 keyboard:* + KEYBOARD_KEY_3a=leftctrl # original: capslock + ''; } From 89d5b7315f225b99bc42ec1a19d020ea2bf1acf9 Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 00:39:37 +0000 Subject: [PATCH 038/197] flake.lock: Update (#787) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/1355a0cbfeac61d785b7183c0caaec1f97361b43?narHash=sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE%3D' (2024-09-10) → 'github:NixOS/nixpkgs/345c263f2f53a3710abe117f28a5cb86d0ba4059?narHash=sha256-sjiGsMh%2B1cWXb53Tecsm4skyFNag33GPbVgCdfj3n9I%3D' (2024-09-13) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/44a71ff39c182edaf25a7ace5c9454e7cba2c658?narHash=sha256-RVhD9hnlTT2nJzPHlAqrWqCkA7T6CYrP41IoVRkciZM%3D' (2024-09-10) → 'github:NixOS/nixpkgs/8f7492cce28977fbf8bd12c72af08b1f6c7c3e49?narHash=sha256-RuVXUwcYwaUeks6h3OLrEmg14z9aFXdWppTWPMTwdQw%3D' (2024-09-14) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 9382ff98..f1fa6f0d 100644 --- a/flake.lock +++ b/flake.lock @@ -42,11 +42,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1725983898, - "narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=", + "lastModified": 1726243404, + "narHash": "sha256-sjiGsMh+1cWXb53Tecsm4skyFNag33GPbVgCdfj3n9I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43", + "rev": "345c263f2f53a3710abe117f28a5cb86d0ba4059", "type": "github" }, "original": { @@ -387,11 +387,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1725930920, - "narHash": "sha256-RVhD9hnlTT2nJzPHlAqrWqCkA7T6CYrP41IoVRkciZM=", + "lastModified": 1726320982, + "narHash": "sha256-RuVXUwcYwaUeks6h3OLrEmg14z9aFXdWppTWPMTwdQw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "44a71ff39c182edaf25a7ace5c9454e7cba2c658", + "rev": "8f7492cce28977fbf8bd12c72af08b1f6c7c3e49", "type": "github" }, "original": { From 9c5496adac3635ddb3c22e0d97a7df654be4ce1d Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 16 Sep 2024 18:26:57 +0900 Subject: [PATCH 039/197] Extract desktop specific NixOS config (#788) Preparation for GH-527 Part of GH-777 Fixes GH-680 and closes GH-742 --- README.md | 1 - flake.nix | 40 +---- nixos/configuration.nix | 190 +++------------------ nixos/console.nix | 4 - nixos/{ => desktop}/GUI.md | 0 nixos/desktop/default.nix | 299 +++++++++++++++++++++++++++++++++ nixos/{ => desktop}/font.nix | 38 ++--- nixos/{ => desktop}/xremap.nix | 0 nixos/gui.nix | 92 ---------- nixos/hosts/algae/default.nix | 7 +- nixos/hosts/moss/default.nix | 7 +- nixos/language.nix | 36 ---- 12 files changed, 352 insertions(+), 362 deletions(-) rename nixos/{ => desktop}/GUI.md (100%) create mode 100644 nixos/desktop/default.nix rename nixos/{ => desktop}/font.nix (60%) rename nixos/{ => desktop}/xremap.nix (100%) delete mode 100644 nixos/gui.nix delete mode 100644 nixos/language.nix diff --git a/README.md b/README.md index 42aa7135..8462d06d 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,6 @@ nix flake show 'github:kachick/dotfiles' --json | jq '.nixosConfigurations | key Candidates - `user@linux-cli` # Used in container - - `kachick@linux-gui` ### Podman on Ubuntu diff --git a/flake.nix b/flake.nix index c4c07d57..1c3b0ff8 100644 --- a/flake.nix +++ b/flake.nix @@ -148,7 +148,6 @@ nixosConfigurations = let system = "x86_64-linux"; - pkgs = import nixpkgs { inherit system; }; edge-pkgs = import edge-nixpkgs { inherit system; config = { @@ -158,22 +157,6 @@ homemade-pkgs = homemade-packages.${system}; shared = { inherit system; - modules = [ - ./nixos/configuration.nix - home-manager.nixosModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - backupFileExtension = "backup"; - # FIXME: Apply gnome.nix in #680 - users.kachick = import ./home-manager/kachick.nix; - extraSpecialArgs = { - inherit homemade-pkgs edge-pkgs; - }; - }; - } - ]; specialArgs = { inherit inputs @@ -185,15 +168,9 @@ }; in { - "moss" = nixpkgs.lib.nixosSystem ( - shared // { modules = shared.modules ++ [ ./nixos/hosts/moss ]; } - ); - - "algae" = nixpkgs.lib.nixosSystem ( - shared // { modules = shared.modules ++ [ ./nixos/hosts/algae ]; } - ); - - "wsl" = nixpkgs.lib.nixosSystem (shared // { modules = shared.modules ++ [ ./nixos/hosts/wsl ]; }); + "moss" = nixpkgs.lib.nixosSystem (shared // { modules = [ ./nixos/hosts/moss ]; }); + "algae" = nixpkgs.lib.nixosSystem (shared // { modules = [ ./nixos/hosts/algae ]; }); + "wsl" = nixpkgs.lib.nixosSystem (shared // { modules = [ ./nixos/hosts/wsl ]; }); }; homeConfigurations = @@ -223,17 +200,6 @@ }; in { - "kachick@linux-gui" = home-manager.lib.homeManagerConfiguration ( - x86-Linux - // { - modules = [ - ./home-manager/kachick.nix - ./home-manager/systemd.nix - ./home-manager/gnome.nix - ]; - } - ); - "kachick@wsl" = home-manager.lib.homeManagerConfiguration ( x86-Linux // { diff --git a/nixos/configuration.nix b/nixos/configuration.nix index ef99c0e8..154025c1 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -10,24 +10,10 @@ lib, ... }: -let - # https://github.com/NixOS/nixpkgs/issues/309662#issuecomment-2155122284 - zed-fhs = pkgs.buildFHSUserEnv { - name = "zed"; - targetPkgs = pkgs: [ - # version in nixos-24.05 does not enable IME - edge-pkgs.zed-editor - ]; - runScript = "zed"; - meta.mainProgram = "zed"; - }; -in { imports = [ ./modules/cloudflare-warp.nix - (import ./font.nix { inherit pkgs homemade-pkgs; }) (import ./console.nix { inherit homemade-pkgs; }) - (import ./language.nix { inherit config pkgs; }) ]; nix.settings.experimental-features = [ @@ -63,7 +49,7 @@ in }; }; - # Set your time zone. + # TODO: Reconsider to set UTC for servers time.timeZone = "Asia/Tokyo"; # Allow unfree packages @@ -71,17 +57,10 @@ in nixpkgs.config.allowUnfree = true; environment.sessionVariables = { - MOZ_ENABLE_WAYLAND = "1"; SSH_ASKPASS_REQUIRE = "prefer"; - NIXOS_OZONE_WL = "1"; - - # Avoiding hidden or unstable mouse cursors when using Alacritty/Wezterm on Wayland - # - # https://github.com/NixOS/nixpkgs/issues/22652 - # https://github.com/alacritty/alacritty/issues/6703#issuecomment-2222503206 - XCURSOR_THEME = "Adwaita"; }; + # TODO: Reconsider to drop this services.packagekit = { enable = true; }; @@ -91,7 +70,6 @@ in hardware.bluetooth.enable = true; # enables support for Bluetooth hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot - services.blueman.enable = true; # Enable sound with pipewire. sound.enable = true; @@ -116,51 +94,21 @@ in package = edge-pkgs.cloudflare-warp; }; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users = { - kachick = { - isNormalUser = true; - description = "An admin"; - extraGroups = [ - "networkmanager" - "wheel" - "input" # For finger print in GDM - ]; - packages = [ - # Don't install spotify, it does not activate IME and no binary cache with the unfree license. - # Use Web Player or PWA - ]; - }; - }; - environment.variables = { - # Don't set *IM_MODULE in KDE: https://discuss.kde.org/t/kde-plasma-wayland/9014 - # QT_IM_MODULE = "fcitx"; - XMODIFIERS = "@im=fcitx"; - EDITOR = lib.getExe pkgs.helix; SYSTEMD_EDITOR = lib.getExe pkgs.helix; - VISUAL = "${lib.getExe zed-fhs} --wait"; }; # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = - with pkgs; - [ + (with pkgs; [ vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. helix micro - zed-fhs - lapce # IME is not working on Windows, but stable even around IME on Wayland than vscode usbutils # `lsusb` to get IDs - skk-dicts - skktools - - alacritty - wget curl git @@ -172,10 +120,6 @@ in ripgrep dig - # 3rd-party bitwarden helper, because of official cli does not have many core features - # Use latest because of nixos-24.05 distributing version has a crucial bug: https://github.com/quexten/goldwarden/issues/190 - edge-pkgs.goldwarden - # Clipboard # # Don't use clipcat, copyq for wayland problem @@ -184,108 +128,19 @@ in # # So use a clipboard gnome extension - # https://github.com/NixOS/nixpkgs/issues/33282 - xdg-user-dirs - # Use stable packages even for GUI apps, because of using home-manager stable channel - firefox - - # Don't use unstable channel. It frequently backported to stable channel - # - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/applications/networking/instant-messengers/signal-desktop/signal-desktop.nix - (signal-desktop.overrideAttrs (prev: { - preFixup = - prev.preFixup - + '' - gappsWrapperArgs+=( - --add-flags "--enable-features=UseOzonePlatform" - --add-flags "--ozone-platform=wayland" - --add-flags "--enable-wayland-ime" - --add-flags "--disable-features=WaylandFractionalScaleV1" - ) - ''; - })) - podman-tui docker-compose chawan - - gnome.dconf-editor - - # https://github.com/NixOS/nixpkgs/issues/174353 - Super + / runs launcher by default - pop-launcher - - nordic - - ## Unfree packages - - # TODO: Consider using vscodium again - # TODO: Consider to drop the unuseful vscode until fixed the Wayland problems - # Don't use unstable channel. It frequently backported to stable channel - # - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/applications/editors/vscode/vscode.nix - (vscode.override (prev: { - # https://wiki.archlinux.org/title/Wayland#Electron - # https://github.com/NixOS/nixpkgs/blob/3f8b7310913d9e4805b7e20b2beabb27e333b31f/pkgs/applications/editors/vscode/generic.nix#L207-L214 - commandLineArgs = (prev.commandLineArgs or [ ]) ++ [ - "--enable-features=UseOzonePlatform" - "--ozone-platform=wayland" - "--enable-wayland-ime" - # https://github.com/microsoft/vscode/issues/192590#issuecomment-1731312805 - # This bug appeared only when using GNOME, not in KDE - "--disable-features=WaylandFractionalScaleV1" - ]; - })) - - # Don't use unstable channel. It frequently backported to stable channel - # - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/by-name/go/google-chrome/package.nix - # - Actually unstable is/was broken. See GH-776 - # - # if you changed hostname and chrome doesn't run, see https://askubuntu.com/questions/476918/google-chrome-wont-start-after-changing-hostname - # `rm -rf ~/.config/google-chrome/Singleton*` - (google-chrome.override (prev: { - # https://wiki.archlinux.org/title/Chromium#Native_Wayland_support - # Similar as https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/chromium.nix - commandLineArgs = (prev.commandLineArgs or [ ]) ++ [ - "--ozone-platform=wayland" - "--ozone-platform-hint=auto" - "--enable-wayland-ime" - ]; - })) - ] - ++ (with pkgs.gnomeExtensions; [ - appindicator - - # Should be changed from default CSS to another to avoid https://github.com/pop-os/shell/issues/132 - # https://github.com/pop-os/shell/blob/cfa0c55e84b7ce339e5ce83832f76fee17e99d51/light.css#L20-L24 - # Apple same color as nord(Nordic) https://github.com/EliverLara/Nordic/blob/5c53654fb6f3e0266ad8c481a099091e92f28274/gnome-shell/_colors.scss#L14-L15 - (pop-shell.overrideAttrs (prev: { - preFixup = - prev.preFixup - + '' - echo '.pop-shell-search-element:select{ background: #8fbcbb !important; color: #fefefe !important; }' >> $out/share/gnome-shell/extensions/pop-shell@system76.com/light.css - ''; - })) - clipboard-history - kimpanel - just-perfection - dash-to-dock - color-picker - xremap + ]) + ++ (with edge-pkgs; [ + # 3rd-party bitwarden helper, because of official cli does not have many core features + # Use latest because of nixos-24.05 distributing version has a crucial bug: https://github.com/quexten/goldwarden/issues/190 + goldwarden ]); - # https://github.com/NixOS/nixpkgs/issues/33282#issuecomment-523572259 - environment.etc."xdg/user-dirs.defaults".text = '' - DESKTOP=Desktop - DOCUMENTS=Documents - DOWNLOAD=Downloads - MUSIC=Music - PICTURES=Pictures - PUBLICSHARE=Public - TEMPLATES=Templates - VIDEOS=Videos - ''; - # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; @@ -305,16 +160,7 @@ in # Or disable the firewall altogether. # networking.firewall.enable = false; - programs.nix-ld.enable = false; - - # https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/programs/firefox.nix - programs.firefox = { - enable = true; - languagePacks = [ - "en-US" - "ja" - ]; - }; + # programs.nix-ld.enable = false; # Prefer NixOS modules rather than home-manager for easy setting up programs.goldwarden = { @@ -335,4 +181,22 @@ in defaultNetwork.settings.dns_enabled = true; }; }; + + # TODO: Reconsider to set C or EN for servers + # Select internationalisation properties. + i18n = { + defaultLocale = "ja_JP.UTF-8"; + + extraLocaleSettings = { + LC_ADDRESS = "ja_JP.UTF-8"; + LC_IDENTIFICATION = "ja_JP.UTF-8"; + LC_MEASUREMENT = "ja_JP.UTF-8"; + LC_MONETARY = "ja_JP.UTF-8"; + LC_NAME = "ja_JP.UTF-8"; + LC_NUMERIC = "ja_JP.UTF-8"; + LC_PAPER = "ja_JP.UTF-8"; + LC_TELEPHONE = "ja_JP.UTF-8"; + LC_TIME = "ja_JP.UTF-8"; + }; + }; } diff --git a/nixos/console.nix b/nixos/console.nix index 1d97f05c..65aaca61 100644 --- a/nixos/console.nix +++ b/nixos/console.nix @@ -1,7 +1,3 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - { homemade-pkgs, ... }: { # https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/config/console.nix diff --git a/nixos/GUI.md b/nixos/desktop/GUI.md similarity index 100% rename from nixos/GUI.md rename to nixos/desktop/GUI.md diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix new file mode 100644 index 00000000..170595ba --- /dev/null +++ b/nixos/desktop/default.nix @@ -0,0 +1,299 @@ +{ + config, + inputs, + outputs, + pkgs, + edge-pkgs, + homemade-pkgs, + lib, + ... +}: + +let + # https://github.com/NixOS/nixpkgs/issues/309662#issuecomment-2155122284 + zed-fhs = pkgs.buildFHSUserEnv { + name = "zed"; + targetPkgs = pkgs: [ + # version in nixos-24.05 does not enable IME + edge-pkgs.zed-editor + ]; + runScript = "zed"; + meta.mainProgram = "zed"; + }; +in +{ + imports = [ + (import ./font.nix { inherit pkgs homemade-pkgs; }) + inputs.xremap-flake.nixosModules.default + ./xremap.nix + inputs.home-manager.nixosModules.home-manager + ]; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users = { + kachick = { + isNormalUser = true; + description = "An admin"; + extraGroups = [ + "networkmanager" + "wheel" + "input" # For finger print in GDM + ]; + packages = [ + # Don't install spotify, it does not activate IME and no binary cache with the unfree license. + # Use Web Player or PWA + ]; + }; + }; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "backup"; + users.kachick = { + imports = [ + ../../home-manager/kachick.nix + ../../home-manager/systemd.nix + ../../home-manager/gnome.nix + ]; + }; + extraSpecialArgs = { + inherit + inputs + outputs + edge-pkgs + homemade-pkgs + ; + }; + }; + + services.xserver = { + enable = true; + + # Don't use other DM like SDDM, LightDM, lemurs for now. They don't start GNOME for now... (AFAIK) + # And when I was using KDE, GDM only worked, SDDM didn't work + # https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/x11/display-managers/gdm.nix + displayManager.gdm.enable = true; + # https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/x11/display-managers/lightdm.nix + # displayManager.lightdm.enable = false; + + desktopManager.gnome = { + enable = true; + # https://github.com/NixOS/nixpkgs/issues/114514 + extraGSettingsOverridePackages = [ pkgs.gnome.mutter ]; + }; + + # Configure keymap in X11 + xkb = { + layout = "us"; + variant = ""; + }; + }; + + services.udev.packages = with pkgs; [ gnome.gnome-settings-daemon ]; + + programs = { + # https://github.com/nix-community/home-manager/blob/release-24.05/modules/misc/dconf.nix#L39-L42 + dconf.enable = true; + # For lanching with command looks like better than alacritty + gnome-terminal.enable = true; + }; + + environment.gnome.excludePackages = + (with pkgs; [ + gnome-tour + gnome-connections + ]) + ++ (with pkgs.gnome; [ + epiphany # web browser + geary # email reader + evince # document viewer + gnome-calendar + gnome-music # does not support flac by defaults + ]); + + # Enable touchpad support (enabled default in most desktopManager). + services.libinput = { + enable = true; + mouse.naturalScrolling = true; + touchpad.naturalScrolling = true; + }; + + services.dbus.packages = [ config.i18n.inputMethod.package ]; + + services.blueman.enable = true; + + environment.systemPackages = + [ zed-fhs ] + ++ (with pkgs; [ + firefox + + # https://github.com/NixOS/nixpkgs/issues/33282 + xdg-user-dirs + + alacritty + + # TODO: Reconsider to drop this + skk-dicts + skktools + + lapce # IME is not working on Windows, but stable even around IME on Wayland than vscode + + # gnome-music does not support flac. + # tramhao/termusic and tsirysndr/music-player does not figure how to use. + rhythmbox + + # Don't use unstable channel. It frequently backported to stable channel + # - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/applications/networking/instant-messengers/signal-desktop/signal-desktop.nix + (signal-desktop.overrideAttrs (prev: { + preFixup = + prev.preFixup + + '' + gappsWrapperArgs+=( + --add-flags "--enable-features=UseOzonePlatform" + --add-flags "--ozone-platform=wayland" + --add-flags "--enable-wayland-ime" + --add-flags "--disable-features=WaylandFractionalScaleV1" + ) + ''; + })) + + gnome.dconf-editor + + # https://github.com/NixOS/nixpkgs/issues/174353 - Super + / runs launcher by default + pop-launcher + + nordic + + ## Unfree packages + + # TODO: Consider using vscodium again + # TODO: Consider to drop the unuseful vscode until fixed the Wayland problems + # Don't use unstable channel. It frequently backported to stable channel + # - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/applications/editors/vscode/vscode.nix + (vscode.override (prev: { + # https://wiki.archlinux.org/title/Wayland#Electron + # https://github.com/NixOS/nixpkgs/blob/3f8b7310913d9e4805b7e20b2beabb27e333b31f/pkgs/applications/editors/vscode/generic.nix#L207-L214 + commandLineArgs = (prev.commandLineArgs or [ ]) ++ [ + "--enable-features=UseOzonePlatform" + "--ozone-platform=wayland" + "--enable-wayland-ime" + # https://github.com/microsoft/vscode/issues/192590#issuecomment-1731312805 + # This bug appeared only when using GNOME, not in KDE + "--disable-features=WaylandFractionalScaleV1" + ]; + })) + + # Don't use unstable channel. It frequently backported to stable channel + # - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/by-name/go/google-chrome/package.nix + # - Actually unstable is/was broken. See GH-776 + # + # if you changed hostname and chrome doesn't run, see https://askubuntu.com/questions/476918/google-chrome-wont-start-after-changing-hostname + # `rm -rf ~/.config/google-chrome/Singleton*` + (google-chrome.override (prev: { + # https://wiki.archlinux.org/title/Chromium#Native_Wayland_support + # Similar as https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/chromium.nix + commandLineArgs = (prev.commandLineArgs or [ ]) ++ [ + "--ozone-platform=wayland" + "--ozone-platform-hint=auto" + "--enable-wayland-ime" + ]; + })) + ]) + ++ (with pkgs.gnomeExtensions; [ + appindicator + + # Should be changed from default CSS to another to avoid https://github.com/pop-os/shell/issues/132 + # https://github.com/pop-os/shell/blob/cfa0c55e84b7ce339e5ce83832f76fee17e99d51/light.css#L20-L24 + # Apple same color as nord(Nordic) https://github.com/EliverLara/Nordic/blob/5c53654fb6f3e0266ad8c481a099091e92f28274/gnome-shell/_colors.scss#L14-L15 + (pop-shell.overrideAttrs (prev: { + preFixup = + prev.preFixup + + '' + echo '.pop-shell-search-element:select{ background: #8fbcbb !important; color: #fefefe !important; }' >> $out/share/gnome-shell/extensions/pop-shell@system76.com/light.css + ''; + })) + clipboard-history + kimpanel + just-perfection + dash-to-dock + color-picker + xremap + ]); + + # Make it natural scroll on KDE, not enough only in libinput + # https://github.com/NixOS/nixpkgs/issues/51875#issuecomment-846251880 + # environment.etc."X11/xorg.conf.d/30-touchpad.conf".text = '' + # Section "InputClass" + # Identifier "libinput touchpad catchall" + # MatchIsTouchpad "on" + # MatchDevicePath "/dev/input/event*" + # Driver "libinput" + # Option "NaturalScrolling" "on" + # EndSection + # ''; + + # https://askubuntu.com/a/88947 + environment.etc."gdm/PostLogin/Default".source = lib.getExe ( + pkgs.writeShellApplication { + name = "connect_cloudflare-warp"; + runtimeInputs = with edge-pkgs; [ cloudflare-warp ]; + text = '' + warp-cli connect + ''; + } + ); + + environment.variables = { + VISUAL = "${lib.getExe zed-fhs} --wait"; + + # Don't set *IM_MODULE in KDE: https://discuss.kde.org/t/kde-plasma-wayland/9014 + # QT_IM_MODULE = "fcitx"; + XMODIFIERS = "@im=fcitx"; + }; + + environment.sessionVariables = { + MOZ_ENABLE_WAYLAND = "1"; + NIXOS_OZONE_WL = "1"; + + # Avoiding hidden or unstable mouse cursors when using Alacritty/Wezterm on Wayland + # + # https://github.com/NixOS/nixpkgs/issues/22652 + # https://github.com/alacritty/alacritty/issues/6703#issuecomment-2222503206 + XCURSOR_THEME = "Adwaita"; + }; + + # https://github.com/NixOS/nixpkgs/issues/33282#issuecomment-523572259 + environment.etc."xdg/user-dirs.defaults".text = '' + DESKTOP=Desktop + DOCUMENTS=Documents + DOWNLOAD=Downloads + MUSIC=Music + PICTURES=Pictures + PUBLICSHARE=Public + TEMPLATES=Templates + VIDEOS=Videos + ''; + + # https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/programs/firefox.nix + programs.firefox = { + enable = true; + languagePacks = [ + "en-US" + "ja" + ]; + }; + + i18n = { + inputMethod = { + enabled = "fcitx5"; + + fcitx5.addons = [ + pkgs.fcitx5-mozc + pkgs.fcitx5-gtk + ]; + + fcitx5.waylandFrontend = true; + }; + }; +} diff --git a/nixos/font.nix b/nixos/desktop/font.nix similarity index 60% rename from nixos/font.nix rename to nixos/desktop/font.nix index 4b226c3f..6a01ed03 100644 --- a/nixos/font.nix +++ b/nixos/desktop/font.nix @@ -1,7 +1,3 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - { pkgs, homemade-pkgs, ... }: { fonts = { @@ -15,23 +11,27 @@ # ``` fontDir.enable = true; - packages = with pkgs; [ - ibm-plex - plemoljp-nf - inconsolata - mplus-outline-fonts.githubRelease - # sarasa-gothic # Drop this because of the large filesize + packages = + (with pkgs; [ + ibm-plex + plemoljp-nf + inconsolata + mplus-outline-fonts.githubRelease + # sarasa-gothic # Drop this because of the large filesize - # emoji - noto-fonts-color-emoji - homemade-pkgs.beedii - twemoji-color-font + # emoji + noto-fonts-color-emoji + twemoji-color-font - # Source Han family includes many definitions, useful for fallback - source-han-code-jp - source-han-sans-japanese - source-han-serif-japanese - ]; + # Source Han family includes many definitions, useful for fallback + source-han-code-jp + source-han-sans-japanese + source-han-serif-japanese + ]) + ++ [ + # emoji + homemade-pkgs.beedii + ]; # Same as home-manager module? # https://github.com/nix-community/home-manager/issues/605 diff --git a/nixos/xremap.nix b/nixos/desktop/xremap.nix similarity index 100% rename from nixos/xremap.nix rename to nixos/desktop/xremap.nix diff --git a/nixos/gui.nix b/nixos/gui.nix deleted file mode 100644 index 55c2d8da..00000000 --- a/nixos/gui.nix +++ /dev/null @@ -1,92 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - -{ - pkgs, - edge-pkgs, - lib, - ... -}: -{ - services.xserver = { - enable = true; - - # Don't use other DM like SDDM, LightDM, lemurs for now. They don't start GNOME for now... (AFAIK) - # And when I was using KDE, GDM only worked, SDDM didn't work - # https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/x11/display-managers/gdm.nix - displayManager.gdm.enable = true; - # https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/x11/display-managers/lightdm.nix - # displayManager.lightdm.enable = false; - - desktopManager.gnome = { - enable = true; - # https://github.com/NixOS/nixpkgs/issues/114514 - extraGSettingsOverridePackages = [ pkgs.gnome.mutter ]; - }; - - # Configure keymap in X11 - xkb = { - layout = "us"; - variant = ""; - }; - }; - - services.udev.packages = with pkgs; [ gnome.gnome-settings-daemon ]; - - programs = { - # https://github.com/nix-community/home-manager/blob/release-24.05/modules/misc/dconf.nix#L39-L42 - dconf.enable = true; - # For lanching with command looks like better than alacritty - gnome-terminal.enable = true; - }; - - environment.gnome.excludePackages = - (with pkgs; [ - gnome-tour - gnome-connections - ]) - ++ (with pkgs.gnome; [ - epiphany # web browser - geary # email reader - evince # document viewer - gnome-calendar - gnome-music # does not support flac by defaults - ]); - - # Enable touchpad support (enabled default in most desktopManager). - services.libinput = { - enable = true; - mouse.naturalScrolling = true; - touchpad.naturalScrolling = true; - }; - - environment.systemPackages = with pkgs; [ - # gnome-music does not support flac. - # tramhao/termusic and tsirysndr/music-player does not figure how to use. - rhythmbox - ]; - - # Make it natural scroll on KDE, not enough only in libinput - # https://github.com/NixOS/nixpkgs/issues/51875#issuecomment-846251880 - # environment.etc."X11/xorg.conf.d/30-touchpad.conf".text = '' - # Section "InputClass" - # Identifier "libinput touchpad catchall" - # MatchIsTouchpad "on" - # MatchDevicePath "/dev/input/event*" - # Driver "libinput" - # Option "NaturalScrolling" "on" - # EndSection - # ''; - - # https://askubuntu.com/a/88947 - environment.etc."gdm/PostLogin/Default".source = lib.getExe ( - pkgs.writeShellApplication { - name = "connect_cloudflare-warp"; - runtimeInputs = with edge-pkgs; [ cloudflare-warp ]; - text = '' - warp-cli connect - ''; - } - ); -} diff --git a/nixos/hosts/algae/default.nix b/nixos/hosts/algae/default.nix index c2b6ad3f..e8345cf0 100644 --- a/nixos/hosts/algae/default.nix +++ b/nixos/hosts/algae/default.nix @@ -1,17 +1,14 @@ -{ inputs, ... }: +{ ... }: { networking.hostName = "algae"; imports = [ ../../configuration.nix - ../../gui.nix ../../hardware.nix + ../../desktop ./hardware-configuration.nix - - inputs.xremap-flake.nixosModules.default - ../../xremap.nix ]; # Apply better fonts for non X consoles diff --git a/nixos/hosts/moss/default.nix b/nixos/hosts/moss/default.nix index 11d8b3e9..156d2ff5 100644 --- a/nixos/hosts/moss/default.nix +++ b/nixos/hosts/moss/default.nix @@ -1,18 +1,15 @@ -{ inputs, ... }: +{ ... }: { networking.hostName = "moss"; imports = [ ../../configuration.nix - ../../gui.nix ../../hardware.nix + ../../desktop ./hardware-configuration.nix ./fingerprint.nix - - inputs.xremap-flake.nixosModules.default - ../../xremap.nix ]; # Apply better fonts for non X consoles diff --git a/nixos/language.nix b/nixos/language.nix deleted file mode 100644 index 7fe7b9c0..00000000 --- a/nixos/language.nix +++ /dev/null @@ -1,36 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - -{ config, pkgs, ... }: -{ - # Select internationalisation properties. - i18n = { - defaultLocale = "ja_JP.UTF-8"; - - extraLocaleSettings = { - LC_ADDRESS = "ja_JP.UTF-8"; - LC_IDENTIFICATION = "ja_JP.UTF-8"; - LC_MEASUREMENT = "ja_JP.UTF-8"; - LC_MONETARY = "ja_JP.UTF-8"; - LC_NAME = "ja_JP.UTF-8"; - LC_NUMERIC = "ja_JP.UTF-8"; - LC_PAPER = "ja_JP.UTF-8"; - LC_TELEPHONE = "ja_JP.UTF-8"; - LC_TIME = "ja_JP.UTF-8"; - }; - - inputMethod = { - enabled = "fcitx5"; - - fcitx5.addons = [ - pkgs.fcitx5-mozc - pkgs.fcitx5-gtk - ]; - - fcitx5.waylandFrontend = true; - }; - }; - - services.dbus.packages = [ config.i18n.inputMethod.package ]; -} From d1fd8203f90c54a84bff693aa81e01d9396b5e55 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 16 Sep 2024 19:47:46 +0900 Subject: [PATCH 040/197] Install evtest for NixOS desktop --- nixos/desktop/default.nix | 2 ++ nixos/hardware.nix | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 170595ba..b713bfc3 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -143,6 +143,8 @@ in # tramhao/termusic and tsirysndr/music-player does not figure how to use. rhythmbox + evtest # To debug keyremapper as GH-786 + # Don't use unstable channel. It frequently backported to stable channel # - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/applications/networking/instant-messengers/signal-desktop/signal-desktop.nix (signal-desktop.overrideAttrs (prev: { diff --git a/nixos/hardware.nix b/nixos/hardware.nix index b8bffe2b..ef89e01f 100644 --- a/nixos/hardware.nix +++ b/nixos/hardware.nix @@ -16,7 +16,7 @@ # Use another filename of "99-local.hwdb"", it is preserved for each host # # - Specify hardware names even if `evdev:input:*` working for mostcase. I should care both US and JIS layout - # - How to get the KEYBOARD_KEY_700??: `nix run nixpkgs#evtest -- /dev/input/event??` + # - How to get the KEYBOARD_KEY_700??: `evtest /dev/input/event??` # - How to get the hardware name:: `udevadm info --attribute-walk /dev/input/event?? | grep -F 'ATTRS{name}'` # - How to apply?: After nixos-rebuild switch `sudo systemd-hwdb update && sudo udevadm trigger` environment.etc."udev/hwdb.d/98-keyboards.hwdb".text = '' From 504c284db6000fd31f009595f81dde6c7ce278b6 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 16 Sep 2024 20:55:44 +0900 Subject: [PATCH 041/197] Introduce newsflash for the RSS reader client in NixOS (#766) --- nixos/desktop/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index b713bfc3..db7fcb6b 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -145,6 +145,8 @@ in evtest # To debug keyremapper as GH-786 + newsflash # RSS reader # TODO: Manage config (sqlite?) or Backup the exported OPML + # Don't use unstable channel. It frequently backported to stable channel # - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/applications/networking/instant-messengers/signal-desktop/signal-desktop.nix (signal-desktop.overrideAttrs (prev: { From 14b85adaa240f032cedc32eb6e70dd3e6091d690 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 13:33:13 +0000 Subject: [PATCH 042/197] Bump the determinatesystems-actions group with 2 updates (#789) Bumps the determinatesystems-actions group with 2 updates: [DeterminateSystems/nix-installer-action](https://github.com/determinatesystems/nix-installer-action) and [DeterminateSystems/magic-nix-cache-action](https://github.com/determinatesystems/magic-nix-cache-action). Updates `DeterminateSystems/nix-installer-action` from 13 to 14 - [Release notes](https://github.com/determinatesystems/nix-installer-action/releases) - [Commits](https://github.com/determinatesystems/nix-installer-action/compare/v13...v14) Updates `DeterminateSystems/magic-nix-cache-action` from 7 to 8 - [Release notes](https://github.com/determinatesystems/magic-nix-cache-action/releases) - [Commits](https://github.com/determinatesystems/magic-nix-cache-action/compare/v7...v8) --- updated-dependencies: - dependency-name: DeterminateSystems/nix-installer-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: determinatesystems-actions - dependency-name: DeterminateSystems/magic-nix-cache-action dependency-type: direct:production update-type: version-update:semver-major dependency-group: determinatesystems-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci-home.yml | 2 +- .github/workflows/ci-nix.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-home.yml b/.github/workflows/ci-home.yml index 7667f7a1..3185f7df 100644 --- a/.github/workflows/ci-home.yml +++ b/.github/workflows/ci-home.yml @@ -50,7 +50,7 @@ jobs: runs-on: ${{ matrix.os }} steps: # Do not use DeterminateSystems/magic-nix-cache-action for home workflow, it always faced to GitHub rate limit because of home depends on many packages - - uses: DeterminateSystems/nix-installer-action@v13 + - uses: DeterminateSystems/nix-installer-action@v14 - name: Print some dotfiles overviews run: | Date: Mon, 16 Sep 2024 22:56:34 +0900 Subject: [PATCH 043/197] Remove markdownlint-cli2-action to prefer nixpkgs version https://github.com/kachick/dotfiles/pull/790/files#r1761200096 --- .github/workflows/lint.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 350f29ec..607250b8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -39,12 +39,3 @@ jobs: token: ${{ github.token }} version: '0.20.0' # selfup {"extract":"\\d\\.\\d+\\.\\d+","replacer":["stylua", "--version"], "nth": 2} args: --check . - - markdownlint: - timeout-minutes: 15 - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - - uses: DavidAnson/markdownlint-cli2-action@b4c9feab76d8025d1e83c653fa3990936df0e6c8 # v16 - with: - globs: '**/*.md' From b90198d38be39ecd7bd1be8fe9ac59c8d3e481b3 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 17 Sep 2024 04:31:52 +0900 Subject: [PATCH 044/197] Make better preview displays in terminals (#758) * Implement markdown renderer for terminal * Implement preview command for file|mime types * Introduce preview command into walk command * Drop to support KDL for now * Replace renmark with mdcat in preview command to support darwin * I might add poppler in another PR for yazi PDF preview --- flake.nix | 2 ++ home-manager/packages.nix | 4 ++++ pkgs/default.nix | 2 ++ pkgs/preview/default.nix | 25 +++++++++++++++++++++++++ pkgs/preview/preview.bash | 33 +++++++++++++++++++++++++++++++++ pkgs/renmark/default.nix | 14 ++++++++++++++ pkgs/renmark/renmark.bash | 1 + pkgs/walk/default.nix | 11 ++++++----- pkgs/walk/walk.bash | 2 +- 9 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 pkgs/preview/default.nix create mode 100644 pkgs/preview/preview.bash create mode 100644 pkgs/renmark/default.nix create mode 100644 pkgs/renmark/renmark.bash diff --git a/flake.nix b/flake.nix index 1c3b0ff8..e48e764e 100644 --- a/flake.nix +++ b/flake.nix @@ -132,6 +132,8 @@ "nix-hash-url" "trim-github-user-prefix-for-reponame" "gredit" + "renmark" + "preview" ] ) ++ [ diff --git a/home-manager/packages.nix b/home-manager/packages.nix index 4f9b0273..af3a6f3e 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -61,6 +61,7 @@ with pkgs; edge-pkgs.jnv # interactive jq - Use unstable because it is a fresh tool ripgrep # `rg` bat # alt cat + mdcat # pipe friendly markdown viewer rather than glow hexyl # hex viewer dysk # alt df fd # alt find @@ -129,6 +130,7 @@ with pkgs; archive-home-files prs gredit + preview ]) ++ (lib.optionals stdenv.isLinux [ # Fix missing locales as `locale: Cannot set LC_CTYPE to default locale` @@ -146,6 +148,8 @@ with pkgs; # Do not install in dawin yet: https://github.com/NixOS/nixpkgs/blob/b4b293ec6c61e846d69224ea0637411283e2ad39/pkgs/by-name/ch/chawan/package.nix#L82 # Keybindigs: https://git.sr.ht/~bptato/chawan/tree/master/item/res/config.toml chawan # `cha` + + homemade-pkgs.renmark # Depend on chawan ]) ++ (lib.optionals stdenv.isDarwin [ # https://github.com/NixOS/nixpkgs/issues/240819 diff --git a/pkgs/default.nix b/pkgs/default.nix index da2516e8..89aea780 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -70,4 +70,6 @@ gredit = pkgs.callPackage ./gredit { }; git-resolve-conflict = pkgs.callPackage ./git-resolve-conflict { }; + renmark = pkgs.callPackage ./renmark { }; + preview = pkgs.callPackage ./preview { }; } diff --git a/pkgs/preview/default.nix b/pkgs/preview/default.nix new file mode 100644 index 00000000..64548723 --- /dev/null +++ b/pkgs/preview/default.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: +pkgs.writeShellApplication rec { + name = "preview"; + text = builtins.readFile ./${name}.bash; + # TODO: Support KDL highlight + # - bat does not support KDL, however TUI editors with pipe is not to be easy handled + # - Helix does not have readonly mode and the KDL highlighting is not correct + # https://github.com/helix-editor/helix/discussions/9245 + # - micro https://github.com/kachick/micro-kdl + # - vim https://github.com/imsnif/kdl.vim + runtimeInputs = + (with pkgs; [ + file # Detect file/mime type + coreutils # For `basename` + bat # code + hexyl # binary + # libsixel + mdcat # markdown - Avoid renmark to keep compatibility in darwin + ]) + ++ [ + (import ../la { inherit pkgs; }) # directory + ]; + # Especially provided for fzf: https://github.com/junegunn/fzf/issues/2855#issuecomment-1164015794 + meta.description = "Run preview commands that are suitable for the file type"; +} diff --git a/pkgs/preview/preview.bash b/pkgs/preview/preview.bash new file mode 100644 index 00000000..79477ff4 --- /dev/null +++ b/pkgs/preview/preview.bash @@ -0,0 +1,33 @@ +path="$1" +filename=$(basename -- "$path") +extension="${filename##*.}" + +case "$(file --dereference --brief --mime-type "$path")" in +text/html) + cha "$path" + ;; +text/*) + case "$extension" in + md | markdown) + mdcat "$path" + ;; + *) + bat --color=always "$path" + ;; + esac + ;; +inode/directory) + la "$path" + ;; +application/x-executable) + hexyl "$path" + ;; +# image/*) +# # TODO: Support images/PDF after using sixel supported terminals for main. Alacritty isn't +# # https://github.com/alacritty/alacritty/issues/910 +# img2sixel "$path" +# ;; +*) + bat --color=always "$path" + ;; +esac diff --git a/pkgs/renmark/default.nix b/pkgs/renmark/default.nix new file mode 100644 index 00000000..3ec29b71 --- /dev/null +++ b/pkgs/renmark/default.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: +pkgs.writeShellApplication rec { + name = "renmark"; + text = builtins.readFile ./${name}.bash; + # Old candidates + # - glow, pandoc, inlyne, chawan built-in markdown renderer, mdcat, gh-markdown-preview, Lynx, w3m + # + # After several candidates, I think this combination is the best for now. + runtimeInputs = with pkgs; [ + chawan + comrak + ]; + meta.description = "RENder MARkdown in terminal. See GH-740"; +} diff --git a/pkgs/renmark/renmark.bash b/pkgs/renmark/renmark.bash new file mode 100644 index 00000000..5c47e0da --- /dev/null +++ b/pkgs/renmark/renmark.bash @@ -0,0 +1 @@ +comrak "$@" | cha --type 'text/html' diff --git a/pkgs/walk/default.nix b/pkgs/walk/default.nix index 8b71ade8..0a25bbdf 100644 --- a/pkgs/walk/default.nix +++ b/pkgs/walk/default.nix @@ -2,9 +2,10 @@ pkgs.writeShellApplication rec { name = "walk"; text = builtins.readFile ./${name}.bash; - runtimeInputs = with pkgs; [ - fzf - fd - bat - ]; + runtimeInputs = + (with pkgs; [ + fzf + fd + ]) + ++ [ (import ../preview { inherit pkgs; }) ]; } diff --git a/pkgs/walk/walk.bash b/pkgs/walk/walk.bash index aed9be91..21d87e17 100644 --- a/pkgs/walk/walk.bash +++ b/pkgs/walk/walk.bash @@ -10,4 +10,4 @@ fi # shellcheck disable=SC2016 fd --type f --hidden --follow --exclude .git . "$@" | - fzf --query "$query" --preview 'bat --color=always {}' --preview-window '~3' --bind 'enter:become(command "$EDITOR" {})' + fzf --query "$query" --preview 'preview {}' --preview-window '~3' --bind 'enter:become(command "$EDITOR" {})' From ba5f04c7318ae149ccf64d8186549fa1634d883c Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 17 Sep 2024 14:17:09 +0900 Subject: [PATCH 045/197] Add minimum zsh PROMPT as a note for I should start from no rc and starship Faiced in https://github.com/kachick/dotfiles/issues/680#issuecomment-2353820508 --- home-manager/zsh.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix index eaf8ae09..6c503e01 100644 --- a/home-manager/zsh.nix +++ b/home-manager/zsh.nix @@ -27,6 +27,13 @@ # https://github.com/nix-community/home-manager/blob/8c731978f0916b9a904d67a0e53744ceff47882c/modules/programs/zsh.nix#L25C3-L25C10 dotDir = ".config/zsh"; + localVariables = { + # This is a minimum note for home-manager dead case such as https://github.com/kachick/dotfiles/issues/680#issuecomment-2353820508 + PROMPT = '' + %~ %? %# + > ''; + }; + history = { # in memory size = 84000; From 4596ba1009ef667d4848624c78da1b7ae47d82d7 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 17 Sep 2024 14:39:34 +0900 Subject: [PATCH 046/197] Keep simple prompt even if alerting failed exit code Keeping same character is useful for copy-paste the operations and logs Update GH-470 --- config/starship/starship.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/starship/starship.toml b/config/starship/starship.toml index 58a87ed4..eb5a8b1a 100644 --- a/config/starship/starship.toml +++ b/config/starship/starship.toml @@ -23,9 +23,9 @@ $cmd_duration\ $container\ $nix_shell\ $shell\ -$line_break\ $time\ $status\ +$line_break\ $character""" # https://www.reddit.com/r/NixOS/comments/17eb1ym/comment/k62nxo4/?utm_source=reddit&utm_medium=web2x&context=3 @@ -41,7 +41,7 @@ disabled = true [character] success_symbol = "[>](bold green)" -error_symbol = "[!](italic purple)" +error_symbol = "[>](italic purple)" [status] disabled = false From cb4802a5eb1a3225584daa02c5066ca37532a8e1 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 17 Sep 2024 16:26:36 +0900 Subject: [PATCH 047/197] Make highlight with red again for error code --- config/starship/starship.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/starship/starship.toml b/config/starship/starship.toml index eb5a8b1a..568d563f 100644 --- a/config/starship/starship.toml +++ b/config/starship/starship.toml @@ -41,12 +41,12 @@ disabled = true [character] success_symbol = "[>](bold green)" -error_symbol = "[>](italic purple)" +error_symbol = "[>](bold red)" [status] disabled = false # Displays as a part of character module -style = "italic purple" +style = "bold red" format = "[$status]($style)" [git_commit] From 35e886f5e6914bbec65b84f133a1f09c6e08ba0c Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 17 Sep 2024 22:34:31 +0900 Subject: [PATCH 048/197] Make NixOS possible to be VM host (#793) * Install virt-manager on NixOS * Add user settings for virt-manager --- home-manager/gnome.nix | 5 +++++ nixos/desktop/default.nix | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 4bac7e32..4fceca28 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -245,6 +245,11 @@ in "org.gnome.Rhythmbox3.desktop:3" ]; }; + + "org/virt-manager/virt-manager/connections" = { + autoconnect = [ "qemu:///system" ]; + uris = [ "qemu:///system" ]; + }; }; }; } diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index db7fcb6b..63302918 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -38,6 +38,7 @@ in "networkmanager" "wheel" "input" # For finger print in GDM + "libvirtd" # For virt-manager ]; packages = [ # Don't install spotify, it does not activate IME and no binary cache with the unfree license. @@ -92,6 +93,13 @@ in services.udev.packages = with pkgs; [ gnome.gnome-settings-daemon ]; + # https://nixos.wiki/wiki/Virt-manager + # + # Alternative candidates: GNOME Boxes, virtualbox, vnware + # distrobox is a container based solution, not vm. And see https://github.com/89luca89/distrobox/issues/958 + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + programs = { # https://github.com/nix-community/home-manager/blob/release-24.05/modules/misc/dconf.nix#L39-L42 dconf.enable = true; From 02de31a2e309d5e2ad137a7d172ee23f40005718 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 18 Sep 2024 04:28:01 +0900 Subject: [PATCH 049/197] Enable direnv module in starship Now using starship 1.19.0, the feature is released since 1.18.0 https://github.com/starship/starship/commit/cec111affdaf0a52f72c398f8307cf7e19c7dd8d --- config/starship/starship.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config/starship/starship.toml b/config/starship/starship.toml index 568d563f..2fff792f 100644 --- a/config/starship/starship.toml +++ b/config/starship/starship.toml @@ -36,8 +36,7 @@ disabled = false style = "blue" [direnv] -# Do not enable until https://github.com/starship/starship/pull/5657 is released -disabled = true +disabled = false [character] success_symbol = "[>](bold green)" From 29b13292c1b737c8bf6d7e30bda106ce138c3083 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 18 Sep 2024 14:44:54 +0900 Subject: [PATCH 050/197] Replace home-manager NixOS module with standalone version again --- README.md | 18 +++++++++++++++++- flake.nix | 11 +++++++++++ nixos/desktop/default.nix | 21 --------------------- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 8462d06d..dbc40367 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ For example ```bash nix --extra-experimental-features 'nix-command flakes' shell 'github:NixOS/nixpkgs/nixos-24.05#git' \ --command sudo nixos-rebuild switch \ - --flake 'github:kachick/dotfiles#moss' \ + --flake "github:kachick/dotfiles#$(hostname)" \ --show-trace sudo reboot now ``` @@ -49,6 +49,15 @@ List defined hostnames nix flake show 'github:kachick/dotfiles' --json | jq '.nixosConfigurations | keys[]' ``` +This repository intentionally reverts the home-manager NixOS module.\ +So, you should activate the user dotfiles with standalone home-manager even though NixOS. + +```bash +nix run 'github:kachick/dotfiles#home-manager' -- switch -b backup --flake 'github:kachick/dotfiles#kachick@desktop' +``` + +See [GH-680](https://github.com/kachick/dotfiles/issues/680) for background + ## Ubuntu 1. Install [Nix](https://nixos.org/) package manager with [DeterminateSystems/nix-installer](https://github.com/DeterminateSystems/nix-installer) to enable [Flakes](https://nixos.wiki/wiki/Flakes) by default. @@ -162,4 +171,11 @@ If you are developing this repository, the simple reactivation is as follows. makers apply user@linux-cli ``` +For NixOS + +```bash +sudo nixos-rebuild switch --flake ".#$(hostname)" --show-trace && \ + makers apply kachick@desktop +``` + If you encounter any errors in the above steps, Check and update CI and [wiki](https://github.com/kachick/dotfiles/wiki). diff --git a/flake.nix b/flake.nix index e48e764e..e1ec5663 100644 --- a/flake.nix +++ b/flake.nix @@ -202,6 +202,17 @@ }; in { + "kachick@desktop" = home-manager.lib.homeManagerConfiguration ( + x86-Linux + // { + modules = [ + ./home-manager/kachick.nix + ./home-manager/systemd.nix + ./home-manager/gnome.nix + ]; + } + ); + "kachick@wsl" = home-manager.lib.homeManagerConfiguration ( x86-Linux // { diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 63302918..b2a1a522 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -47,27 +47,6 @@ in }; }; - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - backupFileExtension = "backup"; - users.kachick = { - imports = [ - ../../home-manager/kachick.nix - ../../home-manager/systemd.nix - ../../home-manager/gnome.nix - ]; - }; - extraSpecialArgs = { - inherit - inputs - outputs - edge-pkgs - homemade-pkgs - ; - }; - }; - services.xserver = { enable = true; From 7a20d2d5183959ac344133266c43ee2fb8709a4c Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 18 Sep 2024 22:13:20 +0900 Subject: [PATCH 051/197] Install gnome-boxes for easy VM solution Update GH-793 --- nixos/desktop/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index b2a1a522..ff6fe5e8 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -74,7 +74,6 @@ in # https://nixos.wiki/wiki/Virt-manager # - # Alternative candidates: GNOME Boxes, virtualbox, vnware # distrobox is a container based solution, not vm. And see https://github.com/89luca89/distrobox/issues/958 virtualisation.libvirtd.enable = true; programs.virt-manager.enable = true; @@ -150,6 +149,7 @@ in })) gnome.dconf-editor + gnome.gnome-boxes # https://github.com/NixOS/nixpkgs/issues/174353 - Super + / runs launcher by default pop-launcher From 19a65582481fe42f3db6008e6d91e8d3b60dd526 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 19 Sep 2024 02:20:41 +0900 Subject: [PATCH 052/197] Bump all go.mod in the updater script Resolves GH-705 I will test the actual behavior with triggering the workflow after this commit --- .github/workflows/update-flake-lock-and-ci.yml | 2 +- pkgs/bump_gomod/bump_gomod.bash | 9 +++++++-- pkgs/bump_gomod/default.nix | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-flake-lock-and-ci.yml b/.github/workflows/update-flake-lock-and-ci.yml index 52e6e16b..470df733 100644 --- a/.github/workflows/update-flake-lock-and-ci.yml +++ b/.github/workflows/update-flake-lock-and-ci.yml @@ -21,6 +21,6 @@ jobs: pr-title: 'Bump flake.lock and related dependencies' optional-run: | nix run .#bump_completions - nix run .#bump_gomod + nix run .#bump_gomod -- . pkgs/trim-github-user-prefix-for-reponame secrets: APP_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} diff --git a/pkgs/bump_gomod/bump_gomod.bash b/pkgs/bump_gomod/bump_gomod.bash index 5b3c61b6..be4e6ecf 100644 --- a/pkgs/bump_gomod/bump_gomod.bash +++ b/pkgs/bump_gomod/bump_gomod.bash @@ -1,5 +1,10 @@ -go get "go@$(go version | grep -oP '(?<=go)\d\S+')" +# `modRoot` in buildGoModule did not fit for this purpose +# https://github.com/NixOS/nixpkgs/blob/086b448a5d54fd117f4dc2dee55c9f0ff461bdc1/pkgs/build-support/go/module.nix#L12-L13 +for dir in "$@"; do + cd "$dir" || exit + go get "go@$(go version | grep -oP '(?<=go)\d\S+')" +done -git add go.mod go.sum +git ls-files '**go.mod' | xargs git add git update-index -q --really-refresh git diff-index --quiet HEAD || git commit -m 'Update go.mod' go.mod go.sum diff --git a/pkgs/bump_gomod/default.nix b/pkgs/bump_gomod/default.nix index 06ddac5e..934082f6 100644 --- a/pkgs/bump_gomod/default.nix +++ b/pkgs/bump_gomod/default.nix @@ -6,6 +6,7 @@ pkgs.writeShellApplication rec { git go gnugrep + findutils # `xargs` ]; meta = { description = "Update go.mod with method of https://github.com/kachick/times_kachick/issues/265"; From 1fc26abc9fb65519aabb309fa92aeddb54fa22de Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 19 Sep 2024 02:35:24 +0900 Subject: [PATCH 053/197] Fix to handle go.sum https://github.com/kachick/dotfiles/commit/19a65582481fe42f3db6008e6d91e8d3b60dd526#r146889773 --- pkgs/bump_gomod/bump_gomod.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/bump_gomod/bump_gomod.bash b/pkgs/bump_gomod/bump_gomod.bash index be4e6ecf..95482643 100644 --- a/pkgs/bump_gomod/bump_gomod.bash +++ b/pkgs/bump_gomod/bump_gomod.bash @@ -5,6 +5,6 @@ for dir in "$@"; do go get "go@$(go version | grep -oP '(?<=go)\d\S+')" done -git ls-files '**go.mod' | xargs git add +git ls-files '**go.mod' '**go.sum' | xargs git add git update-index -q --really-refresh -git diff-index --quiet HEAD || git commit -m 'Update go.mod' go.mod go.sum +git diff-index --quiet HEAD || git commit -m 'Update go.mod and go.sum' From 637f5a66dfc985aeb9e76ce1449eea7ca09aea83 Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:42:48 +0000 Subject: [PATCH 054/197] Bump flake.lock and related dependencies (#797) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * flake.lock: Update Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/345c263f2f53a3710abe117f28a5cb86d0ba4059?narHash=sha256-sjiGsMh%2B1cWXb53Tecsm4skyFNag33GPbVgCdfj3n9I%3D' (2024-09-13) → 'github:NixOS/nixpkgs/99dc8785f6a0adac95f5e2ab05cc2e1bf666d172?narHash=sha256-gI9kkaH0ZjakJOKrdjaI/VbaMEo9qBbSUl93DnU7f4c%3D' (2024-09-16) • Updated input 'home-manager': 'github:nix-community/home-manager/208df2e558b73b6a1f0faec98493cb59a25f62ba?narHash=sha256-tDgM4d8mLK0Hd6YMB2w1BqMto1XBXADOzPEaLl10VI4%3D' (2024-09-07) → 'github:nix-community/home-manager/2ab00f89dd3ecf8012f5090e6d7ca1a7ea30f594?narHash=sha256-2Y6CDvD/BD43WLS77PHu6dUHbdUfFhuzkY8oJAecD/U%3D' (2024-09-17) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/8f7492cce28977fbf8bd12c72af08b1f6c7c3e49?narHash=sha256-RuVXUwcYwaUeks6h3OLrEmg14z9aFXdWppTWPMTwdQw%3D' (2024-09-14) → 'github:NixOS/nixpkgs/086b448a5d54fd117f4dc2dee55c9f0ff461bdc1?narHash=sha256-2yV8nmYE1p9lfmLHhOCbYwQC/W8WYfGQABoGzJOb1JQ%3D' (2024-09-16) • Updated input 'xremap-flake': 'github:xremap/nix-flake/3717cb0539f4967010ba540baa439a4cf6ea8576?narHash=sha256-3tV6a9Ri6JTapeOQFuBpIjYk%2BR%2BF9RGiaG7Hpz1sTv8%3D' (2024-07-24) → 'github:xremap/nix-flake/4b70d925f2b0a9b805c7935ae7b20a2156139509?narHash=sha256-xXgpTX1R2Mx%2BdWhXs7pupkXz1tgdWyNsGnjt2wsJCLk%3D' (2024-09-16) • Updated input 'xremap-flake/crane': 'github:ipetkov/crane/8a68b987c476a33e90f203f0927614a75c3f47ea?narHash=sha256-a0G1NvyXGzdwgu6e1HQpmK5R5yLsfxeBe07nNDyYd%2Bg%3D' (2024-07-18) → 'github:ipetkov/crane/7e4586bad4e3f8f97a9271def747cf58c4b68f3c?narHash=sha256-PrtLmqhM6UtJP7v7IGyzjBFhbG4eOAHT6LPYOFmYfbk%3D' (2024-09-04) • Removed input 'xremap-flake/crane/nixpkgs' • Updated input 'xremap-flake/devshell': 'github:numtide/devshell/1ebbe68d57457c8cae98145410b164b5477761f4?narHash=sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY%3D' (2024-06-03) → 'github:numtide/devshell/67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae?narHash=sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw%3D' (2024-07-27) • Removed input 'xremap-flake/devshell/flake-utils' • Removed input 'xremap-flake/devshell/flake-utils/systems' • Updated input 'xremap-flake/devshell/nixpkgs': 'github:NixOS/nixpkgs/63143ac2c9186be6d9da6035fa22620018c85932?narHash=sha256-QGua89Pmq%2BFBAro8NriTuoO/wNaUtugt29/qqA8zeeM%3D' (2024-01-02) → 'github:NixOS/nixpkgs/e36e9f57337d0ff0cf77aceb58af4c805472bfae?narHash=sha256-OpX0StkL8vpXyWOGUD6G%2BMA26wAXK6SpT94kLJXo6B4%3D' (2024-07-27) • Updated input 'xremap-flake/flake-parts': 'github:hercules-ci/flake-parts/9227223f6d922fee3c7b190b2cc238a99527bbb7?narHash=sha256-pQMhCCHyQGRzdfAkdJ4cIWiw%2BJNuWsTX7f0ZYSyz0VY%3D' (2024-07-03) → 'github:hercules-ci/flake-parts/bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a?narHash=sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U%3D' (2024-09-12) • Updated input 'xremap-flake/flake-parts/nixpkgs-lib': 'https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz?narHash=sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI%3D' (2024-07-01) → 'https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz?narHash=sha256-Ss8QWLXdr2JCBPcYChJhz4xJm%2Bh/xjl4G0c0XlP6a74%3D' (2024-09-01) • Updated input 'xremap-flake/home-manager': 'github:nix-community/home-manager/afd2021bedff2de92dfce0e257a3d03ae65c603d?narHash=sha256-H548rpPMsn25LDKn1PCFmPxmWlClJJGnvdzImHkqjuY%3D' (2024-07-16) → 'github:nix-community/home-manager/a9c9cc6e50f7cbd2d58ccb1cd46a1e06e9e445ff?narHash=sha256-ChhIrjtdu5d83W%2BYDRH%2BEc5g1MmM0xk6hJnkz15Ot7M%3D' (2024-09-15) • Updated input 'xremap-flake/home-manager/nixpkgs': 'github:NixOS/nixpkgs/00d80d13810dbfea8ab4ed1009b09100cca86ba8?narHash=sha256-H3%2BEC5cYuq%2BgQW8y0lSrrDZfH71LB4DAf%2BTDFyvwCNA%3D' (2024-07-01) → 'github:NixOS/nixpkgs/4f807e8940284ad7925ebd0a0993d2a1791acb2f?narHash=sha256-IiA3jfbR7K/B5%2B9byVi9BZGWTD4VSbWe8VLpp9B/iYk%3D' (2024-09-11) • Updated input 'xremap-flake/hyprland': 'github:hyprwm/Hyprland/f642fb97df5c69267a03452533de383ff8023570?narHash=sha256-NT9adHxZtssgoYPsc1jW0NV2OAZBQoko0qdlLO7wkSg%3D' (2024-07-20) → 'github:hyprwm/Hyprland/9e356562446f44c471ae38a80506a9df039305d6?narHash=sha256-RN7CoPxYtyl%2BPVhMYKOp6o8c/n/NhKI2ILscu7jRwxo%3D' (2024-09-15) • Added input 'xremap-flake/hyprland/aquamarine': 'github:hyprwm/aquamarine/e4a13203112a036fc7f437d391c7810f3dd5ab52?narHash=sha256-/NO/h/qD/eJXAQr/fHA4mdDgYsNT9thHQ%2BoT6KPi2ac%3D' (2024-09-07) • Added input 'xremap-flake/hyprland/aquamarine/hyprutils': follows 'xremap-flake/hyprland/hyprutils' • Added input 'xremap-flake/hyprland/aquamarine/hyprwayland-scanner': follows 'xremap-flake/hyprland/hyprwayland-scanner' • Added input 'xremap-flake/hyprland/aquamarine/nixpkgs': follows 'xremap-flake/hyprland/nixpkgs' • Added input 'xremap-flake/hyprland/aquamarine/systems': follows 'xremap-flake/hyprland/systems' • Updated input 'xremap-flake/hyprland/hyprcursor': 'github:hyprwm/hyprcursor/a5c0d57325c5f0814c39110a70ca19c070ae9486?narHash=sha256-AxRkTJlbB8r7aG6gvc7IaLhc2T9TO4/8uqanKRxukBQ%3D' (2024-07-04) → 'github:hyprwm/hyprcursor/912d56025f03d41b1ad29510c423757b4379eb1c?narHash=sha256-sLADpVgebpCBFXkA1FlCXtvEPu1tdEsTfqK1hfeHySE%3D' (2024-08-02) • Updated input 'xremap-flake/hyprland/hyprlang': 'github:hyprwm/hyprlang/5df0174fd09de4ac5475233d65ffc703e89b82eb?narHash=sha256-lyC/EZdHULsaAKVryK11lgHY9u6pXr7qR4irnxNWC7k%3D' (2024-07-07) → 'github:hyprwm/hyprlang/dfeb5811dd6485490cce18d6cc1e38a055eea876?narHash=sha256-d/rZ/fHR5l1n7PeyLw0StWMNLXVU9c4HFyfskw568so%3D' (2024-09-10) • Updated input 'xremap-flake/hyprland/hyprutils': 'github:hyprwm/hyprutils/eb1ceff2b87f6820789249f63faa8e9dcb54d05f?narHash=sha256-qmC9jGfbE4%2BEIBbbSAkrfR/p49wShjpv4/KztgE/P54%3D' (2024-07-15) → 'github:hyprwm/hyprutils/8976e3f6a5357da953a09511d0c7f6a890fb6ec2?narHash=sha256-WXDgKIbzjYKczxSZOsJplCS1i1yrTUpsDPuJV/xpYLo%3D' (2024-08-29) • Updated input 'xremap-flake/hyprland/hyprwayland-scanner': 'github:hyprwm/hyprwayland-scanner/d5fa094ca27e0039be5e94c0a80ae433145af8bb?narHash=sha256-JPdL%2BQul%2BjEueAn8CARfcWP83eJgwkhMejQYfDvrgvU%3D' (2024-07-05) → 'github:hyprwm/hyprwayland-scanner/a048a6cb015340bd82f97c1f40a4b595ca85cc30?narHash=sha256-SOOqIT27/X792%2BvsLSeFdrNTF%2BOSRp5qXv6Te%2Bfb2Qg%3D' (2024-07-18) • Updated input 'xremap-flake/hyprland/nixpkgs': 'github:NixOS/nixpkgs/693bc46d169f5af9c992095736e82c3488bf7dbb?narHash=sha256-oedh2RwpjEa%2BTNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA%3D' (2024-07-14) → 'github:NixOS/nixpkgs/1355a0cbfeac61d785b7183c0caaec1f97361b43?narHash=sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE%3D' (2024-09-10) • Updated input 'xremap-flake/hyprland/xdph': 'github:hyprwm/xdg-desktop-portal-hyprland/b9b97e5ba23fe7bd5fa4df54696102e8aa863cf6?narHash=sha256-Rizg9efi6ue95zOp0MeIV2ZedNo%2B5U9G2l6yirgBUnA%3D' (2024-07-05) → 'github:hyprwm/xdg-desktop-portal-hyprland/e695669fd8e1d1be9eaae40f35e00f8bd8b64c18?narHash=sha256-6SEsjurq9cdTkITA6d49ncAJe4O/8CgRG5/F//s6Xh8%3D' (2024-09-11) • Updated input 'xremap-flake/hyprland/xdph/hyprland-protocols': 'github:hyprwm/hyprland-protocols/1b61f0093afff20ab44d88ad707aed8bf2215290?narHash=sha256-HUklK5u86w2Yh9dOkk4FdsL8eehcOZ95jPhLixGDRQY%3D' (2024-06-18) → 'github:hyprwm/hyprland-protocols/5a11232266bf1a1f5952d5b179c3f4b2facaaa84?narHash=sha256-zCu4R0CSHEactW9JqYki26gy8h9f6rHmSwj4XJmlHgg%3D' (2024-07-18) • Updated input 'xremap-flake/nixpkgs': 'github:NixOS/nixpkgs/2d65995365a2a6b05db69e344d3b673c8d541bcd?narHash=sha256-VaBqKvCu4iFWPwKFFigdhOfgccLUDEVByb6Wa2Z9i98%3D' (2024-07-20) → 'github:NixOS/nixpkgs/20f9370d5f588fb8c72e844c54511cab054b5f40?narHash=sha256-MWTBH4dd5zIz2iatDb8IkqSjIeFum9jAqkFxgHLdzO4%3D' (2024-09-16) • Updated input 'xremap-flake/treefmt-nix': 'github:numtide/treefmt-nix/888bfb10a9b091d9ed2f5f8064de8d488f7b7c97?narHash=sha256-wNXLQ/ATs1S4Opg1PmuNoJ%2BWamqj93rgZYV3Di7kxkg%3D' (2024-07-20) → 'github:numtide/treefmt-nix/9fb342d14b69aefdf46187f6bb80a4a0d97007cd?narHash=sha256-VcqxWT0O/gMaeWTTjf1r4MOyG49NaNxW4GHTO3xuThE%3D' (2024-09-02) • Updated input 'xremap-flake/treefmt-nix/nixpkgs': 'github:nixos/nixpkgs/2741b4b489b55df32afac57bc4bfd220e8bf617e?narHash=sha256-0xSej1g7eP2kaUF%2BJQp8jdyNmpmCJKRpO12mKl/36Kc%3D' (2024-06-29) → 'github:nixos/nixpkgs/12228ff1752d7b7624a54e9c1af4b222b3c1073b?narHash=sha256-Ym04C5%2BqovuQDYL/rKWSR%2BWESseQBbNAe5DsXNx5trY%3D' (2024-08-31) • Updated input 'xremap-flake/xremap': 'github:k0kubun/xremap/d1b17c4b9958feb5804f317b654ab3936f852c61?narHash=sha256-TZvi5EOZ5Ekg8aGXCAzCcphJ7U5YsPtTWKTUQKZXEsg%3D' (2024-05-20) → 'github:k0kubun/xremap/a9b52ccda117dd65468727787b19fbd8bf2915fd?narHash=sha256-%2BkSb1FV1kJyrxfITSRGJp0ja4icGdNQKkwPdq6rzNps%3D' (2024-09-16) * Update go.mod and go.sum --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 212 +++++++++--------- .../go.mod | 2 +- 2 files changed, 106 insertions(+), 108 deletions(-) diff --git a/flake.lock b/flake.lock index f1fa6f0d..e710b94b 100644 --- a/flake.lock +++ b/flake.lock @@ -1,18 +1,49 @@ { "nodes": { - "crane": { + "aquamarine": { "inputs": { + "hyprutils": [ + "xremap-flake", + "hyprland", + "hyprutils" + ], + "hyprwayland-scanner": [ + "xremap-flake", + "hyprland", + "hyprwayland-scanner" + ], "nixpkgs": [ "xremap-flake", + "hyprland", "nixpkgs" + ], + "systems": [ + "xremap-flake", + "hyprland", + "systems" ] }, "locked": { - "lastModified": 1721322122, - "narHash": "sha256-a0G1NvyXGzdwgu6e1HQpmK5R5yLsfxeBe07nNDyYd+g=", + "lastModified": 1725753098, + "narHash": "sha256-/NO/h/qD/eJXAQr/fHA4mdDgYsNT9thHQ+oT6KPi2ac=", + "owner": "hyprwm", + "repo": "aquamarine", + "rev": "e4a13203112a036fc7f437d391c7810f3dd5ab52", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "aquamarine", + "type": "github" + } + }, + "crane": { + "locked": { + "lastModified": 1725409566, + "narHash": "sha256-PrtLmqhM6UtJP7v7IGyzjBFhbG4eOAHT6LPYOFmYfbk=", "owner": "ipetkov", "repo": "crane", - "rev": "8a68b987c476a33e90f203f0927614a75c3f47ea", + "rev": "7e4586bad4e3f8f97a9271def747cf58c4b68f3c", "type": "github" }, "original": { @@ -23,15 +54,14 @@ }, "devshell": { "inputs": { - "flake-utils": "flake-utils_2", "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1717408969, - "narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=", + "lastModified": 1722113426, + "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", "owner": "numtide", "repo": "devshell", - "rev": "1ebbe68d57457c8cae98145410b164b5477761f4", + "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", "type": "github" }, "original": { @@ -42,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1726243404, - "narHash": "sha256-sjiGsMh+1cWXb53Tecsm4skyFNag33GPbVgCdfj3n9I=", + "lastModified": 1726463316, + "narHash": "sha256-gI9kkaH0ZjakJOKrdjaI/VbaMEo9qBbSUl93DnU7f4c=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "345c263f2f53a3710abe117f28a5cb86d0ba4059", + "rev": "99dc8785f6a0adac95f5e2ab05cc2e1bf666d172", "type": "github" }, "original": { @@ -77,11 +107,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1719994518, - "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", + "lastModified": 1726153070, + "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", + "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", "type": "github" }, "original": { @@ -108,24 +138,6 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -133,11 +145,11 @@ ] }, "locked": { - "lastModified": 1725703823, - "narHash": "sha256-tDgM4d8mLK0Hd6YMB2w1BqMto1XBXADOzPEaLl10VI4=", + "lastModified": 1726592409, + "narHash": "sha256-2Y6CDvD/BD43WLS77PHu6dUHbdUfFhuzkY8oJAecD/U=", "owner": "nix-community", "repo": "home-manager", - "rev": "208df2e558b73b6a1f0faec98493cb59a25f62ba", + "rev": "2ab00f89dd3ecf8012f5090e6d7ca1a7ea30f594", "type": "github" }, "original": { @@ -152,11 +164,11 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1721135958, - "narHash": "sha256-H548rpPMsn25LDKn1PCFmPxmWlClJJGnvdzImHkqjuY=", + "lastModified": 1726440980, + "narHash": "sha256-ChhIrjtdu5d83W+YDRH+Ec5g1MmM0xk6hJnkz15Ot7M=", "owner": "nix-community", "repo": "home-manager", - "rev": "afd2021bedff2de92dfce0e257a3d03ae65c603d", + "rev": "a9c9cc6e50f7cbd2d58ccb1cd46a1e06e9e445ff", "type": "github" }, "original": { @@ -184,11 +196,11 @@ ] }, "locked": { - "lastModified": 1720108799, - "narHash": "sha256-AxRkTJlbB8r7aG6gvc7IaLhc2T9TO4/8uqanKRxukBQ=", + "lastModified": 1722623071, + "narHash": "sha256-sLADpVgebpCBFXkA1FlCXtvEPu1tdEsTfqK1hfeHySE=", "owner": "hyprwm", "repo": "hyprcursor", - "rev": "a5c0d57325c5f0814c39110a70ca19c070ae9486", + "rev": "912d56025f03d41b1ad29510c423757b4379eb1c", "type": "github" }, "original": { @@ -199,20 +211,21 @@ }, "hyprland": { "inputs": { + "aquamarine": "aquamarine", "hyprcursor": "hyprcursor", "hyprlang": "hyprlang", "hyprutils": "hyprutils", "hyprwayland-scanner": "hyprwayland-scanner", "nixpkgs": "nixpkgs_5", - "systems": "systems_3", + "systems": "systems_2", "xdph": "xdph" }, "locked": { - "lastModified": 1721463092, - "narHash": "sha256-NT9adHxZtssgoYPsc1jW0NV2OAZBQoko0qdlLO7wkSg=", + "lastModified": 1726430622, + "narHash": "sha256-RN7CoPxYtyl+PVhMYKOp6o8c/n/NhKI2ILscu7jRwxo=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "f642fb97df5c69267a03452533de383ff8023570", + "rev": "9e356562446f44c471ae38a80506a9df039305d6", "type": "github" }, "original": { @@ -237,11 +250,11 @@ ] }, "locked": { - "lastModified": 1718746314, - "narHash": "sha256-HUklK5u86w2Yh9dOkk4FdsL8eehcOZ95jPhLixGDRQY=", + "lastModified": 1721326555, + "narHash": "sha256-zCu4R0CSHEactW9JqYki26gy8h9f6rHmSwj4XJmlHgg=", "owner": "hyprwm", "repo": "hyprland-protocols", - "rev": "1b61f0093afff20ab44d88ad707aed8bf2215290", + "rev": "5a11232266bf1a1f5952d5b179c3f4b2facaaa84", "type": "github" }, "original": { @@ -269,11 +282,11 @@ ] }, "locked": { - "lastModified": 1720381373, - "narHash": "sha256-lyC/EZdHULsaAKVryK11lgHY9u6pXr7qR4irnxNWC7k=", + "lastModified": 1725997860, + "narHash": "sha256-d/rZ/fHR5l1n7PeyLw0StWMNLXVU9c4HFyfskw568so=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "5df0174fd09de4ac5475233d65ffc703e89b82eb", + "rev": "dfeb5811dd6485490cce18d6cc1e38a055eea876", "type": "github" }, "original": { @@ -296,11 +309,11 @@ ] }, "locked": { - "lastModified": 1721071737, - "narHash": "sha256-qmC9jGfbE4+EIBbbSAkrfR/p49wShjpv4/KztgE/P54=", + "lastModified": 1724966483, + "narHash": "sha256-WXDgKIbzjYKczxSZOsJplCS1i1yrTUpsDPuJV/xpYLo=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "eb1ceff2b87f6820789249f63faa8e9dcb54d05f", + "rev": "8976e3f6a5357da953a09511d0c7f6a890fb6ec2", "type": "github" }, "original": { @@ -323,11 +336,11 @@ ] }, "locked": { - "lastModified": 1720215857, - "narHash": "sha256-JPdL+Qul+jEueAn8CARfcWP83eJgwkhMejQYfDvrgvU=", + "lastModified": 1721324119, + "narHash": "sha256-SOOqIT27/X792+vsLSeFdrNTF+OSRp5qXv6Te+fb2Qg=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "d5fa094ca27e0039be5e94c0a80ae433145af8bb", + "rev": "a048a6cb015340bd82f97c1f40a4b595ca85cc30", "type": "github" }, "original": { @@ -375,23 +388,23 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1719876945, - "narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=", + "lastModified": 1725233747, + "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" } }, "nixpkgs_2": { "locked": { - "lastModified": 1726320982, - "narHash": "sha256-RuVXUwcYwaUeks6h3OLrEmg14z9aFXdWppTWPMTwdQw=", + "lastModified": 1726447378, + "narHash": "sha256-2yV8nmYE1p9lfmLHhOCbYwQC/W8WYfGQABoGzJOb1JQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8f7492cce28977fbf8bd12c72af08b1f6c7c3e49", + "rev": "086b448a5d54fd117f4dc2dee55c9f0ff461bdc1", "type": "github" }, "original": { @@ -403,11 +416,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1704161960, - "narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=", + "lastModified": 1722073938, + "narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "63143ac2c9186be6d9da6035fa22620018c85932", + "rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae", "type": "github" }, "original": { @@ -419,11 +432,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1719848872, - "narHash": "sha256-H3+EC5cYuq+gQW8y0lSrrDZfH71LB4DAf+TDFyvwCNA=", + "lastModified": 1726062873, + "narHash": "sha256-IiA3jfbR7K/B5+9byVi9BZGWTD4VSbWe8VLpp9B/iYk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "00d80d13810dbfea8ab4ed1009b09100cca86ba8", + "rev": "4f807e8940284ad7925ebd0a0993d2a1791acb2f", "type": "github" }, "original": { @@ -435,11 +448,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1720957393, - "narHash": "sha256-oedh2RwpjEa+TNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA=", + "lastModified": 1725983898, + "narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "693bc46d169f5af9c992095736e82c3488bf7dbb", + "rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43", "type": "github" }, "original": { @@ -451,11 +464,11 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1721435672, - "narHash": "sha256-VaBqKvCu4iFWPwKFFigdhOfgccLUDEVByb6Wa2Z9i98=", + "lastModified": 1726481836, + "narHash": "sha256-MWTBH4dd5zIz2iatDb8IkqSjIeFum9jAqkFxgHLdzO4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2d65995365a2a6b05db69e344d3b673c8d541bcd", + "rev": "20f9370d5f588fb8c72e844c54511cab054b5f40", "type": "github" }, "original": { @@ -467,11 +480,11 @@ }, "nixpkgs_7": { "locked": { - "lastModified": 1719690277, - "narHash": "sha256-0xSej1g7eP2kaUF+JQp8jdyNmpmCJKRpO12mKl/36Kc=", + "lastModified": 1725103162, + "narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2741b4b489b55df32afac57bc4bfd220e8bf617e", + "rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b", "type": "github" }, "original": { @@ -506,21 +519,6 @@ } }, "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_3": { "locked": { "lastModified": 1689347949, "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", @@ -540,11 +538,11 @@ "nixpkgs": "nixpkgs_7" }, "locked": { - "lastModified": 1721458737, - "narHash": "sha256-wNXLQ/ATs1S4Opg1PmuNoJ+Wamqj93rgZYV3Di7kxkg=", + "lastModified": 1725271838, + "narHash": "sha256-VcqxWT0O/gMaeWTTjf1r4MOyG49NaNxW4GHTO3xuThE=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "888bfb10a9b091d9ed2f5f8064de8d488f7b7c97", + "rev": "9fb342d14b69aefdf46187f6bb80a4a0d97007cd", "type": "github" }, "original": { @@ -573,11 +571,11 @@ ] }, "locked": { - "lastModified": 1720194466, - "narHash": "sha256-Rizg9efi6ue95zOp0MeIV2ZedNo+5U9G2l6yirgBUnA=", + "lastModified": 1726046979, + "narHash": "sha256-6SEsjurq9cdTkITA6d49ncAJe4O/8CgRG5/F//s6Xh8=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "b9b97e5ba23fe7bd5fa4df54696102e8aa863cf6", + "rev": "e695669fd8e1d1be9eaae40f35e00f8bd8b64c18", "type": "github" }, "original": { @@ -589,16 +587,16 @@ "xremap": { "flake": false, "locked": { - "lastModified": 1716231654, - "narHash": "sha256-TZvi5EOZ5Ekg8aGXCAzCcphJ7U5YsPtTWKTUQKZXEsg=", + "lastModified": 1726457781, + "narHash": "sha256-+kSb1FV1kJyrxfITSRGJp0ja4icGdNQKkwPdq6rzNps=", "owner": "k0kubun", "repo": "xremap", - "rev": "d1b17c4b9958feb5804f317b654ab3936f852c61", + "rev": "a9b52ccda117dd65468727787b19fbd8bf2915fd", "type": "github" }, "original": { "owner": "k0kubun", - "ref": "v0.10.0", + "ref": "v0.10.1", "repo": "xremap", "type": "github" } @@ -615,11 +613,11 @@ "xremap": "xremap" }, "locked": { - "lastModified": 1721842203, - "narHash": "sha256-3tV6a9Ri6JTapeOQFuBpIjYk+R+F9RGiaG7Hpz1sTv8=", + "lastModified": 1726517155, + "narHash": "sha256-xXgpTX1R2Mx+dWhXs7pupkXz1tgdWyNsGnjt2wsJCLk=", "owner": "xremap", "repo": "nix-flake", - "rev": "3717cb0539f4967010ba540baa439a4cf6ea8576", + "rev": "4b70d925f2b0a9b805c7935ae7b20a2156139509", "type": "github" }, "original": { diff --git a/pkgs/trim-github-user-prefix-for-reponame/go.mod b/pkgs/trim-github-user-prefix-for-reponame/go.mod index 5af725fc..376c8704 100644 --- a/pkgs/trim-github-user-prefix-for-reponame/go.mod +++ b/pkgs/trim-github-user-prefix-for-reponame/go.mod @@ -1,3 +1,3 @@ module github.com/kachick/dotfiles/pkgs/trim-github-user-prefix-for-reponame -go 1.22.3 +go 1.22.6 From ebb9eafb956ecef097c03c952a4b1fb67e0081d2 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 19 Sep 2024 04:09:58 +0900 Subject: [PATCH 055/197] Install foot and kitty for fallback terminal When faced GH-799 again, I may use these candidates. And hyprland set kitty as default foot can display sixel --- nixos/desktop/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index ff6fe5e8..85791f9f 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -118,6 +118,8 @@ in xdg-user-dirs alacritty + foot + kitty # TODO: Reconsider to drop this skk-dicts From f7b7a9e8f2736f51cf75d6895578cb9e7edf1c3e Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 19 Sep 2024 04:16:51 +0900 Subject: [PATCH 056/197] Sync fcitx5 config directory rather than each file (#794) * Sync fcitx5 config directory in home-maneger instead of each file * Remove needless quote * Set recursive = true * Revert "Set recursive = true" This reverts commit 6990632c173067f701d2734c130a8d0fc3df7b29. --- home-manager/common.nix | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/home-manager/common.nix b/home-manager/common.nix index fca7ad55..035f5c93 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -166,11 +166,9 @@ home.file.".hushlogin".text = "This file disables daily login message. Not depend on this text."; - xdg.configFile."fcitx5/config" = { - source = ../config/fcitx5/config; - }; - xdg.configFile."fcitx5/profile" = { - source = ../config/fcitx5/profile; + # Should sync with the directory instead of each file. See https://github.com/nix-community/home-manager/issues/3090#issuecomment-1799268943 + xdg.configFile.fcitx5 = { + source = ../config/fcitx5; }; # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/starship.nix From f322787ca58c89d8c4fc5d013fdb41e0e82e747e Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 00:37:51 +0000 Subject: [PATCH 057/197] flake.lock: Update (#800) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'xremap-flake': 'github:xremap/nix-flake/4b70d925f2b0a9b805c7935ae7b20a2156139509?narHash=sha256-xXgpTX1R2Mx%2BdWhXs7pupkXz1tgdWyNsGnjt2wsJCLk%3D' (2024-09-16) → 'github:xremap/nix-flake/2c55335d6509702b0d337b8da697d7048e36123d?narHash=sha256-NBGchlI3%2Bdg3cHAFP%2BPKWlysW3a88y83XKnthLAmDns%3D' (2024-09-18) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index e710b94b..c0828e9d 100644 --- a/flake.lock +++ b/flake.lock @@ -613,11 +613,11 @@ "xremap": "xremap" }, "locked": { - "lastModified": 1726517155, - "narHash": "sha256-xXgpTX1R2Mx+dWhXs7pupkXz1tgdWyNsGnjt2wsJCLk=", + "lastModified": 1726701848, + "narHash": "sha256-NBGchlI3+dg3cHAFP+PKWlysW3a88y83XKnthLAmDns=", "owner": "xremap", "repo": "nix-flake", - "rev": "4b70d925f2b0a9b805c7935ae7b20a2156139509", + "rev": "2c55335d6509702b0d337b8da697d7048e36123d", "type": "github" }, "original": { From 32e205c55d342d96d4fc0c312c73f93f6c7eb0d1 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 20 Sep 2024 21:20:41 +0900 Subject: [PATCH 058/197] Prefer hexyl for binary formats more --- pkgs/preview/preview.bash | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkgs/preview/preview.bash b/pkgs/preview/preview.bash index 79477ff4..8a30d962 100644 --- a/pkgs/preview/preview.bash +++ b/pkgs/preview/preview.bash @@ -2,7 +2,9 @@ path="$1" filename=$(basename -- "$path") extension="${filename##*.}" -case "$(file --dereference --brief --mime-type "$path")" in +IFS='; ' read -r -a mime <<<"$(file --dereference --brief --mime "$path")" + +case "${mime[0]}" in text/html) cha "$path" ;; @@ -28,6 +30,13 @@ application/x-executable) # img2sixel "$path" # ;; *) - bat --color=always "$path" + case "${mime[1]}" in + charset=binary) + hexyl "$path" + ;; + *) + bat --color=always "$path" + ;; + esac ;; esac From 8fd6c124ca02b81fbba3d3e0b7808ea24b0724c2 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 20 Sep 2024 21:31:09 +0900 Subject: [PATCH 059/197] Set pager for hexyl --- pkgs/preview/default.nix | 1 + pkgs/preview/preview.bash | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/preview/default.nix b/pkgs/preview/default.nix index 64548723..134c3f82 100644 --- a/pkgs/preview/default.nix +++ b/pkgs/preview/default.nix @@ -14,6 +14,7 @@ pkgs.writeShellApplication rec { coreutils # For `basename` bat # code hexyl # binary + less # Pager for hexyl. See https://github.com/sharkdp/hexyl/issues/40 # libsixel mdcat # markdown - Avoid renmark to keep compatibility in darwin ]) diff --git a/pkgs/preview/preview.bash b/pkgs/preview/preview.bash index 8a30d962..5f58028e 100644 --- a/pkgs/preview/preview.bash +++ b/pkgs/preview/preview.bash @@ -22,7 +22,7 @@ inode/directory) la "$path" ;; application/x-executable) - hexyl "$path" + hexyl --color=always "$path" | less --RAW-CONTROL-CHARS ;; # image/*) # # TODO: Support images/PDF after using sixel supported terminals for main. Alacritty isn't @@ -32,7 +32,7 @@ application/x-executable) *) case "${mime[1]}" in charset=binary) - hexyl "$path" + hexyl --color=always "$path" | less --RAW-CONTROL-CHARS ;; *) bat --color=always "$path" From e1654cc3ca392bd762daef8cbc1e21730124be9e Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 20 Sep 2024 21:35:00 +0900 Subject: [PATCH 060/197] Print mime-type for fallback patterns --- pkgs/preview/preview.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/preview/preview.bash b/pkgs/preview/preview.bash index 5f58028e..796698af 100644 --- a/pkgs/preview/preview.bash +++ b/pkgs/preview/preview.bash @@ -30,6 +30,8 @@ application/x-executable) # img2sixel "$path" # ;; *) + printf "mime-type: %s\n" "${mime[0]}" + case "${mime[1]}" in charset=binary) hexyl --color=always "$path" | less --RAW-CONTROL-CHARS From 9bd41d150a386f91fc347f2f2357f550fa444694 Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 00:39:37 +0000 Subject: [PATCH 061/197] flake.lock: Update (#803) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/99dc8785f6a0adac95f5e2ab05cc2e1bf666d172?narHash=sha256-gI9kkaH0ZjakJOKrdjaI/VbaMEo9qBbSUl93DnU7f4c%3D' (2024-09-16) → 'github:NixOS/nixpkgs/c04d5652cfa9742b1d519688f65d1bbccea9eb7e?narHash=sha256-PmUr/2GQGvFTIJ6/Tvsins7Q43KTMvMFhvG6oaYK%2BWk%3D' (2024-09-19) • Updated input 'home-manager': 'github:nix-community/home-manager/2ab00f89dd3ecf8012f5090e6d7ca1a7ea30f594?narHash=sha256-2Y6CDvD/BD43WLS77PHu6dUHbdUfFhuzkY8oJAecD/U%3D' (2024-09-17) → 'github:nix-community/home-manager/2f23fa308a7c067e52dfcc30a0758f47043ec176?narHash=sha256-Vl%2BWVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM%3D' (2024-09-22) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/086b448a5d54fd117f4dc2dee55c9f0ff461bdc1?narHash=sha256-2yV8nmYE1p9lfmLHhOCbYwQC/W8WYfGQABoGzJOb1JQ%3D' (2024-09-16) → 'github:NixOS/nixpkgs/944b2aea7f0a2d7c79f72468106bc5510cbf5101?narHash=sha256-NmcVhGElxDbmEWzgXsyAjlRhUus/nEqPC5So7BOJLUM%3D' (2024-09-20) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index c0828e9d..b58bed4b 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1726463316, - "narHash": "sha256-gI9kkaH0ZjakJOKrdjaI/VbaMEo9qBbSUl93DnU7f4c=", + "lastModified": 1726755586, + "narHash": "sha256-PmUr/2GQGvFTIJ6/Tvsins7Q43KTMvMFhvG6oaYK+Wk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "99dc8785f6a0adac95f5e2ab05cc2e1bf666d172", + "rev": "c04d5652cfa9742b1d519688f65d1bbccea9eb7e", "type": "github" }, "original": { @@ -145,11 +145,11 @@ ] }, "locked": { - "lastModified": 1726592409, - "narHash": "sha256-2Y6CDvD/BD43WLS77PHu6dUHbdUfFhuzkY8oJAecD/U=", + "lastModified": 1726989464, + "narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=", "owner": "nix-community", "repo": "home-manager", - "rev": "2ab00f89dd3ecf8012f5090e6d7ca1a7ea30f594", + "rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176", "type": "github" }, "original": { @@ -400,11 +400,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1726447378, - "narHash": "sha256-2yV8nmYE1p9lfmLHhOCbYwQC/W8WYfGQABoGzJOb1JQ=", + "lastModified": 1726838390, + "narHash": "sha256-NmcVhGElxDbmEWzgXsyAjlRhUus/nEqPC5So7BOJLUM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "086b448a5d54fd117f4dc2dee55c9f0ff461bdc1", + "rev": "944b2aea7f0a2d7c79f72468106bc5510cbf5101", "type": "github" }, "original": { From 27914e978f135915737ec1e4b7d95bbbd97ccafc Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 00:41:16 +0000 Subject: [PATCH 062/197] flake.lock: Update (#804) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/c04d5652cfa9742b1d519688f65d1bbccea9eb7e?narHash=sha256-PmUr/2GQGvFTIJ6/Tvsins7Q43KTMvMFhvG6oaYK%2BWk%3D' (2024-09-19) → 'github:NixOS/nixpkgs/9357f4f23713673f310988025d9dc261c20e70c6?narHash=sha256-bvGoiQBvponpZh8ClUcmJ6QnsNKw0EMrCQJARK3bI1c%3D' (2024-09-21) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/944b2aea7f0a2d7c79f72468106bc5510cbf5101?narHash=sha256-NmcVhGElxDbmEWzgXsyAjlRhUus/nEqPC5So7BOJLUM%3D' (2024-09-20) → 'github:NixOS/nixpkgs/babc25a577c3310cce57c72d5bed70f4c3c3843a?narHash=sha256-nPyrcFm6FSk7CxzVW4x2hu62aLDghNcv9dX6DF3dXw8%3D' (2024-09-23) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index b58bed4b..43467ab1 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1726755586, - "narHash": "sha256-PmUr/2GQGvFTIJ6/Tvsins7Q43KTMvMFhvG6oaYK+Wk=", + "lastModified": 1726937504, + "narHash": "sha256-bvGoiQBvponpZh8ClUcmJ6QnsNKw0EMrCQJARK3bI1c=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c04d5652cfa9742b1d519688f65d1bbccea9eb7e", + "rev": "9357f4f23713673f310988025d9dc261c20e70c6", "type": "github" }, "original": { @@ -400,11 +400,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1726838390, - "narHash": "sha256-NmcVhGElxDbmEWzgXsyAjlRhUus/nEqPC5So7BOJLUM=", + "lastModified": 1727129439, + "narHash": "sha256-nPyrcFm6FSk7CxzVW4x2hu62aLDghNcv9dX6DF3dXw8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "944b2aea7f0a2d7c79f72468106bc5510cbf5101", + "rev": "babc25a577c3310cce57c72d5bed70f4c3c3843a", "type": "github" }, "original": { From a57d8b23bcda9225bf6447dea89c5ef2c02a67a6 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 26 Sep 2024 16:53:31 +0900 Subject: [PATCH 063/197] Clarify to run zsh Because of $SHELL is now bash Since GH-452 --- pkgs/p/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/p/default.nix b/pkgs/p/default.nix index 61904020..9d3db13c 100644 --- a/pkgs/p/default.nix +++ b/pkgs/p/default.nix @@ -1,9 +1,12 @@ { pkgs, ... }: pkgs.writeShellApplication { name = "p"; - runtimeInputs = with pkgs; [ nix ]; + runtimeInputs = with pkgs; [ + nix + zsh + ]; text = '' # Needless to trim the default command, nix-shell only runs last command if given multiple. - nix-shell --command "$SHELL" --packages "$@" + nix-shell --command 'zsh' --packages "$@" ''; } From db45272c1d2bcef42c9829b62d1876b371d3fd1f Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 26 Sep 2024 17:07:19 +0900 Subject: [PATCH 064/197] Set nixos-unstable for default channel in p command --- pkgs/p/default.nix | 7 ++----- pkgs/p/p.bash | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 pkgs/p/p.bash diff --git a/pkgs/p/default.nix b/pkgs/p/default.nix index 9d3db13c..be227462 100644 --- a/pkgs/p/default.nix +++ b/pkgs/p/default.nix @@ -1,12 +1,9 @@ { pkgs, ... }: -pkgs.writeShellApplication { +pkgs.writeShellApplication rec { name = "p"; runtimeInputs = with pkgs; [ nix zsh ]; - text = '' - # Needless to trim the default command, nix-shell only runs last command if given multiple. - nix-shell --command 'zsh' --packages "$@" - ''; + text = builtins.readFile ./${name}.bash; } diff --git a/pkgs/p/p.bash b/pkgs/p/p.bash new file mode 100644 index 00000000..40d58b44 --- /dev/null +++ b/pkgs/p/p.bash @@ -0,0 +1,2 @@ +# Needless to trim the default command, nix-shell only runs last command if given multiple. +nix-shell -I nixpkgs="https://github.com/NixOS/nixpkgs/archive/${NIXPKGS_REF:-nixos-unstable}.tar.gz" --command 'zsh' --packages "$@" From d18dd033733378ce4eb80222ae146dc1fc3c6a08 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 26 Sep 2024 17:09:58 +0900 Subject: [PATCH 065/197] Expose p command to be easy testable --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index e1ec5663..d044a212 100644 --- a/flake.nix +++ b/flake.nix @@ -134,6 +134,7 @@ "gredit" "renmark" "preview" + "p" ] ) ++ [ From 9439008a94f69721b545ec7eed61d17cb2913c10 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 26 Sep 2024 17:16:12 +0900 Subject: [PATCH 066/197] Don't run zsh in p command, it hides injected package --- pkgs/p/default.nix | 5 +---- pkgs/p/p.bash | 5 +++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pkgs/p/default.nix b/pkgs/p/default.nix index be227462..9bb77f11 100644 --- a/pkgs/p/default.nix +++ b/pkgs/p/default.nix @@ -1,9 +1,6 @@ { pkgs, ... }: pkgs.writeShellApplication rec { name = "p"; - runtimeInputs = with pkgs; [ - nix - zsh - ]; + runtimeInputs = with pkgs; [ nix ]; text = builtins.readFile ./${name}.bash; } diff --git a/pkgs/p/p.bash b/pkgs/p/p.bash index 40d58b44..b9a38cb4 100644 --- a/pkgs/p/p.bash +++ b/pkgs/p/p.bash @@ -1,2 +1,3 @@ -# Needless to trim the default command, nix-shell only runs last command if given multiple. -nix-shell -I nixpkgs="https://github.com/NixOS/nixpkgs/archive/${NIXPKGS_REF:-nixos-unstable}.tar.gz" --command 'zsh' --packages "$@" +# * Needless to trim the default command, nix-shell only runs last command if given multiple. +# * Don't specify another shell such as zsh, the impure mode prefers rc defined environments. It makes confusions when using different version of same package +nix-shell -I nixpkgs="https://github.com/NixOS/nixpkgs/archive/${NIXPKGS_REF:-nixos-unstable}.tar.gz" --packages "$@" From 19a8c33e0e34056e96c3200837e914001d10cca0 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 27 Sep 2024 17:58:54 +0900 Subject: [PATCH 067/197] Replace nil with nixd to adjust same experience as zed-editor in vscode --- .vscode/settings.json | 7 +------ flake.nix | 4 +--- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index b72633e8..c7a7beec 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,13 +16,8 @@ "[lua]": { "editor.defaultFormatter": "JohnnyMorganz.stylua" }, - "nix.serverPath": "nil", + "nix.serverPath": "nixd", "nix.enableLanguageServer": true, - "nix.serverSettings": { - "nil": { - "formatting": { "command": ["nixfmt"] } - } - }, "gopls": { "build.buildFlags": ["-tags=linux,windows,darwin"] }, diff --git a/flake.nix b/flake.nix index d044a212..bc925c12 100644 --- a/flake.nix +++ b/flake.nix @@ -70,9 +70,6 @@ # https://github.com/NixOS/nix/issues/730#issuecomment-162323824 bashInteractive nixfmt-rfc-style - # TODO: Consider to replace nil with nixd: https://github.com/oxalica/nil/issues/111 - nil # Used in vscode Nix extension - nixd # Used in zed Nix extension nixpkgs-lint-community nix-init nurl @@ -91,6 +88,7 @@ trivy ]) ++ (with edge-pkgs; [ + nixd # Don't use treefmt(treefmt1) that does not have crucial feature to cover hidden files # https://github.com/numtide/treefmt/pull/250 treefmt2 From 251e71123d92b3a21e3b4773dd8c8971edc5afd0 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 27 Sep 2024 18:10:48 +0900 Subject: [PATCH 068/197] Disable incorrect nixd inlay-hints in workspace --- .editorconfig | 2 +- .envrc | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 322bfa4e..36bb8470 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,7 +11,7 @@ insert_final_newline = true [*.md] trim_trailing_whitespace = false -[{Makefile,*.mk,*.go,.gitmodules,*.*sh,.*shrc,*shenv,.bash_*}] +[{Makefile,*.mk,*.go,.gitmodules,*.*sh,.*shrc,*shenv,.bash_*,*.envrc}] indent_style = tab indent_size = 4 diff --git a/.envrc b/.envrc index 8f51a982..23f67b2b 100644 --- a/.envrc +++ b/.envrc @@ -5,3 +5,7 @@ use flake # To avoid absolute path for Nix and typos-lsp in vscode settings TYPOS_LSP_PATH="$(command -v typos-lsp)" export TYPOS_LSP_PATH + +# nixd's version inlay-hints does not correctly undersdtand the nixpkgs version, it should be defined with global channel or absolute path for flake +NIXD_FLAGS='--inlay-hints=false' +export NIXD_FLAGS From dd87af2e97ae8fa5c9bff520b70d3937dfd6f275 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 27 Sep 2024 18:20:35 +0900 Subject: [PATCH 069/197] Globaly disable nixd inlay-hints --- .envrc | 4 ---- home-manager/common.nix | 3 --- home-manager/editors.nix | 11 ++++++++++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.envrc b/.envrc index 23f67b2b..8f51a982 100644 --- a/.envrc +++ b/.envrc @@ -5,7 +5,3 @@ use flake # To avoid absolute path for Nix and typos-lsp in vscode settings TYPOS_LSP_PATH="$(command -v typos-lsp)" export TYPOS_LSP_PATH - -# nixd's version inlay-hints does not correctly undersdtand the nixpkgs version, it should be defined with global channel or absolute path for flake -NIXD_FLAGS='--inlay-hints=false' -export NIXD_FLAGS diff --git a/home-manager/common.nix b/home-manager/common.nix index 035f5c93..6b431506 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -43,9 +43,6 @@ enableNixpkgsReleaseCheck = true; sessionVariables = { - # Do NOT set GIT_EDITOR, it overrides `core.editor` in git config - # https://unix.stackexchange.com/questions/4859/visual-vs-editor-what-s-the-difference - EDITOR = lib.getExe pkgs.helix; PAGER = "less"; # https://github.com/sharkdp/bat/blob/v0.24.0/README.md?plain=1#L201-L219 diff --git a/home-manager/editors.nix b/home-manager/editors.nix index 3e37aecb..4cd97349 100644 --- a/home-manager/editors.nix +++ b/home-manager/editors.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: { # Don't add unfree packages like vscode here for using in containers @@ -9,6 +9,15 @@ ./vim.nix ]; + sessionVariables = { + # Do NOT set GIT_EDITOR, it overrides `core.editor` in git config + # https://unix.stackexchange.com/questions/4859/visual-vs-editor-what-s-the-difference + EDITOR = lib.getExe pkgs.helix; + + # nixd's version inlay-hints does not correctly undersdtand the nixpkgs version, it should be defined with global channel or absolute path for flake + NIXD_FLAGS = "--inlay-hints=false"; + }; + # TODO: Update since merged https://github.com/nix-community/home-manager/pull/5455 xdg.configFile."zed/settings.json".source = ../config/zed/settings.json; From 6de5648a5607a6329efd6cf735a76c33663d7d8d Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 27 Sep 2024 21:32:35 +0900 Subject: [PATCH 070/197] Fix nixd inlay hints versions with actual package --- flake.nix | 3 +++ home-manager/editors.nix | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index bc925c12..74a6fb5e 100644 --- a/flake.nix +++ b/flake.nix @@ -65,6 +65,9 @@ in { default = pkgs.mkShellNoCC { + # Realize nixd pkgs version inlay hints for stable channel instead of latest + NIX_PATH = "nixpkgs=${pkgs.path}"; + buildInputs = (with pkgs; [ # https://github.com/NixOS/nix/issues/730#issuecomment-162323824 diff --git a/home-manager/editors.nix b/home-manager/editors.nix index 4cd97349..eb1fc1fe 100644 --- a/home-manager/editors.nix +++ b/home-manager/editors.nix @@ -13,9 +13,6 @@ # Do NOT set GIT_EDITOR, it overrides `core.editor` in git config # https://unix.stackexchange.com/questions/4859/visual-vs-editor-what-s-the-difference EDITOR = lib.getExe pkgs.helix; - - # nixd's version inlay-hints does not correctly undersdtand the nixpkgs version, it should be defined with global channel or absolute path for flake - NIXD_FLAGS = "--inlay-hints=false"; }; # TODO: Update since merged https://github.com/nix-community/home-manager/pull/5455 From c043fee694e6c3f9f0ff35a552e248ff4e68ee6a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 27 Sep 2024 21:36:18 +0900 Subject: [PATCH 071/197] Prefer nix devshell injection for setting repository only env --- .envrc | 4 ---- flake.nix | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.envrc b/.envrc index 8f51a982..e5eb66d0 100644 --- a/.envrc +++ b/.envrc @@ -1,7 +1,3 @@ #!/usr/bin/env -S bash use flake - -# To avoid absolute path for Nix and typos-lsp in vscode settings -TYPOS_LSP_PATH="$(command -v typos-lsp)" -export TYPOS_LSP_PATH diff --git a/flake.nix b/flake.nix index 74a6fb5e..40ae944b 100644 --- a/flake.nix +++ b/flake.nix @@ -68,6 +68,8 @@ # Realize nixd pkgs version inlay hints for stable channel instead of latest NIX_PATH = "nixpkgs=${pkgs.path}"; + TYPOS_LSP_PATH = pkgs.lib.getExe pkgs.typos-lsp; + buildInputs = (with pkgs; [ # https://github.com/NixOS/nix/issues/730#issuecomment-162323824 @@ -85,7 +87,6 @@ dprint stylua typos - typos-lsp go_1_22 goreleaser trivy From 58f56f2f0758e22e6434041914b93f1cff377daa Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 28 Sep 2024 03:43:38 +0900 Subject: [PATCH 072/197] Implement nixf-tidy wrapper to check all nix files --- cmd/lint/main.go | 1 + flake.nix | 1 + pkgs/check_nixf/check_nixf.bash | 12 ++++++++++++ pkgs/check_nixf/default.nix | 21 +++++++++++++++++++++ pkgs/default.nix | 1 + 5 files changed, 36 insertions(+) create mode 100644 pkgs/check_nixf/check_nixf.bash create mode 100644 pkgs/check_nixf/default.nix diff --git a/cmd/lint/main.go b/cmd/lint/main.go index 5a4ea24f..3c1ad50c 100644 --- a/cmd/lint/main.go +++ b/cmd/lint/main.go @@ -32,6 +32,7 @@ func main() { if *allFlag { cmds = append(cmds, runner.Cmd{Path: "trivy", Args: []string{"config", "--exit-code", "1", "."}}) + cmds = append(cmds, runner.Cmd{Path: "nix", Args: []string{"run", ".#check_nixf"}}) } cmds.ParallelRun() diff --git a/flake.nix b/flake.nix index 40ae944b..15a58692 100644 --- a/flake.nix +++ b/flake.nix @@ -119,6 +119,7 @@ "bump_completions" "bump_gomod" "check_no_dirty_xz_in_nix_store" + "check_nixf" "bench_shells" "walk" "ir" diff --git a/pkgs/check_nixf/check_nixf.bash b/pkgs/check_nixf/check_nixf.bash new file mode 100644 index 00000000..c8f8358d --- /dev/null +++ b/pkgs/check_nixf/check_nixf.bash @@ -0,0 +1,12 @@ +script="$( + cat <<'EOF' +echo -n "{}: " +git diff --exit-code --quiet <(echo "[]") <(<{} nixf-tidy --pretty-print --variable-lookup) +echo "$?" +EOF +)" + +git ls-files '*.nix' | xargs -I{} bash -c "$script" | grep -Pv ': 0$' + +# "1" means "worked, but empty" in grep +[[ $? -eq 1 ]] diff --git a/pkgs/check_nixf/default.nix b/pkgs/check_nixf/default.nix new file mode 100644 index 00000000..81483aa5 --- /dev/null +++ b/pkgs/check_nixf/default.nix @@ -0,0 +1,21 @@ +{ pkgs, edge-pkgs, ... }: +pkgs.writeShellApplication rec { + name = "check_nixf"; + text = builtins.readFile ./${name}.bash; + runtimeInputs = + with pkgs; + [ + git + findutils # `xargs` + gnugrep + ] + ++ [ edge-pkgs.nixf ]; + # Removing "errexit" for using grep to check empty result. See https://github.com/kachick/times_kachick/issues/278 + bashOptions = [ + "nounset" + "pipefail" + ]; + meta = { + description = "Wrapper for nixf-tidy. See GH-777"; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 89aea780..fcb842b6 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -6,6 +6,7 @@ bump_gomod = import ./bump_gomod { inherit pkgs; }; check_no_dirty_xz_in_nix_store = import ./check_no_dirty_xz_in_nix_store { inherit pkgs; }; + check_nixf = import ./check_nixf { inherit pkgs edge-pkgs; }; safe_quote_backtik = import ./safe_quote_backtik { inherit pkgs; }; From ea93c2125eb9d90903f40df4ea15298b933639a0 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 28 Sep 2024 03:58:41 +0900 Subject: [PATCH 073/197] Fix nixf-tidy alerts --- flake.nix | 3 +-- home-manager/fish.nix | 2 +- home-manager/git.nix | 1 - home-manager/gnome.nix | 8 +------- nixos/configuration.nix | 1 - nixos/desktop/default.nix | 1 - nixos/hosts/algae/hardware-configuration.nix | 1 - nixos/hosts/moss/hardware-configuration.nix | 1 - 8 files changed, 3 insertions(+), 15 deletions(-) diff --git a/flake.nix b/flake.nix index 15a58692..13762cdb 100644 --- a/flake.nix +++ b/flake.nix @@ -23,8 +23,7 @@ nixpkgs, edge-nixpkgs, home-manager, - nixos-wsl, - xremap-flake, + ... }@inputs: let inherit (self) outputs; diff --git a/home-manager/fish.nix b/home-manager/fish.nix index 4609ed72..9a5c7819 100644 --- a/home-manager/fish.nix +++ b/home-manager/fish.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ pkgs, ... }: { services.gpg-agent.enableFishIntegration = true; diff --git a/home-manager/git.nix b/home-manager/git.nix index f5335c9b..503eae4b 100644 --- a/home-manager/git.nix +++ b/home-manager/git.nix @@ -2,7 +2,6 @@ pkgs, homemade-pkgs, lib, - config, ... }: diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 4fceca28..e0b0f127 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -1,10 +1,4 @@ -{ - config, - lib, - pkgs, - edge-pkgs, - ... -}: +{ lib, pkgs, ... }: let spotify-pwa-file = "chrome-pjibgclleladliembfgfagdaldikeohf-Default.desktop"; diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 154025c1..7b40ac9d 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -3,7 +3,6 @@ # and in the NixOS manual (accessible by running ‘nixos-help’). { - config, pkgs, edge-pkgs, homemade-pkgs, diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 85791f9f..ac363027 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -1,7 +1,6 @@ { config, inputs, - outputs, pkgs, edge-pkgs, homemade-pkgs, diff --git a/nixos/hosts/algae/hardware-configuration.nix b/nixos/hosts/algae/hardware-configuration.nix index b88983ad..5b38a3c9 100644 --- a/nixos/hosts/algae/hardware-configuration.nix +++ b/nixos/hosts/algae/hardware-configuration.nix @@ -4,7 +4,6 @@ { config, lib, - pkgs, modulesPath, ... }: diff --git a/nixos/hosts/moss/hardware-configuration.nix b/nixos/hosts/moss/hardware-configuration.nix index 811742f6..0a069fc9 100644 --- a/nixos/hosts/moss/hardware-configuration.nix +++ b/nixos/hosts/moss/hardware-configuration.nix @@ -4,7 +4,6 @@ { config, lib, - pkgs, modulesPath, ... }: From 3f8214e333f4858e3fa176c367f60b9785e810b1 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 28 Sep 2024 04:01:18 +0900 Subject: [PATCH 074/197] Trigger Nix CI even if draft PRs --- .github/workflows/ci-nix.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml index 092ed3f4..f78e7987 100644 --- a/.github/workflows/ci-nix.yml +++ b/.github/workflows/ci-nix.yml @@ -22,7 +22,6 @@ on: jobs: tasks: - if: (github.event_name != 'pull_request') || (!github.event.pull_request.draft) strategy: fail-fast: false matrix: From bcd584796ecdcf647a98b449f111a72cbfbb2539 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 28 Sep 2024 04:18:14 +0900 Subject: [PATCH 075/197] Display nixd inlay hints in zed --- .zed/settings.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.zed/settings.json b/.zed/settings.json index d4b809ee..65928202 100644 --- a/.zed/settings.json +++ b/.zed/settings.json @@ -18,6 +18,9 @@ "command": "nixfmt", "arguments": ["-"] } + }, + "inlay_hints": { + "enabled": true } }, "Go": { From 5cb2b68e8bf5b4e63c7057dcf8c6f8207e338d18 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 28 Sep 2024 04:24:49 +0900 Subject: [PATCH 076/197] Avoid confusing referenced to pkgs and another pkgs in with --- home-manager/packages.nix | 292 +++++++++++++++++++------------------- 1 file changed, 147 insertions(+), 145 deletions(-) diff --git a/home-manager/packages.nix b/home-manager/packages.nix index af3a6f3e..4eabd3ad 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -8,111 +8,153 @@ # Prefer stable pkgs as possible, if you want to use edge pkgs # - Keep zero or tiny config in home-manager layer # - Set `mod-name.package = edge-pkgs.the-one;` -with pkgs; -[ - # Use `bashInteractive`, don't `bash` - https://github.com/NixOS/nixpkgs/issues/29960, https://github.com/NixOS/nix/issues/730 - # bash - # https://github.com/NixOS/nix/issues/730#issuecomment-162323824 - bashInteractive - # readline # needless and using it does not fix bash problems - zsh - fish - starship - direnv - - fzf # History: CTRL+R, Walker: CTRL+T - # https://github.com/junegunn/fzf/blob/d579e335b5aa30e98a2ec046cb782bbb02bc28ad/ADVANCED.md#key-bindings-for-git-objects - # CTRL+O does not open web browser in WSL: https://github.com/kachick/dotfiles/issues/499 - fzf-git-sh # CTRL-G CTRL-{} keybinds for git - # Use same nixpkgs channel as same as fzf - zoxide # Used in alias `z`, alt cd/pushd. popd = `z -`, fzf-mode = `zi` - - # Used in anywhere - coreutils - less # container base image doesn't have less even for ubuntu official - procps # `ps` - - # Use same tools even in macOS - findutils - diffutils - gnugrep - netcat # `nc` - dig # Alt and raw-data oriented nslookup. TODO: Consider another candidate: dug - https://eng-blog.iij.ad.jp/archives/27527 - - git - gh - ghq - - # GPG - gnupg - - # Do not specify vim and the plugins at here, it made collisions from home-manager vim module. - # See following issues - # - https://github.com/kachick/dotfiles/issues/280 - # - https://discourse.nixos.org/t/home-manager-neovim-collision/16963/2 - - micro # alt nano - - tree - eza # alt ls - curl - wget - jq - edge-pkgs.jnv # interactive jq - Use unstable because it is a fresh tool - ripgrep # `rg` - bat # alt cat - mdcat # pipe friendly markdown viewer rather than glow - hexyl # hex viewer - dysk # alt df - fd # alt find - du-dust # `dust`, alt du - procs - btop # alt top - bottom # `btm`, alt top - xh # alt HTTPie - zellij - yazi # prefer the shell wrapper `yy` - - alacritty - - typos - hyperfine - difftastic # `difft` - gnumake - go-task # Installing for enabling shell completion easy - gitleaks - deno - ruby_3_3 - _7zz # `7zz` - 7zip. Command is not 7zip. - - pastel - - rclone - - # How to get the installed font names - # fontconfig by nix: `fc-list : family style` - # darwin: system_profiler SPFontsDataType - fontconfig # `fc-list`, `fc-cache` - - # - Enable special module for Nix OS. - # - Linux package does not contain podman-remote, you should install uidmap with apt and use this podman as actual engine - # https://github.com/NixOS/nixpkgs/blob/194846768975b7ad2c4988bdb82572c00222c0d7/pkgs/applications/virtualization/podman/default.nix#L112-L116 - # - In darwin, this package will be used for podman-remote, you should manually install podman-desktop for the engine - podman - podman-tui - docker-compose - - # `tldr` rust client, tealdeer is another candidate. - tlrc - - fastfetch # active replacement of neofetch - - # Alternative candidates - # - deep-translator - not active - https://github.com/nidhaloff/deep-translator/issues/240 - # - argos-translate - can be closed in offline, but not yet enough accuracy - # - Apertium - does not support Japanese - translate-shell # `echo "$text" | trans en:ja` -] +( + with pkgs; + [ + # Use `bashInteractive`, don't `bash` - https://github.com/NixOS/nixpkgs/issues/29960, https://github.com/NixOS/nix/issues/730 + # bash + # https://github.com/NixOS/nix/issues/730#issuecomment-162323824 + bashInteractive + # readline # needless and using it does not fix bash problems + zsh + fish + starship + direnv + + fzf # History: CTRL+R, Walker: CTRL+T + # https://github.com/junegunn/fzf/blob/d579e335b5aa30e98a2ec046cb782bbb02bc28ad/ADVANCED.md#key-bindings-for-git-objects + # CTRL+O does not open web browser in WSL: https://github.com/kachick/dotfiles/issues/499 + fzf-git-sh # CTRL-G CTRL-{} keybinds for git + # Use same nixpkgs channel as same as fzf + zoxide # Used in alias `z`, alt cd/pushd. popd = `z -`, fzf-mode = `zi` + + # Used in anywhere + coreutils + less # container base image doesn't have less even for ubuntu official + procps # `ps` + + # Use same tools even in macOS + findutils + diffutils + gnugrep + netcat # `nc` + dig # Alt and raw-data oriented nslookup. TODO: Consider another candidate: dug - https://eng-blog.iij.ad.jp/archives/27527 + + git + gh + ghq + + # GPG + gnupg + + # Do not specify vim and the plugins at here, it made collisions from home-manager vim module. + # See following issues + # - https://github.com/kachick/dotfiles/issues/280 + # - https://discourse.nixos.org/t/home-manager-neovim-collision/16963/2 + + micro # alt nano + + tree + eza # alt ls + curl + wget + jq + edge-pkgs.jnv # interactive jq - Use unstable because it is a fresh tool + ripgrep # `rg` + bat # alt cat + mdcat # pipe friendly markdown viewer rather than glow + hexyl # hex viewer + dysk # alt df + fd # alt find + du-dust # `dust`, alt du + procs + btop # alt top + bottom # `btm`, alt top + xh # alt HTTPie + zellij + yazi # prefer the shell wrapper `yy` + + alacritty + + typos + hyperfine + difftastic # `difft` + gnumake + go-task # Installing for enabling shell completion easy + gitleaks + deno + ruby_3_3 + _7zz # `7zz` - 7zip. Command is not 7zip. + + pastel + + rclone + + # How to get the installed font names + # fontconfig by nix: `fc-list : family style` + # darwin: system_profiler SPFontsDataType + fontconfig # `fc-list`, `fc-cache` + + # - Enable special module for Nix OS. + # - Linux package does not contain podman-remote, you should install uidmap with apt and use this podman as actual engine + # https://github.com/NixOS/nixpkgs/blob/194846768975b7ad2c4988bdb82572c00222c0d7/pkgs/applications/virtualization/podman/default.nix#L112-L116 + # - In darwin, this package will be used for podman-remote, you should manually install podman-desktop for the engine + podman + podman-tui + docker-compose + + # `tldr` rust client, tealdeer is another candidate. + tlrc + + fastfetch # active replacement of neofetch + + # Alternative candidates + # - deep-translator - not active - https://github.com/nidhaloff/deep-translator/issues/240 + # - argos-translate - can be closed in offline, but not yet enough accuracy + # - Apertium - does not support Japanese + translate-shell # `echo "$text" | trans en:ja` + ] + ++ (lib.optionals stdenv.isLinux [ + # Fix missing locales as `locale: Cannot set LC_CTYPE to default locale` + glibc + + # https://github.com/nix-community/home-manager/blob/a8f8f48320c64bd4e3a266a850bbfde2c6fe3a04/modules/services/ssh-agent.nix#L37 + openssh + + iputils # `ping` etc + + # https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/iw/iw/package.nix + edge-pkgs.iw # replacement of wireless-tools(iwconfig) + + # Alt w3m + # Do not install in dawin yet: https://github.com/NixOS/nixpkgs/blob/b4b293ec6c61e846d69224ea0637411283e2ad39/pkgs/by-name/ch/chawan/package.nix#L82 + # Keybindigs: https://git.sr.ht/~bptato/chawan/tree/master/item/res/config.toml + chawan # `cha` + + homemade-pkgs.renmark # Depend on chawan + ]) + ++ (lib.optionals stdenv.isDarwin [ + # https://github.com/NixOS/nixpkgs/issues/240819 + pinentry_mac + + # - You can use major Nerd Fonts as `pkgs.nerdfonts.override ...` + # - Should have at least 1 composite font that includes Monospace + Japanese + Nerd fonts, + # because of alacritty does not have the fallback font feature. https://github.com/alacritty/alacritty/issues/957 + # - Keep fewer nerd fonts to reduce disk space + + # You can also use 0 = `Slashed zero style` with enabling `"editor.fontLigatures": "'zero'"` in vscode + # but cannot use it in alacritty https://github.com/alacritty/alacritty/issues/50 + plemoljp-nf + ibm-plex # For sans-serif, use plemoljp for developing + + source-han-code-jp # Includes many definitions, useful for fallback + inconsolata + + # Don't add zed in macOS with nixpkgs + # https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219 + # edge-pkgs.zed-editor + ]) +) ++ (with homemade-pkgs; [ la lat @@ -132,43 +174,3 @@ with pkgs; gredit preview ]) -++ (lib.optionals stdenv.isLinux [ - # Fix missing locales as `locale: Cannot set LC_CTYPE to default locale` - glibc - - # https://github.com/nix-community/home-manager/blob/a8f8f48320c64bd4e3a266a850bbfde2c6fe3a04/modules/services/ssh-agent.nix#L37 - openssh - - iputils # `ping` etc - - # https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/iw/iw/package.nix - edge-pkgs.iw # replacement of wireless-tools(iwconfig) - - # Alt w3m - # Do not install in dawin yet: https://github.com/NixOS/nixpkgs/blob/b4b293ec6c61e846d69224ea0637411283e2ad39/pkgs/by-name/ch/chawan/package.nix#L82 - # Keybindigs: https://git.sr.ht/~bptato/chawan/tree/master/item/res/config.toml - chawan # `cha` - - homemade-pkgs.renmark # Depend on chawan -]) -++ (lib.optionals stdenv.isDarwin [ - # https://github.com/NixOS/nixpkgs/issues/240819 - pinentry_mac - - # - You can use major Nerd Fonts as `pkgs.nerdfonts.override ...` - # - Should have at least 1 composite font that includes Monospace + Japanese + Nerd fonts, - # because of alacritty does not have the fallback font feature. https://github.com/alacritty/alacritty/issues/957 - # - Keep fewer nerd fonts to reduce disk space - - # You can also use 0 = `Slashed zero style` with enabling `"editor.fontLigatures": "'zero'"` in vscode - # but cannot use it in alacritty https://github.com/alacritty/alacritty/issues/50 - plemoljp-nf - ibm-plex # For sans-serif, use plemoljp for developing - - source-han-code-jp # Includes many definitions, useful for fallback - inconsolata - - # Don't add zed in macOS with nixpkgs - # https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219 - # edge-pkgs.zed-editor -]) From 87babdc4735cd23418cb7231fdda58de1ab34085 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 28 Sep 2024 04:33:35 +0900 Subject: [PATCH 077/197] Fix missing parent attrs for home.sessionVariables This is a bug in refactoring --- home-manager/editors.nix | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/home-manager/editors.nix b/home-manager/editors.nix index eb1fc1fe..94b5b16b 100644 --- a/home-manager/editors.nix +++ b/home-manager/editors.nix @@ -9,23 +9,25 @@ ./vim.nix ]; - sessionVariables = { - # Do NOT set GIT_EDITOR, it overrides `core.editor` in git config - # https://unix.stackexchange.com/questions/4859/visual-vs-editor-what-s-the-difference - EDITOR = lib.getExe pkgs.helix; - }; - # TODO: Update since merged https://github.com/nix-community/home-manager/pull/5455 xdg.configFile."zed/settings.json".source = ../config/zed/settings.json; - # Should have `root = true` in the file. - https://github.com/kachick/anylang-template/blob/45d7ef685ac4fd3836c3b32b8ce8fb45e909b771/.editorconfig#L1 - # Intentionally avoided to use https://github.com/nix-community/home-manager/blob/f58889c07efa8e1328fdf93dc1796ec2a5c47f38/modules/misc/editorconfig.nix - home.file.".editorconfig".source = - pkgs.fetchFromGitHub { - owner = "kachick"; - repo = "anylang-template"; - rev = "45d7ef685ac4fd3836c3b32b8ce8fb45e909b771"; - sha256 = "sha256-F8xP4xCIS1ybvRm1xGB2USekGWKKxz0nokpY6gRxKBE="; - } - + "/.editorconfig"; + home = { + sessionVariables = { + # Do NOT set GIT_EDITOR, it overrides `core.editor` in git config + # https://unix.stackexchange.com/questions/4859/visual-vs-editor-what-s-the-difference + EDITOR = lib.getExe pkgs.helix; + }; + + # Should have `root = true` in the file. - https://github.com/kachick/anylang-template/blob/45d7ef685ac4fd3836c3b32b8ce8fb45e909b771/.editorconfig#L1 + # Intentionally avoided to use https://github.com/nix-community/home-manager/blob/f58889c07efa8e1328fdf93dc1796ec2a5c47f38/modules/misc/editorconfig.nix + file.".editorconfig".source = + pkgs.fetchFromGitHub { + owner = "kachick"; + repo = "anylang-template"; + rev = "45d7ef685ac4fd3836c3b32b8ce8fb45e909b771"; + sha256 = "sha256-F8xP4xCIS1ybvRm1xGB2USekGWKKxz0nokpY6gRxKBE="; + } + + "/.editorconfig"; + }; } From b395697b8c9f384fdbfb73a39201792a25eb3d97 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 29 Sep 2024 19:48:41 +0900 Subject: [PATCH 078/197] Set `$PSNativeCommandUseErrorActionPreference = $true` in a workflow that uses pwsh (#806) Fixes GH-617 --- .github/workflows/windows.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index dce02789..89fe388b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -33,9 +33,19 @@ permissions: defaults: run: - shell: pwsh + # To respect exit code and make fail-fast behaviors. See GH-617 + shell: | + pwsh -Command "$PSVersionTable; $PSNativeCommandUseErrorActionPreference = $true; $ErrorActionPreference = 'Stop'; & '{0}'" jobs: + inspect_runner: + runs-on: windows-2022 + steps: + - name: Print some variables which is applied in GH-617 + run: | + $PSVersionTable + $PSNativeCommandUseErrorActionPreference + $ErrorActionPreference # This job has many comment-out tyle note, agree to ugly, but do NOT remove for now. # See #443 for detail. # From 3a046104fda1789583e310dcddb6694badbdef40 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 29 Sep 2024 20:06:36 +0900 Subject: [PATCH 079/197] Fix a typo --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 89fe388b..59a47095 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -46,7 +46,7 @@ jobs: $PSVersionTable $PSNativeCommandUseErrorActionPreference $ErrorActionPreference - # This job has many comment-out tyle note, agree to ugly, but do NOT remove for now. + # This job has many comment-out style note, agree to ugly, but do NOT remove for now. # See #443 for detail. # # Not Terraform :) From c4585eef776a72a9aacd172da9330bb054dfb61a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 30 Sep 2024 04:09:36 +0900 Subject: [PATCH 080/197] Refactor default pwsh in workflow (#807) --- .github/workflows/windows.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 59a47095..fc15cc26 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -34,8 +34,12 @@ permissions: defaults: run: # To respect exit code and make fail-fast behaviors. See GH-617 + # + # NOTE: `pwsh` specifier is defined in below + # - https://github.com/actions/runner/blob/6d7446a45ebc638a842895d5742d6cf9afa3b66d/src/Runner.Worker/Handlers/ScriptHandlerHelpers.cs#L16-L17 + # - https://github.com/actions/runner/blob/6d7446a45ebc638a842895d5742d6cf9afa3b66d/src/Runner.Worker/Handlers/ScriptHandlerHelpers.cs#L60-L65 shell: | - pwsh -Command "$PSVersionTable; $PSNativeCommandUseErrorActionPreference = $true; $ErrorActionPreference = 'Stop'; & '{0}'" + pwsh -command "$PSNativeCommandUseErrorActionPreference = $true; $ErrorActionPreference = 'stop'; . '{0}'" jobs: inspect_runner: From 3f872023f9a8efcca4a62efb2adc9d00eb937451 Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 00:41:04 +0000 Subject: [PATCH 081/197] flake.lock: Update (#808) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/9357f4f23713673f310988025d9dc261c20e70c6?narHash=sha256-bvGoiQBvponpZh8ClUcmJ6QnsNKw0EMrCQJARK3bI1c%3D' (2024-09-21) → 'github:NixOS/nixpkgs/1925c603f17fc89f4c8f6bf6f631a802ad85d784?narHash=sha256-J%2BPeFKSDV%2BpHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI%3D' (2024-09-26) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/babc25a577c3310cce57c72d5bed70f4c3c3843a?narHash=sha256-nPyrcFm6FSk7CxzVW4x2hu62aLDghNcv9dX6DF3dXw8%3D' (2024-09-23) → 'github:NixOS/nixpkgs/fbca5e745367ae7632731639de5c21f29c8744ed?narHash=sha256-40J9tW7Y794J7Uw4GwcAKlMxlX2xISBl6IBigo83ih8%3D' (2024-09-28) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 43467ab1..4c5d3a5a 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1726937504, - "narHash": "sha256-bvGoiQBvponpZh8ClUcmJ6QnsNKw0EMrCQJARK3bI1c=", + "lastModified": 1727348695, + "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9357f4f23713673f310988025d9dc261c20e70c6", + "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784", "type": "github" }, "original": { @@ -400,11 +400,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1727129439, - "narHash": "sha256-nPyrcFm6FSk7CxzVW4x2hu62aLDghNcv9dX6DF3dXw8=", + "lastModified": 1727540905, + "narHash": "sha256-40J9tW7Y794J7Uw4GwcAKlMxlX2xISBl6IBigo83ih8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "babc25a577c3310cce57c72d5bed70f4c3c3843a", + "rev": "fbca5e745367ae7632731639de5c21f29c8744ed", "type": "github" }, "original": { From 1e52db14036a1a288da7c7385c22755ca1d960c1 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 30 Sep 2024 11:59:01 +0900 Subject: [PATCH 082/197] Disable `trimTrailingWhitespaces` in dprint yaml option --- dprint.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dprint.json b/dprint.json index aefa5516..e21e1a05 100644 --- a/dprint.json +++ b/dprint.json @@ -6,7 +6,8 @@ "markdown": { }, "yaml": { - "quotes": "preferSingle" + "quotes": "preferSingle", + "trimTrailingWhitespaces": false }, "toml": { }, From 984d7d40783f96267bf562abf26ca4ffac93d5cc Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 30 Sep 2024 12:05:54 +0900 Subject: [PATCH 083/197] Update yazi alias to follow official recommended https://github.com/yazi-rs/yazi-rs.github.io/commit/29af4e2bfb989282e2da18b772bc4830b301a77a --- home-manager/common.nix | 2 +- pkgs/posix_shared_functions/default.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/home-manager/common.nix b/home-manager/common.nix index 6b431506..d5bef98d 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -174,7 +174,7 @@ }; # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/yazi.nix - # TODO: Use shell integrations for `yy` after release-24.11. 24.05 is using fixed old `ya` + # TODO: Use shell integrations for `y` after release-24.11. 24.05 is using fixed old `ya` programs.yazi = { enable = true; settings = { diff --git a/pkgs/posix_shared_functions/default.nix b/pkgs/posix_shared_functions/default.nix index 52299027..90212dd9 100644 --- a/pkgs/posix_shared_functions/default.nix +++ b/pkgs/posix_shared_functions/default.nix @@ -53,7 +53,7 @@ pkgs.writeText "posix_shared_functions.sh" ( fc -nrl 1 | ${lib.getExe fzf-bind-posix-shell-history-to-git-commit-message} } - yy() { + y() { local tmp="$(${pkgs.coreutils}/bin/mktemp -t "yazi-cwd.XXXXXX")" ${lib.getExe pkgs.yazi} "$@" --cwd-file="$tmp" if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then From a672281959def72d2cc7462c8bd0244eef4917f8 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 1 Oct 2024 12:49:40 +0900 Subject: [PATCH 084/197] Add minimum kitty config --- home-manager/common.nix | 23 ++++------------------- home-manager/terminals.nix | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 19 deletions(-) create mode 100644 home-manager/terminals.nix diff --git a/home-manager/common.nix b/home-manager/common.nix index d5bef98d..8b4e332c 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -16,6 +16,7 @@ ./ssh.nix ./git.nix ./editors.nix + ./terminals.nix ./fzf.nix ./firefox.nix ./linux.nix @@ -116,25 +117,6 @@ # Use same nixpkgs channel as same as fzf }; - # https://nixos.wiki/wiki/Home_Manager - # - Prefer XDG_* - # - If can't write the reason as a comment - - # Do not alias *.nix into `xdg.configFile`, it actually cannot be used because of using many relative dirs - # So you should call `home-manager switch` with `-f ~/repos/dotfiles/USER_NAME.nix` - - xdg.configFile."alacritty/alacritty.toml".source = ../config/alacritty/alacritty-unix.toml; - xdg.configFile."alacritty/unix.toml".source = - if pkgs.stdenv.isDarwin then ../config/alacritty/macos.toml else ../config/alacritty/linux.toml; - xdg.configFile."alacritty/common.toml".source = ../config/alacritty/common.toml; - xdg.configFile."alacritty/themes" = { - source = ../config/alacritty/themes; - recursive = true; - }; - - # Not under "starship/starship.toml" - xdg.configFile."starship.toml".source = ../config/starship/starship.toml; - # No home-manager module exists https://github.com/nix-community/home-manager/issues/2890 # TODO: Automate that needs to call `Install-Module -Name PSFzfHistory` first xdg.configFile."powershell/Microsoft.PowerShell_profile.ps1".source = ../config/powershell/Profile.ps1; @@ -173,6 +155,9 @@ enable = true; }; + # Not under "starship/starship.toml" + xdg.configFile."starship.toml".source = ../config/starship/starship.toml; + # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/yazi.nix # TODO: Use shell integrations for `y` after release-24.11. 24.05 is using fixed old `ya` programs.yazi = { diff --git a/home-manager/terminals.nix b/home-manager/terminals.nix new file mode 100644 index 00000000..387492f5 --- /dev/null +++ b/home-manager/terminals.nix @@ -0,0 +1,38 @@ +{ pkgs, lib, ... }: + +{ + xdg = { + configFile = { + "alacritty/alacritty.toml".source = ../config/alacritty/alacritty-unix.toml; + "alacritty/unix.toml".source = + if pkgs.stdenv.isDarwin then ../config/alacritty/macos.toml else ../config/alacritty/linux.toml; + "alacritty/common.toml".source = ../config/alacritty/common.toml; + "alacritty/themes" = { + source = ../config/alacritty/themes; + recursive = true; + }; + }; + }; + + # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/kitty.nix + programs.kitty = { + enable = true; + theme = "zenwritten_dark"; + settings = { + shell = lib.getExe pkgs.zsh; + cursor_shape = "beam"; + cursor_blink_interval = 0; + copy_on_select = "clipboard"; + tab_bar_edge = "top"; + # tab_bar_style = "separator"; + # tab_separator = " | "; + tab_bar_style = "slant"; + }; + + # Avoiding a home-manager definition bug for rejecting all float. + # https://github.com/nix-community/home-manager/issues/4850 + extraConfig = '' + background_opacity 0.85 + ''; + }; +} From 96c4d9c107fbd583495bc2da8b8c394cc2a9c615 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 1 Oct 2024 19:09:06 +0900 Subject: [PATCH 085/197] Install vscode-langservers-extracted for helix JSON LSP --- home-manager/helix.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/home-manager/helix.nix b/home-manager/helix.nix index 8300de9f..03387101 100644 --- a/home-manager/helix.nix +++ b/home-manager/helix.nix @@ -221,6 +221,9 @@ in # https://github.com/helix-editor/helix/blob/24.03/languages.toml#L1164 lua-language-server + # https://github.com/helix-editor/helix/blob/24.03/languages.toml#L94 + vscode-langservers-extracted + ## Not helpful. Didin't activated? # # https://github.com/helix-editor/helix/blob/24.03/languages.toml#L1202 From 630d8127c1a5189903beef8069e736f87a033f57 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 00:40:26 +0900 Subject: [PATCH 086/197] Avoid to use `buildFHSEnv` for zed-editor to fix ENOSPC error (#810) Revert ae380db3a51dc6569a39c66fa0a847a975cad2ad to fix GH-809 Simply disables JSON/JSONC/YAML LSP to suppress noisy message `checking for updates to json language server`. TOML LSP does not make problems for now Several added config about JSON LSP is not working. Added for daily testing. --- config/zed/settings.json | 27 +++++++++++++++++++++++++++ home-manager/helix.nix | 2 +- nixos/desktop/default.nix | 22 ++++++++-------------- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/config/zed/settings.json b/config/zed/settings.json index 5727407a..afcea14f 100644 --- a/config/zed/settings.json +++ b/config/zed/settings.json @@ -20,6 +20,33 @@ "tabs": { "file_icons": true }, + "lsp": { + "vscode-json-language-server": { + "binary": { + "path": "/run/current-system/sw/bin/vscode-json-language-server", + "arguments": ["--stdio"] + } + }, + "json-language-server": { + "binary": { + "path": "/run/current-system/sw/bin/vscode-json-language-server", + "arguments": ["--stdio"] + } + } + }, + "languages": { + "JSON": { + // "enable_language_server": false, // Didn't disable with this option + "language_servers": ["vscode-json-language-server", "!json-language-server"] + }, + "JSONC": { + // "enable_language_server": false, // Didn't disable with this option + "language_servers": ["vscode-json-language-server", "!json-language-server"] + }, + "YAML": { + "enable_language_server": false + } + }, "auto_install_extensions": { "nix": true, "toml": true, diff --git a/home-manager/helix.nix b/home-manager/helix.nix index 03387101..9aaad716 100644 --- a/home-manager/helix.nix +++ b/home-manager/helix.nix @@ -224,7 +224,7 @@ in # https://github.com/helix-editor/helix/blob/24.03/languages.toml#L94 vscode-langservers-extracted - ## Not helpful. Didin't activated? + ## Not helpful. Didn't activated? # # https://github.com/helix-editor/helix/blob/24.03/languages.toml#L1202 # nodePackages.yaml-language-server diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index ac363027..d1f77b8d 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -8,18 +8,6 @@ ... }: -let - # https://github.com/NixOS/nixpkgs/issues/309662#issuecomment-2155122284 - zed-fhs = pkgs.buildFHSUserEnv { - name = "zed"; - targetPkgs = pkgs: [ - # version in nixos-24.05 does not enable IME - edge-pkgs.zed-editor - ]; - runScript = "zed"; - meta.mainProgram = "zed"; - }; -in { imports = [ (import ./font.nix { inherit pkgs homemade-pkgs; }) @@ -109,7 +97,11 @@ in services.blueman.enable = true; environment.systemPackages = - [ zed-fhs ] + [ + # version in nixos-24.05 does not enable IME + # Don't use `buildFHSEnv` even through want to apply LSP smart. See GH-809 + edge-pkgs.zed-editor + ] ++ (with pkgs; [ firefox @@ -126,6 +118,8 @@ in lapce # IME is not working on Windows, but stable even around IME on Wayland than vscode + vscode-langservers-extracted + # gnome-music does not support flac. # tramhao/termusic and tsirysndr/music-player does not figure how to use. rhythmbox @@ -237,7 +231,7 @@ in ); environment.variables = { - VISUAL = "${lib.getExe zed-fhs} --wait"; + VISUAL = "${lib.getExe edge-pkgs.zed-editor} --wait"; # Don't set *IM_MODULE in KDE: https://discuss.kde.org/t/kde-plasma-wayland/9014 # QT_IM_MODULE = "fcitx"; From 9b0963d93452b0aef397389be67116ab3c9130c6 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 00:50:12 +0900 Subject: [PATCH 087/197] Alias zeditor with zed for original shorter CLI of zed-editor again --- flake.nix | 1 + nixos/desktop/default.nix | 4 ++-- pkgs/default.nix | 2 ++ pkgs/zed-editor/default.nix | 7 +++++++ pkgs/zed-editor/zed-editor.bash | 1 + 5 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 pkgs/zed-editor/default.nix create mode 100644 pkgs/zed-editor/zed-editor.bash diff --git a/flake.nix b/flake.nix index 13762cdb..fd79ce37 100644 --- a/flake.nix +++ b/flake.nix @@ -125,6 +125,7 @@ "todo" "la" "lat" + "zed-editor" "ghqf" "git-delete-merged-branches" "git-log-fzf" diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index d1f77b8d..d598299e 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -100,7 +100,7 @@ [ # version in nixos-24.05 does not enable IME # Don't use `buildFHSEnv` even through want to apply LSP smart. See GH-809 - edge-pkgs.zed-editor + homemade-pkgs.zed-editor ] ++ (with pkgs; [ firefox @@ -231,7 +231,7 @@ ); environment.variables = { - VISUAL = "${lib.getExe edge-pkgs.zed-editor} --wait"; + VISUAL = "${lib.getExe homemade-pkgs.zed-editor} --wait"; # Don't set *IM_MODULE in KDE: https://discuss.kde.org/t/kde-plasma-wayland/9014 # QT_IM_MODULE = "fcitx"; diff --git a/pkgs/default.nix b/pkgs/default.nix index fcb842b6..3f57afb7 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -18,6 +18,8 @@ lat = import ./lat { inherit pkgs; }; + zed-editor = import ./zed-editor { inherit pkgs edge-pkgs; }; + walk = import ./walk { inherit pkgs; }; ir = pkgs.callPackage ./ir { }; diff --git a/pkgs/zed-editor/default.nix b/pkgs/zed-editor/default.nix new file mode 100644 index 00000000..1e3f4fb8 --- /dev/null +++ b/pkgs/zed-editor/default.nix @@ -0,0 +1,7 @@ +{ pkgs, edge-pkgs, ... }: +pkgs.writeShellApplication rec { + name = "zed-editor"; + text = builtins.readFile ./${name}.bash; + runtimeInputs = [ edge-pkgs.zed-editor ]; + meta.description = "Make shorter command again even through applied https://github.com/NixOS/nixpkgs/pull/344193"; +} diff --git a/pkgs/zed-editor/zed-editor.bash b/pkgs/zed-editor/zed-editor.bash new file mode 100644 index 00000000..f42bc11c --- /dev/null +++ b/pkgs/zed-editor/zed-editor.bash @@ -0,0 +1 @@ +zeditor "$@" From 846d7efcbdc3547084cb9ab3ae95b79e8409642f Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 01:00:22 +0900 Subject: [PATCH 088/197] Adjust terminal behavior in zed-editor --- config/zed/settings.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/zed/settings.json b/config/zed/settings.json index afcea14f..16bdafcf 100644 --- a/config/zed/settings.json +++ b/config/zed/settings.json @@ -47,6 +47,14 @@ "enable_language_server": false } }, + "terminal": { + "shell": { + "program": "zsh" + }, + "copy_on_select": true // Looks not working. + // TODO: Track https://github.com/zed-industries/zed/issues/18507 + // "cursor_shape": "bar" + }, "auto_install_extensions": { "nix": true, "toml": true, From 41e24b25ea1dc1de5df031067dc48e75ac0f7132 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 01:09:35 +0900 Subject: [PATCH 089/197] Fix alias for zed --- flake.nix | 2 +- nixos/desktop/default.nix | 6 ++++-- pkgs/default.nix | 2 +- pkgs/{zed-editor => zed}/default.nix | 2 +- pkgs/{zed-editor/zed-editor.bash => zed/zed.bash} | 0 5 files changed, 7 insertions(+), 5 deletions(-) rename pkgs/{zed-editor => zed}/default.nix (78%) rename pkgs/{zed-editor/zed-editor.bash => zed/zed.bash} (100%) diff --git a/flake.nix b/flake.nix index fd79ce37..d3f66c15 100644 --- a/flake.nix +++ b/flake.nix @@ -125,7 +125,7 @@ "todo" "la" "lat" - "zed-editor" + "zed" "ghqf" "git-delete-merged-branches" "git-log-fzf" diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index d598299e..3babb099 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -100,7 +100,9 @@ [ # version in nixos-24.05 does not enable IME # Don't use `buildFHSEnv` even through want to apply LSP smart. See GH-809 - homemade-pkgs.zed-editor + edge-pkgs.zed-editor + # Adding for zed instead of zeditor since https://github.com/NixOS/nixpkgs/pull/344193. Also keep original zed-editor package here to add icons for GUI + homemade-pkgs.zed ] ++ (with pkgs; [ firefox @@ -231,7 +233,7 @@ ); environment.variables = { - VISUAL = "${lib.getExe homemade-pkgs.zed-editor} --wait"; + VISUAL = "${lib.getExe edge-pkgs.zed-editor} --wait"; # Don't set *IM_MODULE in KDE: https://discuss.kde.org/t/kde-plasma-wayland/9014 # QT_IM_MODULE = "fcitx"; diff --git a/pkgs/default.nix b/pkgs/default.nix index 3f57afb7..3a33f1a3 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -18,7 +18,7 @@ lat = import ./lat { inherit pkgs; }; - zed-editor = import ./zed-editor { inherit pkgs edge-pkgs; }; + zed = import ./zed { inherit pkgs edge-pkgs; }; walk = import ./walk { inherit pkgs; }; diff --git a/pkgs/zed-editor/default.nix b/pkgs/zed/default.nix similarity index 78% rename from pkgs/zed-editor/default.nix rename to pkgs/zed/default.nix index 1e3f4fb8..9f2b4ade 100644 --- a/pkgs/zed-editor/default.nix +++ b/pkgs/zed/default.nix @@ -1,6 +1,6 @@ { pkgs, edge-pkgs, ... }: pkgs.writeShellApplication rec { - name = "zed-editor"; + name = "zed"; # This will be the alias. So do not specify `zed-editor` text = builtins.readFile ./${name}.bash; runtimeInputs = [ edge-pkgs.zed-editor ]; meta.description = "Make shorter command again even through applied https://github.com/NixOS/nixpkgs/pull/344193"; diff --git a/pkgs/zed-editor/zed-editor.bash b/pkgs/zed/zed.bash similarity index 100% rename from pkgs/zed-editor/zed-editor.bash rename to pkgs/zed/zed.bash From a840ff4dc26769060852de59df80b3ae6493c735 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 01:12:25 +0900 Subject: [PATCH 090/197] Globally install bash-language-server for zed-editor --- nixos/desktop/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 3babb099..0eca8ebf 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -120,7 +120,9 @@ lapce # IME is not working on Windows, but stable even around IME on Wayland than vscode + # Add LSP global for zed-editor. Prefer external package for helix vscode-langservers-extracted + nodePackages.bash-language-server # gnome-music does not support flac. # tramhao/termusic and tsirysndr/music-player does not figure how to use. From 0be7fe59d4b482cea5314ea1a965606322342d96 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 01:21:20 +0900 Subject: [PATCH 091/197] Disable zed bash-language-server as same as JSON/JSONC --- config/zed/settings.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/zed/settings.json b/config/zed/settings.json index 16bdafcf..e687fe6d 100644 --- a/config/zed/settings.json +++ b/config/zed/settings.json @@ -20,6 +20,7 @@ "tabs": { "file_icons": true }, + // FIXME: Actually not working... "lsp": { "vscode-json-language-server": { "binary": { @@ -32,6 +33,12 @@ "path": "/run/current-system/sw/bin/vscode-json-language-server", "arguments": ["--stdio"] } + }, + "bash-language-server": { + "binary": { + "path": "/run/current-system/sw/bin/bash-language-server", + "arguments": ["start"] + } } }, "languages": { @@ -45,6 +52,9 @@ }, "YAML": { "enable_language_server": false + }, + "Shell Script": { + "enable_language_server": false } }, "terminal": { From ff118eab1492fbbbd0d328e1fad1b71faceb0f50 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 13:38:58 +0900 Subject: [PATCH 092/197] Update README with adding udev workaround Closes GH-801 for now --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dbc40367..bc3555ff 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,13 @@ List defined hostnames nix flake show 'github:kachick/dotfiles' --json | jq '.nixosConfigurations | keys[]' ``` +And you may need to manually update `/etc/udev/hwdb.bin` for remapping keyboards.\ +See [GH-801](https://github.com/kachick/dotfiles/issues/801) for detail. + +```bash +sudo systemd-hwdb update && sudo udevadm trigger +``` + This repository intentionally reverts the home-manager NixOS module.\ So, you should activate the user dotfiles with standalone home-manager even though NixOS. @@ -168,14 +175,15 @@ Check [traps](./windows/Multi-booting.md) If you are developing this repository, the simple reactivation is as follows. ```bash -makers apply user@linux-cli +makers apply 'kachick@wsl' ``` For NixOS ```bash sudo nixos-rebuild switch --flake ".#$(hostname)" --show-trace && \ - makers apply kachick@desktop + sudo systemd-hwdb update && sudo udevadm trigger && \ + makers apply 'kachick@desktop' ``` If you encounter any errors in the above steps, Check and update CI and [wiki](https://github.com/kachick/dotfiles/wiki). From d91a834a997cbd3a0f16c1907ebe81472a9c3a1b Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 15:09:06 +0900 Subject: [PATCH 093/197] Update dock registered apps --- home-manager/gnome.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index e0b0f127..3ea81a9f 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -41,9 +41,12 @@ in favorite-apps = [ "Alacritty.desktop" + "kitty.desktop" "dev.zed.Zed.desktop" - "org.gnome.Nautilus.desktop" "firefox.desktop" + "io.gitlab.news_flash.NewsFlash.desktop" + "org.gnome.Rhythmbox3.desktop" + "org.gnome.Nautilus.desktop" ]; }; From 06075e74c5ad286d9c3baf1de06f3449293e84a3 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 15:16:55 +0900 Subject: [PATCH 094/197] Open VISUAL editors in another workspace --- home-manager/gnome.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 3ea81a9f..b191feb5 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -237,7 +237,8 @@ in "org/gnome/shell/extensions/auto-move-windows" = { application-list = [ - "btop.desktop:2" # FIXME: Not working + "dev.zed.Zed.desktop:2" + # TODO: Add vscode here as zed-editor "${spotify-pwa-file}:3" "org.gnome.Rhythmbox3.desktop:3" ]; From 160b1d97d20f52ee5af50172ca5eafcd7596a75f Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 15:36:28 +0900 Subject: [PATCH 095/197] Add typos-lsp in devshell again to useable for zed-editor --- flake.nix | 3 ++- nixos/desktop/default.nix | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index d3f66c15..b40b9de6 100644 --- a/flake.nix +++ b/flake.nix @@ -67,7 +67,7 @@ # Realize nixd pkgs version inlay hints for stable channel instead of latest NIX_PATH = "nixpkgs=${pkgs.path}"; - TYPOS_LSP_PATH = pkgs.lib.getExe pkgs.typos-lsp; + TYPOS_LSP_PATH = pkgs.lib.getExe pkgs.typos-lsp; # For vscode typos extension buildInputs = (with pkgs; [ @@ -86,6 +86,7 @@ dprint stylua typos + typos-lsp # For zed-editor typos extension go_1_22 goreleaser trivy diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 0eca8ebf..43bb56ca 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -121,6 +121,7 @@ lapce # IME is not working on Windows, but stable even around IME on Wayland than vscode # Add LSP global for zed-editor. Prefer external package for helix + typos-lsp vscode-langservers-extracted nodePackages.bash-language-server From e4bcdad89a748112664002bb9efcb01dae38d5e4 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 17:05:04 +0900 Subject: [PATCH 096/197] Fix IME for Google Chrome(Chromium) on Wayland except Electron apps (#715) --- home-manager/common.nix | 9 +-------- home-manager/gnome.nix | 5 +++++ home-manager/ime.nix | 17 +++++++++++++++++ nixos/desktop/default.nix | 14 ++++++++++---- 4 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 home-manager/ime.nix diff --git a/home-manager/common.nix b/home-manager/common.nix index 8b4e332c..4dc4717a 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -19,6 +19,7 @@ ./terminals.nix ./fzf.nix ./firefox.nix + ./ime.nix ./linux.nix ./darwin.nix ]; @@ -133,14 +134,6 @@ X-KDE-autostart-phase=1 ''; - # https://wiki.archlinux.org/title/wayland - # Didn't work if the electron is bundled, so unfit for nixpkgs distributing apps - # xdg.configFile."electron-flags.conf".text = '' - # --enable-features=UseOzonePlatform - # --ozone-platform=wayland - # --enable-wayland-ime - # ''; - xdg.dataFile."tmpbin/.keep".text = ""; home.file.".hushlogin".text = "This file disables daily login message. Not depend on this text."; diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index b191feb5..cb43496d 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -248,6 +248,11 @@ in autoconnect = [ "qemu:///system" ]; uris = [ "qemu:///system" ]; }; + + # https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland + "org.gnome.settings-daemon.plugins.xsettings" = { + overrides = "{'Gtk/IMModule':<'fcitx'>}"; + }; }; }; } diff --git a/home-manager/ime.nix b/home-manager/ime.nix new file mode 100644 index 00000000..0cc2eefc --- /dev/null +++ b/home-manager/ime.nix @@ -0,0 +1,17 @@ +{ ... }: +{ + # https://github.com/nix-community/home-manager/blob/release-24.05/modules/misc/gtk.nix + gtk = { + enable = true; + # https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland + gtk2.extraConfig = '' + gtk-im-module=fcitx + ''; + gtk3.extraConfig = { + gtk-im-module = "fcitx"; + }; + gtk4.extraConfig = { + gtk-im-module = "fcitx"; + }; + }; +} diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 43bb56ca..5f7045b4 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -133,6 +133,7 @@ newsflash # RSS reader # TODO: Manage config (sqlite?) or Backup the exported OPML + # TODO: Add `"--wayland-text-input-version=3"` after signal-desktop updates the Electron to 33.0.0 or higher. See GH-689 for detail. # Don't use unstable channel. It frequently backported to stable channel # - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/applications/networking/instant-messengers/signal-desktop/signal-desktop.nix (signal-desktop.overrideAttrs (prev: { @@ -158,8 +159,8 @@ ## Unfree packages + # TODO: Add `"--wayland-text-input-version=3"` after vscode updates the Electron to 33.0.0 or higher. See GH-689 for detail. # TODO: Consider using vscodium again - # TODO: Consider to drop the unuseful vscode until fixed the Wayland problems # Don't use unstable channel. It frequently backported to stable channel # - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/applications/editors/vscode/vscode.nix (vscode.override (prev: { @@ -185,8 +186,10 @@ # https://wiki.archlinux.org/title/Chromium#Native_Wayland_support # Similar as https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/chromium.nix commandLineArgs = (prev.commandLineArgs or [ ]) ++ [ + "--enable-features=UseOzonePlatform" "--ozone-platform=wayland" "--ozone-platform-hint=auto" + "--wayland-text-input-version=3" "--enable-wayland-ime" ]; })) @@ -238,9 +241,12 @@ environment.variables = { VISUAL = "${lib.getExe edge-pkgs.zed-editor} --wait"; - # Don't set *IM_MODULE in KDE: https://discuss.kde.org/t/kde-plasma-wayland/9014 - # QT_IM_MODULE = "fcitx"; - XMODIFIERS = "@im=fcitx"; + XMODIFIERS = "@im=fcitx"; # Required in both GNOME and KDE + + # https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland + # Don't set these in KDE, but should set in GNOME https://discuss.kde.org/t/kde-plasma-wayland/9014 + QT_IM_MODULE = "fcitx"; + GTK_IM_MODULE = "fcitx"; }; environment.sessionVariables = { From e3bf507a35a19d1499011294253fcb74e6dabe4e Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 17:13:05 +0900 Subject: [PATCH 097/197] Fix typos in dconf namespace I should consider GH-726 again... --- home-manager/gnome.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index cb43496d..37d7304d 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -250,7 +250,7 @@ in }; # https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland - "org.gnome.settings-daemon.plugins.xsettings" = { + "org/gnome/settings-daemon/plugins/xsettings" = { overrides = "{'Gtk/IMModule':<'fcitx'>}"; }; }; From 3605181e40b4c680450fd94244738bd1bdcde3c3 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 17:28:19 +0900 Subject: [PATCH 098/197] Remove needless CI broken gtk config in home-manager These are applied in GH-715 I cannot completely read https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland --- home-manager/common.nix | 1 - home-manager/gnome.nix | 5 ----- home-manager/ime.nix | 17 ----------------- 3 files changed, 23 deletions(-) delete mode 100644 home-manager/ime.nix diff --git a/home-manager/common.nix b/home-manager/common.nix index 4dc4717a..6359ab27 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -19,7 +19,6 @@ ./terminals.nix ./fzf.nix ./firefox.nix - ./ime.nix ./linux.nix ./darwin.nix ]; diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 37d7304d..b191feb5 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -248,11 +248,6 @@ in autoconnect = [ "qemu:///system" ]; uris = [ "qemu:///system" ]; }; - - # https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland - "org/gnome/settings-daemon/plugins/xsettings" = { - overrides = "{'Gtk/IMModule':<'fcitx'>}"; - }; }; }; } diff --git a/home-manager/ime.nix b/home-manager/ime.nix deleted file mode 100644 index 0cc2eefc..00000000 --- a/home-manager/ime.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ ... }: -{ - # https://github.com/nix-community/home-manager/blob/release-24.05/modules/misc/gtk.nix - gtk = { - enable = true; - # https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland - gtk2.extraConfig = '' - gtk-im-module=fcitx - ''; - gtk3.extraConfig = { - gtk-im-module = "fcitx"; - }; - gtk4.extraConfig = { - gtk-im-module = "fcitx"; - }; - }; -} From 42bbf88981abba7ffa9eaa86793ae451a7bf3cf9 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 17:39:05 +0900 Subject: [PATCH 099/197] Add chrome to dock because of the IME is fixed since GH-715 --- home-manager/gnome.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index b191feb5..0b34185c 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -44,6 +44,7 @@ in "kitty.desktop" "dev.zed.Zed.desktop" "firefox.desktop" + "google-chrome.desktop" "io.gitlab.news_flash.NewsFlash.desktop" "org.gnome.Rhythmbox3.desktop" "org.gnome.Nautilus.desktop" From 1af42a446d15bea82ec2729d45ede7cbd654307b Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 2 Oct 2024 19:02:43 +0900 Subject: [PATCH 100/197] Make it possible to open Amazon Music like a PWA app (#812) Install browser shortcut for Amazon Music like a PWA This app-id is not a common? I can't find from internet. Guessing amazon music does not officially support PWA. So this ID might be generated by chrome. --- config/pwa/amazon_music.desktop | 9 +++++++++ home-manager/gnome.nix | 4 ++++ 2 files changed, 13 insertions(+) create mode 100644 config/pwa/amazon_music.desktop diff --git a/config/pwa/amazon_music.desktop b/config/pwa/amazon_music.desktop new file mode 100644 index 00000000..1855281c --- /dev/null +++ b/config/pwa/amazon_music.desktop @@ -0,0 +1,9 @@ +#!/usr/bin/env xdg-open +[Desktop Entry] +Version=1.0 +Terminal=false +Type=Application +Name=Amazon Music +Exec=google-chrome-stable "--profile-directory=Profile 1" --app-id=dojpeppajphepagdhclblkkjnoaeamee +Icon=chrome-dojpeppajphepagdhclblkkjnoaeamee-Profile_1 +StartupWMClass=crx_dojpeppajphepagdhclblkkjnoaeamee diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 0b34185c..7d888ae3 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -2,9 +2,11 @@ let spotify-pwa-file = "chrome-pjibgclleladliembfgfagdaldikeohf-Default.desktop"; + amazon_music-pwa-file = "chrome-dojpeppajphepagdhclblkkjnoaeamee-Profile_1.desktop"; in { xdg.dataFile."applications/${spotify-pwa-file}".source = ../config/pwa/spotify.desktop; + xdg.dataFile."applications/${amazon_music-pwa-file}".source = ../config/pwa/amazon_music.desktop; # https://github.com/nix-community/home-manager/blob/release-24.05/modules/misc/dconf.nix dconf = { @@ -46,6 +48,7 @@ in "firefox.desktop" "google-chrome.desktop" "io.gitlab.news_flash.NewsFlash.desktop" + amazon_music-pwa-file "org.gnome.Rhythmbox3.desktop" "org.gnome.Nautilus.desktop" ]; @@ -241,6 +244,7 @@ in "dev.zed.Zed.desktop:2" # TODO: Add vscode here as zed-editor "${spotify-pwa-file}:3" + "${amazon_music-pwa-file}:3" "org.gnome.Rhythmbox3.desktop:3" ]; }; From db43d008f5ca1fea6aa3e96e75fc8e2f130ecc64 Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Thu, 3 Oct 2024 00:39:52 +0000 Subject: [PATCH 101/197] flake.lock: Update (#815) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/1925c603f17fc89f4c8f6bf6f631a802ad85d784?narHash=sha256-J%2BPeFKSDV%2BpHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI%3D' (2024-09-26) → 'github:NixOS/nixpkgs/27e30d177e57d912d614c88c622dcfdb2e6e6515?narHash=sha256-HP89HZOT0ReIbI7IJZJQoJgxvB2Tn28V6XS3MNKnfLs%3D' (2024-10-01) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/fbca5e745367ae7632731639de5c21f29c8744ed?narHash=sha256-40J9tW7Y794J7Uw4GwcAKlMxlX2xISBl6IBigo83ih8%3D' (2024-09-28) → 'github:NixOS/nixpkgs/1719f27dd95fd4206afb9cec9f415b539978827e?narHash=sha256-9/79hjQc9%2BxyH%2BQxeMcRsA6hDyw6Z9Eo1/oxjvwirLk%3D' (2024-09-30) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 4c5d3a5a..0662bf44 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1727348695, - "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=", + "lastModified": 1727802920, + "narHash": "sha256-HP89HZOT0ReIbI7IJZJQoJgxvB2Tn28V6XS3MNKnfLs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784", + "rev": "27e30d177e57d912d614c88c622dcfdb2e6e6515", "type": "github" }, "original": { @@ -400,11 +400,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1727540905, - "narHash": "sha256-40J9tW7Y794J7Uw4GwcAKlMxlX2xISBl6IBigo83ih8=", + "lastModified": 1727672256, + "narHash": "sha256-9/79hjQc9+xyH+QxeMcRsA6hDyw6Z9Eo1/oxjvwirLk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "fbca5e745367ae7632731639de5c21f29c8744ed", + "rev": "1719f27dd95fd4206afb9cec9f415b539978827e", "type": "github" }, "original": { From 294b67ef0dbc0a909be91c67f9a5cf7bc525fff7 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 3 Oct 2024 12:44:25 +0900 Subject: [PATCH 102/197] Keep zellij panes as possible in layouts Part of GH-726 --- config/zellij/layouts/dotfiles.kdl | 11 +++++++---- config/zellij/layouts/regular.kdl | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/config/zellij/layouts/dotfiles.kdl b/config/zellij/layouts/dotfiles.kdl index 7585424a..576334cd 100644 --- a/config/zellij/layouts/dotfiles.kdl +++ b/config/zellij/layouts/dotfiles.kdl @@ -4,7 +4,7 @@ layout { plugin location="zellij:compact-bar" } pane split_direction="horizontal" { - pane size="80%" command="yazi" { + pane size="80%" command="yazi" close_on_exit=false { } pane size="20%" { @@ -30,13 +30,16 @@ layout { pane size=1 borderless=true { plugin location="zellij:compact-bar" } - pane name="edit" edit="home-manager/gnome.nix" size="70%" + // Don't use edit pane. close_on_exit is only available in command panes + pane name="edit" command="hx" size="70%" close_on_exit=false { + args "home-manager/gnome.nix" + } pane split_direction="vertical" size="30%" { - pane name="watch" start_suspended=true command="dconf" { + pane name="watch" start_suspended=true command="dconf" close_on_exit=false { args "watch" "/" start_suspended true } - pane name="blank" + pane name="blank" command="zsh" close_on_exit=false } } tab name="Help" { diff --git a/config/zellij/layouts/regular.kdl b/config/zellij/layouts/regular.kdl index 7dac10ca..b1af49e0 100644 --- a/config/zellij/layouts/regular.kdl +++ b/config/zellij/layouts/regular.kdl @@ -10,7 +10,7 @@ layout { plugin location="zellij:compact-bar" } pane split_direction="horizontal" { - pane size="80%" command="yazi" { + pane size="80%" command="yazi" close_on_exit=false { } pane size="20%" { From 15807836e18392b19fa083d76f7380434a24d37f Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 3 Oct 2024 20:00:24 +0900 Subject: [PATCH 103/197] Takeover ssh-agent role by gpg-agent (#814) * Takeover ssh-agent role by gpg-agent * Disable gnome-keyring with gnupg recommendation * Force disable gnome-keyring * Disable goldwarden ssh-agent integration to prefer gpg-agent * Refactor and add defaultCacheTtlSsh in gpg-agent * Update comments and usage --- README.md | 2 ++ home-manager/gpg.nix | 15 +++++++++++++-- home-manager/ssh.nix | 5 +++-- nixos/configuration.nix | 1 + nixos/desktop/default.nix | 9 +++++++++ 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bc3555ff..e36df7c0 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,8 @@ Check [traps](./windows/Multi-booting.md) ```bash touch ~/.ssh/id_ed25519 && chmod 400 ~/.ssh/id_ed25519 hx ~/.ssh/id_ed25519 + echo UPDATESTARTUPTTY | gpg-connect-agent # https://unix.stackexchange.com/a/371910 + ssh-add ~/.ssh/id_ed25519 ``` 1. [Restore encrypted rclone.conf from STDIN](config/rclone.md) diff --git a/home-manager/gpg.nix b/home-manager/gpg.nix index 18fd7e16..943a9e65 100644 --- a/home-manager/gpg.nix +++ b/home-manager/gpg.nix @@ -18,6 +18,10 @@ # - `gpg --armor --export PUBKEY | clip.exe` # - How to backup private key? # - `gpg --export-secret-keys --armor > gpg-private.keys.bak` +let + # All gpg-agent timeouts numbers should be specified with the `seconds` + day = 60 * 60 * 24; +in { # https://github.com/nix-community/home-manager/blob/release-24.05/modules/services/gpg-agent.nix services.gpg-agent = { @@ -25,11 +29,18 @@ # Update [darwin.nix](darwin.nix) if changed this section # + # TODO: Reconsider the ttls with recent use + # # https://superuser.com/questions/624343/keep-gnupg-credentials-cached-for-entire-user-session - defaultCacheTtl = 60480000; # 700 days - maxCacheTtl = 60480000; # 700 days + defaultCacheTtl = day * 700; + # https://github.com/openbsd/src/blob/862f3f2587ccb85ac6d8602dd1601a861ae5a3e8/usr.bin/ssh/ssh-agent.1#L167-L173 + # ssh-agent sets it as infinite by default. So I can relax here (maybe) + defaultCacheTtlSsh = day * 30; + maxCacheTtl = day * 700; pinentryPackage = pkgs.pinentry-tty; + + enableSshSupport = true; }; # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/gpg.nix diff --git a/home-manager/ssh.nix b/home-manager/ssh.nix index 759a29a6..e15cef4f 100644 --- a/home-manager/ssh.nix +++ b/home-manager/ssh.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, ... }: let # SSH files cannot use XDG Base Directory. @@ -16,7 +16,8 @@ in # - id_*.pub: I CAN register them for different services. { # https://github.com/nix-community/home-manager/blob/release-24.05/modules/services/ssh-agent.nix - services.ssh-agent.enable = pkgs.stdenv.isLinux; + # Prefer gpg-agent for SSH agent role + services.ssh-agent.enable = false; # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/ssh.nix programs.ssh = { diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 7b40ac9d..e89bd1d9 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -165,6 +165,7 @@ programs.goldwarden = { package = edge-pkgs.goldwarden; enable = true; + useSshAgent = false; }; # https://nixos.wiki/wiki/Podman diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 5f7045b4..8fa8ba78 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -85,6 +85,15 @@ gnome-music # does not support flac by defaults ]); + # Recommended to be uninstalled by gnupg. + # https://wiki.gnupg.org/GnomeKeyring + # + # And enabling this makes $SSH_AUTH_SOCK overriding even through enabled gpg-agent in home-manager + # https://github.com/NixOS/nixpkgs/issues/101616 + # + # Using mkforce for https://discourse.nixos.org/t/gpg-smartcard-for-ssh/33689/3 + services.gnome.gnome-keyring.enable = lib.mkForce false; + # Enable touchpad support (enabled default in most desktopManager). services.libinput = { enable = true; From 445ab80454ae3454197aeb96875e1debea380444 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 3 Oct 2024 21:19:36 +0900 Subject: [PATCH 104/197] Simplify the gpg-agent with pinentry-tty integrations https://qiita.com/kino-ma/items/0f10112e0aaef3e39387 https://superuser.com/questions/520980/how-to-force-gpg-to-use-console-mode-pinentry-to-prompt-for-passwords --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e36df7c0..5c3625e8 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ Check [traps](./windows/Multi-booting.md) ```bash touch ~/.ssh/id_ed25519 && chmod 400 ~/.ssh/id_ed25519 hx ~/.ssh/id_ed25519 - echo UPDATESTARTUPTTY | gpg-connect-agent # https://unix.stackexchange.com/a/371910 + gpg-connect-agent updatestartuptty /bye ssh-add ~/.ssh/id_ed25519 ``` From 9a239dfb6bc683ab949ad467e306ae877ca196eb Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 4 Oct 2024 02:24:48 +0900 Subject: [PATCH 105/197] Replace `goldwarden` with `pass` for the secret/password manager (#817) * Introduce `pass` for the password manager * Update gpg-agent ttl since using in pass command * Replace goldwarden with pass to simplify $RCLONE_PASSWORD_COMMAND * Update usage of rclone --- README.md | 6 + config/rclone.md | 11 +- dependencies/goldwarden/completions.bash | 338 ------------------ dependencies/goldwarden/completions.fish | 235 ------------ dependencies/goldwarden/completions.zsh | 212 ----------- home-manager/bash.nix | 1 - home-manager/common.nix | 3 + home-manager/darwin.nix | 4 +- home-manager/fish.nix | 1 - home-manager/gpg.nix | 11 +- home-manager/linux.nix | 11 +- home-manager/packages.nix | 2 + home-manager/zsh.nix | 1 - nixos/configuration.nix | 20 +- pkgs/bump_completions/bump_completions.bash | 8 - pkgs/bump_completions/default.nix | 11 +- pkgs/default.nix | 2 - pkgs/get-rclone-config-password/default.nix | 6 - .../get-rclone-config-password.bash | 2 - 19 files changed, 34 insertions(+), 851 deletions(-) delete mode 100644 dependencies/goldwarden/completions.bash delete mode 100644 dependencies/goldwarden/completions.fish delete mode 100644 dependencies/goldwarden/completions.zsh delete mode 100644 pkgs/get-rclone-config-password/default.nix delete mode 100644 pkgs/get-rclone-config-password/get-rclone-config-password.bash diff --git a/README.md b/README.md index 5c3625e8..88192a21 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,12 @@ Check [traps](./windows/Multi-booting.md) ssh-add ~/.ssh/id_ed25519 ``` +1. Restore encrepted secrets from private git repository + + ```bash + git clone 'git@example.com:password-store.git' "$PASSWORD_STORE_DIR" + ``` + 1. [Restore encrypted rclone.conf from STDIN](config/rclone.md) 1. Restore shell history diff --git a/config/rclone.md b/config/rclone.md index f4411d8a..eee0617b 100644 --- a/config/rclone.md +++ b/config/rclone.md @@ -35,16 +35,9 @@ hx "$(rclone config file | tail -1)" Don't save the file in this repository even if it is encrypted with agenix or sops-nix. -## Persist the token in a session +## Decrypt the config in a session -Always need the token when modifying config is too annoy.\ -Now it reads from `RCLONE_PASSWORD_COMMAND`.\ -Or directly set `RCLONE_CONFIG_PASS` as this.\ -(`read -s` does not work in zsh) - -```bash -export RCLONE_CONFIG_PASS="$(hx)" -``` +The token should be injected with `RCLONE_PASSWORD_COMMAND`. ## Mount diff --git a/dependencies/goldwarden/completions.bash b/dependencies/goldwarden/completions.bash deleted file mode 100644 index 559572f5..00000000 --- a/dependencies/goldwarden/completions.bash +++ /dev/null @@ -1,338 +0,0 @@ -# bash completion V2 for goldwarden -*- shell-script -*- - -__goldwarden_debug() -{ - if [[ -n ${BASH_COMP_DEBUG_FILE-} ]]; then - echo "$*" >> "${BASH_COMP_DEBUG_FILE}" - fi -} - -# Macs have bash3 for which the bash-completion package doesn't include -# _init_completion. This is a minimal version of that function. -__goldwarden_init_completion() -{ - COMPREPLY=() - _get_comp_words_by_ref "$@" cur prev words cword -} - -# This function calls the goldwarden program to obtain the completion -# results and the directive. It fills the 'out' and 'directive' vars. -__goldwarden_get_completion_results() { - local requestComp lastParam lastChar args - - # Prepare the command to request completions for the program. - # Calling ${words[0]} instead of directly goldwarden allows handling aliases - args=("${words[@]:1}") - requestComp="${words[0]} __complete ${args[*]}" - - lastParam=${words[$((${#words[@]}-1))]} - lastChar=${lastParam:$((${#lastParam}-1)):1} - __goldwarden_debug "lastParam ${lastParam}, lastChar ${lastChar}" - - if [[ -z ${cur} && ${lastChar} != = ]]; then - # If the last parameter is complete (there is a space following it) - # We add an extra empty parameter so we can indicate this to the go method. - __goldwarden_debug "Adding extra empty parameter" - requestComp="${requestComp} ''" - fi - - # When completing a flag with an = (e.g., goldwarden -n=) - # bash focuses on the part after the =, so we need to remove - # the flag part from $cur - if [[ ${cur} == -*=* ]]; then - cur="${cur#*=}" - fi - - __goldwarden_debug "Calling ${requestComp}" - # Use eval to handle any environment variables and such - out=$(eval "${requestComp}" 2>/dev/null) - - # Extract the directive integer at the very end of the output following a colon (:) - directive=${out##*:} - # Remove the directive - out=${out%:*} - if [[ ${directive} == "${out}" ]]; then - # There is not directive specified - directive=0 - fi - __goldwarden_debug "The completion directive is: ${directive}" - __goldwarden_debug "The completions are: ${out}" -} - -__goldwarden_process_completion_results() { - local shellCompDirectiveError=1 - local shellCompDirectiveNoSpace=2 - local shellCompDirectiveNoFileComp=4 - local shellCompDirectiveFilterFileExt=8 - local shellCompDirectiveFilterDirs=16 - local shellCompDirectiveKeepOrder=32 - - if (((directive & shellCompDirectiveError) != 0)); then - # Error code. No completion. - __goldwarden_debug "Received error from custom completion go code" - return - else - if (((directive & shellCompDirectiveNoSpace) != 0)); then - if [[ $(type -t compopt) == builtin ]]; then - __goldwarden_debug "Activating no space" - compopt -o nospace - else - __goldwarden_debug "No space directive not supported in this version of bash" - fi - fi - if (((directive & shellCompDirectiveKeepOrder) != 0)); then - if [[ $(type -t compopt) == builtin ]]; then - # no sort isn't supported for bash less than < 4.4 - if [[ ${BASH_VERSINFO[0]} -lt 4 || ( ${BASH_VERSINFO[0]} -eq 4 && ${BASH_VERSINFO[1]} -lt 4 ) ]]; then - __goldwarden_debug "No sort directive not supported in this version of bash" - else - __goldwarden_debug "Activating keep order" - compopt -o nosort - fi - else - __goldwarden_debug "No sort directive not supported in this version of bash" - fi - fi - if (((directive & shellCompDirectiveNoFileComp) != 0)); then - if [[ $(type -t compopt) == builtin ]]; then - __goldwarden_debug "Activating no file completion" - compopt +o default - else - __goldwarden_debug "No file completion directive not supported in this version of bash" - fi - fi - fi - - # Separate activeHelp from normal completions - local completions=() - local activeHelp=() - __goldwarden_extract_activeHelp - - if (((directive & shellCompDirectiveFilterFileExt) != 0)); then - # File extension filtering - local fullFilter filter filteringCmd - - # Do not use quotes around the $completions variable or else newline - # characters will be kept. - for filter in ${completions[*]}; do - fullFilter+="$filter|" - done - - filteringCmd="_filedir $fullFilter" - __goldwarden_debug "File filtering command: $filteringCmd" - $filteringCmd - elif (((directive & shellCompDirectiveFilterDirs) != 0)); then - # File completion for directories only - - local subdir - subdir=${completions[0]} - if [[ -n $subdir ]]; then - __goldwarden_debug "Listing directories in $subdir" - pushd "$subdir" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || return - else - __goldwarden_debug "Listing directories in ." - _filedir -d - fi - else - __goldwarden_handle_completion_types - fi - - __goldwarden_handle_special_char "$cur" : - __goldwarden_handle_special_char "$cur" = - - # Print the activeHelp statements before we finish - if ((${#activeHelp[*]} != 0)); then - printf "\n"; - printf "%s\n" "${activeHelp[@]}" - printf "\n" - - # The prompt format is only available from bash 4.4. - # We test if it is available before using it. - if (x=${PS1@P}) 2> /dev/null; then - printf "%s" "${PS1@P}${COMP_LINE[@]}" - else - # Can't print the prompt. Just print the - # text the user had typed, it is workable enough. - printf "%s" "${COMP_LINE[@]}" - fi - fi -} - -# Separate activeHelp lines from real completions. -# Fills the $activeHelp and $completions arrays. -__goldwarden_extract_activeHelp() { - local activeHelpMarker="_activeHelp_ " - local endIndex=${#activeHelpMarker} - - while IFS='' read -r comp; do - if [[ ${comp:0:endIndex} == $activeHelpMarker ]]; then - comp=${comp:endIndex} - __goldwarden_debug "ActiveHelp found: $comp" - if [[ -n $comp ]]; then - activeHelp+=("$comp") - fi - else - # Not an activeHelp line but a normal completion - completions+=("$comp") - fi - done <<<"${out}" -} - -__goldwarden_handle_completion_types() { - __goldwarden_debug "__goldwarden_handle_completion_types: COMP_TYPE is $COMP_TYPE" - - case $COMP_TYPE in - 37|42) - # Type: menu-complete/menu-complete-backward and insert-completions - # If the user requested inserting one completion at a time, or all - # completions at once on the command-line we must remove the descriptions. - # https://github.com/spf13/cobra/issues/1508 - local tab=$'\t' comp - while IFS='' read -r comp; do - [[ -z $comp ]] && continue - # Strip any description - comp=${comp%%$tab*} - # Only consider the completions that match - if [[ $comp == "$cur"* ]]; then - COMPREPLY+=("$comp") - fi - done < <(printf "%s\n" "${completions[@]}") - ;; - - *) - # Type: complete (normal completion) - __goldwarden_handle_standard_completion_case - ;; - esac -} - -__goldwarden_handle_standard_completion_case() { - local tab=$'\t' comp - - # Short circuit to optimize if we don't have descriptions - if [[ "${completions[*]}" != *$tab* ]]; then - IFS=$'\n' read -ra COMPREPLY -d '' < <(compgen -W "${completions[*]}" -- "$cur") - return 0 - fi - - local longest=0 - local compline - # Look for the longest completion so that we can format things nicely - while IFS='' read -r compline; do - [[ -z $compline ]] && continue - # Strip any description before checking the length - comp=${compline%%$tab*} - # Only consider the completions that match - [[ $comp == "$cur"* ]] || continue - COMPREPLY+=("$compline") - if ((${#comp}>longest)); then - longest=${#comp} - fi - done < <(printf "%s\n" "${completions[@]}") - - # If there is a single completion left, remove the description text - if ((${#COMPREPLY[*]} == 1)); then - __goldwarden_debug "COMPREPLY[0]: ${COMPREPLY[0]}" - comp="${COMPREPLY[0]%%$tab*}" - __goldwarden_debug "Removed description from single completion, which is now: ${comp}" - COMPREPLY[0]=$comp - else # Format the descriptions - __goldwarden_format_comp_descriptions $longest - fi -} - -__goldwarden_handle_special_char() -{ - local comp="$1" - local char=$2 - if [[ "$comp" == *${char}* && "$COMP_WORDBREAKS" == *${char}* ]]; then - local word=${comp%"${comp##*${char}}"} - local idx=${#COMPREPLY[*]} - while ((--idx >= 0)); do - COMPREPLY[idx]=${COMPREPLY[idx]#"$word"} - done - fi -} - -__goldwarden_format_comp_descriptions() -{ - local tab=$'\t' - local comp desc maxdesclength - local longest=$1 - - local i ci - for ci in ${!COMPREPLY[*]}; do - comp=${COMPREPLY[ci]} - # Properly format the description string which follows a tab character if there is one - if [[ "$comp" == *$tab* ]]; then - __goldwarden_debug "Original comp: $comp" - desc=${comp#*$tab} - comp=${comp%%$tab*} - - # $COLUMNS stores the current shell width. - # Remove an extra 4 because we add 2 spaces and 2 parentheses. - maxdesclength=$(( COLUMNS - longest - 4 )) - - # Make sure we can fit a description of at least 8 characters - # if we are to align the descriptions. - if ((maxdesclength > 8)); then - # Add the proper number of spaces to align the descriptions - for ((i = ${#comp} ; i < longest ; i++)); do - comp+=" " - done - else - # Don't pad the descriptions so we can fit more text after the completion - maxdesclength=$(( COLUMNS - ${#comp} - 4 )) - fi - - # If there is enough space for any description text, - # truncate the descriptions that are too long for the shell width - if ((maxdesclength > 0)); then - if ((${#desc} > maxdesclength)); then - desc=${desc:0:$(( maxdesclength - 1 ))} - desc+="…" - fi - comp+=" ($desc)" - fi - COMPREPLY[ci]=$comp - __goldwarden_debug "Final comp: $comp" - fi - done -} - -__start_goldwarden() -{ - local cur prev words cword split - - COMPREPLY=() - - # Call _init_completion from the bash-completion package - # to prepare the arguments properly - if declare -F _init_completion >/dev/null 2>&1; then - _init_completion -n =: || return - else - __goldwarden_init_completion -n =: || return - fi - - __goldwarden_debug - __goldwarden_debug "========= starting completion logic ==========" - __goldwarden_debug "cur is ${cur}, words[*] is ${words[*]}, #words[@] is ${#words[@]}, cword is $cword" - - # The user could have moved the cursor backwards on the command-line. - # We need to trigger completion from the $cword location, so we need - # to truncate the command-line ($words) up to the $cword location. - words=("${words[@]:0:$cword+1}") - __goldwarden_debug "Truncated words[*]: ${words[*]}," - - local out directive - __goldwarden_get_completion_results - __goldwarden_process_completion_results -} - -if [[ $(type -t compopt) = "builtin" ]]; then - complete -o default -F __start_goldwarden goldwarden -else - complete -o default -o nospace -F __start_goldwarden goldwarden -fi - -# ex: ts=4 sw=4 et filetype=sh diff --git a/dependencies/goldwarden/completions.fish b/dependencies/goldwarden/completions.fish deleted file mode 100644 index 94c59285..00000000 --- a/dependencies/goldwarden/completions.fish +++ /dev/null @@ -1,235 +0,0 @@ -# fish completion for goldwarden -*- shell-script -*- - -function __goldwarden_debug - set -l file "$BASH_COMP_DEBUG_FILE" - if test -n "$file" - echo "$argv" >> $file - end -end - -function __goldwarden_perform_completion - __goldwarden_debug "Starting __goldwarden_perform_completion" - - # Extract all args except the last one - set -l args (commandline -opc) - # Extract the last arg and escape it in case it is a space - set -l lastArg (string escape -- (commandline -ct)) - - __goldwarden_debug "args: $args" - __goldwarden_debug "last arg: $lastArg" - - # Disable ActiveHelp which is not supported for fish shell - set -l requestComp "GOLDWARDEN_ACTIVE_HELP=0 $args[1] __complete $args[2..-1] $lastArg" - - __goldwarden_debug "Calling $requestComp" - set -l results (eval $requestComp 2> /dev/null) - - # Some programs may output extra empty lines after the directive. - # Let's ignore them or else it will break completion. - # Ref: https://github.com/spf13/cobra/issues/1279 - for line in $results[-1..1] - if test (string trim -- $line) = "" - # Found an empty line, remove it - set results $results[1..-2] - else - # Found non-empty line, we have our proper output - break - end - end - - set -l comps $results[1..-2] - set -l directiveLine $results[-1] - - # For Fish, when completing a flag with an = (e.g., -n=) - # completions must be prefixed with the flag - set -l flagPrefix (string match -r -- '-.*=' "$lastArg") - - __goldwarden_debug "Comps: $comps" - __goldwarden_debug "DirectiveLine: $directiveLine" - __goldwarden_debug "flagPrefix: $flagPrefix" - - for comp in $comps - printf "%s%s\n" "$flagPrefix" "$comp" - end - - printf "%s\n" "$directiveLine" -end - -# this function limits calls to __goldwarden_perform_completion, by caching the result behind $__goldwarden_perform_completion_once_result -function __goldwarden_perform_completion_once - __goldwarden_debug "Starting __goldwarden_perform_completion_once" - - if test -n "$__goldwarden_perform_completion_once_result" - __goldwarden_debug "Seems like a valid result already exists, skipping __goldwarden_perform_completion" - return 0 - end - - set --global __goldwarden_perform_completion_once_result (__goldwarden_perform_completion) - if test -z "$__goldwarden_perform_completion_once_result" - __goldwarden_debug "No completions, probably due to a failure" - return 1 - end - - __goldwarden_debug "Performed completions and set __goldwarden_perform_completion_once_result" - return 0 -end - -# this function is used to clear the $__goldwarden_perform_completion_once_result variable after completions are run -function __goldwarden_clear_perform_completion_once_result - __goldwarden_debug "" - __goldwarden_debug "========= clearing previously set __goldwarden_perform_completion_once_result variable ==========" - set --erase __goldwarden_perform_completion_once_result - __goldwarden_debug "Successfully erased the variable __goldwarden_perform_completion_once_result" -end - -function __goldwarden_requires_order_preservation - __goldwarden_debug "" - __goldwarden_debug "========= checking if order preservation is required ==========" - - __goldwarden_perform_completion_once - if test -z "$__goldwarden_perform_completion_once_result" - __goldwarden_debug "Error determining if order preservation is required" - return 1 - end - - set -l directive (string sub --start 2 $__goldwarden_perform_completion_once_result[-1]) - __goldwarden_debug "Directive is: $directive" - - set -l shellCompDirectiveKeepOrder 32 - set -l keeporder (math (math --scale 0 $directive / $shellCompDirectiveKeepOrder) % 2) - __goldwarden_debug "Keeporder is: $keeporder" - - if test $keeporder -ne 0 - __goldwarden_debug "This does require order preservation" - return 0 - end - - __goldwarden_debug "This doesn't require order preservation" - return 1 -end - - -# This function does two things: -# - Obtain the completions and store them in the global __goldwarden_comp_results -# - Return false if file completion should be performed -function __goldwarden_prepare_completions - __goldwarden_debug "" - __goldwarden_debug "========= starting completion logic ==========" - - # Start fresh - set --erase __goldwarden_comp_results - - __goldwarden_perform_completion_once - __goldwarden_debug "Completion results: $__goldwarden_perform_completion_once_result" - - if test -z "$__goldwarden_perform_completion_once_result" - __goldwarden_debug "No completion, probably due to a failure" - # Might as well do file completion, in case it helps - return 1 - end - - set -l directive (string sub --start 2 $__goldwarden_perform_completion_once_result[-1]) - set --global __goldwarden_comp_results $__goldwarden_perform_completion_once_result[1..-2] - - __goldwarden_debug "Completions are: $__goldwarden_comp_results" - __goldwarden_debug "Directive is: $directive" - - set -l shellCompDirectiveError 1 - set -l shellCompDirectiveNoSpace 2 - set -l shellCompDirectiveNoFileComp 4 - set -l shellCompDirectiveFilterFileExt 8 - set -l shellCompDirectiveFilterDirs 16 - - if test -z "$directive" - set directive 0 - end - - set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2) - if test $compErr -eq 1 - __goldwarden_debug "Received error directive: aborting." - # Might as well do file completion, in case it helps - return 1 - end - - set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2) - set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2) - if test $filefilter -eq 1; or test $dirfilter -eq 1 - __goldwarden_debug "File extension filtering or directory filtering not supported" - # Do full file completion instead - return 1 - end - - set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2) - set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2) - - __goldwarden_debug "nospace: $nospace, nofiles: $nofiles" - - # If we want to prevent a space, or if file completion is NOT disabled, - # we need to count the number of valid completions. - # To do so, we will filter on prefix as the completions we have received - # may not already be filtered so as to allow fish to match on different - # criteria than the prefix. - if test $nospace -ne 0; or test $nofiles -eq 0 - set -l prefix (commandline -t | string escape --style=regex) - __goldwarden_debug "prefix: $prefix" - - set -l completions (string match -r -- "^$prefix.*" $__goldwarden_comp_results) - set --global __goldwarden_comp_results $completions - __goldwarden_debug "Filtered completions are: $__goldwarden_comp_results" - - # Important not to quote the variable for count to work - set -l numComps (count $__goldwarden_comp_results) - __goldwarden_debug "numComps: $numComps" - - if test $numComps -eq 1; and test $nospace -ne 0 - # We must first split on \t to get rid of the descriptions to be - # able to check what the actual completion will be. - # We don't need descriptions anyway since there is only a single - # real completion which the shell will expand immediately. - set -l split (string split --max 1 \t $__goldwarden_comp_results[1]) - - # Fish won't add a space if the completion ends with any - # of the following characters: @=/:., - set -l lastChar (string sub -s -1 -- $split) - if not string match -r -q "[@=/:.,]" -- "$lastChar" - # In other cases, to support the "nospace" directive we trick the shell - # by outputting an extra, longer completion. - __goldwarden_debug "Adding second completion to perform nospace directive" - set --global __goldwarden_comp_results $split[1] $split[1]. - __goldwarden_debug "Completions are now: $__goldwarden_comp_results" - end - end - - if test $numComps -eq 0; and test $nofiles -eq 0 - # To be consistent with bash and zsh, we only trigger file - # completion when there are no other completions - __goldwarden_debug "Requesting file completion" - return 1 - end - end - - return 0 -end - -# Since Fish completions are only loaded once the user triggers them, we trigger them ourselves -# so we can properly delete any completions provided by another script. -# Only do this if the program can be found, or else fish may print some errors; besides, -# the existing completions will only be loaded if the program can be found. -if type -q "goldwarden" - # The space after the program name is essential to trigger completion for the program - # and not completion of the program name itself. - # Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish. - complete --do-complete "goldwarden " > /dev/null 2>&1 -end - -# Remove any pre-existing completions for the program since we will be handling all of them. -complete -c goldwarden -e - -# this will get called after the two calls below and clear the $__goldwarden_perform_completion_once_result global -complete -c goldwarden -n '__goldwarden_clear_perform_completion_once_result' -# The call to __goldwarden_prepare_completions will setup __goldwarden_comp_results -# which provides the program's completion choices. -# If this doesn't require order preservation, we don't use the -k flag -complete -c goldwarden -n 'not __goldwarden_requires_order_preservation && __goldwarden_prepare_completions' -f -a '$__goldwarden_comp_results' -# otherwise we use the -k flag -complete -k -c goldwarden -n '__goldwarden_requires_order_preservation && __goldwarden_prepare_completions' -f -a '$__goldwarden_comp_results' diff --git a/dependencies/goldwarden/completions.zsh b/dependencies/goldwarden/completions.zsh deleted file mode 100644 index 8957b37a..00000000 --- a/dependencies/goldwarden/completions.zsh +++ /dev/null @@ -1,212 +0,0 @@ -#compdef goldwarden -compdef _goldwarden goldwarden - -# zsh completion for goldwarden -*- shell-script -*- - -__goldwarden_debug() -{ - local file="$BASH_COMP_DEBUG_FILE" - if [[ -n ${file} ]]; then - echo "$*" >> "${file}" - fi -} - -_goldwarden() -{ - local shellCompDirectiveError=1 - local shellCompDirectiveNoSpace=2 - local shellCompDirectiveNoFileComp=4 - local shellCompDirectiveFilterFileExt=8 - local shellCompDirectiveFilterDirs=16 - local shellCompDirectiveKeepOrder=32 - - local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder - local -a completions - - __goldwarden_debug "\n========= starting completion logic ==========" - __goldwarden_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" - - # The user could have moved the cursor backwards on the command-line. - # We need to trigger completion from the $CURRENT location, so we need - # to truncate the command-line ($words) up to the $CURRENT location. - # (We cannot use $CURSOR as its value does not work when a command is an alias.) - words=("${=words[1,CURRENT]}") - __goldwarden_debug "Truncated words[*]: ${words[*]}," - - lastParam=${words[-1]} - lastChar=${lastParam[-1]} - __goldwarden_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" - - # For zsh, when completing a flag with an = (e.g., goldwarden -n=) - # completions must be prefixed with the flag - setopt local_options BASH_REMATCH - if [[ "${lastParam}" =~ '-.*=' ]]; then - # We are dealing with a flag with an = - flagPrefix="-P ${BASH_REMATCH}" - fi - - # Prepare the command to obtain completions - requestComp="${words[1]} __complete ${words[2,-1]}" - if [ "${lastChar}" = "" ]; then - # If the last parameter is complete (there is a space following it) - # We add an extra empty parameter so we can indicate this to the go completion code. - __goldwarden_debug "Adding extra empty parameter" - requestComp="${requestComp} \"\"" - fi - - __goldwarden_debug "About to call: eval ${requestComp}" - - # Use eval to handle any environment variables and such - out=$(eval ${requestComp} 2>/dev/null) - __goldwarden_debug "completion output: ${out}" - - # Extract the directive integer following a : from the last line - local lastLine - while IFS='\n' read -r line; do - lastLine=${line} - done < <(printf "%s\n" "${out[@]}") - __goldwarden_debug "last line: ${lastLine}" - - if [ "${lastLine[1]}" = : ]; then - directive=${lastLine[2,-1]} - # Remove the directive including the : and the newline - local suffix - (( suffix=${#lastLine}+2)) - out=${out[1,-$suffix]} - else - # There is no directive specified. Leave $out as is. - __goldwarden_debug "No directive found. Setting do default" - directive=0 - fi - - __goldwarden_debug "directive: ${directive}" - __goldwarden_debug "completions: ${out}" - __goldwarden_debug "flagPrefix: ${flagPrefix}" - - if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then - __goldwarden_debug "Completion received error. Ignoring completions." - return - fi - - local activeHelpMarker="_activeHelp_ " - local endIndex=${#activeHelpMarker} - local startIndex=$((${#activeHelpMarker}+1)) - local hasActiveHelp=0 - while IFS='\n' read -r comp; do - # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker) - if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then - __goldwarden_debug "ActiveHelp found: $comp" - comp="${comp[$startIndex,-1]}" - if [ -n "$comp" ]; then - compadd -x "${comp}" - __goldwarden_debug "ActiveHelp will need delimiter" - hasActiveHelp=1 - fi - - continue - fi - - if [ -n "$comp" ]; then - # If requested, completions are returned with a description. - # The description is preceded by a TAB character. - # For zsh's _describe, we need to use a : instead of a TAB. - # We first need to escape any : as part of the completion itself. - comp=${comp//:/\\:} - - local tab="$(printf '\t')" - comp=${comp//$tab/:} - - __goldwarden_debug "Adding completion: ${comp}" - completions+=${comp} - lastComp=$comp - fi - done < <(printf "%s\n" "${out[@]}") - - # Add a delimiter after the activeHelp statements, but only if: - # - there are completions following the activeHelp statements, or - # - file completion will be performed (so there will be choices after the activeHelp) - if [ $hasActiveHelp -eq 1 ]; then - if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then - __goldwarden_debug "Adding activeHelp delimiter" - compadd -x "--" - hasActiveHelp=0 - fi - fi - - if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then - __goldwarden_debug "Activating nospace." - noSpace="-S ''" - fi - - if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then - __goldwarden_debug "Activating keep order." - keepOrder="-V" - fi - - if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then - # File extension filtering - local filteringCmd - filteringCmd='_files' - for filter in ${completions[@]}; do - if [ ${filter[1]} != '*' ]; then - # zsh requires a glob pattern to do file filtering - filter="\*.$filter" - fi - filteringCmd+=" -g $filter" - done - filteringCmd+=" ${flagPrefix}" - - __goldwarden_debug "File filtering command: $filteringCmd" - _arguments '*:filename:'"$filteringCmd" - elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then - # File completion for directories only - local subdir - subdir="${completions[1]}" - if [ -n "$subdir" ]; then - __goldwarden_debug "Listing directories in $subdir" - pushd "${subdir}" >/dev/null 2>&1 - else - __goldwarden_debug "Listing directories in ." - fi - - local result - _arguments '*:dirname:_files -/'" ${flagPrefix}" - result=$? - if [ -n "$subdir" ]; then - popd >/dev/null 2>&1 - fi - return $result - else - __goldwarden_debug "Calling _describe" - if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then - __goldwarden_debug "_describe found some completions" - - # Return the success of having called _describe - return 0 - else - __goldwarden_debug "_describe did not find completions." - __goldwarden_debug "Checking if we should do file completion." - if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then - __goldwarden_debug "deactivating file completion" - - # We must return an error code here to let zsh know that there were no - # completions found by _describe; this is what will trigger other - # matching algorithms to attempt to find completions. - # For example zsh can match letters in the middle of words. - return 1 - else - # Perform file completion - __goldwarden_debug "Activating file completion" - - # We must return the result of this command, so it must be the - # last command, or else we must store its result to return it. - _arguments '*:filename:_files'" ${flagPrefix}" - fi - fi - fi -} - -# don't run the completion function when being source-ed or eval-ed -if [ "$funcstack[1]" = "_goldwarden" ]; then - _goldwarden -fi diff --git a/home-manager/bash.nix b/home-manager/bash.nix index 3d9c184f..23127de6 100644 --- a/home-manager/bash.nix +++ b/home-manager/bash.nix @@ -125,7 +125,6 @@ source "${homemade-pkgs.cargo-make-completions}/share/bash-completion/completions/makers-completion.bash" source "${../dependencies/dprint/completions.bash}" - source "${../dependencies/goldwarden/completions.bash}" # Disable `Ctrl + S(no output tty)` ${lib.getBin pkgs.coreutils}/bin/stty stop undef diff --git a/home-manager/common.nix b/home-manager/common.nix index 6359ab27..e406bcf5 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -64,6 +64,9 @@ LESSCHARSET = "utf-8"; STACK_XDG = "https://github.com/commercialhaskell/stack/blob/72f0a1273dd1121740501a159988fc23df2fb362/doc/stack_root.md?plain=1#L7-L11"; + + # Don't add needless quotation in the arguments. For example `pass show 'rclone'` does not work. It should be `pass show rclone`. + RCLONE_PASSWORD_COMMAND = "${lib.getExe pkgs.pass} show rclone"; }; sessionPath = [ diff --git a/home-manager/darwin.nix b/home-manager/darwin.nix index 2706bd82..a9f65f0d 100644 --- a/home-manager/darwin.nix +++ b/home-manager/darwin.nix @@ -16,8 +16,8 @@ lib.mkMerge [ # https://github.com/midchildan/dotfiles/blob/fae87a3ef327c23031d8081333678f9472e4c0ed/nix/home/modules/gnupg/default.nix#L38 xdg.dataFile."gnupg/gpg-agent.conf".text = '' grab - default-cache-ttl 60480000 - max-cache-ttl 60480000 + default-cache-ttl 604800 + max-cache-ttl 604800 pinentry-program ${pkgs.pinentry_mac}/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac ''; }) diff --git a/home-manager/fish.nix b/home-manager/fish.nix index 9a5c7819..3f65132b 100644 --- a/home-manager/fish.nix +++ b/home-manager/fish.nix @@ -18,7 +18,6 @@ # If added here, check the result of `bench_shells`: https://github.com/kachick/dotfiles/pull/423/files#r1503804605 xdg.dataFile."fish/vendor_completions.d/podman.fish".source = "${pkgs.podman}/share/fish/vendor_completions.d/podman.fish"; xdg.dataFile."fish/vendor_completions.d/dprint.fish".source = ../dependencies/dprint/completions.fish; - xdg.dataFile."fish/vendor_completions.d/goldwarden.fish".source = ../dependencies/goldwarden/completions.fish; # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/fish.nix programs.fish = { diff --git a/home-manager/gpg.nix b/home-manager/gpg.nix index 943a9e65..002ef551 100644 --- a/home-manager/gpg.nix +++ b/home-manager/gpg.nix @@ -29,14 +29,12 @@ in # Update [darwin.nix](darwin.nix) if changed this section # - # TODO: Reconsider the ttls with recent use - # # https://superuser.com/questions/624343/keep-gnupg-credentials-cached-for-entire-user-session - defaultCacheTtl = day * 700; + defaultCacheTtl = day * 7; # https://github.com/openbsd/src/blob/862f3f2587ccb85ac6d8602dd1601a861ae5a3e8/usr.bin/ssh/ssh-agent.1#L167-L173 # ssh-agent sets it as infinite by default. So I can relax here (maybe) defaultCacheTtlSsh = day * 30; - maxCacheTtl = day * 700; + maxCacheTtl = day * 7; pinentryPackage = pkgs.pinentry-tty; @@ -62,4 +60,9 @@ in personal-digest-preferences = "SHA512"; }; }; + + # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/password-store.nix + programs.password-store = { + enable = true; + }; } diff --git a/home-manager/linux.nix b/home-manager/linux.nix index aa6a887f..392a48ab 100644 --- a/home-manager/linux.nix +++ b/home-manager/linux.nix @@ -1,9 +1,4 @@ -{ - pkgs, - lib, - homemade-pkgs, - ... -}: +{ pkgs, lib, ... }: # https://github.com/nix-community/home-manager/issues/414#issuecomment-427163925 lib.mkMerge [ @@ -17,9 +12,5 @@ lib.mkMerge [ }; xdg.configFile."hypr/hyprland.conf".source = ../config/hyprland/hyprland.conf; - - # For implementation, handling bitwarden logins which contains space seprared text here looks complex and buggy. So extracted to a script. - # And the dependent goldwarden does not support darwin yet: https://github.com/NixOS/nixpkgs/pull/278362/files#diff-062253d551cb2a1ebc07a298c69c8b69b1fb1152e8b08dc805e170ffe8134ae3R45 - home.sessionVariables.RCLONE_PASSWORD_COMMAND = lib.getExe homemade-pkgs.get-rclone-config-password; }) ] diff --git a/home-manager/packages.nix b/home-manager/packages.nix index 4eabd3ad..f5386e66 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -47,6 +47,8 @@ # GPG gnupg + pass + # Do not specify vim and the plugins at here, it made collisions from home-manager vim module. # See following issues # - https://github.com/kachick/dotfiles/issues/280 diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix index 6c503e01..20538bbb 100644 --- a/home-manager/zsh.nix +++ b/home-manager/zsh.nix @@ -261,7 +261,6 @@ } source "${../dependencies/dprint/completions.zsh}" - source "${../dependencies/goldwarden/completions.zsh}" # Disable `Ctrl + S(no output tty)` ${lib.getBin pkgs.coreutils}/bin/stty stop undef diff --git a/nixos/configuration.nix b/nixos/configuration.nix index e89bd1d9..4ee8ca7b 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -100,8 +100,9 @@ # List packages installed in system profile. To search, run: # $ nix search wget - environment.systemPackages = - (with pkgs; [ + environment.systemPackages = ( + with pkgs; + [ vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. helix micro @@ -133,12 +134,8 @@ docker-compose chawan - ]) - ++ (with edge-pkgs; [ - # 3rd-party bitwarden helper, because of official cli does not have many core features - # Use latest because of nixos-24.05 distributing version has a crucial bug: https://github.com/quexten/goldwarden/issues/190 - goldwarden - ]); + ] + ); # Some programs need SUID wrappers, can be configured further or are # started in user sessions. @@ -161,13 +158,6 @@ # programs.nix-ld.enable = false; - # Prefer NixOS modules rather than home-manager for easy setting up - programs.goldwarden = { - package = edge-pkgs.goldwarden; - enable = true; - useSshAgent = false; - }; - # https://nixos.wiki/wiki/Podman virtualisation = { containers.enable = true; diff --git a/pkgs/bump_completions/bump_completions.bash b/pkgs/bump_completions/bump_completions.bash index 0fc926a8..3164221e 100644 --- a/pkgs/bump_completions/bump_completions.bash +++ b/pkgs/bump_completions/bump_completions.bash @@ -5,11 +5,3 @@ dprint completions fish >./dependencies/dprint/completions.fish git add ./dependencies/dprint git update-index -q --really-refresh git diff-index --quiet HEAD || git commit -m 'Update dprint completions' ./dependencies/dprint - -goldwarden completion bash >./dependencies/goldwarden/completions.bash -goldwarden completion zsh >./dependencies/goldwarden/completions.zsh -goldwarden completion fish >./dependencies/goldwarden/completions.fish - -git add ./dependencies/goldwarden -git update-index -q --really-refresh -git diff-index --quiet HEAD || git commit -m 'Update goldwarden completions' ./dependencies/goldwarden diff --git a/pkgs/bump_completions/default.nix b/pkgs/bump_completions/default.nix index 375efc6c..9b1a9593 100644 --- a/pkgs/bump_completions/default.nix +++ b/pkgs/bump_completions/default.nix @@ -1,11 +1,12 @@ -{ pkgs, edge-pkgs, ... }: +{ pkgs, ... }: pkgs.writeShellApplication rec { name = "bump_completions"; text = builtins.readFile ./${name}.bash; - runtimeInputs = - (with pkgs; [ + runtimeInputs = ( + with pkgs; + [ git dprint - ]) - ++ [ edge-pkgs.goldwarden ]; + ] + ); } diff --git a/pkgs/default.nix b/pkgs/default.nix index 3a33f1a3..0ad172fa 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -59,8 +59,6 @@ posix_shared_functions = pkgs.callPackage ./posix_shared_functions { }; - get-rclone-config-password = import ./get-rclone-config-password { inherit pkgs edge-pkgs; }; - micro-fzfinder = pkgs.callPackage ./micro-fzfinder { }; micro-kdl = pkgs.callPackage ./micro-kdl { }; micro-nordcolors = pkgs.callPackage ./micro-nordcolors { }; diff --git a/pkgs/get-rclone-config-password/default.nix b/pkgs/get-rclone-config-password/default.nix deleted file mode 100644 index 99ab9a01..00000000 --- a/pkgs/get-rclone-config-password/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ edge-pkgs, pkgs, ... }: -pkgs.writeShellApplication rec { - name = "get-rclone-config-password"; - text = builtins.readFile ./${name}.bash; - runtimeInputs = [ edge-pkgs.goldwarden ]; -} diff --git a/pkgs/get-rclone-config-password/get-rclone-config-password.bash b/pkgs/get-rclone-config-password/get-rclone-config-password.bash deleted file mode 100644 index 045a6ecb..00000000 --- a/pkgs/get-rclone-config-password/get-rclone-config-password.bash +++ /dev/null @@ -1,2 +0,0 @@ -# Don't use the uuid for now, and using space separated name is broken when defined in environment variable -goldwarden logins get --name 'Rclone - Configuration Password' From a7b9e0f09e8083573413918e1a2b1536bb571b27 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 4 Oct 2024 13:38:34 +0900 Subject: [PATCH 106/197] Don't consider to use Windows tilling window manager for now Closes GH-725 --- cmd/winit-conf/main.go | 4 - windows/glazewm/README.md | 4 - windows/glazewm/config.yaml | 272 ------------------------------------ 3 files changed, 280 deletions(-) delete mode 100644 windows/glazewm/README.md delete mode 100644 windows/glazewm/config.yaml diff --git a/cmd/winit-conf/main.go b/cmd/winit-conf/main.go index e3f2d327..ad67117f 100644 --- a/cmd/winit-conf/main.go +++ b/cmd/winit-conf/main.go @@ -80,10 +80,6 @@ func provisioners() []provisioner { if err != nil { log.Fatalf("Failed to create path that will have alacritty.toml: %+v", err) } - err = os.MkdirAll(filepath.Join(homePath, ".config", "whkd"), dirPerm) - if err != nil { - log.Fatalf("Failed to create whkd dotfiles directory: %+v", err) - } return []provisioner{ newProvisioner([]string{"config", "starship", "starship.toml"}, []string{homePath, ".config", "starship.toml"}), diff --git a/windows/glazewm/README.md b/windows/glazewm/README.md deleted file mode 100644 index 5ac9163d..00000000 --- a/windows/glazewm/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# GlazeWM - -This config maybe too old.\ -Just keeping settings for now, feel free to remove it. diff --git a/windows/glazewm/config.yaml b/windows/glazewm/config.yaml deleted file mode 100644 index 1be9d170..00000000 --- a/windows/glazewm/config.yaml +++ /dev/null @@ -1,272 +0,0 @@ -general: - # Commands to run when the WM has started (e.g. to run a script or launch - # another application). Here we are running a batch script to start Zebar. - startup_commands: ['shell-exec %userprofile%/.glzr/zebar/start.bat'] - - # Whether to automatically focus windows underneath the cursor. - focus_follows_cursor: false - - # Whether to switch back and forth between the previously focused - # workspace when focusing the current workspace. - toggle_workspace_on_refocus: false - - cursor_jump: - # Whether to automatically move the cursor on the specified trigger. - enabled: true - - # Trigger for cursor jump: - # - 'monitor_focus': Jump when focus changes between monitors. - # - 'window_focus': Jump when focus changes between windows. - trigger: 'monitor_focus' - -gaps: - # Gap between adjacent windows. - inner_gap: '20px' - - # Gap between windows and the screen edge. - outer_gap: - top: '60px' - right: '20px' - bottom: '20px' - left: '20px' - -window_effects: - # Visual effects to apply to the focused window. - focused_window: - # Highlight the window with a colored border. - # ** Exclusive to Windows 11 due to API limitations. - border: - enabled: true - color: '#8dbcff' - - # Visual effects to apply to non-focused windows. - other_windows: - border: - enabled: true - color: '#a1a1a1' - -window_behavior: - # New windows are created in this state whenever possible. - # Allowed values: 'tiling', 'floating'. - initial_state: 'tiling' - - # Sets the default options for when a new window is created. This also - # changes the defaults for when the state change commands, like - # `set-floating`, are used without any flags. - state_defaults: - floating: - # Whether to center floating windows by default. - centered: true - - # Whether to show floating windows as always on top. - shown_on_top: false - - fullscreen: - # Maximize the window if possible. If the window doesn't have a - # maximize button, then it'll be fullscreen'ed normally instead. - maximized: false - - # Whether to show fullscreen windows as always on top. - shown_on_top: false - -workspaces: - - name: '1' - - name: '2' - - name: '3' - - name: '4' - - name: '5' - - name: '6' - - name: '7' - - name: '8' - - name: '9' - -window_rules: - - commands: ['ignore'] - match: - # Ignores any Zebar windows. - - window_process: { equals: 'zebar' } - - # Ignores picture-in-picture windows for browsers. - - window_title: { regex: '[Pp]icture.in.[Pp]icture' } - window_class: { regex: 'Chrome_WidgetWin_1|MozillaDialogClass' } - - # Ignore rules for various 3rd-party apps. - - window_process: { equals: 'PowerToys.PowerAccent' } - - window_process: { equals: 'Lively' } - window_class: { regex: 'HwndWrapper*' } - -binding_modes: - # When enabled, the focused window can be resized via arrow keys or HJKL. - - name: 'resize' - keybindings: - - commands: ['resize --width -2%'] - bindings: ['h', 'left'] - - commands: ['resize --width +2%'] - bindings: ['l', 'right'] - - commands: ['resize --height +2%'] - bindings: ['k', 'up'] - - commands: ['resize --height -2%'] - bindings: ['j', 'down'] - # Press enter/escape to return to default keybindings. - - commands: ['wm-disable-binding-mode --name resize'] - bindings: ['escape', 'enter'] - - # When enabled, all keybindings are disabled except for alt+shift+p which - # returns to default keybindings. - - name: 'pause' - keybindings: - - commands: ['wm-disable-binding-mode --name pause'] - bindings: ['alt+shift+p'] - -keybindings: - # Shift focus in a given direction. - - commands: ['focus --direction left'] - bindings: ['alt+h', 'alt+left'] - - commands: ['focus --direction right'] - bindings: ['alt+l', 'alt+right'] - - commands: ['focus --direction up'] - bindings: ['alt+k', 'alt+up'] - - commands: ['focus --direction down'] - bindings: ['alt+j', 'alt+down'] - - # Move focused window in a given direction. - - commands: ['move --direction left'] - bindings: ['alt+shift+h', 'alt+shift+left'] - - commands: ['move --direction right'] - bindings: ['alt+shift+l', 'alt+shift+right'] - - commands: ['move --direction up'] - bindings: ['alt+shift+k', 'alt+shift+up'] - - commands: ['move --direction down'] - bindings: ['alt+shift+j', 'alt+shift+down'] - - # Resize focused window by a percentage or pixel amount. - - commands: ['resize --width -2%'] - bindings: ['alt+u'] - - commands: ['resize --width +2%'] - bindings: ['alt+p'] - - commands: ['resize --height +2%'] - bindings: ['alt+o'] - - commands: ['resize --height -2%'] - bindings: ['alt+i'] - - # As an alternative to the resize keybindings above, resize mode enables - # resizing via arrow keys or HJKL. The binding mode is defined above with - # the name 'resize'. - - commands: ['wm-enable-binding-mode --name resize'] - bindings: ['alt+r'] - - # Disables all keybindings until alt+shift+p is pressed again. - - commands: ['wm-enable-binding-mode --name pause'] - bindings: ['alt+shift+p'] - - # Change tiling direction. This determines where new tiling windows will - # be inserted. - - commands: ['toggle-tiling-direction'] - bindings: ['alt+v'] - - # Change focus from tiling windows -> floating -> fullscreen. - - commands: ['wm-cycle-focus'] - # https://github.com/glzr-io/glazewm/issues/648 - # bindings: ['alt+space'] - bindings: [] - - # Change the focused window to be floating. - - commands: ['toggle-floating --centered'] - bindings: ['alt+shift+space'] - - # Change the focused window to be tiling. - - commands: ['toggle-tiling'] - bindings: ['alt+t'] - - # Change the focused window to be fullscreen. - - commands: ['toggle-fullscreen'] - # bindings: ['alt+f'] - bindings: ['alt+m'] - - # Minimize focused window. - - commands: ['toggle-minimized'] - # bindings: ['alt+m'] - bindings: [] - - # Close focused window. - - commands: ['close'] - bindings: ['alt+shift+q'] - - # Kill GlazeWM process safely. - - commands: ['wm-exit'] - bindings: ['alt+shift+e'] - - # Re-evaluate configuration file. - - commands: ['wm-reload-config'] - bindings: ['alt+shift+r'] - - # Redraw all windows. - - commands: ['wm-redraw'] - bindings: ['alt+shift+w'] - - # Launch CMD terminal. Alternatively, use `shell-exec wt` or - # `shell-exec %ProgramFiles%/Git/git-bash.exe` to start Windows - # Terminal and Git Bash respectively. - - commands: ['shell-exec cmd'] - bindings: ['alt+enter'] - - # Focus the next/previous workspace defined in `workspaces` config. - - commands: ['focus --next-workspace'] - bindings: ['alt+s'] - - commands: ['focus --prev-workspace'] - bindings: ['alt+a'] - - # Focus the workspace that last had focus. - - commands: ['focus --recent-workspace'] - bindings: ['alt+d'] - - # Change focus to a workspace defined in `workspaces` config. - - commands: ['focus --workspace 1'] - bindings: ['alt+1'] - - commands: ['focus --workspace 2'] - bindings: ['alt+2'] - - commands: ['focus --workspace 3'] - bindings: ['alt+3'] - - commands: ['focus --workspace 4'] - bindings: ['alt+4'] - - commands: ['focus --workspace 5'] - bindings: ['alt+5'] - - commands: ['focus --workspace 6'] - bindings: ['alt+6'] - - commands: ['focus --workspace 7'] - bindings: ['alt+7'] - - commands: ['focus --workspace 8'] - bindings: ['alt+8'] - - commands: ['focus --workspace 9'] - bindings: ['alt+9'] - - # Move the focused window's parent workspace to a monitor in a given - # direction. - - commands: ['move-workspace --direction left'] - bindings: ['alt+shift+a'] - - commands: ['move-workspace --direction right'] - bindings: ['alt+shift+f'] - - commands: ['move-workspace --direction up'] - bindings: ['alt+shift+d'] - - commands: ['move-workspace --direction down'] - bindings: ['alt+shift+s'] - - # Move focused window to a workspace defined in `workspaces` config. - - commands: ['move --workspace 1', 'focus --workspace 1'] - bindings: ['alt+shift+1'] - - commands: ['move --workspace 2', 'focus --workspace 2'] - bindings: ['alt+shift+2'] - - commands: ['move --workspace 3', 'focus --workspace 3'] - bindings: ['alt+shift+3'] - - commands: ['move --workspace 4', 'focus --workspace 4'] - bindings: ['alt+shift+4'] - - commands: ['move --workspace 5', 'focus --workspace 5'] - bindings: ['alt+shift+5'] - - commands: ['move --workspace 6', 'focus --workspace 6'] - bindings: ['alt+shift+6'] - - commands: ['move --workspace 7', 'focus --workspace 7'] - bindings: ['alt+shift+7'] - - commands: ['move --workspace 8', 'focus --workspace 8'] - bindings: ['alt+shift+8'] - - commands: ['move --workspace 9', 'focus --workspace 9'] - bindings: ['alt+shift+9'] From 5f2ecd3e5502a734d3e13090257aac3cb8d023e4 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 4 Oct 2024 18:53:59 +0900 Subject: [PATCH 107/197] Make it possible to use RCLONE_PASSWORD_COMMAND in Windows with current WSL toolset Follow GH-817 --- config/powershell/Profile.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/powershell/Profile.ps1 b/config/powershell/Profile.ps1 index 87458ee4..ccb4f4ac 100644 --- a/config/powershell/Profile.ps1 +++ b/config/powershell/Profile.ps1 @@ -20,6 +20,8 @@ function la { # https://github.com/microsoft/winget-cli/issues/2498#issuecomment-1553863082 $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") +# Specify `bash -i` to run the bash as interactive mode +[Environment]::SetEnvironmentVariable("RCLONE_PASSWORD_COMMAND", 'wsl.exe --exec bash -ic "pass show rclone"') Invoke-Expression (&starship init powershell) Invoke-Expression (& { (zoxide init powershell | Out-String) }) From 2b6689ef51a240ae2ebc3c7d0eed16df9505b33e Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 4 Oct 2024 21:28:13 +0900 Subject: [PATCH 108/197] Introduce nushell again to avoid much slow pwsh (#819) * Introduce nushell again for the Windows daily driver * Add la alias, fzf integration, zoxide, disabling banner for nushell * Update config for Windows Terminal * Update Windows stepup steps for workaround of GH-417 --- .vscode/extensions.json | 3 +- cmd/winit-conf/main.go | 10 + config/nushell/config.nu | 933 ++++++++++++++++++++++++++ config/nushell/env.nu | 106 +++ windows.go | 1 + windows/PowerShell.md | 3 + windows/README.md | 9 +- windows/WindowsTerminal/settings.json | 301 ++------- windows/winget/winget-pkgs-basic.json | 3 + 9 files changed, 1108 insertions(+), 261 deletions(-) create mode 100755 config/nushell/config.nu create mode 100755 config/nushell/env.nu diff --git a/.vscode/extensions.json b/.vscode/extensions.json index dd38ff8b..d300c803 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -12,6 +12,7 @@ "bmalehorn.vscode-fish", "kdl-org.kdl", "JohnnyMorganz.stylua", - "davidanson.vscode-markdownlint" + "davidanson.vscode-markdownlint", + "TheNuProjectContributors.vscode-nushell-lang" ] } diff --git a/cmd/winit-conf/main.go b/cmd/winit-conf/main.go index ad67117f..2eb1b052 100644 --- a/cmd/winit-conf/main.go +++ b/cmd/winit-conf/main.go @@ -72,6 +72,8 @@ func provisioners() []provisioner { // As I understand it, unix like permission masks will work even in windows... const dirPerm = 0750 + // TODO: Replace `filepath.Join(homePath, ".config"...` code with "$env.XDG_CONFIG_HOME" era even through Windows + err = os.MkdirAll(filepath.Join(homePath, ".config", "alacritty", "themes"), dirPerm) if err != nil { log.Fatalf("Failed to create alacritty dotfiles directory: %+v", err) @@ -81,6 +83,11 @@ func provisioners() []provisioner { log.Fatalf("Failed to create path that will have alacritty.toml: %+v", err) } + err = os.MkdirAll(filepath.Join(homePath, ".config", "nushell"), dirPerm) + if err != nil { + log.Fatalf("Failed to create nushell dotfiles directory: %+v", err) + } + return []provisioner{ newProvisioner([]string{"config", "starship", "starship.toml"}, []string{homePath, ".config", "starship.toml"}), @@ -90,6 +97,9 @@ func provisioners() []provisioner { newProvisioner([]string{"config", "alacritty", "themes", "iceberg-dark.toml"}, []string{homePath, ".config", "alacritty", "themes", "iceberg-dark.toml"}), newProvisioner([]string{"config", "alacritty", "alacritty-windows.toml"}, []string{appdataPath, "alacritty", "alacritty.toml"}), + newProvisioner([]string{"config", "nushell", "config.nu"}, []string{homePath, ".config", "nushell", "config.nu"}), + newProvisioner([]string{"config", "nushell", "env.nu"}, []string{homePath, ".config", "nushell", "env.nu"}), + newProvisioner([]string{"windows", "winget", "winget-pkgs-basic.json"}, []string{tmpdirPath, "winget-pkgs-basic.json"}), newProvisioner([]string{"windows", "winget", "winget-pkgs-entertainment.json"}, []string{tmpdirPath, "winget-pkgs-entertainment.json"}), newProvisioner([]string{"windows", "winget", "winget-pkgs-storage.json"}, []string{tmpdirPath, "winget-pkgs-storage.json"}), diff --git a/config/nushell/config.nu b/config/nushell/config.nu new file mode 100755 index 00000000..27e66b90 --- /dev/null +++ b/config/nushell/config.nu @@ -0,0 +1,933 @@ +# Nushell Config File +# +# version = "0.98.0" + +# For more information on defining custom themes, see +# https://www.nushell.sh/book/coloring_and_theming.html +# And here is the theme collection +# https://github.com/nushell/nu_scripts/tree/main/themes +let dark_theme = { + # color for nushell primitives + separator: white + leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off + header: green_bold + empty: blue + # Closures can be used to choose colors for specific values. + # The value (in this case, a bool) is piped into the closure. + # eg) {|| if $in { 'light_cyan' } else { 'light_gray' } } + bool: light_cyan + int: white + filesize: cyan + duration: white + date: purple + range: white + float: white + string: white + nothing: white + binary: white + cell-path: white + row_index: green_bold + record: white + list: white + block: white + hints: dark_gray + search_result: { bg: red fg: white } + shape_and: purple_bold + shape_binary: purple_bold + shape_block: blue_bold + shape_bool: light_cyan + shape_closure: green_bold + shape_custom: green + shape_datetime: cyan_bold + shape_directory: cyan + shape_external: cyan + shape_externalarg: green_bold + shape_external_resolved: light_yellow_bold + shape_filepath: cyan + shape_flag: blue_bold + shape_float: purple_bold + # shapes are used to change the cli syntax highlighting + shape_garbage: { fg: white bg: red attr: b } + shape_glob_interpolation: cyan_bold + shape_globpattern: cyan_bold + shape_int: purple_bold + shape_internalcall: cyan_bold + shape_keyword: cyan_bold + shape_list: cyan_bold + shape_literal: blue + shape_match_pattern: green + shape_matching_brackets: { attr: u } + shape_nothing: light_cyan + shape_operator: yellow + shape_or: purple_bold + shape_pipe: purple_bold + shape_range: yellow_bold + shape_record: cyan_bold + shape_redirection: purple_bold + shape_signature: green_bold + shape_string: green + shape_string_interpolation: cyan_bold + shape_table: blue_bold + shape_variable: purple + shape_vardecl: purple + shape_raw_string: light_purple +} + +let light_theme = { + # color for nushell primitives + separator: dark_gray + leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off + header: green_bold + empty: blue + # Closures can be used to choose colors for specific values. + # The value (in this case, a bool) is piped into the closure. + # eg) {|| if $in { 'dark_cyan' } else { 'dark_gray' } } + bool: dark_cyan + int: dark_gray + filesize: cyan_bold + duration: dark_gray + date: purple + range: dark_gray + float: dark_gray + string: dark_gray + nothing: dark_gray + binary: dark_gray + cell-path: dark_gray + row_index: green_bold + record: dark_gray + list: dark_gray + block: dark_gray + hints: dark_gray + search_result: { fg: white bg: red } + shape_and: purple_bold + shape_binary: purple_bold + shape_block: blue_bold + shape_bool: light_cyan + shape_closure: green_bold + shape_custom: green + shape_datetime: cyan_bold + shape_directory: cyan + shape_external: cyan + shape_externalarg: green_bold + shape_external_resolved: light_purple_bold + shape_filepath: cyan + shape_flag: blue_bold + shape_float: purple_bold + # shapes are used to change the cli syntax highlighting + shape_garbage: { fg: white bg: red attr: b } + shape_glob_interpolation: cyan_bold + shape_globpattern: cyan_bold + shape_int: purple_bold + shape_internalcall: cyan_bold + shape_keyword: cyan_bold + shape_list: cyan_bold + shape_literal: blue + shape_match_pattern: green + shape_matching_brackets: { attr: u } + shape_nothing: light_cyan + shape_operator: yellow + shape_or: purple_bold + shape_pipe: purple_bold + shape_range: yellow_bold + shape_record: cyan_bold + shape_redirection: purple_bold + shape_signature: green_bold + shape_string: green + shape_string_interpolation: cyan_bold + shape_table: blue_bold + shape_variable: purple + shape_vardecl: purple + shape_raw_string: light_purple +} + +# External completer example +# let carapace_completer = {|spans| +# carapace $spans.0 nushell ...$spans | from json +# } + +# The default config record. This is where much of your global configuration is setup. +$env.config = { + show_banner: false # true or false to enable or disable the welcome banner at startup + + ls: { + use_ls_colors: true # use the LS_COLORS environment variable to colorize output + clickable_links: true # enable or disable clickable links. Your terminal has to support links. + } + + rm: { + always_trash: false # always act as if -t was given. Can be overridden with -p + } + + table: { + mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other + index_mode: always # "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column + show_empty: true # show 'empty list' and 'empty record' placeholders for command output + padding: { left: 1, right: 1 } # a left right padding of each column in a table + trim: { + methodology: wrapping # wrapping or truncating + wrapping_try_keep_words: true # A strategy used by the 'wrapping' methodology + truncating_suffix: "..." # A suffix used by the 'truncating' methodology + } + header_on_separator: false # show header text on separator/border line + # abbreviated_row_count: 10 # limit data rows from top and bottom after reaching a set point + } + + error_style: "fancy" # "fancy" or "plain" for screen reader-friendly error messages + + # Whether an error message should be printed if an error of a certain kind is triggered. + display_errors: { + exit_code: false # assume the external command prints an error message + # Core dump errors are always printed, and SIGPIPE never triggers an error. + # The setting below controls message printing for termination by all other signals. + termination_signal: true + } + + # datetime_format determines what a datetime rendered in the shell would look like. + # Behavior without this configuration point will be to "humanize" the datetime display, + # showing something like "a day ago." + datetime_format: { + # normal: '%a, %d %b %Y %H:%M:%S %z' # shows up in displays of variables or other datetime's outside of tables + # table: '%m/%d/%y %I:%M:%S%p' # generally shows up in tabular outputs such as ls. commenting this out will change it to the default human readable datetime format + } + + explore: { + status_bar_background: { fg: "#1D1F21", bg: "#C4C9C6" }, + command_bar_text: { fg: "#C4C9C6" }, + highlight: { fg: "black", bg: "yellow" }, + status: { + error: { fg: "white", bg: "red" }, + warn: {} + info: {} + }, + selected_cell: { bg: light_blue }, + } + + history: { + max_size: 100_000 # Session has to be reloaded for this to take effect + sync_on_enter: true # Enable to share history between multiple sessions, else you have to close the session to write history to file + file_format: "plaintext" # "sqlite" or "plaintext" + isolation: false # only available with sqlite file_format. true enables history isolation, false disables it. true will allow the history to be isolated to the current session using up/down arrows. false will allow the history to be shared across all sessions. + } + + completions: { + case_sensitive: false # set to true to enable case-sensitive completions + quick: true # set this to false to prevent auto-selecting completions when only one remains + partial: true # set this to false to prevent partial filling of the prompt + algorithm: "prefix" # prefix or fuzzy + sort: "smart" # "smart" (alphabetical for prefix matching, fuzzy score for fuzzy matching) or "alphabetical" + external: { + enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up may be very slow + max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options + completer: null # check 'carapace_completer' above as an example + } + use_ls_colors: true # set this to true to enable file/path/directory completions using LS_COLORS + } + + filesize: { + metric: false # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard) + format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, auto + } + + cursor_shape: { + emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (line is the default) + vi_insert: block # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (block is the default) + vi_normal: underscore # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (underscore is the default) + } + + color_config: $dark_theme # if you want a more interesting theme, you can replace the empty record with `$dark_theme`, `$light_theme` or another custom record + footer_mode: 25 # always, never, number_of_rows, auto + float_precision: 2 # the precision for displaying floats in tables + buffer_editor: null # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL + use_ansi_coloring: true + bracketed_paste: true # enable bracketed paste, currently useless on windows + edit_mode: emacs # emacs, vi + shell_integration: { + # osc2 abbreviates the path if in the home_dir, sets the tab/window title, shows the running command in the tab/window title + osc2: true + # osc7 is a way to communicate the path to the terminal, this is helpful for spawning new tabs in the same directory + osc7: true + # osc8 is also implemented as the deprecated setting ls.show_clickable_links, it shows clickable links in ls output if your terminal supports it. show_clickable_links is deprecated in favor of osc8 + osc8: true + # osc9_9 is from ConEmu and is starting to get wider support. It's similar to osc7 in that it communicates the path to the terminal + osc9_9: false + # osc133 is several escapes invented by Final Term which include the supported ones below. + # 133;A - Mark prompt start + # 133;B - Mark prompt end + # 133;C - Mark pre-execution + # 133;D;exit - Mark execution finished with exit code + # This is used to enable terminals to know where the prompt is, the command is, where the command finishes, and where the output of the command is + osc133: true + # osc633 is closely related to osc133 but only exists in visual studio code (vscode) and supports their shell integration features + # 633;A - Mark prompt start + # 633;B - Mark prompt end + # 633;C - Mark pre-execution + # 633;D;exit - Mark execution finished with exit code + # 633;E - Explicitly set the command line with an optional nonce + # 633;P;Cwd= - Mark the current working directory and communicate it to the terminal + # and also helps with the run recent menu in vscode + osc633: true + # reset_application_mode is escape \x1b[?1l and was added to help ssh work better + reset_application_mode: true + } + render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt. + use_kitty_protocol: false # enables keyboard enhancement protocol implemented by kitty console, only if your terminal support this. + highlight_resolved_externals: false # true enables highlighting of external commands in the repl resolved by which. + recursion_limit: 50 # the maximum number of times nushell allows recursion before stopping it + + plugins: {} # Per-plugin configuration. See https://www.nushell.sh/contributor-book/plugins.html#configuration. + + plugin_gc: { + # Configuration for plugin garbage collection + default: { + enabled: true # true to enable stopping of inactive plugins + stop_after: 10sec # how long to wait after a plugin is inactive to stop it + } + plugins: { + # alternate configuration for specific plugins, by name, for example: + # + # gstat: { + # enabled: false + # } + } + } + + hooks: { + pre_prompt: [{ null }] # run before the prompt is shown + pre_execution: [{ null }] # run before the repl input is run + env_change: { + PWD: [{|before, after| null }] # run if the PWD environment is different since the last repl input + } + display_output: "if (term size).columns >= 100 { table -e } else { table }" # run to display the output of a pipeline + command_not_found: { null } # return an error message when a command is not found + } + + menus: [ + # Configuration for default nushell menus + # Note the lack of source parameter + { + name: completion_menu + only_buffer_difference: false + marker: "| " + type: { + layout: columnar + columns: 4 + col_width: 20 # Optional value. If missing all the screen width is used to calculate column width + col_padding: 2 + } + style: { + text: green + selected_text: { attr: r } + description_text: yellow + match_text: { attr: u } + selected_match_text: { attr: ur } + } + } + { + name: ide_completion_menu + only_buffer_difference: false + marker: "| " + type: { + layout: ide + min_completion_width: 0, + max_completion_width: 50, + max_completion_height: 10, # will be limited by the available lines in the terminal + padding: 0, + border: true, + cursor_offset: 0, + description_mode: "prefer_right" + min_description_width: 0 + max_description_width: 50 + max_description_height: 10 + description_offset: 1 + # If true, the cursor pos will be corrected, so the suggestions match up with the typed text + # + # C:\> str + # str join + # str trim + # str split + correct_cursor_pos: false + } + style: { + text: green + selected_text: { attr: r } + description_text: yellow + match_text: { attr: u } + selected_match_text: { attr: ur } + } + } + { + name: history_menu + only_buffer_difference: true + marker: "? " + type: { + layout: list + page_size: 10 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + } + { + name: help_menu + only_buffer_difference: true + marker: "? " + type: { + layout: description + columns: 4 + col_width: 20 # Optional value. If missing all the screen width is used to calculate column width + col_padding: 2 + selection_rows: 4 + description_rows: 10 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + } + ] + + keybindings: [ + { + name: completion_menu + modifier: none + keycode: tab + mode: [emacs vi_normal vi_insert] + event: { + until: [ + { send: menu name: completion_menu } + { send: menunext } + { edit: complete } + ] + } + } + { + name: ide_completion_menu + modifier: control + keycode: char_n + mode: [emacs vi_normal vi_insert] + event: { + until: [ + { send: menu name: ide_completion_menu } + { send: menunext } + { edit: complete } + ] + } + } + { + name: history_menu + modifier: control_shift # Changed from original ctrol to avoid conflict with fzf integration + keycode: char_r + mode: [emacs, vi_insert, vi_normal] + event: { send: menu name: history_menu } + } + # https://github.com/nushell/nushell/issues/1616#issuecomment-2120164422 + { + name: fuzzy_history + modifier: control + keycode: char_r + mode: [emacs, vi_normal, vi_insert] + event: [ + { + send: ExecuteHostCommand + cmd: "commandline edit --insert ( + history + | get command + | reverse + | uniq + | str join (char -i 0) + | fzf + --preview '{}' + --preview-window 'right:30%' + --scheme history + --read0 + --layout reverse + --height 40% + --query (commandline) + | decode utf-8 + | str trim + )" + } + ] + } + { + name: help_menu + modifier: none + keycode: f1 + mode: [emacs, vi_insert, vi_normal] + event: { send: menu name: help_menu } + } + { + name: completion_previous_menu + modifier: shift + keycode: backtab + mode: [emacs, vi_normal, vi_insert] + event: { send: menuprevious } + } + { + name: next_page_menu + modifier: control + keycode: char_x + mode: emacs + event: { send: menupagenext } + } + { + name: undo_or_previous_page_menu + modifier: control + keycode: char_z + mode: emacs + event: { + until: [ + { send: menupageprevious } + { edit: undo } + ] + } + } + { + name: escape + modifier: none + keycode: escape + mode: [emacs, vi_normal, vi_insert] + event: { send: esc } # NOTE: does not appear to work + } + { + name: cancel_command + modifier: control + keycode: char_c + mode: [emacs, vi_normal, vi_insert] + event: { send: ctrlc } + } + { + name: quit_shell + modifier: control + keycode: char_d + mode: [emacs, vi_normal, vi_insert] + event: { send: ctrld } + } + { + name: clear_screen + modifier: control + keycode: char_l + mode: [emacs, vi_normal, vi_insert] + event: { send: clearscreen } + } + { + name: search_history + modifier: control + keycode: char_q + mode: [emacs, vi_normal, vi_insert] + event: { send: searchhistory } + } + { + name: open_command_editor + modifier: control + keycode: char_o + mode: [emacs, vi_normal, vi_insert] + event: { send: openeditor } + } + { + name: move_up + modifier: none + keycode: up + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + { send: menuup } + { send: up } + ] + } + } + { + name: move_down + modifier: none + keycode: down + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + { send: menudown } + { send: down } + ] + } + } + { + name: move_left + modifier: none + keycode: left + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + { send: menuleft } + { send: left } + ] + } + } + { + name: move_right_or_take_history_hint + modifier: none + keycode: right + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + { send: historyhintcomplete } + { send: menuright } + { send: right } + ] + } + } + { + name: move_one_word_left + modifier: control + keycode: left + mode: [emacs, vi_normal, vi_insert] + event: { edit: movewordleft } + } + { + name: move_one_word_right_or_take_history_hint + modifier: control + keycode: right + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + { send: historyhintwordcomplete } + { edit: movewordright } + ] + } + } + { + name: move_to_line_start + modifier: none + keycode: home + mode: [emacs, vi_normal, vi_insert] + event: { edit: movetolinestart } + } + { + name: move_to_line_start + modifier: control + keycode: char_a + mode: [emacs, vi_normal, vi_insert] + event: { edit: movetolinestart } + } + { + name: move_to_line_end_or_take_history_hint + modifier: none + keycode: end + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + { send: historyhintcomplete } + { edit: movetolineend } + ] + } + } + { + name: move_to_line_end_or_take_history_hint + modifier: control + keycode: char_e + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + { send: historyhintcomplete } + { edit: movetolineend } + ] + } + } + { + name: move_to_line_start + modifier: control + keycode: home + mode: [emacs, vi_normal, vi_insert] + event: { edit: movetolinestart } + } + { + name: move_to_line_end + modifier: control + keycode: end + mode: [emacs, vi_normal, vi_insert] + event: { edit: movetolineend } + } + { + name: move_up + modifier: control + keycode: char_p + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + { send: menuup } + { send: up } + ] + } + } + { + name: move_down + modifier: control + keycode: char_t + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + { send: menudown } + { send: down } + ] + } + } + { + name: delete_one_character_backward + modifier: none + keycode: backspace + mode: [emacs, vi_insert] + event: { edit: backspace } + } + { + name: delete_one_word_backward + modifier: control + keycode: backspace + mode: [emacs, vi_insert] + event: { edit: backspaceword } + } + { + name: delete_one_character_forward + modifier: none + keycode: delete + mode: [emacs, vi_insert] + event: { edit: delete } + } + { + name: delete_one_character_forward + modifier: control + keycode: delete + mode: [emacs, vi_insert] + event: { edit: delete } + } + { + name: delete_one_character_backward + modifier: control + keycode: char_h + mode: [emacs, vi_insert] + event: { edit: backspace } + } + { + name: delete_one_word_backward + modifier: control + keycode: char_w + mode: [emacs, vi_insert] + event: { edit: backspaceword } + } + { + name: move_left + modifier: none + keycode: backspace + mode: vi_normal + event: { edit: moveleft } + } + { + name: newline_or_run_command + modifier: none + keycode: enter + mode: emacs + event: { send: enter } + } + { + name: move_left + modifier: control + keycode: char_b + mode: emacs + event: { + until: [ + { send: menuleft } + { send: left } + ] + } + } + { + name: move_right_or_take_history_hint + modifier: control + keycode: char_f + mode: emacs + event: { + until: [ + { send: historyhintcomplete } + { send: menuright } + { send: right } + ] + } + } + { + name: redo_change + modifier: control + keycode: char_g + mode: emacs + event: { edit: redo } + } + { + name: undo_change + modifier: control + keycode: char_z + mode: emacs + event: { edit: undo } + } + { + name: paste_before + modifier: control + keycode: char_y + mode: emacs + event: { edit: pastecutbufferbefore } + } + { + name: cut_word_left + modifier: control + keycode: char_w + mode: emacs + event: { edit: cutwordleft } + } + { + name: cut_line_to_end + modifier: control + keycode: char_k + mode: emacs + event: { edit: cuttolineend } + } + { + name: cut_line_from_start + modifier: control + keycode: char_u + mode: emacs + event: { edit: cutfromstart } + } + { + name: swap_graphemes + modifier: control + keycode: char_t + mode: emacs + event: { edit: swapgraphemes } + } + { + name: move_one_word_left + modifier: alt + keycode: left + mode: emacs + event: { edit: movewordleft } + } + { + name: move_one_word_right_or_take_history_hint + modifier: alt + keycode: right + mode: emacs + event: { + until: [ + { send: historyhintwordcomplete } + { edit: movewordright } + ] + } + } + { + name: move_one_word_left + modifier: alt + keycode: char_b + mode: emacs + event: { edit: movewordleft } + } + { + name: move_one_word_right_or_take_history_hint + modifier: alt + keycode: char_f + mode: emacs + event: { + until: [ + { send: historyhintwordcomplete } + { edit: movewordright } + ] + } + } + { + name: delete_one_word_forward + modifier: alt + keycode: delete + mode: emacs + event: { edit: deleteword } + } + { + name: delete_one_word_backward + modifier: alt + keycode: backspace + mode: emacs + event: { edit: backspaceword } + } + { + name: delete_one_word_backward + modifier: alt + keycode: char_m + mode: emacs + event: { edit: backspaceword } + } + { + name: cut_word_to_right + modifier: alt + keycode: char_d + mode: emacs + event: { edit: cutwordright } + } + { + name: upper_case_word + modifier: alt + keycode: char_u + mode: emacs + event: { edit: uppercaseword } + } + { + name: lower_case_word + modifier: alt + keycode: char_l + mode: emacs + event: { edit: lowercaseword } + } + { + name: capitalize_char + modifier: alt + keycode: char_c + mode: emacs + event: { edit: capitalizechar } + } + # The following bindings with `*system` events require that Nushell has + # been compiled with the `system-clipboard` feature. + # If you want to use the system clipboard for visual selection or to + # paste directly, uncomment the respective lines and replace the version + # using the internal clipboard. + { + name: copy_selection + modifier: control_shift + keycode: char_c + mode: emacs + event: { edit: copyselection } + # event: { edit: copyselectionsystem } + } + { + name: cut_selection + modifier: control_shift + keycode: char_x + mode: emacs + event: { edit: cutselection } + # event: { edit: cutselectionsystem } + } + # { + # name: paste_system + # modifier: control_shift + # keycode: char_v + # mode: emacs + # event: { edit: pastesystem } + # } + { + name: select_all + modifier: control_shift + keycode: char_a + mode: emacs + event: { edit: selectall } + } + ] +} + +use ~/.cache/starship/init.nu + +source ~/.zoxide.nu + +alias la = ls --all diff --git a/config/nushell/env.nu b/config/nushell/env.nu new file mode 100755 index 00000000..03a6e276 --- /dev/null +++ b/config/nushell/env.nu @@ -0,0 +1,106 @@ +# Nushell Environment Config File +# +# version = "0.98.0" + +def create_left_prompt [] { + let dir = match (do --ignore-shell-errors { $env.PWD | path relative-to $nu.home-path }) { + null => $env.PWD + '' => '~' + $relative_pwd => ([~ $relative_pwd] | path join) + } + + let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold }) + let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold }) + let path_segment = $"($path_color)($dir)(ansi reset)" + + $path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)" +} + +def create_right_prompt [] { + # create a right prompt in magenta with green separators and am/pm underlined + let time_segment = ([ + (ansi reset) + (ansi magenta) + (date now | format date '%x %X') # try to respect user's locale + ] | str join | str replace --regex --all "([/:])" $"(ansi green)${1}(ansi magenta)" | + str replace --regex --all "([AP]M)" $"(ansi magenta_underline)${1}") + + let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([ + (ansi rb) + ($env.LAST_EXIT_CODE) + ] | str join) + } else { "" } + + ([$last_exit_code, (char space), $time_segment] | str join) +} + +# Use nushell functions to define your right and left prompt +$env.PROMPT_COMMAND = {|| create_left_prompt } +# FIXME: This default is not implemented in rust code as of 2023-09-08. +$env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt } + +# The prompt indicators are environmental variables that represent +# the state of the prompt +$env.PROMPT_INDICATOR = {|| "> " } +$env.PROMPT_INDICATOR_VI_INSERT = {|| ": " } +$env.PROMPT_INDICATOR_VI_NORMAL = {|| "> " } +$env.PROMPT_MULTILINE_INDICATOR = {|| "::: " } + +# If you want previously entered commands to have a different prompt from the usual one, +# you can uncomment one or more of the following lines. +# This can be useful if you have a 2-line prompt and it's taking up a lot of space +# because every command entered takes up 2 lines instead of 1. You can then uncomment +# the line below so that previously entered commands show with a single `🚀`. +# $env.TRANSIENT_PROMPT_COMMAND = {|| "🚀 " } +# $env.TRANSIENT_PROMPT_INDICATOR = {|| "" } +# $env.TRANSIENT_PROMPT_INDICATOR_VI_INSERT = {|| "" } +# $env.TRANSIENT_PROMPT_INDICATOR_VI_NORMAL = {|| "" } +# $env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = {|| "" } +# $env.TRANSIENT_PROMPT_COMMAND_RIGHT = {|| "" } + +# Specifies how environment variables are: +# - converted from a string to a value on Nushell startup (from_string) +# - converted from a value back to a string when running external commands (to_string) +# Note: The conversions happen *after* config.nu is loaded +$env.ENV_CONVERSIONS = { + "PATH": { + from_string: { |s| $s | split row (char esep) | path expand --no-symlink } + to_string: { |v| $v | path expand --no-symlink | str join (char esep) } + } + "Path": { + from_string: { |s| $s | split row (char esep) | path expand --no-symlink } + to_string: { |v| $v | path expand --no-symlink | str join (char esep) } + } +} + +# Directories to search for scripts when calling source or use +# The default for this is $nu.default-config-dir/scripts +$env.NU_LIB_DIRS = [ + ($nu.default-config-dir | path join 'scripts') # add /scripts + ($nu.data-dir | path join 'completions') # default home for nushell completions +] + +# Directories to search for plugin binaries when calling register +# The default for this is $nu.default-config-dir/plugins +$env.NU_PLUGIN_DIRS = [ + ($nu.default-config-dir | path join 'plugins') # add /plugins +] + +# To add entries to PATH (on Windows you might use Path), you can use the following pattern: +# $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path') +# An alternate way to add entries to $env.PATH is to use the custom command `path add` +# which is built into the nushell stdlib: +# use std "path add" +# $env.PATH = ($env.PATH | split row (char esep)) +# path add /some/path +# path add ($env.CARGO_HOME | path join "bin") +# path add ($env.HOME | path join ".local" "bin") +# $env.PATH = ($env.PATH | uniq) + +# To load from a custom file you can use: +# source ($nu.default-config-dir | path join 'custom.nu') + +mkdir ~/.cache/starship +starship init nu | save -f ~/.cache/starship/init.nu + +zoxide init nushell | save -f ~/.zoxide.nu diff --git a/windows.go b/windows.go index 3877794a..8fa15a3b 100644 --- a/windows.go +++ b/windows.go @@ -4,6 +4,7 @@ import "embed" //go:embed all:windows/* //go:embed config/powershell/* +//go:embed config/nushell/* //go:embed config/starship/* //go:embed config/alacritty/* var WindowsAssets embed.FS diff --git a/windows/PowerShell.md b/windows/PowerShell.md index 8dfbefd6..2f7ca4cf 100644 --- a/windows/PowerShell.md +++ b/windows/PowerShell.md @@ -36,6 +36,9 @@ Reason: ngen.exe cannot compile latest pwsh One more noting, if you cannot find ngen.exe, dig under "C:\Windows\Microsoft.NET\Framework" as "C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe" +However, for my experience, pwsh is still much slow.\ +I didn't try disabling defenders, but using nushell might be better for the Windows daily driver. + ## How to write PowerShell scripts? - diff --git a/windows/README.md b/windows/README.md index a57d636a..515c95ca 100644 --- a/windows/README.md +++ b/windows/README.md @@ -4,7 +4,14 @@ Basically following codes will be done in PowerShell -1. Download the windows helper binaries from [GitHub releases](https://github.com/kachick/dotfiles/releases) or uploaded artifacts in [each workflow](https://github.com/kachick/dotfiles/actions/workflows/windows.yml) summary +1. Enable `Sudo` features in Windows. Windows tells us how to enable it at first use +1. Set `$env.XDG_CONFIG_HOME` in Windows system wide. At least, nushell respects it ([Not all of "XDG Base Directory"](https://github.com/nushell/nushell/issues/10100)) + + ```pwsh + sudo pwsh --command '[Environment]::SetEnvironmentVariable("XDG_CONFIG_HOME", "$HOME\.config", "Machine")' + ``` + +1. Download windows helper binary from [artifacts](https://github.com/kachick/dotfiles/actions/workflows/windows.yml) 1. New session of pwsh ```pwsh diff --git a/windows/WindowsTerminal/settings.json b/windows/WindowsTerminal/settings.json index bd0e878c..3f59419f 100644 --- a/windows/WindowsTerminal/settings.json +++ b/windows/WindowsTerminal/settings.json @@ -7,14 +7,17 @@ "action": "copy", "singleLine": false }, + "id": "User.copy.644BA8F2", "keys": "ctrl+c" }, { "command": "paste", + "id": "User.paste", "keys": "ctrl+v" }, { "command": "find", + "id": "User.find", "keys": "ctrl+shift+f" }, { @@ -23,12 +26,13 @@ "split": "auto", "splitMode": "duplicate" }, + "id": "User.splitPane.A6751878", "keys": "alt+shift+d" } ], "copyFormatting": "none", "copyOnSelect": true, - "defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}", + "defaultProfile": "{47302f9c-1ac4-566c-aa3e-8cf29889d6ab}", "newTabMenu": [ { "type": "remainingProfiles" @@ -47,6 +51,31 @@ "useAcrylic": false }, "list": [ + { + "guid": "{47302f9c-1ac4-566c-aa3e-8cf29889d6ab}", + "hidden": false, + "name": "Nushell", + "source": "nu" + }, + { + "elevate": false, + "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", + "hidden": false, + "name": "PowerShell", + "source": "Windows.Terminal.PowershellCore" + }, + { + "guid": "{d8e96812-b789-5068-a5ae-10b2fb53e95f}", + "hidden": false, + "name": "Ubuntu 24.04.1 LTS", + "source": "CanonicalGroupLimited.Ubuntu24.04LTS_79rhkp1fndgsc" + }, + { + "guid": "{963ff2f7-6aed-5ce3-9d91-90d99571f53a}", + "hidden": true, + "name": "Ubuntu-24.04", + "source": "Windows.Terminal.Wsl" + }, { "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", @@ -66,76 +95,28 @@ "source": "Windows.Terminal.Azure" }, { - "elevate": false, - "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", + "commandline": "C:\\Windows\\system32\\wsl.exe -d NixOS", + "guid": "{588d0238-6339-4ad0-9e2f-c7cc93182b93}", "hidden": false, - "name": "PowerShell", - "source": "Windows.Terminal.PowershellCore" + "icon": "C:\\Tools\\7c162f0a-1b4e-4c72-b6c7-1428a7346656.png", + "name": "NixOS", + "startingDirectory": "~" }, { - "guid": "{51855cb2-8cce-5362-8f54-464b92b32386}", - "hidden": true, - "name": "Ubuntu", - "source": "CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc" + "guid": "{8ab8e6f6-35c6-5b46-8419-3e1568105476}", + "hidden": false, + "name": "podman-machine-default", + "source": "Windows.Terminal.Wsl" }, { - "colorScheme": { - "light": "iceberg-dark" - }, - "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}", + "guid": "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}", "hidden": false, - "name": "Ubuntu", + "name": "Debian", "source": "Windows.Terminal.Wsl" } ] }, "schemes": [ - { - "background": "#0C0C0C", - "black": "#0C0C0C", - "blue": "#0037DA", - "brightBlack": "#767676", - "brightBlue": "#3B78FF", - "brightCyan": "#61D6D6", - "brightGreen": "#16C60C", - "brightPurple": "#B4009E", - "brightRed": "#E74856", - "brightWhite": "#F2F2F2", - "brightYellow": "#F9F1A5", - "cursorColor": "#FFFFFF", - "cyan": "#3A96DD", - "foreground": "#CCCCCC", - "green": "#13A10E", - "name": "Campbell", - "purple": "#881798", - "red": "#C50F1F", - "selectionBackground": "#FFFFFF", - "white": "#CCCCCC", - "yellow": "#C19C00" - }, - { - "background": "#012456", - "black": "#0C0C0C", - "blue": "#0037DA", - "brightBlack": "#767676", - "brightBlue": "#3B78FF", - "brightCyan": "#61D6D6", - "brightGreen": "#16C60C", - "brightPurple": "#B4009E", - "brightRed": "#E74856", - "brightWhite": "#F2F2F2", - "brightYellow": "#F9F1A5", - "cursorColor": "#FFFFFF", - "cyan": "#3A96DD", - "foreground": "#CCCCCC", - "green": "#13A10E", - "name": "Campbell Powershell", - "purple": "#881798", - "red": "#C50F1F", - "selectionBackground": "#FFFFFF", - "white": "#CCCCCC", - "yellow": "#C19C00" - }, { "background": "#141B1E", "black": "#232A2D", @@ -228,52 +209,6 @@ "white": "#FFFFFF", "yellow": "#FFD700" }, - { - "background": "#282C34", - "black": "#282C34", - "blue": "#61AFEF", - "brightBlack": "#5A6374", - "brightBlue": "#61AFEF", - "brightCyan": "#56B6C2", - "brightGreen": "#98C379", - "brightPurple": "#C678DD", - "brightRed": "#E06C75", - "brightWhite": "#DCDFE4", - "brightYellow": "#E5C07B", - "cursorColor": "#FFFFFF", - "cyan": "#56B6C2", - "foreground": "#DCDFE4", - "green": "#98C379", - "name": "One Half Dark", - "purple": "#C678DD", - "red": "#E06C75", - "selectionBackground": "#FFFFFF", - "white": "#DCDFE4", - "yellow": "#E5C07B" - }, - { - "background": "#FAFAFA", - "black": "#383A42", - "blue": "#0184BC", - "brightBlack": "#4F525D", - "brightBlue": "#61AFEF", - "brightCyan": "#56B5C1", - "brightGreen": "#98C379", - "brightPurple": "#C577DD", - "brightRed": "#DF6C75", - "brightWhite": "#FFFFFF", - "brightYellow": "#E4C07A", - "cursorColor": "#4F525D", - "cyan": "#0997B3", - "foreground": "#383A42", - "green": "#50A14F", - "name": "One Half Light", - "purple": "#A626A4", - "red": "#E45649", - "selectionBackground": "#FFFFFF", - "white": "#FAFAFA", - "yellow": "#C18301" - }, { "background": "#1E2127", "black": "#1E2127", @@ -320,52 +255,6 @@ "white": "#D9D9D9", "yellow": "#EBC17A" }, - { - "background": "#002B36", - "black": "#002B36", - "blue": "#268BD2", - "brightBlack": "#073642", - "brightBlue": "#839496", - "brightCyan": "#93A1A1", - "brightGreen": "#586E75", - "brightPurple": "#6C71C4", - "brightRed": "#CB4B16", - "brightWhite": "#FDF6E3", - "brightYellow": "#657B83", - "cursorColor": "#FFFFFF", - "cyan": "#2AA198", - "foreground": "#839496", - "green": "#859900", - "name": "Solarized Dark", - "purple": "#D33682", - "red": "#DC322F", - "selectionBackground": "#FFFFFF", - "white": "#EEE8D5", - "yellow": "#B58900" - }, - { - "background": "#FDF6E3", - "black": "#002B36", - "blue": "#268BD2", - "brightBlack": "#073642", - "brightBlue": "#839496", - "brightCyan": "#93A1A1", - "brightGreen": "#586E75", - "brightPurple": "#6C71C4", - "brightRed": "#CB4B16", - "brightWhite": "#FDF6E3", - "brightYellow": "#657B83", - "cursorColor": "#002B36", - "cyan": "#2AA198", - "foreground": "#657B83", - "green": "#859900", - "name": "Solarized Light", - "purple": "#D33682", - "red": "#DC322F", - "selectionBackground": "#FFFFFF", - "white": "#EEE8D5", - "yellow": "#B58900" - }, { "background": "#20242D", "black": "#000000", @@ -389,52 +278,6 @@ "white": "#B3B8C3", "yellow": "#E5C179" }, - { - "background": "#000000", - "black": "#000000", - "blue": "#3465A4", - "brightBlack": "#555753", - "brightBlue": "#729FCF", - "brightCyan": "#34E2E2", - "brightGreen": "#8AE234", - "brightPurple": "#AD7FA8", - "brightRed": "#EF2929", - "brightWhite": "#EEEEEC", - "brightYellow": "#FCE94F", - "cursorColor": "#FFFFFF", - "cyan": "#06989A", - "foreground": "#D3D7CF", - "green": "#4E9A06", - "name": "Tango Dark", - "purple": "#75507B", - "red": "#CC0000", - "selectionBackground": "#FFFFFF", - "white": "#D3D7CF", - "yellow": "#C4A000" - }, - { - "background": "#FFFFFF", - "black": "#000000", - "blue": "#3465A4", - "brightBlack": "#555753", - "brightBlue": "#729FCF", - "brightCyan": "#34E2E2", - "brightGreen": "#8AE234", - "brightPurple": "#AD7FA8", - "brightRed": "#EF2929", - "brightWhite": "#EEEEEC", - "brightYellow": "#FCE94F", - "cursorColor": "#000000", - "cyan": "#06989A", - "foreground": "#555753", - "green": "#4E9A06", - "name": "Tango Light", - "purple": "#75507B", - "red": "#CC0000", - "selectionBackground": "#FFFFFF", - "white": "#D3D7CF", - "yellow": "#C4A000" - }, { "background": "#300A24", "black": "#171421", @@ -458,29 +301,6 @@ "white": "#CCCCCC", "yellow": "#A2734C" }, - { - "background": "#000000", - "black": "#000000", - "blue": "#000080", - "brightBlack": "#808080", - "brightBlue": "#0000FF", - "brightCyan": "#00FFFF", - "brightGreen": "#00FF00", - "brightPurple": "#FF00FF", - "brightRed": "#FF0000", - "brightWhite": "#FFFFFF", - "brightYellow": "#FFFF00", - "cursorColor": "#FFFFFF", - "cyan": "#008080", - "foreground": "#C0C0C0", - "green": "#008000", - "name": "Vintage", - "purple": "#800080", - "red": "#800000", - "selectionBackground": "#FFFFFF", - "white": "#C0C0C0", - "yellow": "#808000" - }, { "background": "#161821", "black": "#1E2132", @@ -552,42 +372,5 @@ } ], "theme": "dark", - "themes": [ - { - "name": "legacyDark", - "tab": { - "background": null, - "showCloseButton": "always", - "unfocusedBackground": null - }, - "window": { - "applicationTheme": "dark", - "useMica": false - } - }, - { - "name": "legacyLight", - "tab": { - "background": null, - "showCloseButton": "always", - "unfocusedBackground": null - }, - "window": { - "applicationTheme": "light", - "useMica": false - } - }, - { - "name": "legacySystem", - "tab": { - "background": null, - "showCloseButton": "always", - "unfocusedBackground": null - }, - "window": { - "applicationTheme": "system", - "useMica": false - } - } - ] + "themes": [] } diff --git a/windows/winget/winget-pkgs-basic.json b/windows/winget/winget-pkgs-basic.json index bbfe9f99..c246ff0a 100644 --- a/windows/winget/winget-pkgs-basic.json +++ b/windows/winget/winget-pkgs-basic.json @@ -52,6 +52,9 @@ { "PackageIdentifier": "Microsoft.PowerShell" }, + { + "PackageIdentifier": "Nushell.Nushell" + }, { "PackageIdentifier": "Alacritty.Alacritty" }, From fce56ac0563cf20af8b98ca887008f47e95d6697 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 4 Oct 2024 21:32:10 +0900 Subject: [PATCH 109/197] Remove outdated section for note of Dropbox --- windows/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/windows/README.md b/windows/README.md index 515c95ca..a4d96896 100644 --- a/windows/README.md +++ b/windows/README.md @@ -41,8 +41,6 @@ Basically following codes will be done in PowerShell ``` 1. Remove needless pre-installed tools. Pick up from [bulk-uninstall.ps](./winget/bulk-uninstall.ps1) -1. If you are still using Dropbox, Change Dropbox storage path from `C:\Users`, default path made problems in System Restore.\ - See for detail 1. Enable Bitlocker and backup the restore key ## I forgot to backup Bitlocker restore key 😋 From 780ff85355ca2242624d946d6c0c8988049283e4 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 4 Oct 2024 21:59:57 +0900 Subject: [PATCH 110/197] Display OS indicator in prompt to clarify WSL, VM, containers and the host --- config/starship/starship.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/starship/starship.toml b/config/starship/starship.toml index 2fff792f..ab3d7ca1 100644 --- a/config/starship/starship.toml +++ b/config/starship/starship.toml @@ -20,6 +20,7 @@ $python\ $deno\ $nodejs\ $cmd_duration\ +$os\ $container\ $nix_shell\ $shell\ @@ -86,3 +87,6 @@ bash_indicator = 'bash' [container] disabled = false + +[os] +disabled = false From fb0becca32cea82f102a6ceed4160651e9a5391a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 5 Oct 2024 10:37:38 +0900 Subject: [PATCH 111/197] Sort la result in nushell --- config/nushell/config.nu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/nushell/config.nu b/config/nushell/config.nu index 27e66b90..ed1b4d51 100755 --- a/config/nushell/config.nu +++ b/config/nushell/config.nu @@ -930,4 +930,4 @@ use ~/.cache/starship/init.nu source ~/.zoxide.nu -alias la = ls --all +def la [] { ls --all | sort-by type modified } From 6a7ebf1c0effc38d00eb84d08ff1b96b2f0ff656 Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 00:41:14 +0000 Subject: [PATCH 112/197] flake.lock: Update (#821) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/27e30d177e57d912d614c88c622dcfdb2e6e6515?narHash=sha256-HP89HZOT0ReIbI7IJZJQoJgxvB2Tn28V6XS3MNKnfLs%3D' (2024-10-01) → 'github:NixOS/nixpkgs/bc947f541ae55e999ffdb4013441347d83b00feb?narHash=sha256-NOiTvBbRLIOe5F6RbHaAh6%2B%2BBNjsb149fGZd1T4%2BKBg%3D' (2024-10-04) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/1719f27dd95fd4206afb9cec9f415b539978827e?narHash=sha256-9/79hjQc9%2BxyH%2BQxeMcRsA6hDyw6Z9Eo1/oxjvwirLk%3D' (2024-09-30) → 'github:NixOS/nixpkgs/ecbc1ca8ffd6aea8372ad16be9ebbb39889e55b6?narHash=sha256-PbDWAIjKJdlVg%2BqQRhzdSor04bAPApDqIv2DofTyynk%3D' (2024-10-06) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 0662bf44..0daab426 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1727802920, - "narHash": "sha256-HP89HZOT0ReIbI7IJZJQoJgxvB2Tn28V6XS3MNKnfLs=", + "lastModified": 1728018373, + "narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "27e30d177e57d912d614c88c622dcfdb2e6e6515", + "rev": "bc947f541ae55e999ffdb4013441347d83b00feb", "type": "github" }, "original": { @@ -400,11 +400,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1727672256, - "narHash": "sha256-9/79hjQc9+xyH+QxeMcRsA6hDyw6Z9Eo1/oxjvwirLk=", + "lastModified": 1728193676, + "narHash": "sha256-PbDWAIjKJdlVg+qQRhzdSor04bAPApDqIv2DofTyynk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1719f27dd95fd4206afb9cec9f415b539978827e", + "rev": "ecbc1ca8ffd6aea8372ad16be9ebbb39889e55b6", "type": "github" }, "original": { From 7c1c6a3ebd58093d8885937db09c321e22199204 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 00:42:58 +0000 Subject: [PATCH 113/197] Update dependency dprint/dprint-plugin-toml to v0.6.3 (#822) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- dprint.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dprint.json b/dprint.json index e21e1a05..c27dda04 100644 --- a/dprint.json +++ b/dprint.json @@ -21,7 +21,7 @@ "plugins": [ "https://plugins.dprint.dev/json-0.19.3.wasm", "https://plugins.dprint.dev/markdown-0.17.8.wasm", - "https://plugins.dprint.dev/toml-0.6.2.wasm", + "https://plugins.dprint.dev/toml-0.6.3.wasm", "https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm", "https://plugins.dprint.dev/kachick/kdl-0.1.0.wasm" ] From e09ea7ed8d97d65db7d68fae4ce5e9d8ca041270 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 7 Oct 2024 21:10:44 +0900 Subject: [PATCH 114/197] Remove unused markdown-oxide from a zed LSP The official site does not clarify this tool realizes what thing ref: GH-729 --- home-manager/helix.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/home-manager/helix.nix b/home-manager/helix.nix index 9aaad716..9a63d7a6 100644 --- a/home-manager/helix.nix +++ b/home-manager/helix.nix @@ -132,7 +132,6 @@ in formatter = mkDprint "md"; language-servers = [ "marksman" - "markdown-oxide" "typos" ]; } From eba0b5090fbf54a2990ef4f776c18f4ea12b9fe4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:45:37 +0000 Subject: [PATCH 115/197] Bump golang.org/x/sys from 0.25.0 to 0.26.0 (#823) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.25.0 to 0.26.0. - [Commits](https://github.com/golang/sys/compare/v0.25.0...v0.26.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 87d157d6..d978b115 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.22.6 require ( golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b - golang.org/x/sys v0.25.0 + golang.org/x/sys v0.26.0 ) diff --git a/go.sum b/go.sum index d3a3f955..ad4ef33e 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,4 @@ golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b h1:r+vk0EmXNmekl0S0BascoeeoHk/L7wmaW2QF90K+kYI= golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 053937c44737a6bdc8911646161fb0f431a65231 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 8 Oct 2024 13:15:24 +0900 Subject: [PATCH 116/197] Fix to normalize repo name in getrepo (#824) * Add tests for go pkgs * Trim excess prefix and suffix * Clarify vendorHash since go.mod having dependency * Add non git URL for a test case --- Makefile.toml | 14 ++++++ .../default.nix | 2 +- .../go.mod | 2 + .../go.sum | 2 + .../main.go | 23 +++++++--- .../main_test.go | 45 +++++++++++++++++++ 6 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 pkgs/trim-github-user-prefix-for-reponame/go.sum create mode 100644 pkgs/trim-github-user-prefix-for-reponame/main_test.go diff --git a/Makefile.toml b/Makefile.toml index 2fc802c8..efcbfc41 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -78,6 +78,20 @@ args = [ ] [tasks.test-go] +dependencies = [ + 'test-cmd', + 'test-pkg-trim-github-user-prefix-for-reponame', +] + +[tasks.test-cmd] +command = 'go' +args = [ + 'test', + './...', +] + +[tasks.test-pkg-trim-github-user-prefix-for-reponame] +cwd = "./pkgs/trim-github-user-prefix-for-reponame" command = 'go' args = [ 'test', diff --git a/pkgs/trim-github-user-prefix-for-reponame/default.nix b/pkgs/trim-github-user-prefix-for-reponame/default.nix index d2cf45da..8fcedca7 100644 --- a/pkgs/trim-github-user-prefix-for-reponame/default.nix +++ b/pkgs/trim-github-user-prefix-for-reponame/default.nix @@ -3,7 +3,7 @@ pkgs.buildGo122Module rec { pname = "trim-github-user-prefix-for-reponame"; version = "0.0.1"; default = pname; - vendorHash = null; + vendorHash = "sha256-1wycFQdf6sudxnH10xNz1bppRDCQjCz33n+ugP74SdQ="; src = ./.; meta = { diff --git a/pkgs/trim-github-user-prefix-for-reponame/go.mod b/pkgs/trim-github-user-prefix-for-reponame/go.mod index 376c8704..bcf80165 100644 --- a/pkgs/trim-github-user-prefix-for-reponame/go.mod +++ b/pkgs/trim-github-user-prefix-for-reponame/go.mod @@ -1,3 +1,5 @@ module github.com/kachick/dotfiles/pkgs/trim-github-user-prefix-for-reponame go 1.22.6 + +require github.com/google/go-cmp v0.6.0 diff --git a/pkgs/trim-github-user-prefix-for-reponame/go.sum b/pkgs/trim-github-user-prefix-for-reponame/go.sum new file mode 100644 index 00000000..5a8d551d --- /dev/null +++ b/pkgs/trim-github-user-prefix-for-reponame/go.sum @@ -0,0 +1,2 @@ +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= diff --git a/pkgs/trim-github-user-prefix-for-reponame/main.go b/pkgs/trim-github-user-prefix-for-reponame/main.go index 28431f34..776a9a81 100644 --- a/pkgs/trim-github-user-prefix-for-reponame/main.go +++ b/pkgs/trim-github-user-prefix-for-reponame/main.go @@ -7,16 +7,25 @@ import ( "strings" ) +// Can't I use https://github.com/google/go-github or https://github.com/cli/cli for more robust feature? +// They are looks depend on GitHub API, not only for string operations... +func extractRepo(line string) string { + // Using Cut cannot handle `multiple sep as foo/bar/baz`, but I don't need to conisder it for `owner/repo` or `repo` patterns. + base := strings.TrimPrefix(line, "git@github.com:") + base = strings.TrimPrefix(base, "https://github.com/") + base = strings.TrimSuffix(base, ".git") + _, after, found := strings.Cut(base, "/") + if found { + return after + } else { + return line + } +} + func main() { scanner := bufio.NewScanner(os.Stdin) for scanner.Scan() { line := scanner.Text() - // Using Cut cannot handle `multiple sep as foo/bar/baz`, but I don't need to conisder it for `owner/repo` or `repo` patterns. - _, after, found := strings.Cut(line, "/") - if found { - fmt.Println(after) - } else { - fmt.Println(line) - } + fmt.Println(extractRepo(line)) } } diff --git a/pkgs/trim-github-user-prefix-for-reponame/main_test.go b/pkgs/trim-github-user-prefix-for-reponame/main_test.go new file mode 100644 index 00000000..960a65f8 --- /dev/null +++ b/pkgs/trim-github-user-prefix-for-reponame/main_test.go @@ -0,0 +1,45 @@ +package main + +import ( + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestExtractRepo(t *testing.T) { + type testCase struct { + input string + repo string + } + + testCases := map[string]testCase{ + "owner/repo": { + input: "kachick/dotfiles", + repo: "dotfiles", + }, + "repo": { + input: "dotfiles", + repo: "dotfiles", + }, + "SSH": { + input: "git@github.com:kachick/dotfiles.git", + repo: "dotfiles", + }, + "HTTPS": { + input: "https://github.com/kachick/dotfiles.git", + repo: "dotfiles", + }, + "Non Git URL": { + input: "https://github.com/kachick/dotfiles", + repo: "dotfiles", + }, + } + + for description, tc := range testCases { + t.Run(description, func(t *testing.T) { + if diff := cmp.Diff(tc.repo, extractRepo(tc.input)); diff != "" { + t.Errorf("wrong result: %s", diff) + } + }) + } +} From a7297f518ddb1bc9c246c612d26c6a1ed7e62961 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 8 Oct 2024 13:44:28 +0900 Subject: [PATCH 117/197] Simplify reponame util --- .github/dependabot.yml | 2 +- .github/workflows/update-flake-lock-and-ci.yml | 2 +- Makefile.toml | 6 +++--- flake.nix | 2 +- pkgs/default.nix | 4 +--- pkgs/posix_shared_functions/default.nix | 4 ++-- .../default.nix | 2 +- pkgs/reponame/go.mod | 5 +++++ .../go.sum | 0 .../main.go | 2 +- .../main_test.go | 0 pkgs/trim-github-user-prefix-for-reponame/go.mod | 5 ----- 12 files changed, 16 insertions(+), 18 deletions(-) rename pkgs/{trim-github-user-prefix-for-reponame => reponame}/default.nix (84%) create mode 100644 pkgs/reponame/go.mod rename pkgs/{trim-github-user-prefix-for-reponame => reponame}/go.sum (100%) rename pkgs/{trim-github-user-prefix-for-reponame => reponame}/main.go (100%) rename pkgs/{trim-github-user-prefix-for-reponame => reponame}/main_test.go (100%) delete mode 100644 pkgs/trim-github-user-prefix-for-reponame/go.mod diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d7987645..41a3af61 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -15,6 +15,6 @@ updates: schedule: interval: 'weekly' - package-ecosystem: 'gomod' - directory: '/pkgs/trim-github-user-prefix-for-reponame' + directory: '/pkgs/reponame' schedule: interval: 'weekly' diff --git a/.github/workflows/update-flake-lock-and-ci.yml b/.github/workflows/update-flake-lock-and-ci.yml index 470df733..eca4a08c 100644 --- a/.github/workflows/update-flake-lock-and-ci.yml +++ b/.github/workflows/update-flake-lock-and-ci.yml @@ -21,6 +21,6 @@ jobs: pr-title: 'Bump flake.lock and related dependencies' optional-run: | nix run .#bump_completions - nix run .#bump_gomod -- . pkgs/trim-github-user-prefix-for-reponame + nix run .#bump_gomod -- . pkgs/reponame secrets: APP_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} diff --git a/Makefile.toml b/Makefile.toml index efcbfc41..7edfefc8 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -80,7 +80,7 @@ args = [ [tasks.test-go] dependencies = [ 'test-cmd', - 'test-pkg-trim-github-user-prefix-for-reponame', + 'test-pkg-reponame', ] [tasks.test-cmd] @@ -90,8 +90,8 @@ args = [ './...', ] -[tasks.test-pkg-trim-github-user-prefix-for-reponame] -cwd = "./pkgs/trim-github-user-prefix-for-reponame" +[tasks.test-pkg-reponame] +cwd = "./pkgs/reponame" command = 'go' args = [ 'test', diff --git a/flake.nix b/flake.nix index b40b9de6..a9768bdc 100644 --- a/flake.nix +++ b/flake.nix @@ -134,7 +134,7 @@ "git-resolve-conflict" "prs" "nix-hash-url" - "trim-github-user-prefix-for-reponame" + "reponame" "gredit" "renmark" "preview" diff --git a/pkgs/default.nix b/pkgs/default.nix index 0ad172fa..d62e6956 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -50,9 +50,7 @@ prs = import ./prs { inherit pkgs; }; - trim-github-user-prefix-for-reponame = import ./trim-github-user-prefix-for-reponame { - inherit pkgs; - }; + reponame = import ./reponame { inherit pkgs; }; beedii = pkgs.callPackage ./beedii { }; cozette = pkgs.callPackage ./cozette { }; diff --git a/pkgs/posix_shared_functions/default.nix b/pkgs/posix_shared_functions/default.nix index 90212dd9..4ed9d30e 100644 --- a/pkgs/posix_shared_functions/default.nix +++ b/pkgs/posix_shared_functions/default.nix @@ -14,7 +14,7 @@ # How to stop blinking cursor in Linux console? # => https://web-archive-org.translate.goog/web/20220318101402/https://nutr1t07.github.io/post/disable-cursor-blinking-on-linux-console/?_x_tr_sl=auto&_x_tr_tl=ja&_x_tr_hl=ja let - trim-github-user-prefix-for-reponame = pkgs.callPackage ../trim-github-user-prefix-for-reponame { }; + reponame = pkgs.callPackage ../reponame { }; ghqf = pkgs.callPackage ../ghqf { }; fzf-bind-posix-shell-history-to-git-commit-message = pkgs.callPackage ../fzf-bind-posix-shell-history-to-git-commit-message @@ -23,7 +23,7 @@ in pkgs.writeText "posix_shared_functions.sh" ( '' cdrepo() { - local -r query_repoonly="$(echo "$1" | ${lib.getExe trim-github-user-prefix-for-reponame})" + local -r query_repoonly="$(echo "$1" | ${lib.getExe reponame})" local -r repo="$(${lib.getExe ghqf} "$query_repoonly")" if [ -n "$repo" ]; then cd "$(${lib.getExe pkgs.ghq} list --full-path --exact "$repo")" diff --git a/pkgs/trim-github-user-prefix-for-reponame/default.nix b/pkgs/reponame/default.nix similarity index 84% rename from pkgs/trim-github-user-prefix-for-reponame/default.nix rename to pkgs/reponame/default.nix index 8fcedca7..e95271b8 100644 --- a/pkgs/trim-github-user-prefix-for-reponame/default.nix +++ b/pkgs/reponame/default.nix @@ -1,6 +1,6 @@ { pkgs, ... }: pkgs.buildGo122Module rec { - pname = "trim-github-user-prefix-for-reponame"; + pname = "reponame"; version = "0.0.1"; default = pname; vendorHash = "sha256-1wycFQdf6sudxnH10xNz1bppRDCQjCz33n+ugP74SdQ="; diff --git a/pkgs/reponame/go.mod b/pkgs/reponame/go.mod new file mode 100644 index 00000000..e07a18e4 --- /dev/null +++ b/pkgs/reponame/go.mod @@ -0,0 +1,5 @@ +module github.com/kachick/dotfiles/pkgs/reponame + +go 1.22.6 + +require github.com/google/go-cmp v0.6.0 diff --git a/pkgs/trim-github-user-prefix-for-reponame/go.sum b/pkgs/reponame/go.sum similarity index 100% rename from pkgs/trim-github-user-prefix-for-reponame/go.sum rename to pkgs/reponame/go.sum diff --git a/pkgs/trim-github-user-prefix-for-reponame/main.go b/pkgs/reponame/main.go similarity index 100% rename from pkgs/trim-github-user-prefix-for-reponame/main.go rename to pkgs/reponame/main.go index 776a9a81..61808083 100644 --- a/pkgs/trim-github-user-prefix-for-reponame/main.go +++ b/pkgs/reponame/main.go @@ -10,10 +10,10 @@ import ( // Can't I use https://github.com/google/go-github or https://github.com/cli/cli for more robust feature? // They are looks depend on GitHub API, not only for string operations... func extractRepo(line string) string { - // Using Cut cannot handle `multiple sep as foo/bar/baz`, but I don't need to conisder it for `owner/repo` or `repo` patterns. base := strings.TrimPrefix(line, "git@github.com:") base = strings.TrimPrefix(base, "https://github.com/") base = strings.TrimSuffix(base, ".git") + // Using Cut cannot handle `multiple sep as foo/bar/baz`, but I don't need to conisder it for `owner/repo` or `repo` patterns. _, after, found := strings.Cut(base, "/") if found { return after diff --git a/pkgs/trim-github-user-prefix-for-reponame/main_test.go b/pkgs/reponame/main_test.go similarity index 100% rename from pkgs/trim-github-user-prefix-for-reponame/main_test.go rename to pkgs/reponame/main_test.go diff --git a/pkgs/trim-github-user-prefix-for-reponame/go.mod b/pkgs/trim-github-user-prefix-for-reponame/go.mod deleted file mode 100644 index bcf80165..00000000 --- a/pkgs/trim-github-user-prefix-for-reponame/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/kachick/dotfiles/pkgs/trim-github-user-prefix-for-reponame - -go 1.22.6 - -require github.com/google/go-cmp v0.6.0 From cf48b35f66259fd7c4db41e0363112fcb0ee8891 Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 00:38:53 +0000 Subject: [PATCH 118/197] flake.lock: Update (#826) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/bc947f541ae55e999ffdb4013441347d83b00feb?narHash=sha256-NOiTvBbRLIOe5F6RbHaAh6%2B%2BBNjsb149fGZd1T4%2BKBg%3D' (2024-10-04) → 'github:NixOS/nixpkgs/c31898adf5a8ed202ce5bea9f347b1c6871f32d1?narHash=sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw%3D' (2024-10-06) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/ecbc1ca8ffd6aea8372ad16be9ebbb39889e55b6?narHash=sha256-PbDWAIjKJdlVg%2BqQRhzdSor04bAPApDqIv2DofTyynk%3D' (2024-10-06) → 'github:NixOS/nixpkgs/1bfbbbe5bbf888d675397c66bfdb275d0b99361c?narHash=sha256-a0a0M1TmXMK34y3M0cugsmpJ4FJPT/xsblhpiiX1CXo%3D' (2024-10-07) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 0daab426..4d0fea03 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1728018373, - "narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=", + "lastModified": 1728241625, + "narHash": "sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "bc947f541ae55e999ffdb4013441347d83b00feb", + "rev": "c31898adf5a8ed202ce5bea9f347b1c6871f32d1", "type": "github" }, "original": { @@ -400,11 +400,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1728193676, - "narHash": "sha256-PbDWAIjKJdlVg+qQRhzdSor04bAPApDqIv2DofTyynk=", + "lastModified": 1728328465, + "narHash": "sha256-a0a0M1TmXMK34y3M0cugsmpJ4FJPT/xsblhpiiX1CXo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ecbc1ca8ffd6aea8372ad16be9ebbb39889e55b6", + "rev": "1bfbbbe5bbf888d675397c66bfdb275d0b99361c", "type": "github" }, "original": { From 6a110d4468c7aa5d07c0e4365d60f357e28d5254 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 10 Oct 2024 22:15:07 +0900 Subject: [PATCH 119/197] Keep the udev key remapper on NixOS even after being rebooted (#829) Attempt to use services.udev.extraHwdb again with mkBefore and mkAfter Fixes GH-801 --- README.md | 10 +-------- nixos/hardware.nix | 42 ++++++++++++++---------------------- nixos/hosts/moss/default.nix | 7 ++---- 3 files changed, 19 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 88192a21..8aeefbcc 100644 --- a/README.md +++ b/README.md @@ -49,13 +49,6 @@ List defined hostnames nix flake show 'github:kachick/dotfiles' --json | jq '.nixosConfigurations | keys[]' ``` -And you may need to manually update `/etc/udev/hwdb.bin` for remapping keyboards.\ -See [GH-801](https://github.com/kachick/dotfiles/issues/801) for detail. - -```bash -sudo systemd-hwdb update && sudo udevadm trigger -``` - This repository intentionally reverts the home-manager NixOS module.\ So, you should activate the user dotfiles with standalone home-manager even though NixOS. @@ -190,8 +183,7 @@ For NixOS ```bash sudo nixos-rebuild switch --flake ".#$(hostname)" --show-trace && \ - sudo systemd-hwdb update && sudo udevadm trigger && \ - makers apply 'kachick@desktop' + makers apply 'kachick@desktop' ``` If you encounter any errors in the above steps, Check and update CI and [wiki](https://github.com/kachick/dotfiles/wiki). diff --git a/nixos/hardware.nix b/nixos/hardware.nix index ef89e01f..1446dc10 100644 --- a/nixos/hardware.nix +++ b/nixos/hardware.nix @@ -1,29 +1,19 @@ -{ ... }: +{ lib, ... }: { - # services.udev = { - # enable = true; - # # Settings keyremap in raw layer than X. See GH-784 + services.udev = { + enable = true; + # Settings keyremap in raw layer than X. See GH-784 + # + # - Specify hardware names even if `evdev:input:*` working for mostcase. I should care both US and JIS layout + # - How to get the KEYBOARD_KEY_700??: `evtest /dev/input/event??` + # - How to get the hardware name:: `udevadm info --attribute-walk /dev/input/event?? | grep -F 'ATTRS{name}'` + # - How to apply?: Rebuild and reboot. Don't use `sudo systemd-hwdb update && sudo udevadm trigger` except debugging purpose. + extraHwdb = lib.mkBefore '' + evdev:name:Topre REALFORCE 87 US:* + KEYBOARD_KEY_70039=leftctrl # original: capslock - # # Specify hardware names even if `evdev:input:*` working for mostcase - # extraHwdb = '' - # evdev:name:Topre REALFORCE 87 US:* - # # original: capslock - # KEYBOARD_KEY_70039=leftctrl - # ''; - # }; - - # Settings keyremap in raw layer than X. See GH-784 - # Use another filename of "99-local.hwdb"", it is preserved for each host - # - # - Specify hardware names even if `evdev:input:*` working for mostcase. I should care both US and JIS layout - # - How to get the KEYBOARD_KEY_700??: `evtest /dev/input/event??` - # - How to get the hardware name:: `udevadm info --attribute-walk /dev/input/event?? | grep -F 'ATTRS{name}'` - # - How to apply?: After nixos-rebuild switch `sudo systemd-hwdb update && sudo udevadm trigger` - environment.etc."udev/hwdb.d/98-keyboards.hwdb".text = '' - evdev:name:Topre REALFORCE 87 US:* - KEYBOARD_KEY_70039=leftctrl # original: capslock - - evdev:name:Lenovo ThinkPad Compact USB Keyboard with TrackPoint:* # Both US and JIS have same name - KEYBOARD_KEY_70039=leftctrl # original: capslock, Both US and JIS have same keycode for capslock - ''; + evdev:name:Lenovo ThinkPad Compact USB Keyboard with TrackPoint:* # Both US and JIS have same name + KEYBOARD_KEY_70039=leftctrl # original: capslock, Both US and JIS have same keycode for capslock + ''; + }; } diff --git a/nixos/hosts/moss/default.nix b/nixos/hosts/moss/default.nix index 156d2ff5..89fcd544 100644 --- a/nixos/hosts/moss/default.nix +++ b/nixos/hosts/moss/default.nix @@ -1,4 +1,4 @@ -{ ... }: +{ lib, ... }: { networking.hostName = "moss"; @@ -23,10 +23,7 @@ services.xserver.videoDrivers = [ "amdgpu" ]; - # Settings keyremap in raw layer than X. See GH-784 - # Don't use `services.udev.extraHwdb`, it does not create the file at least in NixOS 24.05 - # See https://github.com/NixOS/nixpkgs/issues/182966 for detail - environment.etc."udev/hwdb.d/99-local.hwdb".text = '' + services.udev.extraHwdb = lib.mkAfter '' evdev:name:AT Translated Set 2 keyboard:* KEYBOARD_KEY_3a=leftctrl # original: capslock ''; From a6391114dbbb39303ffa2a055fbc4c2bd0c2aab7 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 11 Oct 2024 03:46:16 +0900 Subject: [PATCH 120/197] Attempt to bump Containerfile base image with renovatebot (#831) Resolves GH-828 --- .github/renovate.json | 3 ++- containers/Containerfile | 2 +- containers/README.md | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index d017effa..c4efd073 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -2,11 +2,12 @@ "$schema": "https://docs.renovatebot.com/renovate-schema.json", "dependencyDashboard": true, "extends": [ + "config:recommended", "github>kachick/renovate-config-dprint#1.3.0", "github>kachick/renovate-config-dprint:self" ], "labels": ["dependencies", "renovate"], - "enabledManagers": ["nix", "regex"], + "enabledManagers": ["nix", "regex", "dockerfile"], "nix": { "enabled": true }, diff --git a/containers/Containerfile b/containers/Containerfile index 9f1805c4..e1408ca4 100644 --- a/containers/Containerfile +++ b/containers/Containerfile @@ -1,5 +1,5 @@ # https://github.com/kachick/containers -FROM ghcr.io/kachick/ubuntu-24.04-nix-systemd:20240515-154517-utc +FROM ghcr.io/kachick/ubuntu-24.04-nix-systemd:latest@sha256:a01a38c42d470ca265e57a91cf82b3fc36efaae5dd6e936f6779aa48fccc973a LABEL org.opencontainers.image.source=https://github.com/kachick/dotfiles LABEL org.opencontainers.image.description="Example by kachick/dotfiles" diff --git a/containers/README.md b/containers/README.md index f7a9ab32..6f4a9df4 100644 --- a/containers/README.md +++ b/containers/README.md @@ -1,5 +1,7 @@ # Containers +Base images are maintained in [another repository](https://github.com/kachick/containers) + ## How to build and test in local ```bash From b177d12751bd0796617708609bbd9ba61be377e5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 18:48:48 +0000 Subject: [PATCH 121/197] Update ghcr.io/kachick/ubuntu-24.04-nix-systemd:latest Docker digest to eb0df86 (#832) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- containers/Containerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/Containerfile b/containers/Containerfile index e1408ca4..1a2f766c 100644 --- a/containers/Containerfile +++ b/containers/Containerfile @@ -1,5 +1,5 @@ # https://github.com/kachick/containers -FROM ghcr.io/kachick/ubuntu-24.04-nix-systemd:latest@sha256:a01a38c42d470ca265e57a91cf82b3fc36efaae5dd6e936f6779aa48fccc973a +FROM ghcr.io/kachick/ubuntu-24.04-nix-systemd:latest@sha256:eb0df8622d8fe4412f1bbfaa56c1228307405b6a9bf95461b22c11a0836b65f8 LABEL org.opencontainers.image.source=https://github.com/kachick/dotfiles LABEL org.opencontainers.image.description="Example by kachick/dotfiles" From 8bd14e0b6e28dee2848f30649ed15120c094b31b Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 11 Oct 2024 04:11:26 +0900 Subject: [PATCH 122/197] Remove needless alacritty from containers (#833) GUI is needless here, keep in NixOS, macOS, Windows --- .github/workflows/ci-home.yml | 1 - home-manager/packages.nix | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-home.yml b/.github/workflows/ci-home.yml index 3185f7df..cf16b257 100644 --- a/.github/workflows/ci-home.yml +++ b/.github/workflows/ci-home.yml @@ -87,7 +87,6 @@ jobs: zsh -c zsh -c 'which la; which p' zsh -c 'ruby --version' zsh -c 'irb --version' - zsh -c 'alacritty --version' zsh -c 'ssh -V' zsh -c 'hx --health' - name: Run homemade commands diff --git a/home-manager/packages.nix b/home-manager/packages.nix index f5386e66..6fc31f3e 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -76,8 +76,6 @@ zellij yazi # prefer the shell wrapper `yy` - alacritty - typos hyperfine difftastic # `difft` @@ -139,6 +137,8 @@ # https://github.com/NixOS/nixpkgs/issues/240819 pinentry_mac + alacritty + # - You can use major Nerd Fonts as `pkgs.nerdfonts.override ...` # - Should have at least 1 composite font that includes Monospace + Japanese + Nerd fonts, # because of alacritty does not have the fallback font feature. https://github.com/alacritty/alacritty/issues/957 From 431bfc4e447e76cb2d72035f7049caaf0a2809b8 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 11 Oct 2024 11:24:17 +0900 Subject: [PATCH 123/197] Uninstall several GUI packages in containers but keeps in NixOS and darwn (#835) * Uninstall several GUI packages in containers but keeps in NixOS and darwn * dconf module doesnt have packages * Fix an attr typo * dconf does not have package, this is correct * Fix to specify uninstalling firefox package from home-manager * Don't install darwin firefox via nixpkgs --- darwin/README.md | 1 + home-manager/firefox.nix | 4 ++++ home-manager/packages.nix | 4 ++++ home-manager/terminals.nix | 1 + 4 files changed, 10 insertions(+) diff --git a/darwin/README.md b/darwin/README.md index 520dff31..8a153265 100644 --- a/darwin/README.md +++ b/darwin/README.md @@ -8,6 +8,7 @@ So you should manually install followings. - [vscode](https://code.visualstudio.com/download) - [zed-editor](https://zed.dev/download) - [podman-desktop](https://podman-desktop.io/downloads) +- [Firefox](https://www.mozilla.org/ja/firefox/all/desktop-release/osx/ja/) ## Limitations diff --git a/home-manager/firefox.nix b/home-manager/firefox.nix index 4e7d80dc..8d539336 100644 --- a/home-manager/firefox.nix +++ b/home-manager/firefox.nix @@ -6,6 +6,10 @@ lib.mkMerge [ # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/firefox.nix programs.firefox = { enable = true; + # In firefox package, use null instead of `pkgs.emptyDirectory` + # - https://github.com/kachick/dotfiles/pull/835#discussion_r1796307643 + # - https://github.com/nix-community/home-manager/blob/342a1d682386d3a1d74f9555cb327f2f311dda6e/modules/programs/firefox/mkFirefoxModule.nix#L264 + package = null; profiles.default = { isDefault = true; settings = { diff --git a/home-manager/packages.nix b/home-manager/packages.nix index 6fc31f3e..f2fdd79a 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -138,6 +138,10 @@ pinentry_mac alacritty + kitty + # foot is only provided for Linux wayland + + # Don't install firefox via nixpkgs for darwin, it is broken https://github.com/NixOS/nixpkgs/blob/bac526a0fe6da6b10cfe2454f62a0defdbf1d898/pkgs/applications/networking/browsers/firefox/packages.nix#L23 # - You can use major Nerd Fonts as `pkgs.nerdfonts.override ...` # - Should have at least 1 composite font that includes Monospace + Japanese + Nerd fonts, diff --git a/home-manager/terminals.nix b/home-manager/terminals.nix index 387492f5..13b55a0e 100644 --- a/home-manager/terminals.nix +++ b/home-manager/terminals.nix @@ -17,6 +17,7 @@ # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/kitty.nix programs.kitty = { enable = true; + package = pkgs.emptyDirectory; theme = "zenwritten_dark"; settings = { shell = lib.getExe pkgs.zsh; From 6f252663f77592d68e6a100d16abbde70312e100 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 11 Oct 2024 15:27:59 +0900 Subject: [PATCH 124/197] Bump macos-14 runner with macos-15 but keeps macos-13 for free intel (#837) --- .github/workflows/ci-go.yml | 2 +- .github/workflows/ci-nix.yml | 2 +- cmd/gen_matrix/main.go | 6 +++--- darwin/README.md | 2 +- flake.nix | 6 ++++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-go.yml b/.github/workflows/ci-go.yml index c8cf6e93..255d62cd 100644 --- a/.github/workflows/ci-go.yml +++ b/.github/workflows/ci-go.yml @@ -27,7 +27,7 @@ jobs: matrix: os: - ubuntu-24.04 - - macos-14 # M1. Doesn't match for my Intel Mac, but preferring with the speed. + - macos-15 # Apple Silicon. Doesn't match for my Intel Mac, but preferring with the speed. - windows-latest runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml index f78e7987..3d40f413 100644 --- a/.github/workflows/ci-nix.yml +++ b/.github/workflows/ci-nix.yml @@ -27,7 +27,7 @@ jobs: matrix: os: - ubuntu-24.04 - - macos-14 # M1. Doesn't match for my Intel Mac, but preferring with the speed. + - macos-15 # Apple Silicon. Doesn't match for my Intel Mac, but preferring with the speed. runs-on: ${{ matrix.os }} timeout-minutes: 30 steps: diff --git a/cmd/gen_matrix/main.go b/cmd/gen_matrix/main.go index 65961e51..197fa4ca 100644 --- a/cmd/gen_matrix/main.go +++ b/cmd/gen_matrix/main.go @@ -24,11 +24,11 @@ func main() { } matrix := Matrix{ - // https://github.com/actions/runner-images/issues/9741#issuecomment-2075259811 + // https://github.com/actions/runner-images/issues/9741#issuecomment-2075259811 Os: []string{ "ubuntu-24.04", - // M1. Doesn't match for my Intel Mac, but preferring with the speed. - "macos-14", + // Apple Silicon. Doesn't match for my Intel Mac, but preferring with the speed. + "macos-15", }, } diff --git a/darwin/README.md b/darwin/README.md index 8a153265..76343e1e 100644 --- a/darwin/README.md +++ b/darwin/README.md @@ -13,4 +13,4 @@ So you should manually install followings. ## Limitations - I only have x86-64 macbook pro, it is much slow in GitHub action macos-13 runner.\ - So preferring macos-14 runner in several place... + So preferring macos-15 runner in several place... diff --git a/flake.nix b/flake.nix index a9768bdc..18401709 100644 --- a/flake.nix +++ b/flake.nix @@ -31,7 +31,9 @@ forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "x86_64-darwin" - # I don't have M1+ mac, providing this for macos-14 free runner https://github.com/actions/runner-images/issues/9741 + # I don't have Apple Silicon machines, providing this for macos-15 free runner + # - https://github.com/actions/runner-images/issues/9741 + # - https://github.com/actions/runner-images/issues/10686 "aarch64-darwin" ]; @@ -257,7 +259,7 @@ } ); - "github-actions@macos-14" = home-manager.lib.homeManagerConfiguration ( + "github-actions@macos-15" = home-manager.lib.homeManagerConfiguration ( aarch64-macOS // { # Prefer "kachick" over "common" only here. From 065fd661a21133a96b8ca9d4e516f75a23b9a980 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 11 Oct 2024 15:38:16 +0900 Subject: [PATCH 125/197] Update darwin note --- darwin/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/darwin/README.md b/darwin/README.md index 76343e1e..13d1fcaf 100644 --- a/darwin/README.md +++ b/darwin/README.md @@ -9,8 +9,9 @@ So you should manually install followings. - [zed-editor](https://zed.dev/download) - [podman-desktop](https://podman-desktop.io/downloads) - [Firefox](https://www.mozilla.org/ja/firefox/all/desktop-release/osx/ja/) +- [cloudflare-warp](https://developers.cloudflare.com/warp-client/get-started/macos/) ## Limitations - I only have x86-64 macbook pro, it is much slow in GitHub action macos-13 runner.\ - So preferring macos-15 runner in several place... + So preferring macos-15 Apple Silicon runner in several place... From 47aaefebed731430685a9025f9b531a966394778 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 11 Oct 2024 16:02:03 +0900 Subject: [PATCH 126/197] Extract darwin note to wiki --- README.md | 2 +- darwin/README.md | 16 +--------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 8aeefbcc..9f0adef4 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ systemd=true' | sudo tee /etc/wsl.conf ## macOS -Activate `kachick@macbook` as Linux and [manually setup some packages](./darwin/README.md). +Activate `kachick@macbook` as Linux and [manually setup some packages](https://github.com/kachick/dotfiles/wiki/macOS). ## Windows diff --git a/darwin/README.md b/darwin/README.md index 13d1fcaf..5bd92e5a 100644 --- a/darwin/README.md +++ b/darwin/README.md @@ -1,17 +1,3 @@ # macOS - darwin -## Missing parts in Nix and home-manager - -Several packages are missing or broken for darwin. Or the x86-64 darwin.\ -So you should manually install followings. - -- [vscode](https://code.visualstudio.com/download) -- [zed-editor](https://zed.dev/download) -- [podman-desktop](https://podman-desktop.io/downloads) -- [Firefox](https://www.mozilla.org/ja/firefox/all/desktop-release/osx/ja/) -- [cloudflare-warp](https://developers.cloudflare.com/warp-client/get-started/macos/) - -## Limitations - -- I only have x86-64 macbook pro, it is much slow in GitHub action macos-13 runner.\ - So preferring macos-15 Apple Silicon runner in several place... +Extracted to [wiki](https://github.com/kachick/dotfiles/wiki/macOS) From 555136f9a9a363f0964a09f7ce8af711b8115ec1 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 11 Oct 2024 16:51:22 +0900 Subject: [PATCH 127/197] Extract linux only home-manager config from shared files --- home-manager/common.nix | 21 --------------------- home-manager/linux.nix | 35 ++++++++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/home-manager/common.nix b/home-manager/common.nix index e406bcf5..b96f8af4 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -81,10 +81,6 @@ }; }; - # This also changes xdg? Official manual sed this config is better for non NixOS Linux - # https://github.com/nix-community/home-manager/blob/559856748982588a9eda6bfb668450ebcf006ccd/modules/targets/generic-linux.nix#L16 - targets.genericLinux.enable = pkgs.stdenv.isLinux; - # Let Home Manager install and manage itself. programs.home-manager.enable = true; @@ -124,27 +120,10 @@ # TODO: Automate that needs to call `Install-Module -Name PSFzfHistory` first xdg.configFile."powershell/Microsoft.PowerShell_profile.ps1".source = ../config/powershell/Profile.ps1; - # https://github.com/NixOS/nixpkgs/issues/222925#issuecomment-1514112861 - xdg.configFile."autostart/userdirs.desktop".text = '' - [Desktop Entry] - Exec=xdg-user-dirs-update - TryExec=xdg-user-dirs-update - NoDisplay=true - StartupNotify=false - Type=Application - X-KDE-AutostartScript=true - X-KDE-autostart-phase=1 - ''; - xdg.dataFile."tmpbin/.keep".text = ""; home.file.".hushlogin".text = "This file disables daily login message. Not depend on this text."; - # Should sync with the directory instead of each file. See https://github.com/nix-community/home-manager/issues/3090#issuecomment-1799268943 - xdg.configFile.fcitx5 = { - source = ../config/fcitx5; - }; - # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/starship.nix programs.starship = { enable = true; diff --git a/home-manager/linux.nix b/home-manager/linux.nix index 392a48ab..aefd09fa 100644 --- a/home-manager/linux.nix +++ b/home-manager/linux.nix @@ -3,14 +3,39 @@ # https://github.com/nix-community/home-manager/issues/414#issuecomment-427163925 lib.mkMerge [ (lib.mkIf pkgs.stdenv.isLinux { + # This also changes xdg? Official manual sed this config is better for non NixOS Linux + # https://github.com/nix-community/home-manager/blob/559856748982588a9eda6bfb668450ebcf006ccd/modules/targets/generic-linux.nix#L16 + targets.genericLinux.enable = true; + # xdg-user-dirs NixOS module does not work or is not enough for me to keep English dirs even in Japanese locale. # Check your `~/.config/user-dirs.dirs` if you faced any trouble # https://github.com/nix-community/home-manager/blob/release-24.05/modules/misc/xdg-user-dirs.nix - xdg.userDirs = { - enable = true; - createDirectories = true; - }; + xdg = { + userDirs = { + enable = true; + createDirectories = true; + }; + + configFile = { + "hypr/hyprland.conf".source = ../config/hyprland/hyprland.conf; - xdg.configFile."hypr/hyprland.conf".source = ../config/hyprland/hyprland.conf; + # https://github.com/NixOS/nixpkgs/issues/222925#issuecomment-1514112861 + "autostart/userdirs.desktop".text = '' + [Desktop Entry] + Exec=xdg-user-dirs-update + TryExec=xdg-user-dirs-update + NoDisplay=true + StartupNotify=false + Type=Application + X-KDE-AutostartScript=true + X-KDE-autostart-phase=1 + ''; + + # Should sync with the directory instead of each file. See https://github.com/nix-community/home-manager/issues/3090#issuecomment-1799268943 + fcitx5 = { + source = ../config/fcitx5; + }; + }; + }; }) ] From 6613a8bccebb280f0ee16f72607ff582d2d1d20c Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 11 Oct 2024 17:26:27 +0900 Subject: [PATCH 128/197] Add /usr/local/bin in $PATH of macOS for binary installed apps (#841) * Add /usr/local/bin in $PATH of macOS for binary installed apps * Update zed-editor integration in darwin --- home-manager/darwin.nix | 8 +++++++- home-manager/zsh.nix | 5 ----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/home-manager/darwin.nix b/home-manager/darwin.nix index a9f65f0d..c4d91abc 100644 --- a/home-manager/darwin.nix +++ b/home-manager/darwin.nix @@ -8,8 +8,14 @@ lib.mkMerge [ # * Do not specify Nix store path for zed in macOS # https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219 # * `cli: install` action installs into this path in macOS - VISUAL = "/usr/local/bin/zed --wait"; + VISUAL = "zed --wait"; }; + + sessionPath = [ + # Many apps installs the binary here if not used nixpkgs + # For example: zed-editor, cloudflare-warp, vscode(symlink?) + "/usr/local/bin" + ]; }; # https://github.com/NixOS/nixpkgs/issues/240819#issuecomment-1616760598 diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix index 20538bbb..03c8ed27 100644 --- a/home-manager/zsh.nix +++ b/home-manager/zsh.nix @@ -294,11 +294,6 @@ if [[ "$OSTYPE" == darwin* ]]; then # TODO: May move to sessionVariables export BROWSER='open' - - # Microsoft recommends this will be written in ~/.zprofile, - if [ -x '/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code' ]; then - export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin" - fi fi ''; }; From 27c69b2e670a447da7fcf47714dbf95f7eb8ccba Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 11 Oct 2024 18:43:47 +0900 Subject: [PATCH 129/197] Remove needless profileExtra for darwin specific $BROWSER --- home-manager/darwin.nix | 2 ++ home-manager/zsh.nix | 10 +--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/home-manager/darwin.nix b/home-manager/darwin.nix index c4d91abc..31930fc4 100644 --- a/home-manager/darwin.nix +++ b/home-manager/darwin.nix @@ -9,6 +9,8 @@ lib.mkMerge [ # https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219 # * `cli: install` action installs into this path in macOS VISUAL = "zed --wait"; + + BROWSER = "open"; }; sessionPath = [ diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix index 03c8ed27..97ea1be5 100644 --- a/home-manager/zsh.nix +++ b/home-manager/zsh.nix @@ -287,14 +287,6 @@ fi ''; - # Use one of profileExtra or loginExtra. Not both - profileExtra = '' - # TODO: Switch to pkgs.zsh from current zsh in darwin - - if [[ "$OSTYPE" == darwin* ]]; then - # TODO: May move to sessionVariables - export BROWSER='open' - fi - ''; + # Useable one of profileExtra or loginExtra. Do not specify both. }; } From 92f15982137428502bb3038b9544e13a74550694 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 13:34:49 +0000 Subject: [PATCH 130/197] Bump gitleaks/gitleaks-action from 2.3.6 to 2.3.7 (#845) Bumps [gitleaks/gitleaks-action](https://github.com/gitleaks/gitleaks-action) from 2.3.6 to 2.3.7. - [Release notes](https://github.com/gitleaks/gitleaks-action/releases) - [Commits](https://github.com/gitleaks/gitleaks-action/compare/44c470ffc35caa8b1eb3e8012ca53c2f9bea4eb5...83373cf2f8c4db6e24b41c1a9b086bb9619e9cd3) --- updated-dependencies: - dependency-name: gitleaks/gitleaks-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/gitleaks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml index b5fda49c..f01ab719 100644 --- a/.github/workflows/gitleaks.yml +++ b/.github/workflows/gitleaks.yml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: gitleaks/gitleaks-action@44c470ffc35caa8b1eb3e8012ca53c2f9bea4eb5 # v2.3.6 + - uses: gitleaks/gitleaks-action@83373cf2f8c4db6e24b41c1a9b086bb9619e9cd3 # v2.3.7 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Without this env uses hardcoded old version. From 2eba5f74c422fdafbc9b044ff755d9a25a700773 Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 01:36:34 +0000 Subject: [PATCH 131/197] Bump flake.lock and related dependencies (#844) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * flake.lock: Update Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/c31898adf5a8ed202ce5bea9f347b1c6871f32d1?narHash=sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw%3D' (2024-10-06) → 'github:NixOS/nixpkgs/5633bcff0c6162b9e4b5f1264264611e950c8ec7?narHash=sha256-9UTxR8eukdg%2BXZeHgxW5hQA9fIKHsKCdOIUycTryeVw%3D' (2024-10-09) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/1bfbbbe5bbf888d675397c66bfdb275d0b99361c?narHash=sha256-a0a0M1TmXMK34y3M0cugsmpJ4FJPT/xsblhpiiX1CXo%3D' (2024-10-07) → 'github:NixOS/nixpkgs/a3f9ad65a0bf298ed5847629a57808b97e6e8077?narHash=sha256-u%2BrxA79a0lyhG%2Bu%2BoPBRtTDtzz8kvkc9a6SWSt9ekVc%3D' (2024-10-12) * flake.lock: Update Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/5633bcff0c6162b9e4b5f1264264611e950c8ec7?narHash=sha256-9UTxR8eukdg%2BXZeHgxW5hQA9fIKHsKCdOIUycTryeVw%3D' (2024-10-09) → 'github:NixOS/nixpkgs/a3c0b3b21515f74fd2665903d4ce6bc4dc81c77c?narHash=sha256-nsNdSldaAyu6PE3YUA%2BYQLqUDJh%2BgRbBooMMekZJwvI%3D' (2024-10-14) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/a3f9ad65a0bf298ed5847629a57808b97e6e8077?narHash=sha256-u%2BrxA79a0lyhG%2Bu%2BoPBRtTDtzz8kvkc9a6SWSt9ekVc%3D' (2024-10-12) → 'github:NixOS/nixpkgs/c0b1da36f7c34a7146501f684e9ebdf15d2bebf8?narHash=sha256-WLxED18lodtQiayIPDE5zwAfkPJSjHJ35UhZ8h3cJUg%3D' (2024-10-14) --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 4d0fea03..95913405 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1728241625, - "narHash": "sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw=", + "lastModified": 1728888510, + "narHash": "sha256-nsNdSldaAyu6PE3YUA+YQLqUDJh+gRbBooMMekZJwvI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c31898adf5a8ed202ce5bea9f347b1c6871f32d1", + "rev": "a3c0b3b21515f74fd2665903d4ce6bc4dc81c77c", "type": "github" }, "original": { @@ -400,11 +400,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1728328465, - "narHash": "sha256-a0a0M1TmXMK34y3M0cugsmpJ4FJPT/xsblhpiiX1CXo=", + "lastModified": 1728909085, + "narHash": "sha256-WLxED18lodtQiayIPDE5zwAfkPJSjHJ35UhZ8h3cJUg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1bfbbbe5bbf888d675397c66bfdb275d0b99361c", + "rev": "c0b1da36f7c34a7146501f684e9ebdf15d2bebf8", "type": "github" }, "original": { From 17f4da08cc264d4696d7b2a942bfb042a9673593 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 16 Oct 2024 13:04:57 +0900 Subject: [PATCH 132/197] Update go to 1.23 (#847) * Bump go version to 1.23 in flake * Bump and specify go version in packages * Update go.mod and go.sum * Bump buildGoModule --- flake.nix | 2 +- go.mod | 2 +- home-manager/helix.nix | 2 +- pkgs/bump_gomod/default.nix | 2 +- pkgs/reponame/default.nix | 2 +- pkgs/reponame/go.mod | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index 18401709..69d022cc 100644 --- a/flake.nix +++ b/flake.nix @@ -89,7 +89,7 @@ stylua typos typos-lsp # For zed-editor typos extension - go_1_22 + go_1_23 goreleaser trivy ]) diff --git a/go.mod b/go.mod index d978b115..bf1db1e1 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/kachick/dotfiles -go 1.22.6 +go 1.23.1 require ( golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b diff --git a/home-manager/helix.nix b/home-manager/helix.nix index 9a63d7a6..ea551f5d 100644 --- a/home-manager/helix.nix +++ b/home-manager/helix.nix @@ -208,7 +208,7 @@ in rust-analyzer # Looks like required to enable gopls - go_1_22 + go_1_23 # https://github.com/helix-editor/helix/blob/24.03/languages.toml#L578 gopls # https://github.com/helix-editor/helix/blob/24.03/languages.toml#L132-L133 diff --git a/pkgs/bump_gomod/default.nix b/pkgs/bump_gomod/default.nix index 934082f6..892a9e79 100644 --- a/pkgs/bump_gomod/default.nix +++ b/pkgs/bump_gomod/default.nix @@ -4,7 +4,7 @@ pkgs.writeShellApplication rec { text = builtins.readFile ./${name}.bash; runtimeInputs = with pkgs; [ git - go + go_1_23 gnugrep findutils # `xargs` ]; diff --git a/pkgs/reponame/default.nix b/pkgs/reponame/default.nix index e95271b8..6e80a607 100644 --- a/pkgs/reponame/default.nix +++ b/pkgs/reponame/default.nix @@ -1,5 +1,5 @@ { pkgs, ... }: -pkgs.buildGo122Module rec { +pkgs.buildGo123Module rec { pname = "reponame"; version = "0.0.1"; default = pname; diff --git a/pkgs/reponame/go.mod b/pkgs/reponame/go.mod index e07a18e4..a30a96e5 100644 --- a/pkgs/reponame/go.mod +++ b/pkgs/reponame/go.mod @@ -1,5 +1,5 @@ module github.com/kachick/dotfiles/pkgs/reponame -go 1.22.6 +go 1.23.1 require github.com/google/go-cmp v0.6.0 From f848fa99b4942cbe1e729e44a269f8abd732b6e8 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 16 Oct 2024 13:25:29 +0900 Subject: [PATCH 133/197] Simplify listing up platforms --- flake.nix | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index 69d022cc..7931e24a 100644 --- a/flake.nix +++ b/flake.nix @@ -28,14 +28,7 @@ let inherit (self) outputs; # Candidates: https://github.com/NixOS/nixpkgs/blob/release-24.05/lib/systems/flake-systems.nix - forAllSystems = nixpkgs.lib.genAttrs [ - "x86_64-linux" - "x86_64-darwin" - # I don't have Apple Silicon machines, providing this for macos-15 free runner - # - https://github.com/actions/runner-images/issues/9741 - # - https://github.com/actions/runner-images/issues/10686 - "aarch64-darwin" - ]; + forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed; mkApp = pkg: { type = "app"; From 642ae6cd40a4f5ae5cce3687da2c108543a7225a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 16 Oct 2024 13:26:33 +0900 Subject: [PATCH 134/197] Bump selfup --- .github/workflows/update-flake-lock-and-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-flake-lock-and-ci.yml b/.github/workflows/update-flake-lock-and-ci.yml index eca4a08c..f510cdad 100644 --- a/.github/workflows/update-flake-lock-and-ci.yml +++ b/.github/workflows/update-flake-lock-and-ci.yml @@ -14,7 +14,7 @@ on: jobs: update-nixpkgs: if: (github.event_name != 'pull_request') || (!github.event.pull_request.draft) - uses: kachick/selfup/.github/workflows/reusable-bump-flake-lock-and-selfup.yml@v1.1.3 + uses: kachick/selfup/.github/workflows/reusable-bump-flake-lock-and-selfup.yml@v1.1.5 with: app_id: ${{ vars.APP_ID }} dry-run: ${{ github.event_name == 'pull_request' }} From cdf510babac02df26cd644e314ee2522036a57b4 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 16 Oct 2024 16:27:53 +0900 Subject: [PATCH 135/197] Add Karabiner-Elements config to persist the keyremapper for disabling caps_lock on macOS (#848) --- .../complex_modifications/1532748339.json | 426 ++++++++++++++++++ config/karabiner/karabiner.json | 77 ++++ home-manager/darwin.nix | 44 +- 3 files changed, 538 insertions(+), 9 deletions(-) create mode 100644 config/karabiner/assets/complex_modifications/1532748339.json create mode 100644 config/karabiner/karabiner.json diff --git a/config/karabiner/assets/complex_modifications/1532748339.json b/config/karabiner/assets/complex_modifications/1532748339.json new file mode 100644 index 00000000..a6c3f76d --- /dev/null +++ b/config/karabiner/assets/complex_modifications/1532748339.json @@ -0,0 +1,426 @@ +{ + "title": "For Japanese (日本語環境向けの設定) (rev 3)", + "rules": [ + { + "description": "コマンドキーを単体で押したときに、英数・かなキーを送信する。(左コマンドキーは英数、右コマンドキーはかな) (rev 2)", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "left_command", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_command", + "lazy": true + } + ], + "to_if_alone": [ + { + "key_code": "japanese_eisuu" + } + ] + }, + { + "type": "basic", + "from": { + "key_code": "right_command", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "right_command", + "lazy": true + } + ], + "to_if_alone": [ + { + "key_code": "japanese_kana" + } + ] + } + ] + }, + { + "description": "コマンドキー(左右どちらでも)を単体で押したときに、英数・かなをトグルで切り替える。", + "manipulators": [ + { + "type": "basic", + "conditions": [ + { + "input_sources": [ + { + "language": "ja" + } + ], + "type": "input_source_if" + } + ], + "from": { + "key_code": "left_command", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_command", + "lazy": true + } + ], + "to_if_alone": [ + { + "key_code": "japanese_eisuu" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "input_sources": [ + { + "language": "en" + } + ], + "type": "input_source_if" + } + ], + "from": { + "key_code": "left_command", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_command", + "lazy": true + } + ], + "to_if_alone": [ + { + "key_code": "japanese_kana" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "input_sources": [ + { + "language": "ja" + } + ], + "type": "input_source_if" + } + ], + "from": { + "key_code": "right_command", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "right_command", + "lazy": true + } + ], + "to_if_alone": [ + { + "key_code": "japanese_eisuu" + } + ] + }, + { + "type": "basic", + "conditions": [ + { + "input_sources": [ + { + "language": "en" + } + ], + "type": "input_source_if" + } + ], + "from": { + "key_code": "right_command", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "right_command", + "lazy": true + } + ], + "to_if_alone": [ + { + "key_code": "japanese_kana" + } + ] + } + ] + }, + { + "description": "英数・かなキーを他のキーと同時に押したときに、Optionキーを送信する", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "japanese_eisuu", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_option" + } + ], + "to_if_alone": [ + { + "key_code": "japanese_eisuu" + } + ] + }, + { + "type": "basic", + "from": { + "key_code": "japanese_kana", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "right_option" + } + ], + "to_if_alone": [ + { + "key_code": "japanese_kana" + } + ] + } + ] + }, + { + "description": "escキーを押したときに、英数キーも送信する(vim用)", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "escape" + }, + "to": [ + { + "key_code": "escape" + }, + { + "key_code": "japanese_eisuu" + } + ] + } + ] + }, + { + "description": "Ctrl+[を押したときに、英数キーも送信する(vim用) (rev 2)", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "open_bracket", + "modifiers": { + "mandatory": [ + "control" + ] + } + }, + "to": [ + { + "key_code": "open_bracket", + "modifiers": [ + "control" + ] + }, + { + "key_code": "japanese_eisuu" + } + ], + "conditions": [ + { + "type": "keyboard_type_if", + "keyboard_types": [ + "ansi", + "iso" + ] + } + ] + }, + { + "type": "basic", + "from": { + "key_code": "close_bracket", + "modifiers": { + "mandatory": [ + "control" + ] + } + }, + "to": [ + { + "key_code": "close_bracket", + "modifiers": [ + "control" + ] + }, + { + "key_code": "japanese_eisuu" + } + ], + "conditions": [ + { + "type": "keyboard_type_if", + "keyboard_types": [ + "jis" + ] + } + ] + } + ] + }, + { + "description": "Ctrl+[を押したときに、escキーと英数キーを送信する", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "open_bracket", + "modifiers": { + "mandatory": [ + "control" + ] + } + }, + "to": [ + { + "key_code": "escape" + }, + { + "key_code": "japanese_eisuu" + } + ], + "conditions": [ + { + "type": "keyboard_type_if", + "keyboard_types": [ + "ansi", + "iso" + ] + } + ] + }, + { + "type": "basic", + "from": { + "key_code": "close_bracket", + "modifiers": { + "mandatory": [ + "control" + ] + } + }, + "to": [ + { + "key_code": "escape" + }, + { + "key_code": "japanese_eisuu" + } + ], + "conditions": [ + { + "type": "keyboard_type_if", + "keyboard_types": [ + "jis" + ] + } + ] + } + ] + }, + { + "description": "英数・かなキーをtoggle方式にする", + "manipulators": [ + { + "conditions": [ + { + "type": "input_source_if", + "input_sources": [ + { + "language": "ja" + } + ] + } + ], + "type": "basic", + "from": { + "key_code": "japanese_kana" + }, + "to": [ + { + "key_code": "japanese_eisuu" + } + ] + }, + { + "conditions": [ + { + "type": "input_source_unless", + "input_sources": [ + { + "language": "ja" + } + ] + } + ], + "type": "basic", + "from": { + "key_code": "japanese_eisuu" + }, + "to": [ + { + "key_code": "japanese_kana" + } + ] + } + ] + } + ] +} diff --git a/config/karabiner/karabiner.json b/config/karabiner/karabiner.json new file mode 100644 index 00000000..75f17736 --- /dev/null +++ b/config/karabiner/karabiner.json @@ -0,0 +1,77 @@ +{ + "profiles": [ + { + "complex_modifications": { + "rules": [ + { + "description": "コマンドキーを単体で押したときに、英数・かなキーを送信する。(左コマンドキーは英数、右コマンドキーはかな) (rev 2)", + "manipulators": [ + { + "from": { + "key_code": "left_command", + "modifiers": { "optional": ["any"] } + }, + "to": [ + { + "key_code": "left_command", + "lazy": true + } + ], + "to_if_alone": [{ "key_code": "japanese_eisuu" }], + "type": "basic" + }, + { + "from": { + "key_code": "right_command", + "modifiers": { "optional": ["any"] } + }, + "to": [ + { + "key_code": "right_command", + "lazy": true + } + ], + "to_if_alone": [{ "key_code": "japanese_kana" }], + "type": "basic" + } + ] + } + ] + }, + "fn_function_keys": [ + { + "from": { "key_code": "f3" }, + "to": [{ "key_code": "mission_control" }] + }, + { + "from": { "key_code": "f4" }, + "to": [{ "key_code": "launchpad" }] + }, + { + "from": { "key_code": "f5" }, + "to": [{ "key_code": "illumination_decrement" }] + }, + { + "from": { "key_code": "f6" }, + "to": [{ "key_code": "illumination_increment" }] + }, + { + "from": { "key_code": "f9" }, + "to": [{ "consumer_key_code": "fastforward" }] + } + ], + "name": "Default profile", + "selected": true, + "simple_modifications": [ + { + "from": { "key_code": "caps_lock" }, + "to": [{ "key_code": "left_control" }] + } + ], + "virtual_hid_keyboard": { + "country_code": 0, + "keyboard_type_v2": "ansi" + } + } + ] +} diff --git a/home-manager/darwin.nix b/home-manager/darwin.nix index 31930fc4..2042fc59 100644 --- a/home-manager/darwin.nix +++ b/home-manager/darwin.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, ... }: +{ + pkgs, + lib, + config, + ... +}: # https://github.com/nix-community/home-manager/issues/414#issuecomment-427163925 lib.mkMerge [ @@ -20,13 +25,34 @@ lib.mkMerge [ ]; }; - # https://github.com/NixOS/nixpkgs/issues/240819#issuecomment-1616760598 - # https://github.com/midchildan/dotfiles/blob/fae87a3ef327c23031d8081333678f9472e4c0ed/nix/home/modules/gnupg/default.nix#L38 - xdg.dataFile."gnupg/gpg-agent.conf".text = '' - grab - default-cache-ttl 604800 - max-cache-ttl 604800 - pinentry-program ${pkgs.pinentry_mac}/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac - ''; + xdg = { + configFile = { + "karabiner/assets" = { + source = ../config/karabiner/assets; + recursive = true; + }; + + "karabiner/HomeManagerInit_karabiner.json" = { + source = ../config/karabiner/karabiner.json; + # https://github.com/nix-community/home-manager/issues/3090#issuecomment-2010891733 + onChange = '' + rm -f ${config.xdg.configHome}/karabiner/karabiner.json + cp ${config.xdg.configHome}/karabiner/HomeManagerInit_karabiner.json ${config.xdg.configHome}/karabiner/karabiner.json + chmod u+w ${config.xdg.configHome}/karabiner/karabiner.json + ''; + }; + }; + + dataFile = { + # https://github.com/NixOS/nixpkgs/issues/240819#issuecomment-1616760598 + # https://github.com/midchildan/dotfiles/blob/fae87a3ef327c23031d8081333678f9472e4c0ed/nix/home/modules/gnupg/default.nix#L38 + "gnupg/gpg-agent.conf".text = '' + grab + default-cache-ttl 604800 + max-cache-ttl 604800 + pinentry-program ${pkgs.pinentry_mac}/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac + ''; + }; + }; }) ] From 8d4bda7b6b0000c959ce0af319733f2c64f250e9 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 17 Oct 2024 09:48:09 +0900 Subject: [PATCH 136/197] Bump cozette font to 1.25.2 https://github.com/slavfox/Cozette/blob/5a309b62ce4f7e8a299835321a76b1bb65ba8f81/CHANGELOG.md?plain=1#L8-L34 --- pkgs/cozette/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/cozette/default.nix b/pkgs/cozette/default.nix index 27e17d51..33245672 100644 --- a/pkgs/cozette/default.nix +++ b/pkgs/cozette/default.nix @@ -8,13 +8,13 @@ # https://github.com/NixOS/nixpkgs/blob/41d21a82c38e226e234e16f4ff213b3fcf85e6e9/pkgs/data/fonts/cozette/default.nix#L1C1-L33C2 stdenvNoCC.mkDerivation rec { pname = "cozette"; - version = "1.25.1"; + version = "1.25.2"; src = fetchzip { url = "https://github.com/slavfox/Cozette/releases/download/v.${version}/CozetteFonts-v-${ builtins.replaceStrings [ "." ] [ "-" ] version }.zip"; - hash = "sha256-Cnl7DTPcZmCRM06qe7WXfZorok3uUNYcB9bR/auzCao="; + hash = "sha256-LtZHbsma9EuegS349gQo4W+ZT8x+Vb3CD/5vRKjwkzc="; }; installPhase = '' From 8b0773c846691b42421ca606e961e9743831eb93 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 17 Oct 2024 09:52:47 +0900 Subject: [PATCH 137/197] Bump micro-kdl with the first stable release --- flake.nix | 1 + pkgs/micro-kdl/default.nix | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 7931e24a..b79b2576 100644 --- a/flake.nix +++ b/flake.nix @@ -100,6 +100,7 @@ packages = forAllSystems (system: { cozette = homemade-packages.${system}.cozette; + micro-kdl = homemade-packages.${system}.micro-kdl; }); apps = forAllSystems ( diff --git a/pkgs/micro-kdl/default.nix b/pkgs/micro-kdl/default.nix index 39a9fb2a..1149cdc1 100644 --- a/pkgs/micro-kdl/default.nix +++ b/pkgs/micro-kdl/default.nix @@ -4,15 +4,15 @@ fetchFromGitHub, }: -stdenv.mkDerivation { +stdenv.mkDerivation rec { pname = "micro-kdl"; - version = "unstable-2024-08-15"; + version = "0.1.0"; src = fetchFromGitHub { owner = "kachick"; repo = "micro-kdl"; - rev = "fa014198284ede791afc36ccec5d24c0c7201256"; - hash = "sha256-wS1Ldrhn8dKTXdLM23glDdFrKxAex4aZJSxgYaHN/uA="; + rev = "v${version}"; + hash = "sha256-vWI7VbcPM2mgNj32txf2tNKgEi+Bbj0+wEjQRz2uu1E="; }; buildPhase = '' From 19b63eadd9000842d69656da19c83e4916bb1068 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 18 Oct 2024 10:57:36 +0900 Subject: [PATCH 138/197] Update comments to follow the merged PR --- home-manager/editors.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home-manager/editors.nix b/home-manager/editors.nix index 94b5b16b..d45464fc 100644 --- a/home-manager/editors.nix +++ b/home-manager/editors.nix @@ -9,7 +9,7 @@ ./vim.nix ]; - # TODO: Update since merged https://github.com/nix-community/home-manager/pull/5455 + # TODO: Update since release-24.11 https://github.com/nix-community/home-manager/pull/5455 xdg.configFile."zed/settings.json".source = ../config/zed/settings.json; home = { From 2f3bec8654691d23bd7d456d6b629bbf5445f92b Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 18 Oct 2024 12:49:56 +0900 Subject: [PATCH 139/197] Switch back to ssh-agent from gpg-agent with setting `$SSH_ASKPASS` which internally uses gpg (#852) * Set $SSH_ASKPASS as same as $RCLONE_PASSWORD_COMMAND * Switch back to ssh-agent from gpg-agent This partially reverts GH-814 However ssh passphrase will be kept by the SSH_ASKPASS and gpg encrypted command --- * Update how to realize https://github.com/kachick/dotfiles/issues/714 with partially reverting https://github.com/kachick/dotfiles/pull/814 with https://github.com/kachick/dotfiles/pull/817 direction * Might be a preparation of GH-849 Since using gpg-agent, it does not remain and hard to handle SSH passphrase. Instead of that, pass command internally uses gpg. It looks enough to me. --- README.md | 1 - home-manager/gpg.nix | 2 +- home-manager/ssh.nix | 18 +++++++++++++++--- nixos/configuration.nix | 4 ---- nixos/desktop/default.nix | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9f0adef4..4b905148 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,6 @@ Check [traps](./windows/Multi-booting.md) ```bash touch ~/.ssh/id_ed25519 && chmod 400 ~/.ssh/id_ed25519 hx ~/.ssh/id_ed25519 - gpg-connect-agent updatestartuptty /bye ssh-add ~/.ssh/id_ed25519 ``` diff --git a/home-manager/gpg.nix b/home-manager/gpg.nix index 002ef551..acb608b7 100644 --- a/home-manager/gpg.nix +++ b/home-manager/gpg.nix @@ -38,7 +38,7 @@ in pinentryPackage = pkgs.pinentry-tty; - enableSshSupport = true; + enableSshSupport = false; }; # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/gpg.nix diff --git a/home-manager/ssh.nix b/home-manager/ssh.nix index e15cef4f..6206243c 100644 --- a/home-manager/ssh.nix +++ b/home-manager/ssh.nix @@ -1,4 +1,4 @@ -{ config, ... }: +{ pkgs, config, ... }: let # SSH files cannot use XDG Base Directory. @@ -16,8 +16,20 @@ in # - id_*.pub: I CAN register them for different services. { # https://github.com/nix-community/home-manager/blob/release-24.05/modules/services/ssh-agent.nix - # Prefer gpg-agent for SSH agent role - services.ssh-agent.enable = false; + services.ssh-agent.enable = pkgs.stdenv.isLinux; + + home.sessionVariables = { + # 'force' ignores $DISPLAY. 'prefer' is not enough + SSH_ASKPASS_REQUIRE = "force"; + SSH_ASKPASS = pkgs.lib.getExe ( + pkgs.writeShellApplication { + name = "ssh-ask-pass"; + text = "pass show ssh-pass"; + meta.description = "GH-714. Required to be wrapped with one command because of SSH_ASKPASS does not accept arguments."; + runtimeInputs = with pkgs; [ pass ]; + } + ); + }; # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/ssh.nix programs.ssh = { diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 4ee8ca7b..75c99b20 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -140,10 +140,6 @@ # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; # List services that you want to enable: diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 8fa8ba78..c85155b8 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -85,7 +85,7 @@ gnome-music # does not support flac by defaults ]); - # Recommended to be uninstalled by gnupg. + # Recommended to be uninstalled by gnupg. I prefer this way, even though disabling gpg-agent ssh integrations. # https://wiki.gnupg.org/GnomeKeyring # # And enabling this makes $SSH_AUTH_SOCK overriding even through enabled gpg-agent in home-manager From 6166f20f9e631fc543b8d77f7ae7cc805bee4b04 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 18 Oct 2024 23:24:55 +0900 Subject: [PATCH 140/197] Make `prs` be a gh extension for avoiding conflict naming of timvisee/prs --- flake.nix | 2 +- home-manager/git.nix | 2 ++ home-manager/packages.nix | 1 - pkgs/default.nix | 2 +- pkgs/{prs => gh-prs}/default.nix | 10 +++++++--- pkgs/{prs/prs.bash => gh-prs/gh-prs.bash} | 0 6 files changed, 11 insertions(+), 6 deletions(-) rename pkgs/{prs => gh-prs}/default.nix (57%) rename pkgs/{prs/prs.bash => gh-prs/gh-prs.bash} (100%) diff --git a/flake.nix b/flake.nix index b79b2576..f8400aee 100644 --- a/flake.nix +++ b/flake.nix @@ -128,7 +128,7 @@ "git-log-fzf" "git-log-simple" "git-resolve-conflict" - "prs" + "gh-prs" "nix-hash-url" "reponame" "gredit" diff --git a/home-manager/git.nix b/home-manager/git.nix index 503eae4b..5727a0f1 100644 --- a/home-manager/git.nix +++ b/home-manager/git.nix @@ -167,5 +167,7 @@ "https://gist.github.com" ]; }; + + extensions = [ homemade-pkgs.gh-prs ]; }; } diff --git a/home-manager/packages.nix b/home-manager/packages.nix index f2fdd79a..2800f167 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -176,7 +176,6 @@ updeps bench_shells archive-home-files - prs gredit preview ]) diff --git a/pkgs/default.nix b/pkgs/default.nix index d62e6956..0a5b7f58 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -48,7 +48,7 @@ git-hooks-commit-msg = import ./git-hooks-commit-msg { inherit pkgs; }; git-hooks-pre-push = import ./git-hooks-pre-push { inherit pkgs; }; - prs = import ./prs { inherit pkgs; }; + gh-prs = import ./gh-prs { inherit pkgs; }; reponame = import ./reponame { inherit pkgs; }; diff --git a/pkgs/prs/default.nix b/pkgs/gh-prs/default.nix similarity index 57% rename from pkgs/prs/default.nix rename to pkgs/gh-prs/default.nix index d149b1db..f438cb28 100644 --- a/pkgs/prs/default.nix +++ b/pkgs/gh-prs/default.nix @@ -1,6 +1,6 @@ { pkgs, ... }: -pkgs.writeShellApplication rec { - name = "prs"; +(pkgs.writeShellApplication rec { + name = "gh-prs"; text = builtins.readFile ./${name}.bash; runtimeInputs = with pkgs; @@ -13,4 +13,8 @@ pkgs.writeShellApplication rec { ++ (lib.optionals stdenv.isLinux [ wslu # WSL helpers like `wslview`. It is used in open browser features in gh command ]); -} +}).overrideAttrs + (prev: { + # Required in https://github.com/nix-community/home-manager/blob/346973b338365240090eded0de62f7edce4ce3d1/modules/programs/gh.nix#L160 + pname = prev.name; + }) diff --git a/pkgs/prs/prs.bash b/pkgs/gh-prs/gh-prs.bash similarity index 100% rename from pkgs/prs/prs.bash rename to pkgs/gh-prs/gh-prs.bash From 1a974361d39e784258f92a702e874074f640fb4e Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 19 Oct 2024 00:00:07 +0900 Subject: [PATCH 141/197] Prefer derivationArgs rather than overrideAttrs --- pkgs/gh-prs/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/gh-prs/default.nix b/pkgs/gh-prs/default.nix index f438cb28..d85c6bf7 100644 --- a/pkgs/gh-prs/default.nix +++ b/pkgs/gh-prs/default.nix @@ -1,5 +1,5 @@ { pkgs, ... }: -(pkgs.writeShellApplication rec { +pkgs.writeShellApplication rec { name = "gh-prs"; text = builtins.readFile ./${name}.bash; runtimeInputs = @@ -13,8 +13,8 @@ ++ (lib.optionals stdenv.isLinux [ wslu # WSL helpers like `wslview`. It is used in open browser features in gh command ]); -}).overrideAttrs - (prev: { + derivationArgs = { # Required in https://github.com/nix-community/home-manager/blob/346973b338365240090eded0de62f7edce4ce3d1/modules/programs/gh.nix#L160 - pname = prev.name; - }) + pname = name; + }; +} From 7a348136a30e1e33a12837a06a8b7e64c6c9c391 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 19 Oct 2024 02:13:55 +0900 Subject: [PATCH 142/197] Install gh-poi with nixpkgs No need to reboot kachick/nixpkgs#2 since https://github.com/NixOS/nixpkgs/commit/a9bfb0a872e6d49a9ac80a181450c9a54f24b000 --- home-manager/git.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home-manager/git.nix b/home-manager/git.nix index 5727a0f1..dde31d5c 100644 --- a/home-manager/git.nix +++ b/home-manager/git.nix @@ -168,6 +168,6 @@ ]; }; - extensions = [ homemade-pkgs.gh-prs ]; + extensions = (with pkgs; [ gh-poi ]) ++ (with homemade-pkgs; [ gh-prs ]); }; } From 341612e741225a94bc6096c1d67d17156797b889 Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 23:44:48 +0000 Subject: [PATCH 143/197] flake.lock: Update (#855) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/a3c0b3b21515f74fd2665903d4ce6bc4dc81c77c?narHash=sha256-nsNdSldaAyu6PE3YUA%2BYQLqUDJh%2BgRbBooMMekZJwvI%3D' (2024-10-14) → 'github:NixOS/nixpkgs/5785b6bb5eaae44e627d541023034e1601455827?narHash=sha256-KOTTUfPkugH52avUvXGxvWy8ibKKj4genodIYUED%2BKc%3D' (2024-10-16) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/c0b1da36f7c34a7146501f684e9ebdf15d2bebf8?narHash=sha256-WLxED18lodtQiayIPDE5zwAfkPJSjHJ35UhZ8h3cJUg%3D' (2024-10-14) → 'github:NixOS/nixpkgs/dc2e0028d274394f73653c7c90cc63edbb696be1?narHash=sha256-GKJjtPY%2BSXfLF/yTN7M2cAnQB6RERFKnQhD8UvPSf3M%3D' (2024-10-16) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 95913405..0b76c10f 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1728888510, - "narHash": "sha256-nsNdSldaAyu6PE3YUA+YQLqUDJh+gRbBooMMekZJwvI=", + "lastModified": 1729070438, + "narHash": "sha256-KOTTUfPkugH52avUvXGxvWy8ibKKj4genodIYUED+Kc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a3c0b3b21515f74fd2665903d4ce6bc4dc81c77c", + "rev": "5785b6bb5eaae44e627d541023034e1601455827", "type": "github" }, "original": { @@ -400,11 +400,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1728909085, - "narHash": "sha256-WLxED18lodtQiayIPDE5zwAfkPJSjHJ35UhZ8h3cJUg=", + "lastModified": 1729044727, + "narHash": "sha256-GKJjtPY+SXfLF/yTN7M2cAnQB6RERFKnQhD8UvPSf3M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c0b1da36f7c34a7146501f684e9ebdf15d2bebf8", + "rev": "dc2e0028d274394f73653c7c90cc63edbb696be1", "type": "github" }, "original": { From dfbd9876bc59b2b84d3d5a295332eb19740113ef Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Sat, 19 Oct 2024 14:57:44 +0000 Subject: [PATCH 144/197] flake.lock: Update (#856) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/5785b6bb5eaae44e627d541023034e1601455827?narHash=sha256-KOTTUfPkugH52avUvXGxvWy8ibKKj4genodIYUED%2BKc%3D' (2024-10-16) → 'github:NixOS/nixpkgs/4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0?narHash=sha256-/uilDXvCIEs3C9l73JTACm4quuHUsIHcns1c%2BcHUJwA%3D' (2024-10-18) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/dc2e0028d274394f73653c7c90cc63edbb696be1?narHash=sha256-GKJjtPY%2BSXfLF/yTN7M2cAnQB6RERFKnQhD8UvPSf3M%3D' (2024-10-16) → 'github:NixOS/nixpkgs/4eb33fe664af7b41a4c446f87d20c9a0a6321fa3?narHash=sha256-LDiPhQ3l%2BfBjRATNtnuDZsBS7hqoBtPkKBkhpoBHv3I%3D' (2024-10-17) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 0b76c10f..3217934d 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1729070438, - "narHash": "sha256-KOTTUfPkugH52avUvXGxvWy8ibKKj4genodIYUED+Kc=", + "lastModified": 1729256560, + "narHash": "sha256-/uilDXvCIEs3C9l73JTACm4quuHUsIHcns1c+cHUJwA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5785b6bb5eaae44e627d541023034e1601455827", + "rev": "4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0", "type": "github" }, "original": { @@ -400,11 +400,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1729044727, - "narHash": "sha256-GKJjtPY+SXfLF/yTN7M2cAnQB6RERFKnQhD8UvPSf3M=", + "lastModified": 1729181673, + "narHash": "sha256-LDiPhQ3l+fBjRATNtnuDZsBS7hqoBtPkKBkhpoBHv3I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "dc2e0028d274394f73653c7c90cc63edbb696be1", + "rev": "4eb33fe664af7b41a4c446f87d20c9a0a6321fa3", "type": "github" }, "original": { From dd895e57f22b793ab9f02d54c5219a7afb79aabd Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 20 Oct 2024 16:54:38 +0900 Subject: [PATCH 145/197] Refresh zcompdump cache in each home-manager activation (#857) * Extract zcompdump path with zsh only variable * Remove ZCOMPDUMP_CACHE in each home-manager activation Without this, no completion changes after packages changes, it makes much confusion * Fix to handle cache * As same as in zsh code --- home-manager/zsh.nix | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix index 97ea1be5..83a7be76 100644 --- a/home-manager/zsh.nix +++ b/home-manager/zsh.nix @@ -6,6 +6,10 @@ ... }: +let + ZCOMPDUMP_CACHE_DIR = "${config.xdg.cacheHome}/zsh"; + ZCOMPDUMP_CACHE_PATH = "${ZCOMPDUMP_CACHE_DIR}/zcompdump-${pkgs.zsh.version}"; +in { services.gpg-agent.enableZshIntegration = true; programs.starship.enableZshIntegration = true; @@ -15,6 +19,14 @@ # Avoid nested zellij in host and remote login as container programs.zellij.enableZshIntegration = false; + home.activation.refreshZcompdumpCache = config.lib.dag.entryAnywhere '' + if [[ -v oldGenPath ]]; then + run ${lib.getBin pkgs.coreutils}/bin/mkdir -p '${ZCOMPDUMP_CACHE_DIR}' + run ${lib.getExe pkgs.zsh} --interactive -c 'compinit -d "${ZCOMPDUMP_CACHE_PATH}"' + run ${lib.getBin pkgs.coreutils}/bin/touch '${ZCOMPDUMP_CACHE_PATH}' # Ensure to update timestamp + fi + ''; + # https://nixos.wiki/wiki/Zsh # https://zsh.sourceforge.io/Doc/Release/Options.html # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/zsh.nix @@ -28,6 +40,8 @@ dotDir = ".config/zsh"; localVariables = { + inherit ZCOMPDUMP_CACHE_DIR ZCOMPDUMP_CACHE_PATH; + # This is a minimum note for home-manager dead case such as https://github.com/kachick/dotfiles/issues/680#issuecomment-2353820508 PROMPT = '' %~ %? %# @@ -127,19 +141,19 @@ # speed - https://gist.github.com/ctechols/ca1035271ad134841284 # both - https://github.com/kachick/dotfiles/pull/155 _compinit_with_interval() { - local -r dump_dir="${config.xdg.cacheHome}/zsh" - local -r dump_path="$dump_dir/zcompdump-$ZSH_VERSION" # seconds * minutes * hours local -r threshold="$((60 * 60 * 3))" - if [ -e "$dump_path" ] && [ "$(_elapsed_seconds_for "$dump_path")" -le "$threshold" ]; then + if [ -e "$ZCOMPDUMP_CACHE_PATH" ] && [ "$(_elapsed_seconds_for "$ZCOMPDUMP_CACHE_PATH")" -le "$threshold" ]; then # https://zsh.sourceforge.io/Doc/Release/Completion-System.html#Use-of-compinit # -C omit to check new functions - compinit -C -d "$dump_path" + compinit -C -d "$ZCOMPDUMP_CACHE_PATH" else - ${lib.getBin pkgs.coreutils}/bin/mkdir -p "$dump_dir" - compinit -d "$dump_path" - ${lib.getBin pkgs.coreutils}/bin/touch "$dump_path" # Ensure to update timestamp + # For refreshing the cache + + ${lib.getBin pkgs.coreutils}/bin/mkdir -p "$ZCOMPDUMP_CACHE_DIR" + compinit -d "$ZCOMPDUMP_CACHE_PATH" + ${lib.getBin pkgs.coreutils}/bin/touch "$ZCOMPDUMP_CACHE_PATH" # Ensure to update timestamp fi } ''; From 3dd74a8007f2498d6d57cda5cad4c7f0955da621 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 20 Oct 2024 17:38:55 +0900 Subject: [PATCH 146/197] Remove zcompdump cache instead of regenerate to clear old commands Follow dd895e57f22b793ab9f02d54c5219a7afb79aabd --- home-manager/zsh.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix index 83a7be76..d6b7ded4 100644 --- a/home-manager/zsh.nix +++ b/home-manager/zsh.nix @@ -6,6 +6,10 @@ ... }: +# NOTE: +# Most frustrated part of zsh is how to keep speed with the slow completions. +# See https://github.com/zsh-users/zsh/blob/zsh-5.9/Completion/compinit for the options. + let ZCOMPDUMP_CACHE_DIR = "${config.xdg.cacheHome}/zsh"; ZCOMPDUMP_CACHE_PATH = "${ZCOMPDUMP_CACHE_DIR}/zcompdump-${pkgs.zsh.version}"; @@ -20,10 +24,9 @@ in programs.zellij.enableZshIntegration = false; home.activation.refreshZcompdumpCache = config.lib.dag.entryAnywhere '' - if [[ -v oldGenPath ]]; then - run ${lib.getBin pkgs.coreutils}/bin/mkdir -p '${ZCOMPDUMP_CACHE_DIR}' - run ${lib.getExe pkgs.zsh} --interactive -c 'compinit -d "${ZCOMPDUMP_CACHE_PATH}"' - run ${lib.getBin pkgs.coreutils}/bin/touch '${ZCOMPDUMP_CACHE_PATH}' # Ensure to update timestamp + if [[ -v oldGenPath && -f '${ZCOMPDUMP_CACHE_PATH}' ]]; then + # Enforcing to clear old cache, because of just omitting -C kept the command names + ${lib.getBin pkgs.coreutils}/bin/rm '${ZCOMPDUMP_CACHE_PATH}' fi ''; From fb008efb4ff9e1e68ffd689414b1887f427ae4bb Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 20 Oct 2024 17:45:27 +0900 Subject: [PATCH 147/197] Prefer sequoia-sq for the option of OpenPGP implementation (#849) * Add sequoia-sq for the preferred option of OpenPGP implementation * Replace "gnupg + gpg-agent + pass" with "sequoia-chameleon-gnupg + gpg-agent + gopass" * Remove added gpg-sq alias for gpg, keep original gpg now now --- config/powershell/Profile.ps1 | 2 +- home-manager/common.nix | 6 +++--- home-manager/git.nix | 5 ++++- home-manager/packages.nix | 9 +++++--- home-manager/{gpg.nix => pgp.nix} | 36 ++++++++++++++++++++++++++++--- home-manager/ssh.nix | 4 ++-- 6 files changed, 49 insertions(+), 13 deletions(-) rename home-manager/{gpg.nix => pgp.nix} (61%) diff --git a/config/powershell/Profile.ps1 b/config/powershell/Profile.ps1 index ccb4f4ac..b0ae7bf2 100644 --- a/config/powershell/Profile.ps1 +++ b/config/powershell/Profile.ps1 @@ -21,7 +21,7 @@ function la { # https://github.com/microsoft/winget-cli/issues/2498#issuecomment-1553863082 $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") # Specify `bash -i` to run the bash as interactive mode -[Environment]::SetEnvironmentVariable("RCLONE_PASSWORD_COMMAND", 'wsl.exe --exec bash -ic "pass show rclone"') +[Environment]::SetEnvironmentVariable("RCLONE_PASSWORD_COMMAND", 'wsl.exe --exec bash -ic "gopass show rclone"') Invoke-Expression (&starship init powershell) Invoke-Expression (& { (zoxide init powershell | Out-String) }) diff --git a/home-manager/common.nix b/home-manager/common.nix index b96f8af4..b8fbddd0 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -12,7 +12,7 @@ ./bash.nix ./zsh.nix ./fish.nix - ./gpg.nix + ./pgp.nix ./ssh.nix ./git.nix ./editors.nix @@ -65,8 +65,8 @@ STACK_XDG = "https://github.com/commercialhaskell/stack/blob/72f0a1273dd1121740501a159988fc23df2fb362/doc/stack_root.md?plain=1#L7-L11"; - # Don't add needless quotation in the arguments. For example `pass show 'rclone'` does not work. It should be `pass show rclone`. - RCLONE_PASSWORD_COMMAND = "${lib.getExe pkgs.pass} show rclone"; + # Don't add needless quotation in the arguments. For example `gopass show 'rclone'` does not work. It should be `gopass show rclone`. + RCLONE_PASSWORD_COMMAND = "${lib.getExe pkgs.gopass} show rclone"; }; sessionPath = [ diff --git a/home-manager/git.nix b/home-manager/git.nix index dde31d5c..da1fdaa9 100644 --- a/home-manager/git.nix +++ b/home-manager/git.nix @@ -1,6 +1,7 @@ { pkgs, homemade-pkgs, + edge-pkgs, lib, ... }: @@ -57,9 +58,11 @@ }; gpg = { - # I prefer GPG sign rather than SSH key to consider revocation and expiration usecase. + # I prefer PGP sign rather than SSH key to consider revocation and expiration usecase. # See https://github.com/kachick/dotfiles/issues/289 for detail. format = "openpgp"; + + program = "${pkgs.lib.getBin edge-pkgs.sequoia-chameleon-gnupg}/bin/gpg-sq"; # GH-830 }; commit = { diff --git a/home-manager/packages.nix b/home-manager/packages.nix index 2800f167..3ba98533 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -44,10 +44,13 @@ gh ghq - # GPG - gnupg + edge-pkgs.sequoia-sq # Alt `gpg` - nixos-24.05 does not backport recent versions and the older requires to rebuild. https://github.com/NixOS/nixpkgs/pull/331099 + edge-pkgs.sequoia-chameleon-gnupg + gnupg # Also keep original GPG for now. sequoia-chameleon-gnupg does not support some crucial toolset. etc: `gpg --edit-key`, `gpgconf` - pass + # Alt `pass` for password-store. Candidates: gopass, prs + gopass # They will respect pass comaptibility: https://github.com/gopasspw/gopass/issues/1365#issuecomment-719655627 + # Do not use ripasso-cursive for now. It only provides TUI, not a replacement of CLI. And currently unstable on my NixOS. # Do not specify vim and the plugins at here, it made collisions from home-manager vim module. # See following issues diff --git a/home-manager/gpg.nix b/home-manager/pgp.nix similarity index 61% rename from home-manager/gpg.nix rename to home-manager/pgp.nix index acb608b7..65a7ab16 100644 --- a/home-manager/gpg.nix +++ b/home-manager/pgp.nix @@ -1,6 +1,25 @@ -{ config, pkgs, ... }: +{ + config, + pkgs, + edge-pkgs, + ... +}: -# ## FAQ - GPG +# # FAQ +# +# ## sequoia-sq and gpg +# +# See GH-830 +# +# If you faced to decrypt error with gpg-sq, check it with `sq decrypt`. It displays error details. +# For example, `1: AEAD Encrypted Data Packet v1 is not considered secure` +# This is caused by encrypted non configured gpg for the AEAD. Disable it with showpref/setpref if you still use gpg. +# +# ## sequoia-sq +# +# TODO: +# +# ## GPG # # - How to list keys? # - 1. `gpg --list-secret-keys --keyid-format=long` # The `sec` first section displays same text as `pub` by `gpg --list-keys --keyid-format=long` @@ -23,6 +42,9 @@ let day = 60 * 60 * 24; in { + # Don't set $SEQUOIA_HOME, it unified config and data, cache to one directory as same as gpg era. + # Use default $HOME instead, it respects XDG Base Directory Specification + # https://github.com/nix-community/home-manager/blob/release-24.05/modules/services/gpg-agent.nix services.gpg-agent = { enable = pkgs.stdenv.isLinux; @@ -41,16 +63,23 @@ in enableSshSupport = false; }; - # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/gpg.nix + home.sessionVariables = { + GOPASS_GPG_BINARY = "${pkgs.lib.getBin edge-pkgs.sequoia-chameleon-gnupg}/bin/gpg-sq"; + }; + # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/gpg.nix programs.gpg = { enable = true; + # package = edge-pkgs.sequoia-chameleon-gnupg; # Also will be respected in gpg-agent: https://github.com/nix-community/home-manager/blob/5171f5ef654425e09d9c2100f856d887da595437/modules/services/gpg-agent.nix#L8C3-L8C9 + # However I prefer original gnupg for now, sequoia-chameleon-gnupg does not support crucial features for GPG toolset (etc. `gpg --edit-key`, `gpgconf`) # Preferring XDG_DATA_HOME rather than XDG_CONFIG_HOME from following examples # - https://wiki.archlinux.org/title/XDG_Base_Directory # - https://github.com/nix-community/home-manager/blob/5171f5ef654425e09d9c2100f856d887da595437/modules/programs/gpg.nix#L192 homedir = "${config.xdg.dataHome}/gnupg"; + # Used for `gpg.conf`. I don't know how to specify `gpgconf` with this. + # TODO: Set gpg binary as sequoia-chameleon-gnupg. AFAIK I don't actually need it for now, because I'm not using dependent tools. However it is ideal config. # - How to read `--list-keys` - https://unix.stackexchange.com/questions/613839/help-understanding-gpg-list-keys-output # - Ed448 in GitHub is not yet supported - https://github.com/orgs/community/discussions/45937 settings = { @@ -64,5 +93,6 @@ in # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/password-store.nix programs.password-store = { enable = true; + package = pkgs.gopass; # Setting package is not a aliasing command, however I would try this for now. https://github.com/gopasspw/gopass/blob/70c56f9102999661b54e28c28fa2d63fa5fc813b/docs/setup.md?plain=1#L292-L298 }; } diff --git a/home-manager/ssh.nix b/home-manager/ssh.nix index 6206243c..fc2be679 100644 --- a/home-manager/ssh.nix +++ b/home-manager/ssh.nix @@ -24,9 +24,9 @@ in SSH_ASKPASS = pkgs.lib.getExe ( pkgs.writeShellApplication { name = "ssh-ask-pass"; - text = "pass show ssh-pass"; + text = "gopass show ssh-pass"; meta.description = "GH-714. Required to be wrapped with one command because of SSH_ASKPASS does not accept arguments."; - runtimeInputs = with pkgs; [ pass ]; + runtimeInputs = with pkgs; [ gopass ]; } ); }; From e108001b0992948e31ceb421fc8e6b4741c5d605 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 20 Oct 2024 18:01:19 +0900 Subject: [PATCH 148/197] Ensure gopass respects GOPASS_GPG_BINARY in encloded package Follow GH-849 --- home-manager/ssh.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/home-manager/ssh.nix b/home-manager/ssh.nix index fc2be679..f695acc9 100644 --- a/home-manager/ssh.nix +++ b/home-manager/ssh.nix @@ -1,4 +1,9 @@ -{ pkgs, config, ... }: +{ + pkgs, + edge-pkgs, + config, + ... +}: let # SSH files cannot use XDG Base Directory. @@ -26,7 +31,10 @@ in name = "ssh-ask-pass"; text = "gopass show ssh-pass"; meta.description = "GH-714. Required to be wrapped with one command because of SSH_ASKPASS does not accept arguments."; - runtimeInputs = with pkgs; [ gopass ]; + runtimeInputs = (with pkgs; [ gopass ]) ++ (with edge-pkgs; [ sequoia-chameleon-gnupg ]); + runtimeEnv = { + GOPASS_GPG_BINARY = "${pkgs.lib.getBin edge-pkgs.sequoia-chameleon-gnupg}/bin/gpg-sq"; + }; } ); }; From 8c9e9d853bce0d45febc626a53eafc40e55dc655 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 20 Oct 2024 19:34:01 +0900 Subject: [PATCH 149/197] Backport nixpkgs merged changes for integration of cargo-make completions (#859) Apply NixOS/nixpkgs#349104 Update GH-771 --- home-manager/bash.nix | 5 +++- home-manager/zsh.nix | 3 ++- pkgs/cargo-make-completions/default.nix | 31 ------------------------- pkgs/default.nix | 2 -- 4 files changed, 6 insertions(+), 35 deletions(-) delete mode 100644 pkgs/cargo-make-completions/default.nix diff --git a/home-manager/bash.nix b/home-manager/bash.nix index 23127de6..ba014eaa 100644 --- a/home-manager/bash.nix +++ b/home-manager/bash.nix @@ -3,6 +3,7 @@ lib, pkgs, homemade-pkgs, + edge-pkgs, ... }: @@ -122,7 +123,9 @@ source "${pkgs.fzf-git-sh}/share/fzf-git-sh/fzf-git.sh" source "${pkgs.podman}/share/bash-completion/completions/podman" source "${pkgs.zellij}/share/bash-completion/completions/zellij.bash" - source "${homemade-pkgs.cargo-make-completions}/share/bash-completion/completions/makers-completion.bash" + + # Adding only in devshell is not enough + source "${edge-pkgs.cargo-make}/share/bash-completion/completions/makers-completion.bash" source "${../dependencies/dprint/completions.bash}" diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix index d6b7ded4..99291a46 100644 --- a/home-manager/zsh.nix +++ b/home-manager/zsh.nix @@ -3,6 +3,7 @@ lib, pkgs, homemade-pkgs, + edge-pkgs, ... }: @@ -231,7 +232,7 @@ in source "${pkgs.fzf-git-sh}/share/fzf-git-sh/fzf-git.sh" source "${pkgs.podman}/share/zsh/site-functions/_podman" # cargo-make recommends to use bash completions for zsh - source "${homemade-pkgs.cargo-make-completions}/share/bash-completion/completions/makers-completion.bash" + source "${edge-pkgs.cargo-make}/share/bash-completion/completions/makers-completion.bash" # fzf completions are also possible to be used in bash, but it overrides default completions with the registering # So currently injecting only in zsh diff --git a/pkgs/cargo-make-completions/default.nix b/pkgs/cargo-make-completions/default.nix deleted file mode 100644 index 0ee52943..00000000 --- a/pkgs/cargo-make-completions/default.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitHub, - installShellFiles, -}: - -stdenv.mkDerivation rec { - pname = "cargo-make-completions"; - version = "0.37.16"; - - src = fetchFromGitHub { - owner = "sagiegurari"; - repo = "cargo-make"; - rev = version; - hash = "sha256-OC1HzoEb9OyusYGC5jmEC4qW4U3oGApYvpy5XkZttSg="; - }; - - nativeBuildInputs = [ installShellFiles ]; - - installPhase = '' - installShellCompletion extra/shell/*.bash - ''; - - meta = with lib; { - description = "cargo-make shell completions which missing in nixpkgs"; - homepage = "https://github.com/sagiegurari/cargo-make"; - license = licenses.asl20; - platforms = platforms.all; - }; -} diff --git a/pkgs/default.nix b/pkgs/default.nix index 0a5b7f58..25d6f02f 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -61,8 +61,6 @@ micro-kdl = pkgs.callPackage ./micro-kdl { }; micro-nordcolors = pkgs.callPackage ./micro-nordcolors { }; - cargo-make-completions = pkgs.callPackage ./cargo-make-completions { }; - kdl-vim = pkgs.callPackage ./kdl.vim { }; nix-hash-url = pkgs.callPackage ./nix-hash-url { }; From 2ed1ad4d163e09db28d0f11431b9a4d6d1b92ead Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 20 Oct 2024 19:47:10 +0900 Subject: [PATCH 150/197] Ensure helix for gh editor such as git editor (#860) Open visual editor does not match for gh command purpose... --- home-manager/git.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/home-manager/git.nix b/home-manager/git.nix index da1fdaa9..443b1d9b 100644 --- a/home-manager/git.nix +++ b/home-manager/git.nix @@ -138,6 +138,9 @@ enable = true; settings = { + # Without this, gh prefer $VISUAL + editor = lib.getExe pkgs.helix; + aliases = { # https://github.com/kachick/wait-other-jobs/blob/b576def89f0816aab642bed952817a018e99b373/docs/examples.md#github_token-vs-pat setup = '' From 4561a84226d2c1d227d4f862a364a6cf9920c7f5 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 20 Oct 2024 20:42:58 +0900 Subject: [PATCH 151/197] Install signal-desktop in macOS via nixpkgs (#861) --- flake.nix | 45 ++++++++++++++++++++++++++++----------- home-manager/packages.nix | 2 ++ 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/flake.nix b/flake.nix index f8400aee..677fa324 100644 --- a/flake.nix +++ b/flake.nix @@ -186,21 +186,42 @@ }; }; - x86-macOS = { - pkgs = nixpkgs.legacyPackages.x86_64-darwin; - extraSpecialArgs = { - homemade-pkgs = homemade-packages.x86_64-darwin; - edge-pkgs = edge-nixpkgs.legacyPackages.x86_64-darwin; + x86-macOS = + let + system = "x86_64-darwin"; + in + { + pkgs = nixpkgs.legacyPackages.${system}; + extraSpecialArgs = { + homemade-pkgs = homemade-packages.${system}; + edge-pkgs = import edge-nixpkgs { + inherit system; + config = { + # Atleast required for following + # signal-desktop: https://github.com/NixOS/nixpkgs/pull/348165/files#diff-05921dc46b537c59c8a76dfc3c3e9a3a1fd93345ee5bff8573aae36dedf719bcR49 + # android-studio: https://github.com/NixOS/nixpkgs/blob/3490095db7c455272ee96c1d99d424d029bdf576/pkgs/applications/editors/android-studio/common.nix#L281 + allowUnfree = true; + }; + }; + }; }; - }; - aarch64-macOS = { - pkgs = nixpkgs.legacyPackages.aarch64-darwin; - extraSpecialArgs = { - homemade-pkgs = homemade-packages.aarch64-darwin; - edge-pkgs = edge-nixpkgs.legacyPackages.aarch64-darwin; + aarch64-macOS = + let + system = "aarch64-darwin"; + in + { + pkgs = nixpkgs.legacyPackages.${system}; + extraSpecialArgs = { + homemade-pkgs = homemade-packages.${system}; + edge-pkgs = import edge-nixpkgs { + inherit system; + config = { + allowUnfree = true; + }; + }; + }; }; - }; in { "kachick@desktop" = home-manager.lib.homeManagerConfiguration ( diff --git a/home-manager/packages.nix b/home-manager/packages.nix index 3ba98533..7a751ef4 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -162,6 +162,8 @@ # Don't add zed in macOS with nixpkgs # https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219 # edge-pkgs.zed-editor + + edge-pkgs.signal-desktop # Useable since https://github.com/NixOS/nixpkgs/pull/348165 ]) ) ++ (with homemade-pkgs; [ From 3ea3a21d27d55768ecf31ceeeef1e060a00e1b67 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 20 Oct 2024 22:39:46 +0900 Subject: [PATCH 152/197] Adjust locale setting especially to fix Tofu in VT (#864) * Prefer English for system default * Ensure ASCII in Linux VT console * Prefer ISO 8601 date format with en_DK hack ref: GH-667, GH-858 --- home-manager/bash.nix | 1 + home-manager/common.nix | 7 +++++++ home-manager/zsh.nix | 1 + nixos/configuration.nix | 15 ++------------- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/home-manager/bash.nix b/home-manager/bash.nix index ba014eaa..bc56c5dc 100644 --- a/home-manager/bash.nix +++ b/home-manager/bash.nix @@ -135,6 +135,7 @@ source "${homemade-pkgs.posix_shared_functions}" if [ 'linux' = "$TERM" ]; then + export LANG=C # Avoid Tofu disable_blinking_cursor fi '' diff --git a/home-manager/common.nix b/home-manager/common.nix index b8fbddd0..b3e99268 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -79,6 +79,13 @@ inherit edge-pkgs; inherit homemade-pkgs; }; + + # https://wiki.archlinux.jp/index.php/%E3%83%AD%E3%82%B1%E3%83%BC%E3%83%AB + # https://github.com/nix-community/home-manager/blob/fe56302339bb28e3471632379d733547caec8103/modules/home-environment.nix#L11 + language = { + base = "ja_JP.UTF-8"; + time = "en_DK.UTF-8"; # To prefer ISO 8601 format. See https://unix.stackexchange.com/questions/62316/why-is-there-no-euro-english-locale + }; }; # Let Home Manager install and manage itself. diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix index 99291a46..3c2d842d 100644 --- a/home-manager/zsh.nix +++ b/home-manager/zsh.nix @@ -292,6 +292,7 @@ in source_sh "${homemade-pkgs.posix_shared_functions}" if [ 'linux' = "$TERM" ]; then + export LANG=C # Avoid Tofu disable_blinking_cursor fi diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 75c99b20..38377c79 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -168,21 +168,10 @@ }; }; - # TODO: Reconsider to set C or EN for servers - # Select internationalisation properties. i18n = { - defaultLocale = "ja_JP.UTF-8"; - extraLocaleSettings = { - LC_ADDRESS = "ja_JP.UTF-8"; - LC_IDENTIFICATION = "ja_JP.UTF-8"; - LC_MEASUREMENT = "ja_JP.UTF-8"; - LC_MONETARY = "ja_JP.UTF-8"; - LC_NAME = "ja_JP.UTF-8"; - LC_NUMERIC = "ja_JP.UTF-8"; - LC_PAPER = "ja_JP.UTF-8"; - LC_TELEPHONE = "ja_JP.UTF-8"; - LC_TIME = "ja_JP.UTF-8"; + # https://wiki.archlinux.jp/index.php/%E3%83%AD%E3%82%B1%E3%83%BC%E3%83%AB + LC_TIME = "en_DK.UTF-8"; # To prefer ISO 8601 format. See https://unix.stackexchange.com/questions/62316/why-is-there-no-euro-english-locale }; }; } From 33fb3249faf0b03e3d2ee3032ca5996372b36bc2 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 20 Oct 2024 23:51:39 +0900 Subject: [PATCH 153/197] Force setting plain text starship presets when in Linux VT console (#865) --- home-manager/bash.nix | 5 ++++- home-manager/common.nix | 5 ++--- home-manager/zsh.nix | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/home-manager/bash.nix b/home-manager/bash.nix index bc56c5dc..6d0d3c7c 100644 --- a/home-manager/bash.nix +++ b/home-manager/bash.nix @@ -135,7 +135,10 @@ source "${homemade-pkgs.posix_shared_functions}" if [ 'linux' = "$TERM" ]; then - export LANG=C # Avoid Tofu + # Avoid Tofu + export LANG=C + export STARSHIP_CONFIG="${pkgs.starship}/share/starship/presets/plain-text-symbols.toml" + disable_blinking_cursor fi '' diff --git a/home-manager/common.nix b/home-manager/common.nix index b3e99268..60a3c8cb 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -67,6 +67,8 @@ # Don't add needless quotation in the arguments. For example `gopass show 'rclone'` does not work. It should be `gopass show rclone`. RCLONE_PASSWORD_COMMAND = "${lib.getExe pkgs.gopass} show rclone"; + + STARSHIP_CONFIG = ../config/starship/starship.toml; }; sessionPath = [ @@ -136,9 +138,6 @@ enable = true; }; - # Not under "starship/starship.toml" - xdg.configFile."starship.toml".source = ../config/starship/starship.toml; - # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/yazi.nix # TODO: Use shell integrations for `y` after release-24.11. 24.05 is using fixed old `ya` programs.yazi = { diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix index 3c2d842d..f9d86e9c 100644 --- a/home-manager/zsh.nix +++ b/home-manager/zsh.nix @@ -292,7 +292,10 @@ in source_sh "${homemade-pkgs.posix_shared_functions}" if [ 'linux' = "$TERM" ]; then - export LANG=C # Avoid Tofu + # Avoid Tofu + export LANG=C + export STARSHIP_CONFIG="${pkgs.starship}/share/starship/presets/plain-text-symbols.toml" + disable_blinking_cursor fi From fff253d75ef4c78af2c8a792e78c769997125471 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 21 Oct 2024 01:27:59 +0900 Subject: [PATCH 154/197] Set everforest for micro-editor theme --- flake.nix | 2 ++ home-manager/micro.nix | 4 +++- pkgs/default.nix | 1 + pkgs/micro-everforest/default.nix | 20 ++++++++++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 pkgs/micro-everforest/default.nix diff --git a/flake.nix b/flake.nix index 677fa324..49a349e1 100644 --- a/flake.nix +++ b/flake.nix @@ -101,6 +101,8 @@ packages = forAllSystems (system: { cozette = homemade-packages.${system}.cozette; micro-kdl = homemade-packages.${system}.micro-kdl; + micro-nordcolors = homemade-packages.${system}.micro-nordcolors; + micro-everforest = homemade-packages.${system}.micro-everforest; }); apps = forAllSystems ( diff --git a/home-manager/micro.nix b/home-manager/micro.nix index 843ab3b2..b367ed50 100644 --- a/home-manager/micro.nix +++ b/home-manager/micro.nix @@ -12,6 +12,7 @@ xdg.configFile."micro/plug/fzfinder".source = homemade-pkgs.micro-fzfinder; xdg.configFile."micro/plug/kdl".source = homemade-pkgs.micro-kdl; xdg.configFile."micro/plug/nordcolors".source = homemade-pkgs.micro-nordcolors; + xdg.configFile."micro/colorschemes/everforest.micro".source = "${homemade-pkgs.micro-everforest}/colorschemes/everforest.micro"; # Default keybinfings are https://github.com/zyedidia/micro/blob/master/runtime/help/keybindings.md xdg.configFile."micro/bindings.json".source = ../config/micro/bindings.json; @@ -60,7 +61,8 @@ # Embed candidates are https://github.com/zyedidia/micro/tree/c15abea64c20066fc0b4c328dfabd3e6ba3253a0/runtime/colorschemes # But none of fit colors with other place, See #587 for further detail - colorscheme = "nord-16"; + # Candidates: nord-16, everforest + colorscheme = "everforest"; fzfcmd = lib.getExe pkgs.fzf; fzfarg = "--preview '${lib.getExe pkgs.bat} --color=always {}'"; diff --git a/pkgs/default.nix b/pkgs/default.nix index 25d6f02f..ed9203b8 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -60,6 +60,7 @@ micro-fzfinder = pkgs.callPackage ./micro-fzfinder { }; micro-kdl = pkgs.callPackage ./micro-kdl { }; micro-nordcolors = pkgs.callPackage ./micro-nordcolors { }; + micro-everforest = pkgs.callPackage ./micro-everforest { }; kdl-vim = pkgs.callPackage ./kdl.vim { }; diff --git a/pkgs/micro-everforest/default.nix b/pkgs/micro-everforest/default.nix new file mode 100644 index 00000000..157f966e --- /dev/null +++ b/pkgs/micro-everforest/default.nix @@ -0,0 +1,20 @@ +{ stdenv, fetchFromGitHub }: + +stdenv.mkDerivation { + name = "micro-everforest"; + src = fetchFromGitHub { + owner = "atomashevic"; + repo = "everforest-micro"; + rev = "3a1844eb88e58c582ac902e27d7cc1b33f43199b"; + sha256 = "sha256-WRjORWRo2/mHhLppn8QDEdLp98g2jbG8cnGB4WNNL1c="; + }; + + buildPhase = '' + mkdir $out + mkdir $out/colorschemes + ''; + + installPhase = '' + cp everforest.micro $out/colorschemes + ''; +} From bbf9b6d7a86424b712ce1aca0064de5627457e56 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 21 Oct 2024 01:52:14 +0900 Subject: [PATCH 155/197] Set catppuccin-mocha-transparent for micro-editor theme --- flake.nix | 1 + home-manager/micro.nix | 12 ++++++++++-- pkgs/default.nix | 1 + pkgs/micro-catppuccin/default.nix | 19 +++++++++++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 pkgs/micro-catppuccin/default.nix diff --git a/flake.nix b/flake.nix index 49a349e1..33d29c15 100644 --- a/flake.nix +++ b/flake.nix @@ -103,6 +103,7 @@ micro-kdl = homemade-packages.${system}.micro-kdl; micro-nordcolors = homemade-packages.${system}.micro-nordcolors; micro-everforest = homemade-packages.${system}.micro-everforest; + micro-catppuccin = homemade-packages.${system}.micro-catppuccin; }); apps = forAllSystems ( diff --git a/home-manager/micro.nix b/home-manager/micro.nix index b367ed50..3c19119b 100644 --- a/home-manager/micro.nix +++ b/home-manager/micro.nix @@ -6,12 +6,20 @@ }: { + home.sessionVariables = { + MICRO_TRUECOLOR = "1"; + }; + # For temporal use xdg.configFile."micro/colorschemes/.keep".text = ""; xdg.configFile."micro/plug/fzfinder".source = homemade-pkgs.micro-fzfinder; xdg.configFile."micro/plug/kdl".source = homemade-pkgs.micro-kdl; xdg.configFile."micro/plug/nordcolors".source = homemade-pkgs.micro-nordcolors; + xdg.configFile."micro/colorschemes" = { + source = "${homemade-pkgs.micro-catppuccin}/colorschemes"; + recursive = true; + }; xdg.configFile."micro/colorschemes/everforest.micro".source = "${homemade-pkgs.micro-everforest}/colorschemes/everforest.micro"; # Default keybinfings are https://github.com/zyedidia/micro/blob/master/runtime/help/keybindings.md @@ -61,8 +69,8 @@ # Embed candidates are https://github.com/zyedidia/micro/tree/c15abea64c20066fc0b4c328dfabd3e6ba3253a0/runtime/colorschemes # But none of fit colors with other place, See #587 for further detail - # Candidates: nord-16, everforest - colorscheme = "everforest"; + # Candidates: nord-16, everforest, catppuccin-mocha-transparent + colorscheme = "catppuccin-mocha-transparent"; fzfcmd = lib.getExe pkgs.fzf; fzfarg = "--preview '${lib.getExe pkgs.bat} --color=always {}'"; diff --git a/pkgs/default.nix b/pkgs/default.nix index ed9203b8..344697fd 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -61,6 +61,7 @@ micro-kdl = pkgs.callPackage ./micro-kdl { }; micro-nordcolors = pkgs.callPackage ./micro-nordcolors { }; micro-everforest = pkgs.callPackage ./micro-everforest { }; + micro-catppuccin = pkgs.callPackage ./micro-catppuccin { }; kdl-vim = pkgs.callPackage ./kdl.vim { }; diff --git a/pkgs/micro-catppuccin/default.nix b/pkgs/micro-catppuccin/default.nix new file mode 100644 index 00000000..a616fc25 --- /dev/null +++ b/pkgs/micro-catppuccin/default.nix @@ -0,0 +1,19 @@ +{ stdenv, fetchFromGitHub }: + +stdenv.mkDerivation { + name = "micro-everforest"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "micro"; + rev = "2802b32308e5b1a827689c095f11ae604bbc85e6"; + sha256 = "sha256-+Jf32S2CHackdmx+UmEKjx71ZCf4VfnxeA3yzz3MSLQ="; + }; + + buildPhase = '' + mkdir $out + ''; + + installPhase = '' + cp -rf src $out/colorschemes + ''; +} From b88d36168b3cfdc03e7d7ff5dfda3bd97f3138ec Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 21 Oct 2024 01:59:44 +0900 Subject: [PATCH 156/197] Refine packaging for micro plugins with stdenvNoCC and license link --- pkgs/micro-catppuccin/default.nix | 13 +++++++++++-- pkgs/micro-everforest/default.nix | 13 +++++++++++-- pkgs/micro-fzfinder/default.nix | 11 ++++++----- pkgs/micro-kdl/default.nix | 10 +++++----- pkgs/micro-nordcolors/default.nix | 13 +++++++++++-- 5 files changed, 44 insertions(+), 16 deletions(-) diff --git a/pkgs/micro-catppuccin/default.nix b/pkgs/micro-catppuccin/default.nix index a616fc25..765b27ed 100644 --- a/pkgs/micro-catppuccin/default.nix +++ b/pkgs/micro-catppuccin/default.nix @@ -1,6 +1,10 @@ -{ stdenv, fetchFromGitHub }: +{ + lib, + stdenvNoCC, + fetchFromGitHub, +}: -stdenv.mkDerivation { +stdenvNoCC.mkDerivation { name = "micro-everforest"; src = fetchFromGitHub { owner = "catppuccin"; @@ -16,4 +20,9 @@ stdenv.mkDerivation { installPhase = '' cp -rf src $out/colorschemes ''; + + meta = { + # https://github.com/catppuccin/micro/blob/2802b32308e5b1a827689c095f11ae604bbc85e6/LICENSE + license = lib.licenses.mit; + }; } diff --git a/pkgs/micro-everforest/default.nix b/pkgs/micro-everforest/default.nix index 157f966e..a40480e6 100644 --- a/pkgs/micro-everforest/default.nix +++ b/pkgs/micro-everforest/default.nix @@ -1,6 +1,10 @@ -{ stdenv, fetchFromGitHub }: +{ + lib, + stdenvNoCC, + fetchFromGitHub, +}: -stdenv.mkDerivation { +stdenvNoCC.mkDerivation { name = "micro-everforest"; src = fetchFromGitHub { owner = "atomashevic"; @@ -17,4 +21,9 @@ stdenv.mkDerivation { installPhase = '' cp everforest.micro $out/colorschemes ''; + + meta = { + # https://github.com/atomashevic/everforest-micro/blob/3a1844eb88e58c582ac902e27d7cc1b33f43199b/LICENSE + license = lib.licenses.mit; + }; } diff --git a/pkgs/micro-fzfinder/default.nix b/pkgs/micro-fzfinder/default.nix index 75bcf5d4..25d06956 100644 --- a/pkgs/micro-fzfinder/default.nix +++ b/pkgs/micro-fzfinder/default.nix @@ -1,10 +1,10 @@ { lib, - stdenv, + stdenvNoCC, fetchFromGitHub, }: -stdenv.mkDerivation rec { +stdenvNoCC.mkDerivation rec { pname = "micro-fzfinder"; version = "0.2.0"; @@ -24,11 +24,12 @@ stdenv.mkDerivation rec { cp fzfinder.lua $out ''; - meta = with lib; { + meta = { description = "The plugin allows you to integrate fzf to select and search for your project files"; homepage = "https://github.com/MuratovAS/micro-fzfinder"; - license = licenses.mit; + # https://github.com/MuratovAS/micro-fzfinder/blob/7be0adb25d72b557eab9fea5aceaff18d47bff52/LICENSE + license = lib.licenses.mit; mainProgram = "micro-fzfinder"; - platforms = platforms.all; + platforms = lib.platforms.all; }; } diff --git a/pkgs/micro-kdl/default.nix b/pkgs/micro-kdl/default.nix index 1149cdc1..b2e653cc 100644 --- a/pkgs/micro-kdl/default.nix +++ b/pkgs/micro-kdl/default.nix @@ -1,10 +1,10 @@ { lib, - stdenv, + stdenvNoCC, fetchFromGitHub, }: -stdenv.mkDerivation rec { +stdenvNoCC.mkDerivation rec { pname = "micro-kdl"; version = "0.1.0"; @@ -24,11 +24,11 @@ stdenv.mkDerivation rec { cp kdl.* $out ''; - meta = with lib; { + meta = { description = "Micro editor syntax highlighting for KDL"; homepage = "https://github.com/kachick/micro-kdl"; - license = licenses.mit; + license = lib.licenses.mit; mainProgram = "micro-kdl"; - platforms = platforms.all; + platforms = lib.platforms.all; }; } diff --git a/pkgs/micro-nordcolors/default.nix b/pkgs/micro-nordcolors/default.nix index 857c46ee..cd66a8da 100644 --- a/pkgs/micro-nordcolors/default.nix +++ b/pkgs/micro-nordcolors/default.nix @@ -1,6 +1,10 @@ -{ stdenv, fetchFromGitHub }: +{ + lib, + stdenvNoCC, + fetchFromGitHub, +}: -stdenv.mkDerivation { +stdenvNoCC.mkDerivation { name = "micro-nordcolors"; src = fetchFromGitHub { owner = "KiranWells"; @@ -19,4 +23,9 @@ stdenv.mkDerivation { cp -rf ./colorschemes $out/colorschemes cp -rf ./help $out/help ''; + + meta = { + # https://github.com/KiranWells/micro-nord-tc-colors/blob/f63c855735f755704c25c958abe45f12a4b2c8d3/LICENSE + license = lib.licenses.mit; + }; } From 0dc84044a524ac48eb4dfcbdd85406a48cc45d68 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 21 Oct 2024 11:34:14 +0900 Subject: [PATCH 157/197] Fix macos trigger path for home-manager --- .github/workflows/ci-home.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-home.yml b/.github/workflows/ci-home.yml index cf16b257..bc0d23ab 100644 --- a/.github/workflows/ci-home.yml +++ b/.github/workflows/ci-home.yml @@ -4,14 +4,14 @@ on: branches: [main] paths: - '.github/workflows/ci-home.yml' - - '**/home-manager/**.nix' + - 'home-manager/**.nix' - '**.nix' - 'flake.*' - 'Makefile.toml' pull_request: paths: - '.github/workflows/ci-home.yml' - - '**/home-manager/**.nix' + - 'home-manager/**.nix' - '**.nix' - 'flake.*' - 'Makefile.toml' From 87dca0c59f8929c12dedb68435bf09401ffea0c0 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 21 Oct 2024 12:20:54 +0900 Subject: [PATCH 158/197] Run slow macos-13 runner only when changed darwin related files (#867) --- .github/workflows/ci-home.yml | 11 ++++++++--- cmd/gen_matrix/main.go | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-home.yml b/.github/workflows/ci-home.yml index bc0d23ab..5e78fea9 100644 --- a/.github/workflows/ci-home.yml +++ b/.github/workflows/ci-home.yml @@ -28,18 +28,23 @@ jobs: outputs: matrix: ${{ steps.generator.outputs.matrix }} steps: + - name: Install gh-action-escape + run: curl -fsSL https://raw.githubusercontent.com/kachick/gh-action-escape/main/scripts/install-in-github-action.sh | sh -s v0.2.0 - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Get changed paths + run: | + git diff origin/main --name-only | gh-action-escape -name=CHANGED_PATHS | tee --append "$GITHUB_ENV" - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: 'go.mod' cache-dependency-path: 'go.sum' - - name: Install gh-action-escape - run: curl -fsSL https://raw.githubusercontent.com/kachick/gh-action-escape/main/scripts/install-in-github-action.sh | sh -s v0.2.0 - name: Generate Matrix id: generator run: | - go run ./cmd/gen_matrix -event_name '${{ github.event_name }}' | gh-action-escape -name=matrix | tee -a "$GITHUB_OUTPUT" + go run ./cmd/gen_matrix -event_name '${{ github.event_name }}' -paths "$CHANGED_PATHS" | gh-action-escape -name=matrix | tee -a "$GITHUB_OUTPUT" home-manager: needs: [generate_matrix] if: (github.event_name != 'pull_request') || (!github.event.pull_request.draft) diff --git a/cmd/gen_matrix/main.go b/cmd/gen_matrix/main.go index 197fa4ca..ad5bdf5b 100644 --- a/cmd/gen_matrix/main.go +++ b/cmd/gen_matrix/main.go @@ -5,6 +5,7 @@ import ( "flag" "fmt" "log" + "strings" ) type Matrix struct { @@ -13,10 +14,24 @@ type Matrix struct { func main() { eventNameFlag := flag.String("event_name", "", "github.event_name") + pathsFlag := flag.String("paths", "", "changed paths specified by lines") flag.Parse() eventName := *eventNameFlag + paths := *pathsFlag + + higherMacOSPossibility := false + + for paths != "" { + line, rest, _ := strings.Cut(paths, "\n") + paths = rest + line = strings.TrimSuffix(line, "\r") + + if strings.Contains(line, "darwin") || line == "home-manager/packages.nix" { + higherMacOSPossibility = true + } + } if eventName == "" { flag.Usage() @@ -32,7 +47,7 @@ func main() { }, } - if eventName != "pull_request" { + if higherMacOSPossibility || eventName != "pull_request" { matrix.Os = append(matrix.Os, // Intel. Correct with the architecture. But basically skipping because of it is much slow to complete. "macos-13", From 5bc8fb636a9fb77c9bad7699162dfb919de85b6f Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 21 Oct 2024 13:11:39 +0900 Subject: [PATCH 159/197] Install Maccy in macOS with forked Nix package (#866) --- .github/workflows/ci-home.yml | 4 +++ home-manager/packages.nix | 2 ++ pkgs/default.nix | 1 + pkgs/maccy/default.nix | 47 +++++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 pkgs/maccy/default.nix diff --git a/.github/workflows/ci-home.yml b/.github/workflows/ci-home.yml index 5e78fea9..05948742 100644 --- a/.github/workflows/ci-home.yml +++ b/.github/workflows/ci-home.yml @@ -94,6 +94,10 @@ jobs: zsh -c 'irb --version' zsh -c 'ssh -V' zsh -c 'hx --health' + - name: Make sure macos dependencies + if: runner.os == 'macOS' + run: | + zsh -c 'command -v maccy' - name: Run homemade commands run: | zsh -c 'la ~; lat ~/.config' diff --git a/home-manager/packages.nix b/home-manager/packages.nix index 7a751ef4..f3a8bb74 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -164,6 +164,8 @@ # edge-pkgs.zed-editor edge-pkgs.signal-desktop # Useable since https://github.com/NixOS/nixpkgs/pull/348165 + + homemade-pkgs.maccy ]) ) ++ (with homemade-pkgs; [ diff --git a/pkgs/default.nix b/pkgs/default.nix index 344697fd..c951aafc 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -54,6 +54,7 @@ beedii = pkgs.callPackage ./beedii { }; cozette = pkgs.callPackage ./cozette { }; + maccy = pkgs.callPackage ./maccy { }; posix_shared_functions = pkgs.callPackage ./posix_shared_functions { }; diff --git a/pkgs/maccy/default.nix b/pkgs/maccy/default.nix new file mode 100644 index 00000000..d41dd312 --- /dev/null +++ b/pkgs/maccy/default.nix @@ -0,0 +1,47 @@ +{ + lib, + stdenvNoCC, + fetchurl, + unzip, + makeWrapper, +}: + +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "maccy"; + version = "2.1.0"; + + src = fetchurl { + url = "https://github.com/p0deje/Maccy/releases/download/${finalAttrs.version}/Maccy.app.zip"; + hash = "sha256-yFlq2A5NAryBU2UnVk1VuS7MBsov/Fm15VwkX+OTLBM="; + }; + + dontUnpack = true; + + nativeBuildInputs = [ + unzip + makeWrapper + ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/Applications + unzip -d $out/Applications $src + makeWrapper "$out/Applications/Maccy.app/Contents/MacOS/Maccy" "$out/bin/maccy" + + runHook postInstall + ''; + + meta = with lib; { + description = "Simple clipboard manager for macOS"; + homepage = "https://maccy.app"; + license = licenses.mit; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + maintainers = with maintainers; [ + emilytrau + kachick + ]; + platforms = platforms.darwin; + mainProgram = "maccy"; + }; +}) From ebc8011822e45f888e7818a96c4a32a6203ab00d Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 21 Oct 2024 13:45:15 +0900 Subject: [PATCH 160/197] Refactor home-manager packages with the os (#868) --- home-manager/darwin.nix | 34 +++++ home-manager/linux.nix | 28 +++- home-manager/packages.nix | 267 +++++++++++++++----------------------- 3 files changed, 168 insertions(+), 161 deletions(-) diff --git a/home-manager/darwin.nix b/home-manager/darwin.nix index 2042fc59..641895f5 100644 --- a/home-manager/darwin.nix +++ b/home-manager/darwin.nix @@ -1,5 +1,7 @@ { pkgs, + edge-pkgs, + homemade-pkgs, lib, config, ... @@ -23,6 +25,38 @@ lib.mkMerge [ # For example: zed-editor, cloudflare-warp, vscode(symlink?) "/usr/local/bin" ]; + + packages = with pkgs; [ + # https://github.com/NixOS/nixpkgs/issues/240819 + pinentry_mac + + alacritty + kitty + # foot is only provided for Linux wayland + + # Don't install firefox via nixpkgs for darwin, it is broken https://github.com/NixOS/nixpkgs/blob/bac526a0fe6da6b10cfe2454f62a0defdbf1d898/pkgs/applications/networking/browsers/firefox/packages.nix#L23 + + # - You can use major Nerd Fonts as `pkgs.nerdfonts.override ...` + # - Should have at least 1 composite font that includes Monospace + Japanese + Nerd fonts, + # because of alacritty does not have the fallback font feature. https://github.com/alacritty/alacritty/issues/957 + # - Keep fewer nerd fonts to reduce disk space + + # You can also use 0 = `Slashed zero style` with enabling `"editor.fontLigatures": "'zero'"` in vscode + # but cannot use it in alacritty https://github.com/alacritty/alacritty/issues/50 + plemoljp-nf + ibm-plex # For sans-serif, use plemoljp for developing + + source-han-code-jp # Includes many definitions, useful for fallback + inconsolata + + # Don't add zed in macOS with nixpkgs + # https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219 + # edge-pkgs.zed-editor + + edge-pkgs.signal-desktop # Useable since https://github.com/NixOS/nixpkgs/pull/348165 + + homemade-pkgs.maccy + ]; }; xdg = { diff --git a/home-manager/linux.nix b/home-manager/linux.nix index aefd09fa..6c184ec2 100644 --- a/home-manager/linux.nix +++ b/home-manager/linux.nix @@ -1,4 +1,10 @@ -{ pkgs, lib, ... }: +{ + pkgs, + lib, + edge-pkgs, + homemade-pkgs, + ... +}: # https://github.com/nix-community/home-manager/issues/414#issuecomment-427163925 lib.mkMerge [ @@ -7,6 +13,26 @@ lib.mkMerge [ # https://github.com/nix-community/home-manager/blob/559856748982588a9eda6bfb668450ebcf006ccd/modules/targets/generic-linux.nix#L16 targets.genericLinux.enable = true; + home.packages = with pkgs; [ + # Fix missing locales as `locale: Cannot set LC_CTYPE to default locale` + glibc + + # https://github.com/nix-community/home-manager/blob/a8f8f48320c64bd4e3a266a850bbfde2c6fe3a04/modules/services/ssh-agent.nix#L37 + openssh + + iputils # `ping` etc + + # https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/iw/iw/package.nix + edge-pkgs.iw # replacement of wireless-tools(iwconfig) + + # Alt w3m + # Do not install in dawin yet: https://github.com/NixOS/nixpkgs/blob/b4b293ec6c61e846d69224ea0637411283e2ad39/pkgs/by-name/ch/chawan/package.nix#L82 + # Keybindigs: https://git.sr.ht/~bptato/chawan/tree/master/item/res/config.toml + chawan # `cha` + + homemade-pkgs.renmark # Depend on chawan + ]; + # xdg-user-dirs NixOS module does not work or is not enough for me to keep English dirs even in Japanese locale. # Check your `~/.config/user-dirs.dirs` if you faced any trouble # https://github.com/nix-community/home-manager/blob/release-24.05/modules/misc/xdg-user-dirs.nix diff --git a/home-manager/packages.nix b/home-manager/packages.nix index f3a8bb74..402ddde9 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -8,166 +8,113 @@ # Prefer stable pkgs as possible, if you want to use edge pkgs # - Keep zero or tiny config in home-manager layer # - Set `mod-name.package = edge-pkgs.the-one;` -( - with pkgs; - [ - # Use `bashInteractive`, don't `bash` - https://github.com/NixOS/nixpkgs/issues/29960, https://github.com/NixOS/nix/issues/730 - # bash - # https://github.com/NixOS/nix/issues/730#issuecomment-162323824 - bashInteractive - # readline # needless and using it does not fix bash problems - zsh - fish - starship - direnv - - fzf # History: CTRL+R, Walker: CTRL+T - # https://github.com/junegunn/fzf/blob/d579e335b5aa30e98a2ec046cb782bbb02bc28ad/ADVANCED.md#key-bindings-for-git-objects - # CTRL+O does not open web browser in WSL: https://github.com/kachick/dotfiles/issues/499 - fzf-git-sh # CTRL-G CTRL-{} keybinds for git - # Use same nixpkgs channel as same as fzf - zoxide # Used in alias `z`, alt cd/pushd. popd = `z -`, fzf-mode = `zi` - - # Used in anywhere - coreutils - less # container base image doesn't have less even for ubuntu official - procps # `ps` - - # Use same tools even in macOS - findutils - diffutils - gnugrep - netcat # `nc` - dig # Alt and raw-data oriented nslookup. TODO: Consider another candidate: dug - https://eng-blog.iij.ad.jp/archives/27527 - - git - gh - ghq - - edge-pkgs.sequoia-sq # Alt `gpg` - nixos-24.05 does not backport recent versions and the older requires to rebuild. https://github.com/NixOS/nixpkgs/pull/331099 - edge-pkgs.sequoia-chameleon-gnupg - gnupg # Also keep original GPG for now. sequoia-chameleon-gnupg does not support some crucial toolset. etc: `gpg --edit-key`, `gpgconf` - - # Alt `pass` for password-store. Candidates: gopass, prs - gopass # They will respect pass comaptibility: https://github.com/gopasspw/gopass/issues/1365#issuecomment-719655627 - # Do not use ripasso-cursive for now. It only provides TUI, not a replacement of CLI. And currently unstable on my NixOS. - - # Do not specify vim and the plugins at here, it made collisions from home-manager vim module. - # See following issues - # - https://github.com/kachick/dotfiles/issues/280 - # - https://discourse.nixos.org/t/home-manager-neovim-collision/16963/2 - - micro # alt nano - - tree - eza # alt ls - curl - wget - jq - edge-pkgs.jnv # interactive jq - Use unstable because it is a fresh tool - ripgrep # `rg` - bat # alt cat - mdcat # pipe friendly markdown viewer rather than glow - hexyl # hex viewer - dysk # alt df - fd # alt find - du-dust # `dust`, alt du - procs - btop # alt top - bottom # `btm`, alt top - xh # alt HTTPie - zellij - yazi # prefer the shell wrapper `yy` - - typos - hyperfine - difftastic # `difft` - gnumake - go-task # Installing for enabling shell completion easy - gitleaks - deno - ruby_3_3 - _7zz # `7zz` - 7zip. Command is not 7zip. - - pastel - - rclone - - # How to get the installed font names - # fontconfig by nix: `fc-list : family style` - # darwin: system_profiler SPFontsDataType - fontconfig # `fc-list`, `fc-cache` - - # - Enable special module for Nix OS. - # - Linux package does not contain podman-remote, you should install uidmap with apt and use this podman as actual engine - # https://github.com/NixOS/nixpkgs/blob/194846768975b7ad2c4988bdb82572c00222c0d7/pkgs/applications/virtualization/podman/default.nix#L112-L116 - # - In darwin, this package will be used for podman-remote, you should manually install podman-desktop for the engine - podman - podman-tui - docker-compose - - # `tldr` rust client, tealdeer is another candidate. - tlrc - - fastfetch # active replacement of neofetch - - # Alternative candidates - # - deep-translator - not active - https://github.com/nidhaloff/deep-translator/issues/240 - # - argos-translate - can be closed in offline, but not yet enough accuracy - # - Apertium - does not support Japanese - translate-shell # `echo "$text" | trans en:ja` - ] - ++ (lib.optionals stdenv.isLinux [ - # Fix missing locales as `locale: Cannot set LC_CTYPE to default locale` - glibc - - # https://github.com/nix-community/home-manager/blob/a8f8f48320c64bd4e3a266a850bbfde2c6fe3a04/modules/services/ssh-agent.nix#L37 - openssh - - iputils # `ping` etc - - # https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/iw/iw/package.nix - edge-pkgs.iw # replacement of wireless-tools(iwconfig) - - # Alt w3m - # Do not install in dawin yet: https://github.com/NixOS/nixpkgs/blob/b4b293ec6c61e846d69224ea0637411283e2ad39/pkgs/by-name/ch/chawan/package.nix#L82 - # Keybindigs: https://git.sr.ht/~bptato/chawan/tree/master/item/res/config.toml - chawan # `cha` - - homemade-pkgs.renmark # Depend on chawan - ]) - ++ (lib.optionals stdenv.isDarwin [ - # https://github.com/NixOS/nixpkgs/issues/240819 - pinentry_mac - - alacritty - kitty - # foot is only provided for Linux wayland - - # Don't install firefox via nixpkgs for darwin, it is broken https://github.com/NixOS/nixpkgs/blob/bac526a0fe6da6b10cfe2454f62a0defdbf1d898/pkgs/applications/networking/browsers/firefox/packages.nix#L23 - - # - You can use major Nerd Fonts as `pkgs.nerdfonts.override ...` - # - Should have at least 1 composite font that includes Monospace + Japanese + Nerd fonts, - # because of alacritty does not have the fallback font feature. https://github.com/alacritty/alacritty/issues/957 - # - Keep fewer nerd fonts to reduce disk space - - # You can also use 0 = `Slashed zero style` with enabling `"editor.fontLigatures": "'zero'"` in vscode - # but cannot use it in alacritty https://github.com/alacritty/alacritty/issues/50 - plemoljp-nf - ibm-plex # For sans-serif, use plemoljp for developing - - source-han-code-jp # Includes many definitions, useful for fallback - inconsolata - - # Don't add zed in macOS with nixpkgs - # https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219 - # edge-pkgs.zed-editor - - edge-pkgs.signal-desktop # Useable since https://github.com/NixOS/nixpkgs/pull/348165 - - homemade-pkgs.maccy - ]) -) +(with pkgs; [ + # Use `bashInteractive`, don't `bash` - https://github.com/NixOS/nixpkgs/issues/29960, https://github.com/NixOS/nix/issues/730 + # bash + # https://github.com/NixOS/nix/issues/730#issuecomment-162323824 + bashInteractive + # readline # needless and using it does not fix bash problems + zsh + fish + starship + direnv + + fzf # History: CTRL+R, Walker: CTRL+T + # https://github.com/junegunn/fzf/blob/d579e335b5aa30e98a2ec046cb782bbb02bc28ad/ADVANCED.md#key-bindings-for-git-objects + # CTRL+O does not open web browser in WSL: https://github.com/kachick/dotfiles/issues/499 + fzf-git-sh # CTRL-G CTRL-{} keybinds for git + # Use same nixpkgs channel as same as fzf + zoxide # Used in alias `z`, alt cd/pushd. popd = `z -`, fzf-mode = `zi` + + # Used in anywhere + coreutils + less # container base image doesn't have less even for ubuntu official + procps # `ps` + + # Use same tools even in macOS + findutils + diffutils + gnugrep + netcat # `nc` + dig # Alt and raw-data oriented nslookup. TODO: Consider another candidate: dug - https://eng-blog.iij.ad.jp/archives/27527 + + git + gh + ghq + + edge-pkgs.sequoia-sq # Alt `gpg` - nixos-24.05 does not backport recent versions and the older requires to rebuild. https://github.com/NixOS/nixpkgs/pull/331099 + edge-pkgs.sequoia-chameleon-gnupg + gnupg # Also keep original GPG for now. sequoia-chameleon-gnupg does not support some crucial toolset. etc: `gpg --edit-key`, `gpgconf` + + # Alt `pass` for password-store. Candidates: gopass, prs + gopass # They will respect pass comaptibility: https://github.com/gopasspw/gopass/issues/1365#issuecomment-719655627 + # Do not use ripasso-cursive for now. It only provides TUI, not a replacement of CLI. And currently unstable on my NixOS. + + # Do not specify vim and the plugins at here, it made collisions from home-manager vim module. + # See following issues + # - https://github.com/kachick/dotfiles/issues/280 + # - https://discourse.nixos.org/t/home-manager-neovim-collision/16963/2 + + micro # alt nano + + tree + eza # alt ls + curl + wget + jq + edge-pkgs.jnv # interactive jq - Use unstable because it is a fresh tool + ripgrep # `rg` + bat # alt cat + mdcat # pipe friendly markdown viewer rather than glow + hexyl # hex viewer + dysk # alt df + fd # alt find + du-dust # `dust`, alt du + procs + btop # alt top + bottom # `btm`, alt top + xh # alt HTTPie + zellij + yazi # prefer the shell wrapper `yy` + + typos + hyperfine + difftastic # `difft` + gnumake + go-task # Installing for enabling shell completion easy + gitleaks + deno + ruby_3_3 + _7zz # `7zz` - 7zip. Command is not 7zip. + + pastel + + rclone + + # How to get the installed font names + # fontconfig by nix: `fc-list : family style` + # darwin: system_profiler SPFontsDataType + fontconfig # `fc-list`, `fc-cache` + + # - Enable special module for Nix OS. + # - Linux package does not contain podman-remote, you should install uidmap with apt and use this podman as actual engine + # https://github.com/NixOS/nixpkgs/blob/194846768975b7ad2c4988bdb82572c00222c0d7/pkgs/applications/virtualization/podman/default.nix#L112-L116 + # - In darwin, this package will be used for podman-remote, you should manually install podman-desktop for the engine + podman + podman-tui + docker-compose + + # `tldr` rust client, tealdeer is another candidate. + tlrc + + fastfetch # active replacement of neofetch + + # Alternative candidates + # - deep-translator - not active - https://github.com/nidhaloff/deep-translator/issues/240 + # - argos-translate - can be closed in offline, but not yet enough accuracy + # - Apertium - does not support Japanese + translate-shell # `echo "$text" | trans en:ja` +]) ++ (with homemade-pkgs; [ la lat From fb007a00d8922752895950dbc7fe4dc76f0c88b0 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 21 Oct 2024 17:08:43 +0900 Subject: [PATCH 161/197] Make shorter prompt (#870) * Adjust order of prompt attrs * Adjust starship prompt to make shorter direnv and nix-shell indicators * Adjsut order and spacing --- config/starship/starship.toml | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/config/starship/starship.toml b/config/starship/starship.toml index ab3d7ca1..48528606 100644 --- a/config/starship/starship.toml +++ b/config/starship/starship.toml @@ -3,13 +3,14 @@ format = """ $username\ $hostname\ +$os\ +$container\ $shlvl\ $directory\ $git_branch\ $git_commit\ $git_state\ $git_status\ -$direnv\ $crystal\ $elm\ $haskell\ @@ -19,12 +20,12 @@ $ruby\ $python\ $deno\ $nodejs\ -$cmd_duration\ -$os\ -$container\ +$direnv\ $nix_shell\ $shell\ +$jobs\ $time\ +$cmd_duration\ $status\ $line_break\ $character""" @@ -38,6 +39,11 @@ style = "blue" [direnv] disabled = false +# https://github.com/direnv/direnv-logo/blob/0949c12bafa532da0b23482a1bb042cf41b654fc/direnv-logo.png +symbol = '📁' +loaded_msg = '🍃' +unloaded_msg = '🍂' +format = '[$symbol$loaded]($style) ' [character] success_symbol = "[>](bold green)" @@ -59,28 +65,15 @@ format = "[$branch]($style)" style = "242" [git_status] -format = "[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)]($style)" style = "cyan" -conflicted = "​" -untracked = "​" -modified = "​" -staged = "​" -renamed = "​" -deleted = "​" -stashed = "≡" [git_state] -format = '\([$state( $progress_current/$progress_total)]($style)\) ' style = "bright-black" [cmd_duration] format = "[$duration]($style) " style = "yellow" -[python] -format = "[$virtualenv]($style) " -style = "bright-black" - [shell] disabled = false bash_indicator = 'bash' @@ -90,3 +83,8 @@ disabled = false [os] disabled = false + +[nix_shell] +# Set another character with NixOS and keep short +symbol = '☃️ ' +format = '[$symbol]($style) ' From 157389f1ee702bda308f7fd96b8672faf383085c Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 21 Oct 2024 17:17:07 +0900 Subject: [PATCH 162/197] Prefer kitty for NixOS terminal to avoid alacritty bug Closes GH-785 for now --- home-manager/gnome.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 7d888ae3..b516faf4 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -42,7 +42,6 @@ in ); favorite-apps = [ - "Alacritty.desktop" "kitty.desktop" "dev.zed.Zed.desktop" "firefox.desktop" @@ -56,7 +55,7 @@ in # https://unix.stackexchange.com/questions/481142/launch-default-terminal-emulator-by-command "org/gnome/desktop/default-applications/terminal" = { - exec = lib.getExe pkgs.alacritty; + exec = lib.getExe pkgs.kitty; # exec-arg=""; }; @@ -160,9 +159,9 @@ in }; "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { - name = "Alacritty"; + name = "Terminal"; binding = "t"; - command = lib.getExe pkgs.alacritty; + command = lib.getExe pkgs.kitty; }; "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = { From bf7ff2b1f1de82589ddca16a3f2a338265634c7d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 22:38:43 +0900 Subject: [PATCH 163/197] Bump kachick/selfup from 1.1.5 to 1.1.6 (#872) Bumps [kachick/selfup](https://github.com/kachick/selfup) from 1.1.5 to 1.1.6. - [Release notes](https://github.com/kachick/selfup/releases) - [Changelog](https://github.com/kachick/selfup/blob/main/.goreleaser.yaml) - [Commits](https://github.com/kachick/selfup/compare/v1.1.5...v1.1.6) --- updated-dependencies: - dependency-name: kachick/selfup dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/update-flake-lock-and-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-flake-lock-and-ci.yml b/.github/workflows/update-flake-lock-and-ci.yml index f510cdad..e366fc4f 100644 --- a/.github/workflows/update-flake-lock-and-ci.yml +++ b/.github/workflows/update-flake-lock-and-ci.yml @@ -14,7 +14,7 @@ on: jobs: update-nixpkgs: if: (github.event_name != 'pull_request') || (!github.event.pull_request.draft) - uses: kachick/selfup/.github/workflows/reusable-bump-flake-lock-and-selfup.yml@v1.1.5 + uses: kachick/selfup/.github/workflows/reusable-bump-flake-lock-and-selfup.yml@v1.1.6 with: app_id: ${{ vars.APP_ID }} dry-run: ${{ github.event_name == 'pull_request' }} From 87353d03a404ec90d6769775e9f3e0181233de2d Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 13:47:09 +0000 Subject: [PATCH 164/197] flake.lock: Update (#873) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/4eb33fe664af7b41a4c446f87d20c9a0a6321fa3?narHash=sha256-LDiPhQ3l%2BfBjRATNtnuDZsBS7hqoBtPkKBkhpoBHv3I%3D' (2024-10-17) → 'github:NixOS/nixpkgs/a9b86fc2290b69375c5542b622088eb6eca2a7c3?narHash=sha256-QUvb6epgKi9pCu9CttRQW4y5NqJ%2BsnKr1FZpG/x3Wtc%3D' (2024-10-19) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 3217934d..60ad2ce5 100644 --- a/flake.lock +++ b/flake.lock @@ -400,11 +400,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1729181673, - "narHash": "sha256-LDiPhQ3l+fBjRATNtnuDZsBS7hqoBtPkKBkhpoBHv3I=", + "lastModified": 1729307008, + "narHash": "sha256-QUvb6epgKi9pCu9CttRQW4y5NqJ+snKr1FZpG/x3Wtc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4eb33fe664af7b41a4c446f87d20c9a0a6321fa3", + "rev": "a9b86fc2290b69375c5542b622088eb6eca2a7c3", "type": "github" }, "original": { From e3a178dc0b8b5145fd69fb699372b7e2bf03c15c Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 22 Oct 2024 17:18:08 +0900 Subject: [PATCH 165/197] Implement env filter (#876) * Implement `envs` command to make easier debugging GH-755 and developing GH-853 * Rewrite the command with ruby, the pipeline_w much helps for daily use. So closes GH-825 for now --- .rubocop.yml | 154 ++++++++++++++++++++++++++++++++++++++ flake.nix | 4 + home-manager/packages.nix | 1 + pkgs/default.nix | 2 + pkgs/envs/default.nix | 12 +++ pkgs/envs/envs.bash | 1 + pkgs/envs/envs.rb | 17 +++++ 7 files changed, 191 insertions(+) create mode 100644 .rubocop.yml create mode 100644 pkgs/envs/default.nix create mode 100644 pkgs/envs/envs.bash create mode 100644 pkgs/envs/envs.rb diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..5404eb0d --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,154 @@ +# TODO: Extract to another repository for use of inheritance + +AllCops: + TargetRubyVersion: 3.3 + DisplayCopNames: true + DisabledByDefault: true + Exclude: + - 'dependencies' + - '.direnv' + - 'result' + - 'dist' + NewCops: disable + +Security: + Enabled: true + +Style/HashSyntax: + Enabled: true + +Style/TrailingMethodEndStatement: + Enabled: true + +Style/MethodDefParentheses: + Enabled: true + +Style/TrailingCommaInBlockArgs: + Enabled: true + +Style/StringLiterals: + Enabled: true + EnforcedStyle: 'single_quotes' + +Style/StringLiteralsInInterpolation: + Enabled: true + EnforcedStyle: 'single_quotes' + +Style/TopLevelMethodDefinition: + Enabled: true + +Style/InPatternThen: + Enabled: true + +Style/HashEachMethods: + Enabled: true + +Style/QuotedSymbols: + Enabled: true + EnforcedStyle: 'single_quotes' + +Style/MultilineInPatternThen: + Enabled: true + +Layout: + Enabled: true + +Layout/TrailingEmptyLines: + Enabled: true + +Layout/TrailingWhitespace: + Enabled: true + +Layout/SpaceBeforeFirstArg: + Enabled: true + +Layout/SpaceBeforeSemicolon: + Enabled: true + +Layout/SpaceInsideArrayPercentLiteral: + Enabled: true + +Layout/SpaceInsideBlockBraces: + Enabled: true + +Layout/SpaceInsideParens: + Enabled: true + +Layout/SpaceInsidePercentLiteralDelimiters: + Enabled: true + +Layout/SpaceInsideRangeLiteral: + Enabled: true + +Layout/SpaceInsideReferenceBrackets: + Enabled: true + +Layout/SpaceInsideStringInterpolation: + Enabled: true + +Layout/SpaceAroundMethodCallOperator: + Enabled: true + +Layout/SpaceAroundKeyword: + Enabled: true + +Layout/ArgumentAlignment: + Enabled: true + +Layout/CaseIndentation: + Enabled: true + +Layout/SpaceInLambdaLiteral: + Enabled: true + EnforcedStyle: require_space + +Layout/SpaceBeforeBlockBraces: + Enabled: true + +Naming/MethodName: + Enabled: true + +Naming/FileName: + Enabled: true + +Naming/ConstantName: + Enabled: true + +Naming/ClassAndModuleCamelCase: + Enabled: true + +Naming/BlockParameterName: + Enabled: true + +Naming/HeredocDelimiterCase: + Enabled: true + +Bundler: + Enabled: true + +Bundler/OrderedGems: + Enabled: false + +Gemspec: + Enabled: true + +Gemspec/OrderedDependencies: + Enabled: false + +Lint: + Enabled: true + +Lint/InheritException: + Enabled: false + +Lint/RedundantStringCoercion: + Enabled: false + +Lint/UnusedMethodArgument: + Enabled: false + +Lint/AssignmentInCondition: + Enabled: false + +Lint/RescueException: + Enabled: false diff --git a/flake.nix b/flake.nix index 33d29c15..729b8ff3 100644 --- a/flake.nix +++ b/flake.nix @@ -85,6 +85,8 @@ go_1_23 goreleaser trivy + + (ruby_3_3.withPackages (ps: with ps; [ rubocop ])) ]) ++ (with edge-pkgs; [ nixd @@ -104,6 +106,7 @@ micro-nordcolors = homemade-packages.${system}.micro-nordcolors; micro-everforest = homemade-packages.${system}.micro-everforest; micro-catppuccin = homemade-packages.${system}.micro-catppuccin; + envs = homemade-packages.${system}.envs; }); apps = forAllSystems ( @@ -132,6 +135,7 @@ "git-log-simple" "git-resolve-conflict" "gh-prs" + "envs" "nix-hash-url" "reponame" "gredit" diff --git a/home-manager/packages.nix b/home-manager/packages.nix index 402ddde9..9f04bec8 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -126,6 +126,7 @@ p g walk + envs ir updeps bench_shells diff --git a/pkgs/default.nix b/pkgs/default.nix index c951aafc..e6df3847 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -50,6 +50,8 @@ gh-prs = import ./gh-prs { inherit pkgs; }; + envs = import ./envs { inherit pkgs; }; + reponame = import ./reponame { inherit pkgs; }; beedii = pkgs.callPackage ./beedii { }; diff --git a/pkgs/envs/default.nix b/pkgs/envs/default.nix new file mode 100644 index 00000000..ffcbaf32 --- /dev/null +++ b/pkgs/envs/default.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: +pkgs.writeShellApplication rec { + name = "envs"; + text = builtins.readFile ./${name}.bash; + runtimeInputs = with pkgs; [ + fzf + ruby_3_3 # pkgs.writers.writeRuby and writeRubyBin does not fit + ]; + runtimeEnv = { + RUBY_SCRIPT_PATH = ./${name}.rb; + }; +} diff --git a/pkgs/envs/envs.bash b/pkgs/envs/envs.bash new file mode 100644 index 00000000..a38593ce --- /dev/null +++ b/pkgs/envs/envs.bash @@ -0,0 +1 @@ +ruby -w "$RUBY_SCRIPT_PATH" "$@" diff --git a/pkgs/envs/envs.rb b/pkgs/envs/envs.rb new file mode 100644 index 00000000..3eac4cb0 --- /dev/null +++ b/pkgs/envs/envs.rb @@ -0,0 +1,17 @@ +require 'open3' + +shortner = -> str { + limit = 70 + length = str.size + str.slice(...limit).gsub("\n", ' ') + (length > limit ? '...' : '') +} + +envs = ENV.sort.map { |k, v| "#{k}=#{shortner.(v)}" } + +fzf_query = ARGV.first + +Open3.pipeline_w( + %Q!fzf --delimiter '=' --nth '1' --query "#{fzf_query}"! +) do |first_stdin, _wait_thrs| + first_stdin.puts envs +end From cf75c40913ac58384da95befee01b7c385e20a32 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 22 Oct 2024 18:38:40 +0900 Subject: [PATCH 166/197] Make .viminfo respect XDG Base Directory (#877) * Make .viminfo respect XDG Base Directory Fixes GH-871 * Ensure to put vim directory in statehome * Fix with avoiding missing xdg.stateHome --- home-manager/vim.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/home-manager/vim.nix b/home-manager/vim.nix index c6c4be93..11c271aa 100644 --- a/home-manager/vim.nix +++ b/home-manager/vim.nix @@ -1,6 +1,14 @@ -{ pkgs, homemade-pkgs, ... }: +{ + pkgs, + config, + homemade-pkgs, + ... +}: { + # TODO: Prefer xdg.stateFile since home-manager release-24.11. See https://github.com/nix-community/home-manager/pull/5779 + home.file."${config.xdg.stateHome}/vim/.keep".text = "Keep this directory because of home-manager and vim does not create the file if directory is missing"; + # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/vim.nix # https://nixos.wiki/wiki/Vim programs.vim = { @@ -20,6 +28,7 @@ extraConfig = '' colorscheme iceberg set termguicolors + set viminfofile=${config.xdg.stateHome}/vim/viminfo ''; }; } From 259ff601a15932fc8d807fcc6af07986d0e51b35 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 22 Oct 2024 22:49:25 +0900 Subject: [PATCH 167/197] Add trouble shoot step to fix missing locale --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 4b905148..39dcf18e 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,12 @@ See [GH-680](https://github.com/kachick/dotfiles/issues/680) for background Candidates - `user@linux-cli` # Used in container +1. If you faced to lcoale errors such as `-bash: warning: setlocale: LC_TIME: cannot change locale (en_DK.UTF-8): No such file or directory` + + ```bash + sudo localedef -f UTF-8 -i en_DK en_DK.UTF-8 + ``` + ### Podman on Ubuntu 1. Install uidmap without Nix for use of podman even if the podman will be installed from nixpkgs From 005874e8a596c5c639b4833517f8380b7b1b7553 Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 15:57:06 +0000 Subject: [PATCH 168/197] flake.lock: Update (#878) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0?narHash=sha256-/uilDXvCIEs3C9l73JTACm4quuHUsIHcns1c%2BcHUJwA%3D' (2024-10-18) → 'github:NixOS/nixpkgs/1997e4aa514312c1af7e2bda7fad1644e778ff26?narHash=sha256-I4tuhRpZFa6Fu6dcH9Dlo5LlH17peT79vx1y1SpeKt0%3D' (2024-10-20) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/a9b86fc2290b69375c5542b622088eb6eca2a7c3?narHash=sha256-QUvb6epgKi9pCu9CttRQW4y5NqJ%2BsnKr1FZpG/x3Wtc%3D' (2024-10-19) → 'github:NixOS/nixpkgs/89172919243df199fe237ba0f776c3e3e3d72367?narHash=sha256-Gf04dXB0n4q0A9G5nTGH3zuMGr6jtJppqdeljxua1fo%3D' (2024-10-20) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 60ad2ce5..481c1c3f 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1729256560, - "narHash": "sha256-/uilDXvCIEs3C9l73JTACm4quuHUsIHcns1c+cHUJwA=", + "lastModified": 1729413321, + "narHash": "sha256-I4tuhRpZFa6Fu6dcH9Dlo5LlH17peT79vx1y1SpeKt0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0", + "rev": "1997e4aa514312c1af7e2bda7fad1644e778ff26", "type": "github" }, "original": { @@ -400,11 +400,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1729307008, - "narHash": "sha256-QUvb6epgKi9pCu9CttRQW4y5NqJ+snKr1FZpG/x3Wtc=", + "lastModified": 1729449015, + "narHash": "sha256-Gf04dXB0n4q0A9G5nTGH3zuMGr6jtJppqdeljxua1fo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a9b86fc2290b69375c5542b622088eb6eca2a7c3", + "rev": "89172919243df199fe237ba0f776c3e3e3d72367", "type": "github" }, "original": { From c0f9666e78f728b34a201a2b096c554a153497f8 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 23 Oct 2024 01:05:28 +0900 Subject: [PATCH 169/197] Backport kdl.vim package (#879) https://github.com/NixOS/nixpkgs/pull/349031/commits/83e0aed01ebe77a0dc88c3d920e51ae139631199 has been merged here via GH-878 --- home-manager/vim.nix | 4 ++-- pkgs/default.nix | 2 -- pkgs/kdl.vim/default.nix | 15 --------------- 3 files changed, 2 insertions(+), 19 deletions(-) delete mode 100644 pkgs/kdl.vim/default.nix diff --git a/home-manager/vim.nix b/home-manager/vim.nix index 11c271aa..ffe208ed 100644 --- a/home-manager/vim.nix +++ b/home-manager/vim.nix @@ -1,7 +1,7 @@ { pkgs, config, - homemade-pkgs, + edge-pkgs, ... }: @@ -20,7 +20,7 @@ iceberg-vim fzf-vim ]) - ++ [ homemade-pkgs.kdl-vim ]; + ++ [ edge-pkgs.vimPlugins.kdl-vim ]; settings = { background = "dark"; diff --git a/pkgs/default.nix b/pkgs/default.nix index e6df3847..c79f2ed8 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -66,8 +66,6 @@ micro-everforest = pkgs.callPackage ./micro-everforest { }; micro-catppuccin = pkgs.callPackage ./micro-catppuccin { }; - kdl-vim = pkgs.callPackage ./kdl.vim { }; - nix-hash-url = pkgs.callPackage ./nix-hash-url { }; gredit = pkgs.callPackage ./gredit { }; diff --git a/pkgs/kdl.vim/default.nix b/pkgs/kdl.vim/default.nix deleted file mode 100644 index b4c345d5..00000000 --- a/pkgs/kdl.vim/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs, fetchFromGitHub }: - -pkgs.vimUtils.buildVimPlugin { - pname = "kdl.vim"; - version = "2023-02-20"; - - src = fetchFromGitHub { - owner = "imsnif"; - repo = "kdl.vim"; - rev = "b84d7d3a15d8d30da016cf9e98e2cfbe35cddee5"; - sha256 = "IajKK1EjrKs6b2rotOj+RlBBge9Ii2m/iuIuefnjAE4="; - }; - - meta.homepage = "https://github.com/imsnif/kdl.vim"; -} From 55a8ef3668a073d7387689a61c732ec6bca63217 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 23 Oct 2024 01:29:08 +0900 Subject: [PATCH 170/197] Install podman-desktop via nixpkgs (#881) * Install podman-desktop in macOS via nixpkgs * Also install podman-desktop on NixOS * Add podman-desktop icon in GNOME dock --- home-manager/darwin.nix | 2 ++ home-manager/gnome.nix | 1 + home-manager/packages.nix | 1 - nixos/desktop/default.nix | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/home-manager/darwin.nix b/home-manager/darwin.nix index 641895f5..1cf4cf8e 100644 --- a/home-manager/darwin.nix +++ b/home-manager/darwin.nix @@ -53,6 +53,8 @@ lib.mkMerge [ # https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219 # edge-pkgs.zed-editor + edge-pkgs.podman-desktop # Useable since https://github.com/NixOS/nixpkgs/pull/343648 + edge-pkgs.signal-desktop # Useable since https://github.com/NixOS/nixpkgs/pull/348165 homemade-pkgs.maccy diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index b516faf4..777392c8 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -46,6 +46,7 @@ in "dev.zed.Zed.desktop" "firefox.desktop" "google-chrome.desktop" + "podman-desktop.desktop" "io.gitlab.news_flash.NewsFlash.desktop" amazon_music-pwa-file "org.gnome.Rhythmbox3.desktop" diff --git a/home-manager/packages.nix b/home-manager/packages.nix index 9f04bec8..c214000b 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -99,7 +99,6 @@ # - Enable special module for Nix OS. # - Linux package does not contain podman-remote, you should install uidmap with apt and use this podman as actual engine # https://github.com/NixOS/nixpkgs/blob/194846768975b7ad2c4988bdb82572c00222c0d7/pkgs/applications/virtualization/podman/default.nix#L112-L116 - # - In darwin, this package will be used for podman-remote, you should manually install podman-desktop for the engine podman podman-tui docker-compose diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index c85155b8..331a6fa6 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -112,6 +112,8 @@ edge-pkgs.zed-editor # Adding for zed instead of zeditor since https://github.com/NixOS/nixpkgs/pull/344193. Also keep original zed-editor package here to add icons for GUI homemade-pkgs.zed + + edge-pkgs.podman-desktop ] ++ (with pkgs; [ firefox From 685f6ab363e25a69cea7bfcfbb7dcd0562f840c7 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 23 Oct 2024 02:31:39 +0900 Subject: [PATCH 171/197] Install vscode in macOS via nixpkgs (#882) * Install vscode in macOS via nixpkgs * Prefer vscode in macOS again I'm not much familiar to zed yet, so I prefer experimented one for darwin --- home-manager/darwin.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/home-manager/darwin.nix b/home-manager/darwin.nix index 1cf4cf8e..dba00689 100644 --- a/home-manager/darwin.nix +++ b/home-manager/darwin.nix @@ -12,10 +12,12 @@ lib.mkMerge [ (lib.mkIf pkgs.stdenv.isDarwin { home = { sessionVariables = { - # * Do not specify Nix store path for zed in macOS - # https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219 - # * `cli: install` action installs into this path in macOS - VISUAL = "zed --wait"; + # ## If you prefer zed + # * Do not specify Nix store path for zed in macOS + # https://github.com/NixOS/nixpkgs/blob/bba8dffd3135f35810e9112c40ee621f4ede7cca/pkgs/by-name/ze/zed-editor/package.nix#L217-L219 + # * `cli: install` action installs into this path in macOS + # VISUAL = "zed --wait"; + VISUAL = lib.getExe edge-pkgs.vscode; BROWSER = "open"; }; @@ -55,6 +57,8 @@ lib.mkMerge [ edge-pkgs.podman-desktop # Useable since https://github.com/NixOS/nixpkgs/pull/343648 + edge-pkgs.vscode # Keep latest as possible + edge-pkgs.signal-desktop # Useable since https://github.com/NixOS/nixpkgs/pull/348165 homemade-pkgs.maccy From ed9200c0d8ba7867fca509daf5ebb14dde7cc1ec Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 23 Oct 2024 20:06:26 +0900 Subject: [PATCH 172/197] Set zed-editor default font size with vscode default --- config/zed/settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/zed/settings.json b/config/zed/settings.json index e687fe6d..c38f26ff 100644 --- a/config/zed/settings.json +++ b/config/zed/settings.json @@ -14,9 +14,9 @@ "auto_update": false, "soft_wrap": "editor_width", "ui_font_family": "PlemolJP Console NF", - "ui_font_size": 16, + "ui_font_size": 14, "buffer_font_family": "PlemolJP Console NF", - "buffer_font_size": 16, + "buffer_font_size": 14, "tabs": { "file_icons": true }, From 675e56d4a734939fa8de6e709b4dc48dfac95a30 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 23 Oct 2024 20:31:08 +0900 Subject: [PATCH 173/197] Set Base16 iA Dark for zed theme --- config/zed/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/zed/settings.json b/config/zed/settings.json index c38f26ff..64d8dab3 100644 --- a/config/zed/settings.json +++ b/config/zed/settings.json @@ -7,7 +7,7 @@ // custom settings, run the `open default settings` command // from the command palette or from `Zed` application menu. { - "theme": "Iceberg", + "theme": "Base16 iA Dark", "telemetry": { "metrics": false }, From 0ac564f8c3bb5e16518a9c8b21aee9ddd83fb0c0 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 23 Oct 2024 21:43:25 +0900 Subject: [PATCH 174/197] Fix locale regression in GNOME (#886) --- home-manager/common.nix | 8 +++----- home-manager/systemd.nix | 8 ++++++++ nixos/desktop/default.nix | 5 +++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/home-manager/common.nix b/home-manager/common.nix index 60a3c8cb..abefe27f 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -50,11 +50,6 @@ MANPAGER = "${lib.getExe pkgs.bashInteractive} -c '${pkgs.util-linux}/bin/col -bx | ${lib.getExe pkgs.bat} -l man -p'"; MANROFFOPT = "-c"; - # - You can check the candidates in `locale -a` - # - pkgs.glibc installs many candidates, but it does not support darwin - # This value may overrides NixOS config for GNOME - # LANG = "en_US.UTF-8"; - # NOTE: Original comments in zsh # Mouse-wheel scrolling has been disabled by -X (disable screen clearing). # Remove -X and -F (exit if the content fits on one screen) to enable it. @@ -82,10 +77,13 @@ inherit homemade-pkgs; }; + # You can check the candidates in `locale -a` + # pkgs.glibc installs many candidates, but it does not support darwin # https://wiki.archlinux.jp/index.php/%E3%83%AD%E3%82%B1%E3%83%BC%E3%83%AB # https://github.com/nix-community/home-manager/blob/fe56302339bb28e3471632379d733547caec8103/modules/home-environment.nix#L11 language = { base = "ja_JP.UTF-8"; + # systemd config overrides this value in gnome-shell, however this will be used in Linux VT console time = "en_DK.UTF-8"; # To prefer ISO 8601 format. See https://unix.stackexchange.com/questions/62316/why-is-there-no-euro-english-locale }; }; diff --git a/home-manager/systemd.nix b/home-manager/systemd.nix index 0a584f42..2dd17af1 100644 --- a/home-manager/systemd.nix +++ b/home-manager/systemd.nix @@ -4,6 +4,14 @@ # https://github.com/nix-community/home-manager/blob/release-24.05/modules/systemd.nix#L161-L173 systemd = { user = { + # Enable locale for GNOME and terminals in the gnome-shell. Linux VT console respects home.sessionVariables instead + # https://superuser.com/a/1841368 + # https://github.com/nix-community/home-manager/blob/5ec753a1fc4454df9285d8b3ec0809234defb975/modules/systemd.nix#L92-L96 + sessionVariables = { + # GNOME clock respects LC_TIME. And does not support displaying iso-8601 format even if set en_DK + LC_TIME = "ja_JP.UTF-8"; + }; + services.podman = { Unit = { Description = "Podman API Service"; diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 331a6fa6..08efb9e0 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -34,6 +34,11 @@ }; }; + i18n = { + # GNOME respects this, I don't know how to realize it only via home-manager + defaultLocale = "ja_JP.UTF-8"; + }; + services.xserver = { enable = true; From 806e847a05cb3bf40824ddffa07be17684db99b2 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 23 Oct 2024 23:11:49 +0900 Subject: [PATCH 175/197] Adjust git prompt --- config/starship/starship.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/starship/starship.toml b/config/starship/starship.toml index 48528606..8552a572 100644 --- a/config/starship/starship.toml +++ b/config/starship/starship.toml @@ -57,6 +57,7 @@ format = "[$status]($style)" [git_commit] only_detached = false +tag_disabled = false [git_branch] format = "[$branch]($style)" @@ -65,7 +66,7 @@ format = "[$branch]($style)" style = "242" [git_status] -style = "cyan" +style = "purple" [git_state] style = "bright-black" From fa3c2bac8ad9dac85c8bd33d5e37eacafbc12f68 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 23 Oct 2024 23:46:21 +0900 Subject: [PATCH 176/197] Fix starship config path in deployed container --- home-manager/common.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home-manager/common.nix b/home-manager/common.nix index abefe27f..a8036c1a 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -63,7 +63,7 @@ # Don't add needless quotation in the arguments. For example `gopass show 'rclone'` does not work. It should be `gopass show rclone`. RCLONE_PASSWORD_COMMAND = "${lib.getExe pkgs.gopass} show rclone"; - STARSHIP_CONFIG = ../config/starship/starship.toml; + STARSHIP_CONFIG = "${../config/starship/starship.toml}"; }; sessionPath = [ From 58ba0efcdcc6988ebdd02a5583066c4008b22723 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 24 Oct 2024 00:33:05 +0900 Subject: [PATCH 177/197] Also fix envs with the script path This should be a trap for me. I made 3+ mistakes in past --- pkgs/envs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/envs/default.nix b/pkgs/envs/default.nix index ffcbaf32..530bf86f 100644 --- a/pkgs/envs/default.nix +++ b/pkgs/envs/default.nix @@ -7,6 +7,6 @@ pkgs.writeShellApplication rec { ruby_3_3 # pkgs.writers.writeRuby and writeRubyBin does not fit ]; runtimeEnv = { - RUBY_SCRIPT_PATH = ./${name}.rb; + RUBY_SCRIPT_PATH = "${./${name}.rb}"; }; } From f1cec3ce871d47c12820834a2b4b40393eb81430 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 24 Oct 2024 02:34:39 +0900 Subject: [PATCH 178/197] Relax deployment trigger to cover dispatch --- .github/workflows/container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index e8678aca..c4b7d66f 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -52,7 +52,7 @@ jobs: if [ '${{ github.event_name }}' = 'pull_request' ]; then special='pr-${{ github.event.number }}-${{ github.event.pull_request.head.sha }}' ref='${{ github.event.pull_request.head.sha }}' - elif [ '${{ github.event_name }}' = 'push' ] && [ '${{ github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then + elif [ '${{ github.ref_name }}' = '${{ github.event.repository.default_branch }}' ]; then special='latest' ref='${{ github.sha }}' else From 9777cf1d270a8d5c32c59b42e33054562a2b1f92 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 19:51:53 +0000 Subject: [PATCH 179/197] Update ghcr.io/kachick/ubuntu-24.04-nix-systemd:latest Docker digest to add9000 (#887) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- containers/Containerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/Containerfile b/containers/Containerfile index 1a2f766c..ceebf7c3 100644 --- a/containers/Containerfile +++ b/containers/Containerfile @@ -1,5 +1,5 @@ # https://github.com/kachick/containers -FROM ghcr.io/kachick/ubuntu-24.04-nix-systemd:latest@sha256:eb0df8622d8fe4412f1bbfaa56c1228307405b6a9bf95461b22c11a0836b65f8 +FROM ghcr.io/kachick/ubuntu-24.04-nix-systemd:latest@sha256:add9000002243eb614237536ad2b32938230904cd7567fcf46eb49efc68cb4c9 LABEL org.opencontainers.image.source=https://github.com/kachick/dotfiles LABEL org.opencontainers.image.description="Example by kachick/dotfiles" From f706473584670b408427a30151a96c27b97ee5de Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 25 Oct 2024 14:22:41 +0900 Subject: [PATCH 180/197] Make nixos-wsl and xremap will follow other nixpkgs --- flake.lock | 62 +++++++++++++++--------------------------------------- flake.nix | 12 +++++++++-- 2 files changed, 27 insertions(+), 47 deletions(-) diff --git a/flake.lock b/flake.lock index 481c1c3f..d9f8f187 100644 --- a/flake.lock +++ b/flake.lock @@ -54,7 +54,7 @@ }, "devshell": { "inputs": { - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1722113426, @@ -161,7 +161,7 @@ }, "home-manager_2": { "inputs": { - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1726440980, @@ -216,7 +216,7 @@ "hyprlang": "hyprlang", "hyprutils": "hyprutils", "hyprwayland-scanner": "hyprwayland-scanner", - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_4", "systems": "systems_2", "xdph": "xdph" }, @@ -353,7 +353,9 @@ "inputs": { "flake-compat": "flake-compat", "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { "lastModified": 1720391164, @@ -372,11 +374,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1719956923, - "narHash": "sha256-nNJHJ9kfPdzYsCOlHOnbiiyKjZUW5sWbwx3cakg3/C4=", + "lastModified": 1729449015, + "narHash": "sha256-Gf04dXB0n4q0A9G5nTGH3zuMGr6jtJppqdeljxua1fo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "706eef542dec88cc0ed25b9075d3037564b2d164", + "rev": "89172919243df199fe237ba0f776c3e3e3d72367", "type": "github" }, "original": { @@ -399,22 +401,6 @@ } }, "nixpkgs_2": { - "locked": { - "lastModified": 1729449015, - "narHash": "sha256-Gf04dXB0n4q0A9G5nTGH3zuMGr6jtJppqdeljxua1fo=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "89172919243df199fe237ba0f776c3e3e3d72367", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-24.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1722073938, "narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=", @@ -430,7 +416,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_3": { "locked": { "lastModified": 1726062873, "narHash": "sha256-IiA3jfbR7K/B5+9byVi9BZGWTD4VSbWe8VLpp9B/iYk=", @@ -446,7 +432,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_4": { "locked": { "lastModified": 1725983898, "narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=", @@ -462,23 +448,7 @@ "type": "github" } }, - "nixpkgs_6": { - "locked": { - "lastModified": 1726481836, - "narHash": "sha256-MWTBH4dd5zIz2iatDb8IkqSjIeFum9jAqkFxgHLdzO4=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "20f9370d5f588fb8c72e844c54511cab054b5f40", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_7": { + "nixpkgs_5": { "locked": { "lastModified": 1725103162, "narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=", @@ -499,7 +469,7 @@ "edge-nixpkgs": "edge-nixpkgs", "home-manager": "home-manager", "nixos-wsl": "nixos-wsl", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs", "xremap-flake": "xremap-flake" } }, @@ -535,7 +505,7 @@ }, "treefmt-nix": { "inputs": { - "nixpkgs": "nixpkgs_7" + "nixpkgs": "nixpkgs_5" }, "locked": { "lastModified": 1725271838, @@ -608,7 +578,9 @@ "flake-parts": "flake-parts", "home-manager": "home-manager_2", "hyprland": "hyprland", - "nixpkgs": "nixpkgs_6", + "nixpkgs": [ + "edge-nixpkgs" + ], "treefmt-nix": "treefmt-nix", "xremap": "xremap" }, diff --git a/flake.nix b/flake.nix index 729b8ff3..5be347c8 100644 --- a/flake.nix +++ b/flake.nix @@ -12,9 +12,17 @@ url = "github:nix-community/home-manager/release-24.05"; inputs.nixpkgs.follows = "nixpkgs"; }; - nixos-wsl.url = "github:nix-community/NixOS-WSL/2405.5.4"; + nixos-wsl = { + url = "github:nix-community/NixOS-WSL/2405.5.4"; + # https://github.com/nix-community/NixOS-WSL/blob/5a965cb108fb1f30b29a26dbc29b473f49e80b41/flake.nix#L5 + inputs.nixpkgs.follows = "nixpkgs"; + }; # https://github.com/xremap/nix-flake/blob/master/docs/HOWTO.md - xremap-flake.url = "github:xremap/nix-flake"; + xremap-flake = { + url = "github:xremap/nix-flake"; + # https://github.com/xremap/nix-flake/blob/2c55335d6509702b0d337b8da697d7048e36123d/flake.nix#L6 + inputs.nixpkgs.follows = "edge-nixpkgs"; + }; }; outputs = From 4029637e7d1f8e70a0de64e07c5e74fefd38cc2c Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 25 Oct 2024 14:32:11 +0900 Subject: [PATCH 181/197] Install selfup in devshell --- flake.lock | 22 ++++++++++++++++++++++ flake.nix | 8 +++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/flake.lock b/flake.lock index d9f8f187..16699739 100644 --- a/flake.lock +++ b/flake.lock @@ -470,9 +470,31 @@ "home-manager": "home-manager", "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs", + "selfup": "selfup", "xremap-flake": "xremap-flake" } }, + "selfup": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729058896, + "narHash": "sha256-JdVC3/Agrc8vijReztNHyggEHRp6PAijp7ymVmYB+nU=", + "owner": "kachick", + "repo": "selfup", + "rev": "19e2cb02d17162faaaa65a9c2d47726fb76add3b", + "type": "github" + }, + "original": { + "owner": "kachick", + "ref": "v1.1.6", + "repo": "selfup", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, diff --git a/flake.nix b/flake.nix index 5be347c8..173a91f9 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,11 @@ # https://github.com/xremap/nix-flake/blob/2c55335d6509702b0d337b8da697d7048e36123d/flake.nix#L6 inputs.nixpkgs.follows = "edge-nixpkgs"; }; + selfup = { + url = "github:kachick/selfup/v1.1.6"; + # https://github.com/kachick/selfup/blob/991afc21e437a449c9bd4237b4253f8da407f569/flake.nix#L8 + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = @@ -103,7 +108,8 @@ treefmt2 markdownlint-cli2 ]) - ++ (with homemade-pkgs; [ nix-hash-url ]); + ++ (with homemade-pkgs; [ nix-hash-url ]) + ++ [ inputs.selfup.packages.${system}.default ]; }; } ); From 796621f0879ffadd3c1b409001ed848f89556b10 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 25 Oct 2024 14:42:28 +0900 Subject: [PATCH 182/197] Enable magic-nix-cache-action again beucase of macos runner now takes longtime with the unfree packages --- .github/workflows/ci-home.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-home.yml b/.github/workflows/ci-home.yml index 05948742..8995d84e 100644 --- a/.github/workflows/ci-home.yml +++ b/.github/workflows/ci-home.yml @@ -56,6 +56,7 @@ jobs: steps: # Do not use DeterminateSystems/magic-nix-cache-action for home workflow, it always faced to GitHub rate limit because of home depends on many packages - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 - name: Print some dotfiles overviews run: | Date: Fri, 25 Oct 2024 14:59:19 +0900 Subject: [PATCH 183/197] Add cache clean action for DeterminateSystems/magic-nix-cache-action --- .github/workflows/cleanup-caches.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/cleanup-caches.yml diff --git a/.github/workflows/cleanup-caches.yml b/.github/workflows/cleanup-caches.yml new file mode 100644 index 00000000..f4013dc4 --- /dev/null +++ b/.github/workflows/cleanup-caches.yml @@ -0,0 +1,27 @@ +# Mostly for DeterminateSystems/magic-nix-cache-action +name: 👋 caches in a branch +on: + pull_request: + types: + - closed + +jobs: + cleanup: + runs-on: ubuntu-24.04 + steps: + - name: Cleanup + run: | + echo "Fetching list of cache key" + cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id') + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + gh cache delete $cacheKey + done + echo "Done" + env: + GH_TOKEN: ${{ github.token }} + BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge From 4559b863d59ab37452e6163df6e100ec20037c85 Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Fri, 25 Oct 2024 14:20:22 +0000 Subject: [PATCH 184/197] flake.lock: Update (#888) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/1997e4aa514312c1af7e2bda7fad1644e778ff26?narHash=sha256-I4tuhRpZFa6Fu6dcH9Dlo5LlH17peT79vx1y1SpeKt0%3D' (2024-10-20) → 'github:NixOS/nixpkgs/2768c7d042a37de65bb1b5b3268fc987e534c49d?narHash=sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4%3D' (2024-10-23) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/89172919243df199fe237ba0f776c3e3e3d72367?narHash=sha256-Gf04dXB0n4q0A9G5nTGH3zuMGr6jtJppqdeljxua1fo%3D' (2024-10-20) → 'github:NixOS/nixpkgs/32e940c7c420600ef0d1ef396dc63b04ee9cad37?narHash=sha256-BAuPWW%2B9fa1moZTU%2BjFh%2B1cUtmsuF8asgzFwejM4wac%3D' (2024-10-23) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 16699739..e64a8b6b 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1729413321, - "narHash": "sha256-I4tuhRpZFa6Fu6dcH9Dlo5LlH17peT79vx1y1SpeKt0=", + "lastModified": 1729665710, + "narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1997e4aa514312c1af7e2bda7fad1644e778ff26", + "rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d", "type": "github" }, "original": { @@ -374,11 +374,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729449015, - "narHash": "sha256-Gf04dXB0n4q0A9G5nTGH3zuMGr6jtJppqdeljxua1fo=", + "lastModified": 1729691686, + "narHash": "sha256-BAuPWW+9fa1moZTU+jFh+1cUtmsuF8asgzFwejM4wac=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "89172919243df199fe237ba0f776c3e3e3d72367", + "rev": "32e940c7c420600ef0d1ef396dc63b04ee9cad37", "type": "github" }, "original": { From cac99ad22cfc05e13d7b1d34d4edc687c7b1fa49 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 27 Oct 2024 19:13:32 +0900 Subject: [PATCH 185/197] Replace Pop Shell with PaperWM (#889) * Replace Pop Shell with PaperWM * Adjust keybindings since introduced PaperWM * Remove conflicted btop shortcut --- Fixes GH-799 --- home-manager/gnome.nix | 49 ++++++++++++++------------------------- nixos/desktop/default.nix | 12 +--------- nixos/desktop/xremap.nix | 11 --------- 3 files changed, 18 insertions(+), 54 deletions(-) diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 777392c8..5e0a7eaa 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -24,7 +24,7 @@ in [ appindicator # blur-my-shell # Don't use this extension, it often makes flicker. See GH-775 - pop-shell + paperwm clipboard-history kimpanel removable-drive-menu @@ -87,10 +87,6 @@ in toggle-message-tray = [ "m" ]; # default: ['v', 'm'], `"disable"` restore default. So added annoy modifier to prevent trigger }; - "org/gnome/desktop/wm/preferences" = { - num-workspaces = 3; - }; - "org/gnome/desktop/wm/keybindings" = { activate-window-menu = [ ]; # Disabling default `space` to run launchers @@ -147,15 +143,12 @@ in }; "org/gnome/settings-daemon/plugins/media-keys" = { - # control-center = [ "comma" ]; # I set this because of inspired by vscode, but disable to avoid conflict of pop-shell minimizerr - www = [ "w" ]; # Prefer w even through pop-shell recommends to Super+b + www = [ "w" ]; home = [ ]; email = [ ]; - # terminal = [ "t" ]; I don't know why this won't work. So use cosutom keybinding - search = [ "f" ]; # pop-shell sets to file manager, but replace to overview + search = [ "space" ]; custom-keybindings = [ "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" - "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/" ]; }; @@ -165,25 +158,6 @@ in command = lib.getExe pkgs.kitty; }; - "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = { - name = "Resource Monitor - TUI"; - binding = "r"; - # https://askubuntu.com/questions/5172/running-a-desktop-file-in-the-terminal - command = "gtk-launch btop.desktop"; - }; - - # https://github.com/pop-os/shell/blob/master_noble/schemas/org.gnome.shell.extensions.pop-shell.gschema.xml - "org/gnome/shell/extensions/pop-shell" = { - tile-by-default = true; - - # Keybindings: https://github.com/pop-os/shell/blob/master_noble/scripts/configure.sh - - # https://www.reddit.com/r/pop_os/comments/mt5kgf/how_to_change_default_keybind_for/ - activate-launcher = [ "space" ]; - - active-hint = true; - }; - "org/gnome/shell/extensions/clipboard-history" = { history-size = 100; toggle-menu = [ "v" ]; # default: ['v'] @@ -204,7 +178,7 @@ in # Disable default Super runs GNOME overview with search # https://ubuntuforums.org/showthread.php?t=2405352 - # The feature is useful, but frustrated when using pop-shell shortcuts. Super modifier is mostly used now + # The feature is useful, but frustrated when using paperwm or pop-shell shortcuts. Super modifier is mostly used in them overlay-key = ""; }; @@ -237,18 +211,29 @@ in "org/gnome/desktop/wm/preferences" = { theme = "Nordic"; + + num-workspaces = 3; + # This names are might not be persisted with paperwm, it also uses own UUID for that + workspace-names = [ + "Main" + "Sandbox" + "Music" + ]; }; "org/gnome/shell/extensions/auto-move-windows" = { application-list = [ - "dev.zed.Zed.desktop:2" - # TODO: Add vscode here as zed-editor "${spotify-pwa-file}:3" "${amazon_music-pwa-file}:3" "org.gnome.Rhythmbox3.desktop:3" ]; }; + "org/gnome/shell/extensions/paperwm/keybindings" = { + take-window = [ ]; # default: ['t'] + open-window-position = 0; + }; + "org/virt-manager/virt-manager/connections" = { autoconnect = [ "qemu:///system" ]; uris = [ "qemu:///system" ]; diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 08efb9e0..4426b307 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -212,17 +212,7 @@ ]) ++ (with pkgs.gnomeExtensions; [ appindicator - - # Should be changed from default CSS to another to avoid https://github.com/pop-os/shell/issues/132 - # https://github.com/pop-os/shell/blob/cfa0c55e84b7ce339e5ce83832f76fee17e99d51/light.css#L20-L24 - # Apple same color as nord(Nordic) https://github.com/EliverLara/Nordic/blob/5c53654fb6f3e0266ad8c481a099091e92f28274/gnome-shell/_colors.scss#L14-L15 - (pop-shell.overrideAttrs (prev: { - preFixup = - prev.preFixup - + '' - echo '.pop-shell-search-element:select{ background: #8fbcbb !important; color: #fefefe !important; }' >> $out/share/gnome-shell/extensions/pop-shell@system76.com/light.css - ''; - })) + paperwm clipboard-history kimpanel just-perfection diff --git a/nixos/desktop/xremap.nix b/nixos/desktop/xremap.nix index 3c47785f..34aad496 100644 --- a/nixos/desktop/xremap.nix +++ b/nixos/desktop/xremap.nix @@ -33,17 +33,6 @@ }; } ]; - - # Disabled while using Alt-Space for pop-shell launcher - # Keymap for key combo rebinds - # keymap = [ - # { - # name = "Gnome lancher"; - # remap = { - # "Alt-Space" = "LEFTMETA"; - # }; - # } - # ]; }; }; } From c8699c8eeefac6523987466f27145226f5f76dd0 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 27 Oct 2024 19:18:22 +0900 Subject: [PATCH 186/197] Remove duplicated SSH_ASKPASS_REQUIRE from NixOS config Preparation part of GH-890 --- nixos/configuration.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 38377c79..05e29168 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -55,10 +55,6 @@ # Be careful to deploy containers if true, and it may take longtime in CI for non binary caches nixpkgs.config.allowUnfree = true; - environment.sessionVariables = { - SSH_ASKPASS_REQUIRE = "prefer"; - }; - # TODO: Reconsider to drop this services.packagekit = { enable = true; From ca9924e4db1db26e1cc3e7c4c6af1babe463c8a8 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 27 Oct 2024 21:49:58 +0900 Subject: [PATCH 187/197] Install gdm-settings This does not help GH-755 for now. Mostly for UI looks --- nixos/desktop/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 4426b307..0c55f5f0 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -119,6 +119,8 @@ homemade-pkgs.zed edge-pkgs.podman-desktop + + edge-pkgs.gdm-settings # Useable since https://github.com/NixOS/nixpkgs/pull/335233 ] ++ (with pkgs; [ firefox From 5a2218528e6b95af1938674d58af2498d1697e24 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 00:26:39 +0000 Subject: [PATCH 188/197] Update dependency dprint/dprint-plugin-json to v0.19.4 (#892) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- dprint.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dprint.json b/dprint.json index c27dda04..a03f2852 100644 --- a/dprint.json +++ b/dprint.json @@ -19,7 +19,7 @@ "dependencies" ], "plugins": [ - "https://plugins.dprint.dev/json-0.19.3.wasm", + "https://plugins.dprint.dev/json-0.19.4.wasm", "https://plugins.dprint.dev/markdown-0.17.8.wasm", "https://plugins.dprint.dev/toml-0.6.3.wasm", "https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm", From 31f3107b20c9b0274a643975025c85e7408c7a36 Mon Sep 17 00:00:00 2001 From: "selfup-runner[bot]" <146065330+selfup-runner[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 00:44:48 +0000 Subject: [PATCH 189/197] flake.lock: Update (#893) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'edge-nixpkgs': 'github:NixOS/nixpkgs/2768c7d042a37de65bb1b5b3268fc987e534c49d?narHash=sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4%3D' (2024-10-23) → 'github:NixOS/nixpkgs/18536bf04cd71abd345f9579158841376fdd0c5a?narHash=sha256-RP%2BOQ6koQQLX5nw0NmcDrzvGL8HDLnyXt/jHhL1jwjM%3D' (2024-10-25) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/32e940c7c420600ef0d1ef396dc63b04ee9cad37?narHash=sha256-BAuPWW%2B9fa1moZTU%2BjFh%2B1cUtmsuF8asgzFwejM4wac%3D' (2024-10-23) → 'github:NixOS/nixpkgs/cd3e8833d70618c4eea8df06f95b364b016d4950?narHash=sha256-knnVBGfTCZlQgxY1SgH0vn2OyehH9ykfF8geZgS95bk%3D' (2024-10-26) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index e64a8b6b..e6b4847e 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "edge-nixpkgs": { "locked": { - "lastModified": 1729665710, - "narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=", + "lastModified": 1729880355, + "narHash": "sha256-RP+OQ6koQQLX5nw0NmcDrzvGL8HDLnyXt/jHhL1jwjM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d", + "rev": "18536bf04cd71abd345f9579158841376fdd0c5a", "type": "github" }, "original": { @@ -374,11 +374,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729691686, - "narHash": "sha256-BAuPWW+9fa1moZTU+jFh+1cUtmsuF8asgzFwejM4wac=", + "lastModified": 1729973466, + "narHash": "sha256-knnVBGfTCZlQgxY1SgH0vn2OyehH9ykfF8geZgS95bk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "32e940c7c420600ef0d1ef396dc63b04ee9cad37", + "rev": "cd3e8833d70618c4eea8df06f95b364b016d4950", "type": "github" }, "original": { From 794fbf39d8f7c2e58991c5c4538a13d036a706a2 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 28 Oct 2024 11:45:28 +0900 Subject: [PATCH 190/197] Reset home-manager sourced flag in NixOS sessionVariables (#891) * Fixes GH-755 and Fixes GH-890 with adding workaround for home-manager and wayland problem in NixOS layer * Prevent GH-890 with disabling home-manager conflicted ssh feature in NixOS --- nixos/desktop/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 0c55f5f0..8a54d51a 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -64,6 +64,9 @@ services.udev.packages = with pkgs; [ gnome.gnome-settings-daemon ]; + # To avoid unexpected overriding with the NixOS module. I prefer gpg-agent or another way for that. + programs.ssh.enableAskPassword = false; + # https://nixos.wiki/wiki/Virt-manager # # distrobox is a container based solution, not vm. And see https://github.com/89luca89/distrobox/issues/958 @@ -266,6 +269,8 @@ # https://github.com/NixOS/nixpkgs/issues/22652 # https://github.com/alacritty/alacritty/issues/6703#issuecomment-2222503206 XCURSOR_THEME = "Adwaita"; + + __HM_SESS_VARS_SOURCED = ""; # Workaround for GH-755 and GH-890 }; # https://github.com/NixOS/nixpkgs/issues/33282#issuecomment-523572259 From 3d207f7f35bc3f6b1469c376205a3f8cf35bb288 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 28 Oct 2024 12:33:39 +0900 Subject: [PATCH 191/197] Install lshw to help debugging GH-894 --- nixos/desktop/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 8a54d51a..71cd0744 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -139,6 +139,8 @@ skk-dicts skktools + lshw + lapce # IME is not working on Windows, but stable even around IME on Wayland than vscode # Add LSP global for zed-editor. Prefer external package for helix From c6879926fbcf0cb44bbb9ee3b4a9ab70f70f9100 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 28 Oct 2024 12:41:38 +0900 Subject: [PATCH 192/197] Install cyme to help debugging GH-894 --- nixos/desktop/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index 71cd0744..ee12b91d 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -123,6 +123,8 @@ edge-pkgs.podman-desktop + edge-pkgs.cyme # Frequently updated + edge-pkgs.gdm-settings # Useable since https://github.com/NixOS/nixpkgs/pull/335233 ] ++ (with pkgs; [ From 863447c1d6093ff57e04e69cdb1d0abd6695a708 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 28 Oct 2024 13:47:50 +0900 Subject: [PATCH 193/197] Fix a typo --- nixos/hardware.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/hardware.nix b/nixos/hardware.nix index 1446dc10..561b8b83 100644 --- a/nixos/hardware.nix +++ b/nixos/hardware.nix @@ -4,7 +4,7 @@ enable = true; # Settings keyremap in raw layer than X. See GH-784 # - # - Specify hardware names even if `evdev:input:*` working for mostcase. I should care both US and JIS layout + # - Specify hardware names even if `evdev:input:*` working for mostcase. I should care both US and JIS layout # - How to get the KEYBOARD_KEY_700??: `evtest /dev/input/event??` # - How to get the hardware name:: `udevadm info --attribute-walk /dev/input/event?? | grep -F 'ATTRS{name}'` # - How to apply?: Rebuild and reboot. Don't use `sudo systemd-hwdb update && sudo udevadm trigger` except debugging purpose. From e1e11f55f0b270f2f72db6196d91d7bf352e3265 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 28 Oct 2024 14:01:48 +0900 Subject: [PATCH 194/197] Refine cache clean action --- .github/workflows/cleanup-caches.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cleanup-caches.yml b/.github/workflows/cleanup-caches.yml index f4013dc4..4a1c6090 100644 --- a/.github/workflows/cleanup-caches.yml +++ b/.github/workflows/cleanup-caches.yml @@ -1,27 +1,27 @@ # Mostly for DeterminateSystems/magic-nix-cache-action -name: 👋 caches in a branch +name: 👋 caches in merged PRs on: pull_request: types: - closed + schedule: + # Every 12:42 JST + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule + - cron: '42 3 * * *' + workflow_dispatch: jobs: cleanup: runs-on: ubuntu-24.04 steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + # Intentionally cover all merged PRs to keep simple logics. See https://github.com/kachick/times_kachick/issues/311 - name: Cleanup run: | - echo "Fetching list of cache key" - cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id') - - ## Setting this to not fail the workflow while deleting cache keys. - set +e - echo "Deleting caches..." - for cacheKey in $cacheKeysForPR - do - gh cache delete $cacheKey - done - echo "Done" + gh pr list --state merged --json number --jq '.[].number' --limit 2000 | \ + xargs --no-run-if-empty -I '{}' gh cache list --sort size_in_bytes --order desc --json id --jq '.[].id' --limit 100 --ref 'refs/pull/{}/merge' | \ + xargs --no-run-if-empty --max-lines=1 gh cache delete env: GH_TOKEN: ${{ github.token }} - BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge From ed4bc8905d8beb94086112881ebb940e481b2f7d Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 28 Oct 2024 16:15:30 +0900 Subject: [PATCH 195/197] Enable wakeup for USB input devices which connected via USB Switcher/KVM (#896) Fixes GH-894 --- nixos/hosts/algae/default.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/nixos/hosts/algae/default.nix b/nixos/hosts/algae/default.nix index e8345cf0..54f5c417 100644 --- a/nixos/hosts/algae/default.nix +++ b/nixos/hosts/algae/default.nix @@ -1,4 +1,4 @@ -{ ... }: +{ lib, ... }: { networking.hostName = "algae"; @@ -21,4 +21,20 @@ }; services.xserver.videoDrivers = [ "amdgpu" ]; + + # Required to reboot if you want to apply changes + # Prevent GH-894 + # https://askubuntu.com/a/1446653 + services.udev.extraRules = lib.mkAfter '' + # Enable USB port 3 wakeup + ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="2109", ATTRS{idProduct}=="2817", ATTRS{busnum}=="3", ATTR{power/wakeup}="enabled" + # Disable USB Switcher wakeup + ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="5411", ATTR{power/wakeup}="disabled" + # Enable trackball - "Kensington SlimBlade Pro Trackball(Wired)" wakeup + ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="047d", ATTRS{idProduct}=="80d7", ATTR{power/wakeup}="enabled" + # Enable keyboard - "REALFORCE 87 US" wakeup + ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="0853", ATTRS{idProduct}=="0146", ATTR{power/wakeup}="enabled" + # Enable keyboard - "ThinkPad Compact USB Keyboard with TrackPoint" wakeup + ACTION=="add", SUBSYSTEM=="usb", DRIVERS=="usb", ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="6047", ATTR{power/wakeup}="enabled" + ''; } From cdbf3bbdb5cc3f0245d7d46e31ef9649f295829a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 29 Oct 2024 21:24:31 +0900 Subject: [PATCH 196/197] Install "age" and "passage" for adding an option in encryption (#869) * Install "age" and "passage" for another option of PGP in encryption * Set PASSAGE envs with XDG base spec * Extract documents to wiki * Omit to add fzf integration. Because of using passage only for initialization step. And having small list Resolves GH-853 --- README.md | 28 +------------- config/rclone.md | 10 +---- home-manager/common.nix | 2 +- home-manager/{pgp.nix => encryption.nix} | 48 ++++++++---------------- home-manager/packages.nix | 8 +++- 5 files changed, 26 insertions(+), 70 deletions(-) rename home-manager/{pgp.nix => encryption.nix} (72%) diff --git a/README.md b/README.md index 39dcf18e..794a3449 100644 --- a/README.md +++ b/README.md @@ -148,33 +148,9 @@ Read [Windows README](windows/README.md) and [CI](.github/workflows/windows.yml) Check [traps](./windows/Multi-booting.md) -## Following steps +## How to setup secrets -1. Restore GPG secret from STDIN - - ```bash - gpg --import - ``` - -1. Restore SSH secret from STDIN - - ```bash - touch ~/.ssh/id_ed25519 && chmod 400 ~/.ssh/id_ed25519 - hx ~/.ssh/id_ed25519 - ssh-add ~/.ssh/id_ed25519 - ``` - -1. Restore encrepted secrets from private git repository - - ```bash - git clone 'git@example.com:password-store.git' "$PASSWORD_STORE_DIR" - ``` - -1. [Restore encrypted rclone.conf from STDIN](config/rclone.md) - -1. Restore shell history - - [Work in Progress](https://github.com/kachick/dotfiles/pull/266) +Extracted to [wiki](https://github.com/kachick/dotfiles/wiki/Vault) ## Note diff --git a/config/rclone.md b/config/rclone.md index eee0617b..4b584cb8 100644 --- a/config/rclone.md +++ b/config/rclone.md @@ -26,14 +26,8 @@ See [rclone with Google Drive](https://rclone.org/drive) for detail. ## Restore Config -Assume you encrypted the config - -```bash -rclone config touch -hx "$(rclone config file | tail -1)" -``` - -Don't save the file in this repository even if it is encrypted with agenix or sops-nix. +Don't save the file in this repository even if it is encrypted with agenix or sops-nix.\ +See for the detail. ## Decrypt the config in a session diff --git a/home-manager/common.nix b/home-manager/common.nix index a8036c1a..22163a2a 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -12,7 +12,7 @@ ./bash.nix ./zsh.nix ./fish.nix - ./pgp.nix + ./encryption.nix ./ssh.nix ./git.nix ./editors.nix diff --git a/home-manager/pgp.nix b/home-manager/encryption.nix similarity index 72% rename from home-manager/pgp.nix rename to home-manager/encryption.nix index 65a7ab16..246bacd0 100644 --- a/home-manager/pgp.nix +++ b/home-manager/encryption.nix @@ -5,41 +5,12 @@ ... }: -# # FAQ -# -# ## sequoia-sq and gpg -# -# See GH-830 -# -# If you faced to decrypt error with gpg-sq, check it with `sq decrypt`. It displays error details. -# For example, `1: AEAD Encrypted Data Packet v1 is not considered secure` -# This is caused by encrypted non configured gpg for the AEAD. Disable it with showpref/setpref if you still use gpg. -# -# ## sequoia-sq -# -# TODO: -# -# ## GPG -# -# - How to list keys? -# - 1. `gpg --list-secret-keys --keyid-format=long` # The `sec` first section displays same text as `pub` by `gpg --list-keys --keyid-format=long` -# - How to add subkey? -# - 1. `gpg --edit-key PUBKEY` -# - 2. `addkey` -# - 3. `save` -# - How to revoke subkey? -# - 1. `gpg --edit-key PUBKEY` -# - 2. `key n` n is the index of subkey -# - 3. `revkey` -# - 4. `save` -# - 5. Replace uploaded pubkey with new one, see https://github.com/kachick/dotfiles/pull/311#issuecomment-1715812324 for detail -# - How to get pubkey to upload? -# - `gpg --armor --export PUBKEY | clip.exe` -# - How to backup private key? -# - `gpg --export-secret-keys --armor > gpg-private.keys.bak` +# See https://github.com/kachick/dotfiles/wiki/Encryption for the extracted comments + let # All gpg-agent timeouts numbers should be specified with the `seconds` day = 60 * 60 * 24; + passage_identity_dir = "${config.xdg.configHome}/passage"; in { # Don't set $SEQUOIA_HOME, it unified config and data, cache to one directory as same as gpg era. @@ -63,10 +34,21 @@ in enableSshSupport = false; }; - home.sessionVariables = { + home.sessionVariables = rec { GOPASS_GPG_BINARY = "${pkgs.lib.getBin edge-pkgs.sequoia-chameleon-gnupg}/bin/gpg-sq"; + + # Do NOT include the identity here + PASSAGE_DIR = "${config.xdg.dataHome}/passage/store"; + + # Create with: `age-keygen | age --passphrase --armor` + PASSAGE_IDENTITIES_FILE = "${passage_identity_dir}/identities.age"; + + # Create with: `age --decrypt "$PASSAGE_IDENTITIES_FILE" | age-keygen -y` + PASSAGE_RECIPIENTS_FILE = "${PASSAGE_DIR}/.age-recipients"; }; + home.file."${passage_identity_dir}/.keep".text = "Keep this directory because of passage and age does not create the file if directory is missing"; + # https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/gpg.nix programs.gpg = { enable = true; diff --git a/home-manager/packages.nix b/home-manager/packages.nix index c214000b..4a2d338e 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -46,9 +46,13 @@ edge-pkgs.sequoia-chameleon-gnupg gnupg # Also keep original GPG for now. sequoia-chameleon-gnupg does not support some crucial toolset. etc: `gpg --edit-key`, `gpgconf` - # Alt `pass` for password-store. Candidates: gopass, prs + age # Candidates: rage + + # Alt `pass` for password-store. Candidates: gopass, prs. Do not use ripasso-cursive for now. It only provides TUI, not a replacement of CLI. And currently unstable on my NixOS. gopass # They will respect pass comaptibility: https://github.com/gopasspw/gopass/issues/1365#issuecomment-719655627 - # Do not use ripasso-cursive for now. It only provides TUI, not a replacement of CLI. And currently unstable on my NixOS. + + # Age fork of `pass`, also supports rage with $PASSAGE_AGE. + edge-pkgs.passage # Use latest to apply https://github.com/NixOS/nixpkgs/pull/339113 # Do not specify vim and the plugins at here, it made collisions from home-manager vim module. # See following issues From 24a52486f964932f35f6ed118b01f370f3f74f01 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 29 Oct 2024 21:26:05 +0900 Subject: [PATCH 197/197] Update wiki page name --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 794a3449..059b6278 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ Check [traps](./windows/Multi-booting.md) ## How to setup secrets -Extracted to [wiki](https://github.com/kachick/dotfiles/wiki/Vault) +Extracted to [wiki](https://github.com/kachick/dotfiles/wiki/Encryption) ## Note