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

nix.conf: create function for creating this file #35662

Closed
FRidh opened this issue Feb 26, 2018 · 6 comments
Closed

nix.conf: create function for creating this file #35662

FRidh opened this issue Feb 26, 2018 · 6 comments
Assignees
Labels
0.kind: enhancement 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

Comments

@FRidh
Copy link
Member

FRidh commented Feb 26, 2018

Issue description

The nix-daemon module creates a nix.conf file. The derivation creating this file is useful also for non-NixOS users and should therefore be factored out.

The main motivation is generating the paths for "extra-sandbox-paths".

Steps to reproduce

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the
results.

@FRidh FRidh self-assigned this Feb 26, 2018
@FRidh FRidh added this to the 18.03 milestone Feb 26, 2018
@7c6f434c
Copy link
Member

Should we factor out the generation of nix.conf or should we have official support for exporting /etc/ entries from a NixOS system?

Currently I use

  etcSelectPrefix = filenamePrefix: config:
    let
      nixosInstance = nixos {configuration = config;};
      selected = (pkgs.lib.filterAttrs
                           (k: v: pkgs.lib.hasPrefix filenamePrefix v.target)
                           nixosInstance.config.environment.etc);
    in (pkgs.lib.mapAttrs'
             (k: v: let source = v.source; in
                      { 
                        value = (if pkgs.lib.isString source then source else source.outPath);
                        name = v.target;
                      })
             selected);

and select the nix/ prefix with a configuration containing only { nix= {…}; } part.

@FRidh
Copy link
Member Author

FRidh commented Feb 26, 2018

Should we factor out the generation of nix.conf or should we have official support for exporting /etc/ entries from a NixOS system?

It would need a different approach and is of a much larger scope, but why not.

Does your nixosInstance need a kernel configuration? I suppose not, unless a module that you request needs it.

@7c6f434c
Copy link
Member

nixos=import <nixpkgs/nixos> is the typical context.

A typical invocation is etcSelectPrefix "nix/" { nix = { useSandbox = true; }; }

My current helper library is https://github.com/7c6f434c/lang-os/blob/master/use-from-nixos.nix and its use is https://github.com/7c6f434c/lang-os/blob/master/system-etc-pieces.nix and https://github.com/7c6f434c/lang-os/blob/master/local/test-system.nix (etcSelect… calls)

As of scope — I think the main question is «can we agree to keep /etc, and /etc/nix/ there, for a longer time than a module system; and does Nixpkgs as a project commit not to do completely crazy scoping that makes the entries invisible from outside». Because if the answer is «Yes there is a commitment.», an implementation against the current NixOS code is small. And I need to maintain it for a comfortable environment anyway.

Of course, adding makeNixConf to Nixpkgs further normalizes splitting the implementation from coordination/configuration as implemented by NixOS module system which does sound nice…

@matthewbauer matthewbauer modified the milestones: 18.03, 18.09 Apr 17, 2018
infinisil added a commit to infinisil/nixpkgs that referenced this issue Aug 1, 2018
This is such that even people not using NixOS can use it to generate the
nix.conf file. See NixOS#35662
@infinisil
Copy link
Member

See #44322 (comment)

Feel free to close this issue if you feel like that's good enough

@matthewbauer matthewbauer removed this from the 18.09 milestone Nov 5, 2018
@stale
Copy link

stale bot commented Jun 3, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 3, 2020
@FRidh
Copy link
Member Author

FRidh commented Aug 26, 2020

I have no need for this any longer and the suggestion in #44322 (comment) seems adequate as well.

@FRidh FRidh closed this as completed Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: enhancement 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
Projects
None yet
Development

No branches or pull requests

4 participants