Hi everyone! I’m new with Nix ecosystem.
I’m trying to config my new system using home-manager and flakes.
I try to following some tutorials and the manual of home-manager and nix.
To exemplify my situation:
I’m using Ubuntu; Installed Nix (2.22.1); home-manager (24.11-pre)
I created a new directory called dotfiles.
In this directory I have this files:
- flake.nix
- home.nix
My flake.nix
has this content:
{
description = "A simple flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, home-manager }: {
defaultPackage.x86_64-linux = home-manager.defaultPackage.x86_64-linux;
defaultPackage.x86_64-darwin = home-manager.defaultPackage.x86_64-darwin;
homeConfigurations = {
"myUsername" = home-manager.lib.homeManagerConfiguration {
system = "x86_64";
homeDirectory = "myHomeDirectory";
username = "myUsername";
modules = [ ./home.nix ];
};
};
};
}
Nice, now this is my home.nix
content:
{ config, pkgs, ... }:
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "MyUsername";
home.homeDirectory = "myHomeDirectory";
home.stateVersion = "24.05";
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = [
pkgs.zsh
pkgs.htop
pkgs.git
pkgs.vim
pkgs.fzf
pkgs.bat
pkgs.eza
pkgs.tlrc
pkgs.thefuck
pkgs.autojump
];
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
home.sessionVariables = {
EDITOR = "vim";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}
The problem is, when I try to run the command nix run . switch
the output is that two strange messages:
warning: Git tree ‘/home/myHomeDirectory/dotfiles’ is dirty
No configuration file found. Please create one at /home/myHomeDirectory/.config/home-manager/home.nix
I running the command above inside of dotfiles
directory, so in this place home.nix
exists.
I tried to figure out what is happening without success. So if anyone could help me with that.