feat(nixos): add home-manager to flake

This commit is contained in:
rafiq 2025-02-27 03:44:34 +08:00
parent a417314404
commit fdeb289590
4 changed files with 63 additions and 6 deletions

21
flake.lock generated
View file

@ -1,5 +1,25 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1740579671,
"narHash": "sha256-Dwt/3KknOQ4bgFG5YjqDT7oWRy27rPpDjAi2P0ok1zw=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "53c587d263f94aaf6a281745923c76bbec62bcf3",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1740367490,
@ -18,6 +38,7 @@
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}

View file

@ -1,18 +1,40 @@
{
description = "NixOS setup for one host with home-manager";
outputs = {
self,
nixpkgs,
home-manager,
...
} @ inputs: {
nixosConfigurations = {
nemesis = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [ ./hosts/nemesis ];
modules = [
./hosts/nemesis
# Add the home-manager user
home-manager.nixosModules.home-manager {
# Don't instantiate the home-manager instance of nixpkgs
home-manager.useGlobalPkgs = true;
# Install user packages to /etc/profiles
home-manager.useUserPackages = true;
# Pass inputs to home-manager configurations
home-manager.extraSpecialArgs = { inherit inputs; };
# Add the users
home-manager.users.rafiq.imports = [
./users/rafiq
];
}
];
};
};
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
}

View file

@ -61,11 +61,7 @@
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
git
];
environment.systemPackages = with pkgs; [];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.

18
users/rafiq/default.nix Normal file
View file

@ -0,0 +1,18 @@
{ config, pkgs, inputs, ... }:
{
home.username = "rafiq";
home.homeDirectory = "/home/rafiq";
programs.git = {
enable = true;
userName = "rafiq";
userEmail = "mohammadrafiq567@gmail.com";
extraConfig = {
init.defaultBranch = "prime";
};
};
home.stateVersion = "25.05";
programs.home-manager.enable = true;
}