Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos: make the nixpkgs symlink permanent #51026

Closed
wants to merge 1 commit into from

Conversation

zimbatm
Copy link
Member

@zimbatm zimbatm commented Nov 25, 2018

Motivation for this change

This change allows to set NIX_PATH=/path/to/nixpkgs and still have a working
<nixpkgs>.

The ./nixpkgs -> . symlink was initially introduced as a way to allow
backward-compatibility. Instead of generating it on channel creation,
add it to the repository directly. That way even a git checkout will
work the same way.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

This allows to set `NIX_PATH=/path/to/nixpkgs` and still have a working
`<nixpkgs>`.

The `./nixpkgs -> .` symlink was initially introduced as a way to allow
backward-compatibility. Instead of generating it on channel creation,
add it to the repository directly. That way even a git checkout will
work the same way.
@avnik
Copy link
Contributor

avnik commented Nov 25, 2018

Would be nice to have ability to add /etc/nixpkgs as which was used to build configuration (allow to have predictable preconfigured nixpkgs for machines deployed with nixops or other tools)

@coretemp

This comment has been minimized.

@edolstra
Copy link
Member

That way even a git checkout will work the same way.

Well, the nixpkgs hack is only necessary because the NixOS channel is called nixos rather than nixpkgs. It's not needed in other contexts (e.g. when you do -I nixpkgs=/my/git).

@grahamc
Copy link
Member

grahamc commented Nov 26, 2018

Seems pretty reasonable, I think.

@zimbatm
Copy link
Member Author

zimbatm commented Nov 27, 2018

@edolstra one use-case is if I want to try nixpkgs-unstable on nixos. I also think that it's convenient to be able to just set NIX_PATH=$PWD nix run nixpkgs.hello for example.

@mmahut
Copy link
Member

mmahut commented Aug 11, 2019

Are there any updates on this pull request, please?

@zimbatm
Copy link
Member Author

zimbatm commented Aug 11, 2019

Eelco doesn't want this change so closing.

@zimbatm zimbatm closed this Aug 11, 2019
@zimbatm zimbatm deleted the nixpkgs-nixpkgs-nixpkgs branch August 11, 2019 11:52
@avnik
Copy link
Contributor

avnik commented Aug 11, 2019

Just for records/reference -- I used following construction to reach similar behavior

{ config, lib, pkgs, ... }:

let localNixpkgs = import ../bootstrap/nixpkgs.nix; in

with lib;
{
    nix.nixPath = [
        "nixpkgs=/etc/nixpkgs"
    ];

    environment.etc = [ {
        source = localNixpkgs; target = "nixpkgs";
    }];
}

It used in conjuction with "pinned" nixpkgs revision, and provide default vetted nixpkgs for ordinary nix-shell users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants