Hello, it’s me with some silly questions again.
So i tried out flake, even though I don’t really understand how it works completely.
My goal is to have my environment (configuration.nix and home.nix) set up with only one command, and all my configs (configuration.nix and home.nix) is stored in /etc/nixos
(though it would definitely be better if I can just store it in home directory, so I can edit with vscode)
The following file is my flake:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { home-manager, nixpkgs, ... }@inputs:
let
username = "Peal";
hostname = "Windows11";
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in
{
nixosConfigurations."${hostname}" = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs username system; };
modules = [ ./configuration.nix ];
};
homeConfigurations."${username}" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs username; };
modules = [ ./home.nix ];
};
};
}
But for some reason (skill issues), when i do nixos-rebuild switch --flake
, only the confiuration.nix file got rebuild, and I don’t know how I can get my home manager to rebuild along with it too.
some unrelated info but hope it can be helpful:
in /etc/nixos
:
.
├── configuration.nix
├── flake.lock
├── flake.nix
└── home.nix
content of few first line of home.nix
:
{config, pkgs, ...}: {
home.stateVersion = "23.11";
home.username = "kahlenden";
home.homeDirectory = "/home/kahlenden/";
programs.home-manager.enable = true;
#...
}