nix-community/nix-environments
关于
用于维护树外 shell.nix 文件的仓库(维护者:@mic92)
开发工具实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- +1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Nix-environments
Repository to maintain out-of-tree shell.nix files.
For some projects it is non-trivial to get a minimal develop environment that work with Nix/NixOS. The purpose of this repository is to share shell.nix expression that help to get started with those projects. The goal of the project is not to build or package those projects (which is often even harder) but to document the build requirements.
What environments should include:
- dependencies to build, develop or test the project
What environments should not include:
- opinionated, user-specific dependencies for example editors or favorite debugging tools
Current available environments
| Name | Attribute |
|---|---|
| Arduino | arduino |
| cc2538-bsl | cc2538-bsl |
| Jruby | jruby |
| Firefox | firefox |
| Git | git |
| Github Pages | github-pages |
| Homeassistant | home-assistant |
| Nannou | nannou |
| Phoronix test suite | phoronix-test-suite |
| OpenWRT | openwrt |
| SPEC benchmark | spec-benchmark |
| Yocto | yocto |
| Xilinx vitis | xilinx-vitis |
| InfiniSim | infinisim |
| Ladybird | ladybird |
| buildroot | buildroot |
| zmk | zmk |
How to use
Stable Nix
All environments referenced in default.nix can be loaded by running nix-shell like that:
$ nix-shell https://github.com/nix-community/nix-environments/archive/master.tar.gz -A PROJECT_NAME
for example openwrt:
$ nix-shell https://github.com/nix-community/nix-environments/archive/master.tar.gz -A openwrt
To apply custom modification one can also import environments into their own shell.nix files and
override them. Note that this approach does currently not work for buildFHSEnv-based environments!
{ pkgs ? import <nixpkgs> {} }:
let
envs = (import (builtins.fetchTarball {
url = "https://github.com/nix-community/nix-environments/archive/master.tar.gz";
}));
phoronix = envs.phoronix-test-suite { inherit pkgs; };
in (phoronix.overrideAttrs (old: {
# this will append python to the existing dependencies
buildInputs = old.buildInputs ++ [ pkgs.python3 ];
}))
To provide additional packages to buildFHSEnv-based environments you can use the extraPkgs attribute.
For the Yocto environment, you can use callPackage to override stdenv or python3:
{pkgs ? import <nixpkgs> {}}:
let
yoctoEnv = pkgs.callPackage ((builtins.fetchTarball {
url = "https://github.com/nix-community/nix-environments/archive/master.tar.gz";
}) + "/envs/yocto/shell.nix") {
stdenv = pkgs.gcc11Stdenv; # Use GCC 11 for older Yocto releases
python3 = pkgs.python311; # Use Python 3.11 for older Yocto releases
extraPkgs = [pkgs.hello];
};
in
yoctoEnv
For other environments, you can still use the traditional import method:
{pkgs ? import <nixpkgs> {}}:
let
buildrootEnv = ((builtins.fetchTarball {
url = "https://github.com/nix-community/nix-environments/archive/master.tar.gz";
})
+ "/envs/buildroot/shell.nix");
in
(import buildrootEnv) {
inherit pkgs;
extraPkgs = [pkgs.hello];
}
Nix Flakes
Nix-environments are also available as Flake outputs. Flakes are an experimental new way to handle Nix expressions.
For dropping into the environment for the OpenWRT project, just run:
nix develop --no-write-lock-file github:nix-community/nix-environments#openwrt
The last part is a flake URL and is an abbreviation of github:nix-community/nix-environments#devShells.SYSTEM.openwrt, where SYSTEM is your current system, e.g. x86_64-linux.
You can also use these environments in your own flake and extend them:
{
inputs.nix-environments.url = "github:nix-community/nix-environments";
outputs = { self, nixpkgs, nix-environments }: let
# Replace this string with your actual system, e.g. "x86_64-linux"
system = "SYSTEM";
in {
devShell.${system} = let
pkgs = import nixpkgs { inherit system; };
in nix-environments.devShells.${system}.phoronix-test-suite.overrideAttrs (old: {
buildInputs = old.buildInputs ++ [ pkgs.python3 ];
});
};
}
For the Yocto environment, you can also override parameters like stdenv and python3:
{
inputs.nix-environments.url = "github:nix-community/nix-environments";
outputs = { self, nixpkgs, nix-environments }: let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in {
devShells.${system}.default =
nix-environments.devShells.${system}.yocto.override {
stdenv = pkgs.gcc11Stdenv;
python3 = pkgs.python311;
};
};
}
Similar projects
- generates generic templates for different languages: https://github.com/kampka/nixify
- also templates for different languages: https://github.com/mrVanDalo/nix-shell-mix
- templates for flakes: https://github.com/NixOS/templates
探索相关项目
加载中…