Only append once

[GitHub #76]
This commit is contained in:
Aoran Zeng
2024-11-22 01:42:01 +08:00
parent 505b14895e
commit c1c495cf6d
10 changed files with 48 additions and 57 deletions

View File

@@ -43,18 +43,18 @@ wr_nix_setsrc (char *option)
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");
char *w = xy_strjoin (3, "substituters = ", source.url, "store https://cache.nixos.org/");
chsrc_append_to_file (w, "~/.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);
say (cmd);
cmd = xy_strjoin (3, "nix.settings.substituters = [ \"", source.url, "store\" ];");
chsrc_note2 ("若您使用的是NixOS请额外添加下述内容至 configuration.nix 中");
puts (cmd);
say (cmd);
chsrc_conclude (&source, SetsrcType_SemiAuto);
}