Skip to content

What do I change if I want to have my configuration in my home directory instead of /etc? #66

@ckp95

Description

@ckp95

I have not moved to flakes yet. Right now I keep my configuration.nix and hardware.nix under my home directory at ~/me/src/dotfiles. In my configuration.nix, I have set my nixPath as:

  nix.nixPath = [
    "nixos-config=/home/cameron/me/src/dotfiles/configuration.nix"
    "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
    "/nix/var/nix/profiles/per-user/root/channels"
  ];

so when I run sudo nixos-rebuild switch it uses the config there rather than looking in /etc/nixos. (I don't know what the channels-related ones are actually doing, I just kept them there from the original config)

I want to keep this directory layout in a flake-based config. I notice in the template, this section:

  # This will additionally add your inputs to the system's legacy channels
  # Making legacy nix commands consistent as well, awesome!
  nix.nixPath = ["/etc/nix/path"];
  environment.etc =
    lib.mapAttrs'
    (name: value: {
      name = "nix/path/${name}";
      value.source = value.flake;
    })
    config.nix.registry;

What is this /etc/nix/path doing? I don't currently have such a directory. Will it be created automatically? And do I need to add my dotfiles directory to this list?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions