From 6732c71613a7f53f4c463c50db709bf799fe82ca Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Thu, 25 Jul 2024 22:10:16 +0900 Subject: [PATCH 01/20] sheldon: add module --- modules/programs/sheldon.nix | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 modules/programs/sheldon.nix diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix new file mode 100644 index 000000000..cbd3767f3 --- /dev/null +++ b/modules/programs/sheldon.nix @@ -0,0 +1,34 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.sheldon; + tomlFormat = pkgs.formats.toml {}; +in { + meta.maintainers = pkgs.sheldon.meta.maintainers; + + options.programs.sheldon = { + enable = mkEnableOption "sheldon"; + + package = mkOption { + type = types.package; + default = pkgs.sheldon; + defaultText = literalExpression "pkgs.sheldon"; + description = "The package to use for the sheldon binary."; + }; + + settings = mkOption { + inherit (tomlFormat) type; + default = { }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.packages ]; + + xdg.configFile."sheldon/plugins.toml" = mkIf (cfg.settings != { }) { + source = tomlFormat.generate "sheldon-config" cfg.settings; + }; + }; +} From 0c63255773b138fb63b5c6fa675ac3e25012a54b Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Thu, 25 Jul 2024 22:20:07 +0900 Subject: [PATCH 02/20] sheldon: add module --- modules/modules.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/modules.nix b/modules/modules.nix index dbeebfbf7..3eeeb23c3 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -214,6 +214,7 @@ let ./programs/script-directory.nix ./programs/senpai.nix ./programs/sftpman.nix + ./programs/sheldon.nix ./programs/sioyek.nix ./programs/skim.nix ./programs/sm64ex.nix From ea859bc3e332aa5e50d98d5885d0749fb01dd981 Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Thu, 25 Jul 2024 23:02:51 +0900 Subject: [PATCH 03/20] sheldon: some fixes --- modules/programs/sheldon.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index cbd3767f3..9bbecf825 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -4,9 +4,9 @@ with lib; let cfg = config.programs.sheldon; - tomlFormat = pkgs.formats.toml {}; + tomlFormat = pkgs.formats.toml { }; in { - meta.maintainers = pkgs.sheldon.meta.maintainers; + inherit (pkgs.sheldon) meta; options.programs.sheldon = { enable = mkEnableOption "sheldon"; From e0e99704acbc4a45092b9c5bfa62f32a9cb6f2de Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Thu, 25 Jul 2024 23:11:15 +0900 Subject: [PATCH 04/20] Revert "sheldon: some fixes" This reverts commit ea859bc3e332aa5e50d98d5885d0749fb01dd981. --- modules/programs/sheldon.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index 9bbecf825..cbd3767f3 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -4,9 +4,9 @@ with lib; let cfg = config.programs.sheldon; - tomlFormat = pkgs.formats.toml { }; + tomlFormat = pkgs.formats.toml {}; in { - inherit (pkgs.sheldon) meta; + meta.maintainers = pkgs.sheldon.meta.maintainers; options.programs.sheldon = { enable = mkEnableOption "sheldon"; From 21690ed641bb5af887a2c4b7e4c75b18e726197d Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Thu, 25 Jul 2024 23:12:40 +0900 Subject: [PATCH 05/20] sheldon: fix missed variable name --- modules/programs/sheldon.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index cbd3767f3..9d3908fb5 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -25,7 +25,7 @@ in { }; config = mkIf cfg.enable { - home.packages = [ cfg.packages ]; + home.packages = [ cfg.package ]; xdg.configFile."sheldon/plugins.toml" = mkIf (cfg.settings != { }) { source = tomlFormat.generate "sheldon-config" cfg.settings; From 70800bed61a35a1130d37c065f61db28818c4295 Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Thu, 25 Jul 2024 23:14:32 +0900 Subject: [PATCH 06/20] sheldon: add description and example (blank) --- modules/programs/sheldon.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index 9d3908fb5..f19869a93 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -21,6 +21,10 @@ in { settings = mkOption { inherit (tomlFormat) type; default = { }; + description = '' + ''; + example = literalExpression '' + ''; }; }; From d7f0ae89701e4899c695db188eb9fc757c45dc57 Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Fri, 26 Jul 2024 00:19:55 +0900 Subject: [PATCH 07/20] sheldon: add shell configs --- modules/programs/sheldon.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index f19869a93..c79642260 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -5,6 +5,7 @@ with lib; let cfg = config.programs.sheldon; tomlFormat = pkgs.formats.toml {}; + cmd = "${config.home.profileDirectory}/bin/sheldon"; in { meta.maintainers = pkgs.sheldon.meta.maintainers; @@ -34,5 +35,13 @@ in { xdg.configFile."sheldon/plugins.toml" = mkIf (cfg.settings != { }) { source = tomlFormat.generate "sheldon-config" cfg.settings; }; + + programs.bash.initExtra = mkIf (cfg.settings != { }) '' + eval "$(sheldon source)" + ''; + + programs.zsh.initExtra = mkIf (cfg.settings != { }) '' + eval "$(sheldon source)" + ''; }; } From 8e3e635cf124fa13999e4afb88dd68f4eab45776 Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Fri, 26 Jul 2024 00:31:47 +0900 Subject: [PATCH 08/20] sheldon: format code --- modules/programs/sheldon.nix | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index c79642260..48d992cb5 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -4,7 +4,7 @@ with lib; let cfg = config.programs.sheldon; - tomlFormat = pkgs.formats.toml {}; + tomlFormat = pkgs.formats.toml { }; cmd = "${config.home.profileDirectory}/bin/sheldon"; in { meta.maintainers = pkgs.sheldon.meta.maintainers; @@ -22,10 +22,8 @@ in { settings = mkOption { inherit (tomlFormat) type; default = { }; - description = '' - ''; - example = literalExpression '' - ''; + description = ""; + example = literalExpression ""; }; }; @@ -37,11 +35,11 @@ in { }; programs.bash.initExtra = mkIf (cfg.settings != { }) '' - eval "$(sheldon source)" + eval "$(sheldon source)" ''; programs.zsh.initExtra = mkIf (cfg.settings != { }) '' - eval "$(sheldon source)" + eval "$(sheldon source)" ''; }; } From 531f7bae73ec0e99bc0ac34507086946a34b1735 Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Sat, 27 Jul 2024 00:46:26 +0900 Subject: [PATCH 09/20] sheldon: add test case --- tests/default.nix | 1 + tests/modules/programs/sheldon/plugins.toml | 60 +++++++++++++++++++ tests/modules/programs/sheldon/settings.nix | 65 +++++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 tests/modules/programs/sheldon/plugins.toml create mode 100644 tests/modules/programs/sheldon/settings.nix diff --git a/tests/default.nix b/tests/default.nix index 28ce4f648..5dfa9499e 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -140,6 +140,7 @@ in import nmtSrc { ./modules/programs/scmpuff ./modules/programs/senpai ./modules/programs/sftpman + ./modules/programs/sheldon ./modules/programs/sioyek ./modules/programs/sm64ex ./modules/programs/spotify-player diff --git a/tests/modules/programs/sheldon/plugins.toml b/tests/modules/programs/sheldon/plugins.toml new file mode 100644 index 000000000..9be6c9386 --- /dev/null +++ b/tests/modules/programs/sheldon/plugins.toml @@ -0,0 +1,60 @@ +shell = "zsh" +[plugins] +[plugins.add-zsh-hook] +inline = "autoload -U add-zsh-hook" + +[plugins.anyframe] +github = "mollifier/anyframe" + +[plugins.async] +apply = ["defer"] +local = "~/.config/sheldon/async" +use = ["*.zsh"] + +[plugins.colors] +inline = "autoload -U colors && zsh-defer colors" + +[plugins.compinit] +inline = "autoload -U compinit && zsh-defer compinit -C" + +[plugins.fzf] +github = "junegunn/fzf" + +[plugins.predict] +inline = "autoload -U predict-on && predict-on" + +[plugins.starship] +inline = "eval \"$(starship init zsh)\"\n" + +[plugins.sync] +apply = ["source"] +local = "~/.config/sheldon/sync" +use = ["*.zsh"] + +[plugins.zcalc] +inline = "autoload -U zcalc" + +[plugins.zsh-async] +github = "mafredri/zsh-async" + +[plugins.zsh-complations] +apply = ["defer"] +github = "zsh-users/zsh-completions" + +[plugins.zsh-defer] +apply = ["source"] +github = "romkatv/zsh-defer" + +[plugins.zsh-history-substring-search] +apply = ["defer"] +github = "zsh-users/zsh-history-substring-search" + +[plugins.zsh-syntax-highlighting] +apply = ["defer"] +github = "zsh-users/zsh-syntax-highlighting" + +[plugins.zsh-terminfo] +inline = "zmodload zsh/terminfo" + +[templates] +defer = "{{ hooks | get: \"pre\" | nl }}{% for file in files %}zsh-defer source \"{{ file }}\"\n{% endfor %}{{ hooks | get: \"post\" | nl }}" diff --git a/tests/modules/programs/sheldon/settings.nix b/tests/modules/programs/sheldon/settings.nix new file mode 100644 index 000000000..c8f150555 --- /dev/null +++ b/tests/modules/programs/sheldon/settings.nix @@ -0,0 +1,65 @@ +{ + config = { + programs.sheldon = { + enable = true; + settings = { + shell = "zsh"; + plugins = { + async = { + local = "~/.config/sheldon/async"; + use = [ "*.zsh" ]; + apply = [ "defer" ]; + }; + sync = { + local = "~/.config/sheldon/sync"; + use = [ "*.zsh" ]; + apply = [ "source" ]; + }; + zsh-defer = { + github = "romkatv/zsh-defer"; + apply = [ "source" ]; + }; + add-zsh-hook = { inline = "autoload -U add-zsh-hook"; }; + anyframe = { github = "mollifier/anyframe"; }; + colors = { inline = "autoload -U colors && zsh-defer colors"; }; + compinit = { + inline = "autoload -U compinit && zsh-defer compinit -C"; + }; + fzf = { github = "junegunn/fzf"; }; + predict = { inline = "autoload -U predict-on && predict-on"; }; + starship = { + inline = '' + eval "$(starship init zsh)" + ''; + }; + zcalc = { inline = "autoload -U zcalc"; }; + zsh-async = { github = "mafredri/zsh-async"; }; + zsh-complations = { + github = "zsh-users/zsh-completions"; + apply = [ "defer" ]; + }; + zsh-history-substring-search = { + github = "zsh-users/zsh-history-substring-search"; + apply = [ "defer" ]; + }; + zsh-syntax-highlighting = { + github = "zsh-users/zsh-syntax-highlighting"; + apply = [ "defer" ]; + }; + zsh-terminfo = { inline = "zmodload zsh/terminfo"; }; + }; + templates = { + defer = '' + {{ hooks | get: "pre" | nl }}{% for file in files %}zsh-defer source "{{ file }}" + {% endfor %}{{ hooks | get: "post" | nl }}''; + }; + }; + }; + }; + + test.stubs.sheldon = { }; + + nmt.script = "assertFileContent home-files/.config/sheldon/plugins.toml ${ + ./plugins.toml + }"; +} From 1429d45f74d8e748db68d04a85519364928b824a Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Sat, 27 Jul 2024 00:58:03 +0900 Subject: [PATCH 10/20] maintainers: add Kyure-A as maintainer --- modules/lib/maintainers.nix | 7 +++++++ modules/programs/sheldon.nix | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index f1a818155..5bc8b7458 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -581,4 +581,11 @@ github = "zorrobert"; githubId = 118135271; }; + + Kyure-A = { + name = "Kyure_A"; + email = "k@kyre.moe"; + github = "Kyure-A"; + githubId = 49436968; + }; } diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index 48d992cb5..1d4c3a5b8 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -7,7 +7,7 @@ let tomlFormat = pkgs.formats.toml { }; cmd = "${config.home.profileDirectory}/bin/sheldon"; in { - meta.maintainers = pkgs.sheldon.meta.maintainers; + meta.maintainers = [ maintainers.Kyure-A ]; options.programs.sheldon = { enable = mkEnableOption "sheldon"; From 8f9d24cdf0009a9ac14f24c74f382f7c19ca4be8 Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Sat, 27 Jul 2024 01:01:53 +0900 Subject: [PATCH 11/20] sheldon: fix missed file name --- tests/modules/programs/sheldon/{settings.nix => defaults.nix} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/modules/programs/sheldon/{settings.nix => defaults.nix} (100%) diff --git a/tests/modules/programs/sheldon/settings.nix b/tests/modules/programs/sheldon/defaults.nix similarity index 100% rename from tests/modules/programs/sheldon/settings.nix rename to tests/modules/programs/sheldon/defaults.nix From edb6367c91acea489692b9486d79bc33508b1466 Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Sat, 27 Jul 2024 01:02:50 +0900 Subject: [PATCH 12/20] sheldon: fix missed file name --- tests/modules/programs/sheldon/{defaults.nix => default.nix} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/modules/programs/sheldon/{defaults.nix => default.nix} (100%) diff --git a/tests/modules/programs/sheldon/defaults.nix b/tests/modules/programs/sheldon/default.nix similarity index 100% rename from tests/modules/programs/sheldon/defaults.nix rename to tests/modules/programs/sheldon/default.nix From 718f450b97d57234dc0c801c76b856b6b615cde6 Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Tue, 30 Jul 2024 20:19:04 +0900 Subject: [PATCH 13/20] sheldon: fix setting to simple --- tests/modules/programs/sheldon/default.nix | 38 --------------- tests/modules/programs/sheldon/plugins.toml | 53 --------------------- 2 files changed, 91 deletions(-) diff --git a/tests/modules/programs/sheldon/default.nix b/tests/modules/programs/sheldon/default.nix index c8f150555..eba78f424 100644 --- a/tests/modules/programs/sheldon/default.nix +++ b/tests/modules/programs/sheldon/default.nix @@ -5,48 +5,10 @@ settings = { shell = "zsh"; plugins = { - async = { - local = "~/.config/sheldon/async"; - use = [ "*.zsh" ]; - apply = [ "defer" ]; - }; - sync = { - local = "~/.config/sheldon/sync"; - use = [ "*.zsh" ]; - apply = [ "source" ]; - }; - zsh-defer = { - github = "romkatv/zsh-defer"; - apply = [ "source" ]; - }; - add-zsh-hook = { inline = "autoload -U add-zsh-hook"; }; - anyframe = { github = "mollifier/anyframe"; }; - colors = { inline = "autoload -U colors && zsh-defer colors"; }; - compinit = { - inline = "autoload -U compinit && zsh-defer compinit -C"; - }; - fzf = { github = "junegunn/fzf"; }; - predict = { inline = "autoload -U predict-on && predict-on"; }; - starship = { - inline = '' - eval "$(starship init zsh)" - ''; - }; - zcalc = { inline = "autoload -U zcalc"; }; - zsh-async = { github = "mafredri/zsh-async"; }; - zsh-complations = { - github = "zsh-users/zsh-completions"; - apply = [ "defer" ]; - }; - zsh-history-substring-search = { - github = "zsh-users/zsh-history-substring-search"; - apply = [ "defer" ]; - }; zsh-syntax-highlighting = { github = "zsh-users/zsh-syntax-highlighting"; apply = [ "defer" ]; }; - zsh-terminfo = { inline = "zmodload zsh/terminfo"; }; }; templates = { defer = '' diff --git a/tests/modules/programs/sheldon/plugins.toml b/tests/modules/programs/sheldon/plugins.toml index 9be6c9386..f40b27cf2 100644 --- a/tests/modules/programs/sheldon/plugins.toml +++ b/tests/modules/programs/sheldon/plugins.toml @@ -1,60 +1,7 @@ shell = "zsh" -[plugins] -[plugins.add-zsh-hook] -inline = "autoload -U add-zsh-hook" - -[plugins.anyframe] -github = "mollifier/anyframe" - -[plugins.async] -apply = ["defer"] -local = "~/.config/sheldon/async" -use = ["*.zsh"] - -[plugins.colors] -inline = "autoload -U colors && zsh-defer colors" - -[plugins.compinit] -inline = "autoload -U compinit && zsh-defer compinit -C" - -[plugins.fzf] -github = "junegunn/fzf" - -[plugins.predict] -inline = "autoload -U predict-on && predict-on" - -[plugins.starship] -inline = "eval \"$(starship init zsh)\"\n" - -[plugins.sync] -apply = ["source"] -local = "~/.config/sheldon/sync" -use = ["*.zsh"] - -[plugins.zcalc] -inline = "autoload -U zcalc" - -[plugins.zsh-async] -github = "mafredri/zsh-async" - -[plugins.zsh-complations] -apply = ["defer"] -github = "zsh-users/zsh-completions" - -[plugins.zsh-defer] -apply = ["source"] -github = "romkatv/zsh-defer" - -[plugins.zsh-history-substring-search] -apply = ["defer"] -github = "zsh-users/zsh-history-substring-search" - [plugins.zsh-syntax-highlighting] apply = ["defer"] github = "zsh-users/zsh-syntax-highlighting" -[plugins.zsh-terminfo] -inline = "zmodload zsh/terminfo" - [templates] defer = "{{ hooks | get: \"pre\" | nl }}{% for file in files %}zsh-defer source \"{{ file }}\"\n{% endfor %}{{ hooks | get: \"post\" | nl }}" From b6bc02376efa269df496d1a8ec320abcbbd175d9 Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Tue, 30 Jul 2024 20:35:53 +0900 Subject: [PATCH 14/20] sheldon: add option to enable completion script --- modules/programs/sheldon.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index 1d4c3a5b8..c414256b0 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -25,6 +25,18 @@ in { description = ""; example = literalExpression ""; }; + + enableZshCompletions = mkEnableOption "Zsh completions" // { + default = false; + }; + + enableBashCompletions = mkEnableOption "Bash completions" // { + default = false; + }; + + enableFishCompletions = mkEnableOption "Fish completions" // { + default = false; + }; }; config = mkIf cfg.enable { @@ -36,10 +48,26 @@ in { programs.bash.initExtra = mkIf (cfg.settings != { }) '' eval "$(sheldon source)" + '' + mkIf cfg.enableBashCompletions '' + if [[ $TERM != "dumb" ]]; then + eval "$(${cmd} completions --shell=bash)" + fi ''; programs.zsh.initExtra = mkIf (cfg.settings != { }) '' eval "$(sheldon source)" + '' + mkIf cfg.enableZshCompletions '' + if [[ $TERM != "dumb" ]]; then + eval "$(${cmd} completions --shell=zsh)" + fi + ''; + + programs.fish.interactiveShellInit = mkIf (cfg.settings != { }) '' + eval "$(sheldon source)" + '' + mkIf cfg.enableFishCompletions '' + if test "$TERM" != "dumb" + eval "$(${cmd} completions --shell=fish)" + end ''; }; } From 6c65ca95fc33e63a38d8d03e681bec304227b1a8 Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Tue, 30 Jul 2024 21:06:42 +0900 Subject: [PATCH 15/20] sheldon: change default value of options to enable completions to true --- modules/programs/sheldon.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index c414256b0..a87634ac0 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -27,15 +27,15 @@ in { }; enableZshCompletions = mkEnableOption "Zsh completions" // { - default = false; + default = true; }; enableBashCompletions = mkEnableOption "Bash completions" // { - default = false; + default = true; }; enableFishCompletions = mkEnableOption "Fish completions" // { - default = false; + default = true; }; }; From abfc68ac8f5fa9ee066a2d3c0ccd792f04bc380a Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Tue, 30 Jul 2024 21:29:22 +0900 Subject: [PATCH 16/20] sheldon: fix how commands are combined --- modules/programs/sheldon.nix | 63 ++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index a87634ac0..e44f11f6f 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -46,28 +46,49 @@ in { source = tomlFormat.generate "sheldon-config" cfg.settings; }; - programs.bash.initExtra = mkIf (cfg.settings != { }) '' - eval "$(sheldon source)" - '' + mkIf cfg.enableBashCompletions '' - if [[ $TERM != "dumb" ]]; then - eval "$(${cmd} completions --shell=bash)" - fi - ''; + programs.bash.initExtra = concatStringsSep "\n" [ + mkIf + (cfg.settings != { }) + '' + eval "$(sheldon source)" + '' + mkIf + cfg.enableBashCompletions + '' + if [[ $TERM != "dumb" ]]; then + eval "$(${cmd} completions --shell=bash)" + fi + '' + ]; - programs.zsh.initExtra = mkIf (cfg.settings != { }) '' - eval "$(sheldon source)" - '' + mkIf cfg.enableZshCompletions '' - if [[ $TERM != "dumb" ]]; then - eval "$(${cmd} completions --shell=zsh)" - fi - ''; + programs.zsh.initExtra = concatStringsSep "\n" [ + mkIf + (cfg.settings != { }) + '' + eval "$(sheldon source)" + '' + mkIf + cfg.enableZshCompletions + '' + if [[ $TERM != "dumb" ]]; then + eval "$(${cmd} completions --shell=zsh)" + fi + '' + ]; - programs.fish.interactiveShellInit = mkIf (cfg.settings != { }) '' - eval "$(sheldon source)" - '' + mkIf cfg.enableFishCompletions '' - if test "$TERM" != "dumb" - eval "$(${cmd} completions --shell=fish)" - end - ''; + programs.fish.interactiveShellInit = concatStringsSep "\n" [ + mkIf + (cfg.settings != { }) + '' + eval "$(sheldon source)" + '' + mkIf + cfg.enableFishCompletions + '' + if test "$TERM" != "dumb" + eval "$(${cmd} completions --shell=fish)" + end + '' + ]; }; } From cdb8ea396e3e79748528ce4b629435da1f7e6bbf Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Tue, 30 Jul 2024 21:50:14 +0900 Subject: [PATCH 17/20] sheldon: fix missing prefix --- modules/programs/sheldon.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index e44f11f6f..aaf904e1b 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -46,7 +46,7 @@ in { source = tomlFormat.generate "sheldon-config" cfg.settings; }; - programs.bash.initExtra = concatStringsSep "\n" [ + programs.bash.initExtra = builtins.concatStringsSep "\n" [ mkIf (cfg.settings != { }) '' @@ -61,7 +61,7 @@ in { '' ]; - programs.zsh.initExtra = concatStringsSep "\n" [ + programs.zsh.initExtra = builtins.concatStringsSep "\n" [ mkIf (cfg.settings != { }) '' @@ -76,7 +76,7 @@ in { '' ]; - programs.fish.interactiveShellInit = concatStringsSep "\n" [ + programs.fish.interactiveShellInit = builtins.concatStringsSep "\n" [ mkIf (cfg.settings != { }) '' From a63b8500667c7aa547ae8982eb5acae619d35423 Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Tue, 30 Jul 2024 21:59:36 +0900 Subject: [PATCH 18/20] sheldon: change mkIf to be enclosed in parentheses --- modules/programs/sheldon.nix | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index aaf904e1b..d28457f22 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -47,48 +47,36 @@ in { }; programs.bash.initExtra = builtins.concatStringsSep "\n" [ - mkIf - (cfg.settings != { }) - '' + (mkIf (cfg.settings != { }) '' eval "$(sheldon source)" - '' - mkIf - cfg.enableBashCompletions - '' + '') + (mkIf cfg.enableBashCompletions '' if [[ $TERM != "dumb" ]]; then eval "$(${cmd} completions --shell=bash)" fi - '' + '') ]; programs.zsh.initExtra = builtins.concatStringsSep "\n" [ - mkIf - (cfg.settings != { }) - '' + (mkIf (cfg.settings != { }) '' eval "$(sheldon source)" - '' - mkIf - cfg.enableZshCompletions - '' + '') + (mkIf cfg.enableZshCompletions '' if [[ $TERM != "dumb" ]]; then eval "$(${cmd} completions --shell=zsh)" fi - '' + '') ]; programs.fish.interactiveShellInit = builtins.concatStringsSep "\n" [ - mkIf - (cfg.settings != { }) - '' + (mkIf (cfg.settings != { }) '' eval "$(sheldon source)" - '' - mkIf - cfg.enableFishCompletions - '' + '') + (mkIf cfg.enableFishCompletions '' if test "$TERM" != "dumb" eval "$(${cmd} completions --shell=fish)" end - '' + '') ]; }; } From fbd892591c2a3c324552cf652e2b446848957d8c Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Wed, 31 Jul 2024 19:36:31 +0900 Subject: [PATCH 19/20] sheldon: fix expression type --- modules/programs/sheldon.nix | 44 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index d28457f22..0d43a1bcd 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -5,7 +5,7 @@ with lib; let cfg = config.programs.sheldon; tomlFormat = pkgs.formats.toml { }; - cmd = "${config.home.profileDirectory}/bin/sheldon"; + sheldonCmd = "${config.home.profileDirectory}/bin/sheldon"; in { meta.maintainers = [ maintainers.Kyure-A ]; @@ -46,37 +46,37 @@ in { source = tomlFormat.generate "sheldon-config" cfg.settings; }; - programs.bash.initExtra = builtins.concatStringsSep "\n" [ - (mkIf (cfg.settings != { }) '' + programs.bash.initExtra = '' + ${optionalString (cfg.settings != { }) '' eval "$(sheldon source)" - '') - (mkIf cfg.enableBashCompletions '' + ''} + ${optionalString cfg.enableBashCompletions '' if [[ $TERM != "dumb" ]]; then - eval "$(${cmd} completions --shell=bash)" + eval "$(${sheldonCmd} completions --shell=bash)" fi - '') - ]; + ''} + ''; - programs.zsh.initExtra = builtins.concatStringsSep "\n" [ - (mkIf (cfg.settings != { }) '' + programs.zsh.initExtra = '' + ${optionalString (cfg.settings != { }) '' eval "$(sheldon source)" - '') - (mkIf cfg.enableZshCompletions '' + ''} + ${optionalString cfg.enableZshCompletions '' if [[ $TERM != "dumb" ]]; then - eval "$(${cmd} completions --shell=zsh)" + eval "$(${sheldonCmd} completions --shell=zsh)" fi - '') - ]; + ''} + ''; - programs.fish.interactiveShellInit = builtins.concatStringsSep "\n" [ - (mkIf (cfg.settings != { }) '' + programs.fish.interactiveShellInit = '' + ${optionalString (cfg.settings != { }) '' eval "$(sheldon source)" - '') - (mkIf cfg.enableFishCompletions '' + ''} + ${optionalString cfg.enableFishCompletions '' if test "$TERM" != "dumb" - eval "$(${cmd} completions --shell=fish)" + eval "$(${sheldonCmd} completions --shell=fish)" end - '') - ]; + ''} + ''; }; } From 9e7fafde5df4984537a5c0f1b016deb3398c426e Mon Sep 17 00:00:00 2001 From: Kyure_A <49436968+Kyure-A@users.noreply.github.com> Date: Wed, 31 Jul 2024 19:38:36 +0900 Subject: [PATCH 20/20] sheldon: add mainrs as maintainer --- modules/programs/sheldon.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/sheldon.nix b/modules/programs/sheldon.nix index 0d43a1bcd..5b67928c8 100644 --- a/modules/programs/sheldon.nix +++ b/modules/programs/sheldon.nix @@ -7,7 +7,7 @@ let tomlFormat = pkgs.formats.toml { }; sheldonCmd = "${config.home.profileDirectory}/bin/sheldon"; in { - meta.maintainers = [ maintainers.Kyure-A ]; + meta.maintainers = with maintainers; [ Kyure-A mainrs ]; options.programs.sheldon = { enable = mkEnableOption "sheldon";