LoginSignup
0
0

nix-shellで開発環境を準備する

Posted at

対象読者

  • Pythonでプロジェクトを管理している人
  • poetryユーザー
  • nix-shellユーザー

nix-shellとは

nix package managerを利用して開発環境を準備するためのソフトウェア 参考

使い方

プロジェクト直下のshell.nixファイルに次のように記載する

let pkgs = import <nixpkgs> {};

in pkgs.mkShell rec {
  name = "two-stage-distant-ner";

  buildInputs = with pkgs; [
    python39
    python39Packages.poetry
  ];

  shellHook = ''
  poetry config virtualenvs.in-project true
  poetry install
'';
}

その後、シェル上で次のコマンドを打つとプロジェクト直下に仮想環境がインストールされる

nix-shell

結論

便利!!!Nixバンザイ!!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0