Firstly, im extremely sorry for the late reply.
This is what i was trying to setup (add my git username declaratively), so was trying to add them under my home.nix. After adding the programs.git
to the home.nix i gave the wrong command as home-manager rebuild
instead of nixos-rebuild
. then this OP.
so to answer you question, No. its not in git and im kind of stuck way before pushing them, So sorry for the inconvenience. I looked at the example what you have given and im unable to correlate with my existing .nix files. So im adding them here for a ref, (as of now this is the current state all the .nix files and i would like to go modular like they way you do)
flake.nix
{
description = "Initial Flake";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# home-manager.url = "github:nix-community/home-manager/release-23.11";
home-manager.url = "https://github.com/Kareem-Medhat/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, ... }:
let
systemSettings = {
system = "x86_64-linux";
hostname = "nixos";
};
userSettings = {
username = "mainuser";
dotfilesDir = "~/.dotfiles";
};
system = systemSettings.system;
lib = nixpkgs.lib;
pkgs = nixpkgs.legacyPackages.${systemSettings.system};
pkgs-unstable = nixpkgs-unstable.legacyPackages.${systemSettings.system};
in {
nixosConfigurations = {
system = lib.nixosSystem {
system = systemSettings.system;
modules = [ ./configuration.nix ];
specialArgs = {
inherit systemSettings;
inherit userSettings;
inherit pkgs-unstable;
};
};
};
homeConfigurations = {
userSettings.username = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./home.nix ];
extraSpecialArgs = {
inherit systemSettings;
inherit userSettings;
inherit pkgs-unstable;
};
};
};
};
}
my configuration.nix is,
{ config, pkgs, pkgs-unstable, systemSettings, userSettings, ... }:
{
imports =
[ ./hardware-configuration.nix ];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Session Variables
environment.sessionVariables = {
FLAKE = "/home/${userSettings.username}/.dotfiles";
};
networking.hostName = systemSettings.hostname;
# Flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
users.users.${userSettings.username} = {
isNormalUser = true;
description = userSettings.username;
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
firefox
kate
];
};
nixpkgs.config.allowUnfree = true;
environment.systemPackages =
(with pkgs; [
...
home-manager
...
])
++
(with pkgs-unstable; [
...
]);
system.stateVersion = "23.05"; # Did you read the comment?
}
And my home.nix is
{ config, pkgs, systemSettings, userSettings,... }:
{
imports = [
./sh/sh.nix
];
#home.username = "mainuser";
home.username = userSettings.username;
#home.homeDirectory = "/home/mainuser";
home.homeDirectory = "/home/${userSettings.username}";
programs.git = {
enable = true;
userName = "";
userEmail = "";
};
home.stateVersion = "23.05";
home.packages = with pkgs; [
hello
emacs
tmux
htop
];
home.file = {
};
im extremely sorry if im asking for more. Im still a beginner and unable to understand atleast bare minimal things from your .nix. to me it looks way too complex.