Skip to content

Add documentation and notes for custom shells/packages #4

@bbarker

Description

@bbarker
<bebarker> I'd like to run a nix-shell with a derivation defined in a .nix file not in the nixpkgs tree - is this possible by some means?
<clever> bebarker: nix-shell vim.nix
* oida (~oida@unaffiliated/oida) has joined
<clever> if the file doesnt need any arguments
<bebarker> clever, ok, I tried that, but the files in $out/bin appear to not be added to the PATH
<bebarker> i verified they are there, e.g.: /nix/store/g1zisjcq1wisxk2kppgy7gmx2l0zs56v-gurobi-7.5.1/bin/
<clever> bebarker: ahh, you want to use the result of it, not build it under the shell
<bebarker> yes! 
<clever> bebarker: nix-shell -p '(import ./gurobi.nix)'
<clever> all -p does, is generate a dummy derivation to "build", and puts all of the arguments into the buildInputs
<clever> and its just dumb string manipulation, so you can inject code into that
* Judson has quit (Ping timeout: 258 seconds)
<bebarker> clever ooh, I've got to write that down now, I always find myself wanting to do this
<clever> bebarker: another option is to just write a second file, that does nothing and depends on gurobi
<bebarker> i may need to take that approach more as i start to pull in multiple custom packages anyway I suppose. thanks!
<clever> bebarker: i recently did that with https://gist.github.com/cleverca22/9c4a83b06121108607b54771a38ebbaa
<clever> bebarker: that allows me to just "nix-shell vim.nix" and i get a fully configured editor, without any lasting changes to the machine
<bebarker> great, that sounds like what I'm looking for
<clever> bebarker: as a nixos module that installs vim: https://github.com/cleverca22/nixos-configs/blob/master/vim.nix#L37
<clever> bebarker: and then just a dummy derivation i can shell into: https://gist.github.com/cleverca22/9c4a83b06121108607b54771a38ebbaa

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions