Skip to content

dao42/nixpkgs-showmebug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nixpkgs-showmebug

nixpkgs-showmebug is Showmebug's nixpkgs overlay. This overlay provides several channels that track the upstream nix channels of the same name.

nix 环境预置

安装 nix

安装 niv

设置国内代理

  1. 更新channel
nix-channel --add https://mirrors.tuna.tsinghua.edu.cn/nix-channels/nixpkgs-21.11-darwin  nixpkgs
nix-channel --add https://mirrors.tuna.tsinghua.edu.cn/nix-channels/nixpkgs-unstable nixpkgs-unstable  # 最新版的包一般会优先在这个通道
nix-channel --update
  1. 更改build 缓存
sudo vi /etc/nix/nix.conf
# 最后一行添加
substituters = https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store https://cache.nixos.org/

本地使用

可以通过添加channel的方式进行使用。利用 GITHUB ARCHIVE 生成gz文件,格式如下:

  1. 利用分支
https://github.com/dao42/nixpkgs-showmebug/archive/{branch}.tar.gz
  1. 利用commit
https://github.com/dao42/nixpkgs-showmebug/archive/{commit}.tar.gz
  1. 发布release
https://github.com/dao42/nixpkgs-showmebug/archive/refs/tags/{tag}.tar.gz

终端执行添加channel:

nix-channel --add https://github.com/dao42/nixpkgs-showmebug/archive/main.tar.gz  nixpkgs-showmebug
nix-channel --update

编写shell.nix

{ pkgs ? import <nixpkgs-showmebug> {} }:
pkgs.mkShell {
    shellHook = ''
        alias ll="ls -l"
        export PS1="\[\e[0m\]\w\[\e[0m\]#\[\e[0m\] "
    '';
    packages = [
        # env
        pkgs.php74
        pkgs.php74Packages.composer
        pkgs.showmebugPackages.phpunit
    ];
}

执行 nix-shell 进入到php环境

备注: 初次执行比较慢,可通过 nix-shell -v 查看日志,另外后续进入时,为避免从substituters查询,可以使用 nix-shell --no-substitute 快速进入shell环境

本地代理

基于nginx文件服务器,对与下载比较慢的文件进行托管。

http://106.52.58.179:8080

基于本地代理的nix-channel设置

终端执行添加channel:

#nix-channel --add http://106.52.58.179:8080/nixpkgs-showmebug/{branch|commit etc.}.tar.gz  nixpkgs-showmebug
nix-channel --add http://106.52.58.179:8080/nixpkgs-showmebug/nixpkgs-showmebug-feature-change-url-to-local-nginx.tar.gz  nixpkgs-showmebug
nix-channel --update

使用时直接在nix文件头部指定channel

{ pkgs ? import <nixpkgs-showmebug> {} }:
    # 环境设置表达式

支持语言说明

序号 支持语言 支持LSP 支持测试用例 预置环境
1 bash
2 C++ C++
3 C language C language
4 Java Java
5 NodeJS
6 TypeScript
7 Golang
8 Objective-C Objective-C
9 PHP
10 HTML/CSS/JS
11 MySQL
12 Python2 Python2
13 Python3 Python3
14 Ruby2 Ruby2
15 Ruby3 Ruby3
16 Assembly(GAS)
17 Assembly(NASM)
18 Clojure
19 CoffeeScript
20 C#
21 Dart
22 Elixir
23 Erlang
24 Haskell
25 Kotlin
26 Lua
27 OCaml
28 Perl
29 R
30 Rust
31 Scala
32 Swift
33 Visual Basic
34 Verilog
35 VHDL

参考资料

搜索nix包

nixpkgs 仓库 nixpkgs-replit replit仓库 replit官网

nix pills

nix-by-example

Nix tutorial

Nix Man Page

待补充...

About

这是一个自定义nix expression的仓库,包含语言环境搭建、nix教程、环境预置脚本等

Resources

Stars

Watchers

Forks

Packages

No packages published