Use Nushell from Nixpkgs unstable

This commit is contained in:
Ajeet D'Souza 2021-04-03 12:26:43 +05:30
parent 4224f494ed
commit 63f107e5d1
5 changed files with 42 additions and 40 deletions

View File

@ -19,11 +19,6 @@ jobs:
with: with:
crate: cargo-audit crate: cargo-audit
version: latest version: latest
- uses: actions-rs/install@v0.1
if: ${{ matrix.os != 'windows-latest' }}
with:
crate: nu
version: latest
- uses: cachix/install-nix-action@v12 - uses: cachix/install-nix-action@v12
if: ${{ matrix.os != 'windows-latest' }} if: ${{ matrix.os != 'windows-latest' }}
with: with:

View File

@ -16,7 +16,7 @@ endif
ifeq ($(NIX), true) ifeq ($(NIX), true)
build: build:
nix-shell --run 'cargo build $(build_flags) $(ci_color_always)' nix-shell --pure --run 'cargo build $(build_flags) $(ci_color_always)'
else else
build: build:
cargo build $(build_flags) $(ci_color_always) cargo build $(build_flags) $(ci_color_always)
@ -24,7 +24,7 @@ endif
ifeq ($(NIX), true) ifeq ($(NIX), true)
clean: clean:
nix-shell --run 'cargo clean $(ci_color_always)' nix-shell --pure --run 'cargo clean $(ci_color_always)'
else else
clean: clean:
cargo clean $(ci_color_always) cargo clean $(ci_color_always)
@ -32,7 +32,7 @@ endif
ifeq ($(NIX), true) ifeq ($(NIX), true)
install: install:
nix-shell --run 'cargo install --path=. $(ci_color_always)' nix-shell --pure --run 'cargo install --path=. $(ci_color_always)'
else else
install: install:
cargo install --path=. $(ci_color_always) cargo install --path=. $(ci_color_always)
@ -40,11 +40,11 @@ endif
ifeq ($(NIX), true) ifeq ($(NIX), true)
test: test:
nix-shell --run 'cargo fmt -- --check --files-with-diff $(ci_color_always)' nix-shell --pure --run 'cargo fmt -- --check --files-with-diff $(ci_color_always)'
nix-shell --run 'cargo check --all-features $(build_flags) $(ci_color_always)' nix-shell --pure --run 'cargo check --all-features $(build_flags) $(ci_color_always)'
nix-shell --run 'cargo clippy --all-features $(build_flags) $(ci_color_always) -- --deny warnings --deny clippy::all' nix-shell --pure --run 'cargo clippy --all-features $(build_flags) $(ci_color_always) -- --deny warnings --deny clippy::all'
nix-shell --run 'cargo test --all-features --no-fail-fast $(build_flags) $(ci_color_always)' nix-shell --pure --run 'cargo test --all-features --no-fail-fast $(build_flags) $(ci_color_always)'
nix-shell --run 'cargo audit --deny warnings $(ci_color_always) --ignore=RUSTSEC-2020-0095' nix-shell --pure --run 'cargo audit --deny warnings $(ci_color_always) --ignore=RUSTSEC-2020-0095'
else else
test: test:
cargo fmt -- --check --files-with-diff $(ci_color_always) cargo fmt -- --check --files-with-diff $(ci_color_always)
@ -56,7 +56,7 @@ endif
ifeq ($(NIX), true) ifeq ($(NIX), true)
uninstall: uninstall:
nix-shell --run 'cargo uninstall $(ci_color_always)' nix-shell --pure --run 'cargo uninstall $(ci_color_always)'
else else
uninstall: uninstall:
cargo uninstall $(ci_color_always) cargo uninstall $(ci_color_always)

View File

@ -1,8 +1,9 @@
import os.path import os.path
import subprocess
import ranger.api import ranger.api
import ranger.core.fm import ranger.core.fm
import ranger.ext.signals import ranger.ext.signals
import subprocess
hook_init_old = ranger.api.hook_init hook_init_old = ranger.api.hook_init

View File

@ -1,29 +1,30 @@
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/20.09.tar.gz") {} }:
let let
python-pkgs = pkgs.python3.withPackages (pkgs: [ pkgs.black pkgs.mypy pkgs.pylint ]); pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/20.09.tar.gz") {};
pkgsMaster = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/470e4a9bbc98b171a7e733dfc9e62531f7b9ceca.tar.gz") {};
pkgsPython = pkgs.python3.withPackages (pkgs: [ pkgs.black pkgs.mypy pkgs.pylint ]);
in in
pkgs.mkShell { pkgs.mkShell
name = "env"; {
buildInputs = [ name = "env";
pkgs.bash buildInputs = [
pkgs.cargo pkgsMaster.nushell
pkgs.cargo-audit pkgsPython
pkgs.dash pkgs.bash
pkgs.fish pkgs.cargo
pkgs.fzf pkgs.cargo-audit
pkgs.git pkgs.dash
# pkgs.nushell # FIXME: too outdated pkgs.fish
pkgs.powershell pkgs.fzf
pkgs.rustc pkgs.git
pkgs.shellcheck pkgs.powershell
pkgs.shfmt pkgs.rustc
pkgs.xonsh pkgs.rustfmt
pkgs.zsh pkgs.shellcheck
python-pkgs pkgs.shfmt
]; pkgs.xonsh
pkgs.zsh
];
# Set Environment Variables RUST_BACKTRACE = 1;
RUST_BACKTRACE = 1; }
}

View File

@ -157,7 +157,12 @@ mod tests {
fn nushell_nushell_#i() { fn nushell_nushell_#i() {
let opts = dbg!(&opts()[i]); let opts = dbg!(&opts()[i]);
let source = Nushell(opts).render().unwrap(); let source = Nushell(opts).render().unwrap();
let tempdir = tempfile::tempdir().unwrap();
let tempdir = tempdir.path().to_str().unwrap();
let assert = Command::new("nu") let assert = Command::new("nu")
.env("HOME", tempdir)
.args(&["--commands", &source]) .args(&["--commands", &source])
.assert() .assert()
.success() .success()