mirror of
https://github.com/RubyMetric/chsrc.git
synced 2024-11-22 11:11:36 +08:00
Split nix out
This commit is contained in:
parent
8305341d62
commit
e77e42fb6c
|
@ -166,20 +166,6 @@ wr_flathub_sources[] = {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* @time 2023-09-22 更新
|
||||
* @note {
|
||||
* 1. 目前只有一个源
|
||||
* 2. 这些链接将会在setsrc函数中补充完整
|
||||
* }
|
||||
*/
|
||||
wr_nix_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/nix-channels/"}
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @time 2023-09-11 更新
|
||||
* @note 目前只有一个源
|
||||
|
@ -228,6 +214,6 @@ def_sources_n(pl_clojure);
|
|||
def_sources_n(pl_dotnet);
|
||||
|
||||
def_sources_n(wr_flathub);
|
||||
def_sources_n(wr_nix); def_sources_n(wr_guix);
|
||||
def_sources_n(wr_guix);
|
||||
def_sources_n(wr_tex);
|
||||
def_sources_n(wr_anaconda);
|
||||
|
|
42
src/chsrc.c
42
src/chsrc.c
|
@ -180,7 +180,7 @@ wr_tex_setsrc (char *option)
|
|||
#include "recipe/ware/WinGet.c"
|
||||
#include "recipe/ware/Homebrew.c"
|
||||
#include "recipe/ware/CocoaPods.c"
|
||||
|
||||
#include "recipe/ware/Nix.c"
|
||||
|
||||
/**
|
||||
* 参考: https://mirrors.sjtug.sjtu.edu.cn/docs/guix
|
||||
|
@ -203,46 +203,6 @@ wr_guix_setsrc (char *option)
|
|||
|
||||
|
||||
|
||||
void
|
||||
wr_nix_check_cmd ()
|
||||
{
|
||||
chsrc_ensure_program ("nix-channel");
|
||||
}
|
||||
|
||||
/**
|
||||
* 参考:
|
||||
* 1. https://mirrors.bfsu.edu.cn/help/nix-channels/
|
||||
* 2. https://gitee.com/RubyMetric/chsrc/issues/I83894
|
||||
*/
|
||||
void
|
||||
wr_nix_setsrc (char *option)
|
||||
{
|
||||
wr_nix_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_nix);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
char *cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs-unstable nixpkgs");
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
char *towrite = xy_strjoin (3, "substituters = ", source.url, "store https://cache.nixos.org/");
|
||||
chsrc_append_to_file (towrite , "~/.config/nix/nix.conf");
|
||||
|
||||
chsrc_run ("nix-channel --update", RunOpt_Default);
|
||||
|
||||
chsrc_note2 ("若您使用的是NixOS,请确认您的系统版本<version>(如22.11),并手动运行:");
|
||||
cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs-<version> nixpkgs");
|
||||
puts (cmd);
|
||||
|
||||
cmd = xy_strjoin (3, "nix.settings.substituters = [ \"", source.url, "store\" ];");
|
||||
chsrc_note2 ("若您使用的是NixOS,请额外添加下述内容至 configuration.nix 中");
|
||||
puts (cmd);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
|
||||
#include "recipe/ware/docker.c"
|
||||
|
||||
|
||||
|
|
|
@ -93,7 +93,6 @@ static const char
|
|||
|
||||
|
||||
def_target_noget (wr_flathub);
|
||||
def_target_noget (wr_nix);
|
||||
def_target_noget (wr_guix);
|
||||
def_target_noget (wr_anaconda);
|
||||
def_target(wr_tex);
|
||||
|
|
64
src/recipe/ware/Nix.c
Normal file
64
src/recipe/ware/Nix.c
Normal file
|
@ -0,0 +1,64 @@
|
|||
/** ------------------------------------------------------------
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
* Contributors : Nil Null <nil@null.org>
|
||||
* Created On : <2023-09-26>
|
||||
* Last Modified : <2024-08-15>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @time 2023-09-22 更新
|
||||
* @note {
|
||||
* 1. 目前只有一个源
|
||||
* 2. 这些链接将会在setsrc函数中补充完整
|
||||
* }
|
||||
*/
|
||||
static SourceInfo
|
||||
wr_nix_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/nix-channels/"}
|
||||
};
|
||||
def_sources_n(wr_nix);
|
||||
|
||||
|
||||
void
|
||||
wr_nix_check_cmd ()
|
||||
{
|
||||
chsrc_ensure_program ("nix-channel");
|
||||
}
|
||||
|
||||
/**
|
||||
* 参考:
|
||||
* 1. https://mirrors.bfsu.edu.cn/help/nix-channels/
|
||||
* 2. https://gitee.com/RubyMetric/chsrc/issues/I83894
|
||||
*/
|
||||
void
|
||||
wr_nix_setsrc (char *option)
|
||||
{
|
||||
wr_nix_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_nix);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
char *cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs-unstable nixpkgs");
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
char *towrite = xy_strjoin (3, "substituters = ", source.url, "store https://cache.nixos.org/");
|
||||
chsrc_append_to_file (towrite , "~/.config/nix/nix.conf");
|
||||
|
||||
chsrc_run ("nix-channel --update", RunOpt_Default);
|
||||
|
||||
chsrc_note2 ("若您使用的是NixOS,请确认您的系统版本<version>(如22.11),并手动运行:");
|
||||
cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs-<version> nixpkgs");
|
||||
puts (cmd);
|
||||
|
||||
cmd = xy_strjoin (3, "nix.settings.substituters = [ \"", source.url, "store\" ];");
|
||||
chsrc_note2 ("若您使用的是NixOS,请额外添加下述内容至 configuration.nix 中");
|
||||
puts (cmd);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
def_target_noget (wr_nix);
|
Loading…
Reference in New Issue
Block a user