From a92b30c57b64f16413f13baa58e68b633215f102 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 16 Aug 2024 04:20:48 +0800 Subject: [PATCH] Split guix out --- include/source.h | 11 ----------- src/chsrc.c | 20 +------------------- src/recipe/catalog.c | 1 - src/recipe/ware/Guix.c | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 31 deletions(-) create mode 100644 src/recipe/ware/Guix.c diff --git a/include/source.h b/include/source.h index c870ebc..4051e87 100644 --- a/include/source.h +++ b/include/source.h @@ -166,16 +166,6 @@ wr_flathub_sources[] = { -/** - * @time 2023-09-11 更新 - * @note 目前只有一个源 - */ -wr_guix_sources[] = { - {&Upstream, NULL}, - {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/git/guix.git"} -}, - - /** @@ -214,6 +204,5 @@ def_sources_n(pl_clojure); def_sources_n(pl_dotnet); def_sources_n(wr_flathub); -def_sources_n(wr_guix); def_sources_n(wr_tex); def_sources_n(wr_anaconda); diff --git a/src/chsrc.c b/src/chsrc.c index e57f570..2cdedd1 100644 --- a/src/chsrc.c +++ b/src/chsrc.c @@ -181,25 +181,7 @@ wr_tex_setsrc (char *option) #include "recipe/ware/Homebrew.c" #include "recipe/ware/CocoaPods.c" #include "recipe/ware/Nix.c" - -/** - * 参考: https://mirrors.sjtug.sjtu.edu.cn/docs/guix - */ -void -wr_guix_setsrc (char *option) -{ - SourceInfo source; - chsrc_yield_source (wr_guix); - chsrc_confirm_source (&source); - - char *file = xy_strjoin (3, "(list (channel\n" - " (inherit (car %default-channels))\n" - " (url \"", source.url, "\")))"); - - chsrc_note2 ("为防止扰乱配置文件,请您手动写入以下内容到 ~/.config/guix/channels.scm 文件中"); - puts (file); - chsrc_say_lastly (&source, ChsrcTypeManual); -} +#include "recipe/ware/Guix.c" diff --git a/src/recipe/catalog.c b/src/recipe/catalog.c index c935d59..18ee059 100644 --- a/src/recipe/catalog.c +++ b/src/recipe/catalog.c @@ -93,7 +93,6 @@ static const char def_target_noget (wr_flathub); -def_target_noget (wr_guix); def_target_noget (wr_anaconda); def_target(wr_tex); diff --git a/src/recipe/ware/Guix.c b/src/recipe/ware/Guix.c new file mode 100644 index 0000000..978405a --- /dev/null +++ b/src/recipe/ware/Guix.c @@ -0,0 +1,41 @@ +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------- + * File Authors : Aoran Zeng + * Contributors : Nil Null + * Created On : <2023-09-11> + * Last Modified : <2024-08-15> + * ------------------------------------------------------------*/ + +/** + * @time 2023-09-11 更新 + * @note 目前只有一个源 + */ +static SourceInfo +wr_guix_sources[] = { + {&Upstream, NULL}, + {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/git/guix.git"} +}; +def_sources_n(wr_guix); + + +/** + * 参考: https://mirrors.sjtug.sjtu.edu.cn/docs/guix + */ +void +wr_guix_setsrc (char *option) +{ + SourceInfo source; + chsrc_yield_source (wr_guix); + chsrc_confirm_source (&source); + + char *file = xy_strjoin (3, "(list (channel\n" + " (inherit (car %default-channels))\n" + " (url \"", source.url, "\")))"); + + chsrc_note2 ("为防止扰乱配置文件,请您手动写入以下内容到 ~/.config/guix/channels.scm 文件中"); + puts (file); + chsrc_say_lastly (&source, ChsrcTypeManual); +} + +def_target_noget (wr_guix);