Skip to content

Instantly share code, notes, and snippets.

@tastycode
Created May 21, 2024 02:52

Revisions

  1. tastycode created this gist May 21, 2024.
    62 changes: 62 additions & 0 deletions flake.nix
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,62 @@
    {
    inputs = {
    nixpkgs.url = "github:cachix/devenv-nixpkgs/rolling";
    systems.url = "github:nix-systems/default";
    devenv.url = "github:cachix/devenv";
    devenv.inputs.nixpkgs.follows = "nixpkgs";
    nixpkgs-python.url = "github:cachix/nixpkgs-python";
    nixpkgs-python.inputs = { nixpkgs.follows = "nixpkgs"; };
    };

    nixConfig = {
    extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw= cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=";
    extra-substituters = "https://devenv.cachix.org https://cuda-maintainers.cachix.org";
    };

    outputs = { self, nixpkgs, devenv, systems, ... } @ inputs:
    let
    forEachSystem = nixpkgs.lib.genAttrs (import systems);
    in
    {
    packages = forEachSystem (system: {
    devenv-up = self.devShells.${system}.default.config.procfileScript;
    });

    devShells = forEachSystem
    (system:
    let
    pkgs = import nixpkgs {
    inherit system;
    packageOverrides = pkgs: {
    stdenv = pkgs.stdenv.override {
    cc = pkgs.gcc12;
    };
    python310Packages = pkgs.python310Packages.override {
    overrides = self: super: {
    vllm = super.vllm.overrideAttrs (oldAttrs: rec {
    stdenv = oldAttrs.stdenv.override {
    cc = pkgs.gcc12;
    };
    });
    };
    };
    };
    };
    in
    {
    default = devenv.lib.mkShell {
    inherit inputs pkgs;
    modules = [
    {
    # https://devenv.sh/reference/options/
    languages.python = {
    enable = true;
    version = "3.10";
    venv.enable = true;
    };
    }
    ];
    };
    });
    };
    }
    21 changes: 21 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    (nix:devenv-shell-env) (devenv) (venv) root@ded878848f30:/workspace/FastEval# pip install -r requirements.txt
    Obtaining transformers from git+https://github.com/huggingface/transformers.git#egg=transformers (from -r requirements.txt (line 2))
    Cloning https://github.com/huggingface/transformers.git to ./.devenv/state/venv/src/transformers
    error: subprocess-exited-with-error

    × git version did not run successfully.
    │ exit code: 127
    ╰─> [2 lines of output]
    git: symbol lookup error: /nix/store/7v7c61ikm7cbd3kbimk9qr8h7pdmyccn-manylinux2014/lib/libc.so.6: undefined symbol: __tunable_is_initialized, version GLIBC_PRIVATE
    [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    error: subprocess-exited-with-error

    × git version did not run successfully.
    │ exit code: 127
    ╰─> See above for output.

    note: This error originates from a subprocess, and is likely not a problem with pip.
    (nix:devenv-shell-env) (devenv) (venv) root@ded878848f30:/workspace/FastEval# cat flake.nix
    {