diff --git a/flake.lock b/flake.lock index e19c85d..705d03c 100644 --- a/flake.lock +++ b/flake.lock @@ -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" } } diff --git a/flake.nix b/flake.nix index ce3895f..4b5b127 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; }; } diff --git a/hosts/nemesis/default.nix b/hosts/nemesis/default.nix index 4018090..eb6f89d 100644 --- a/hosts/nemesis/default.nix +++ b/hosts/nemesis/default.nix @@ -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. diff --git a/users/rafiq/default.nix b/users/rafiq/default.nix new file mode 100644 index 0000000..8da4421 --- /dev/null +++ b/users/rafiq/default.nix @@ -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; +}