From ef89e56b6e3318e5f317c8b51a7991dffe457df7 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 22 Feb 2025 12:38:34 +0800 Subject: [PATCH] build(nixos): add home-manager --- flake.lock | 21 +++++++++++++++++++++ flake.nix | 12 ++++++++++-- home.nix | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 home.nix diff --git a/flake.lock b/flake.lock index bad2016..a4a6c73 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1740188029, + "narHash": "sha256-pnPs+XSpR633G/q0gj+SDyL4RaDfiKlom86zEBPtq+M=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "765cb91e9d5ab06ed8c92c25fc0e51d6c11d43cb", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1739866667, @@ -18,6 +38,7 @@ }, "root": { "inputs": { + "home-manager": "home-manager", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 521fb02..5779224 100644 --- a/flake.nix +++ b/flake.nix @@ -1,15 +1,23 @@ { - description = "simple NixOS flake"; + description = "simple NixOS flake with home-manager"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs@{ self, nixpkgs, ... }: { + outputs = inputs@{ self, nixpkgs, home-manager, ... }: { nixosConfigurations.nemesis = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs; }; modules = [ ./configuration.nix + + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.rafiq = import ./home.nix; + } ]; }; }; diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..f555602 --- /dev/null +++ b/home.nix @@ -0,0 +1,42 @@ +{ config, pkgs, ... }: + +{ + home.username = "rafiq"; + home.homeDirectory = "/home/rafiq"; + + # home.file.".config/" = { + # source = ./.config; + # recursive = true; + # }; + + home.packages = with pkgs; [ + fastfetch + neovim + zip + unzip + ripgrep + ]; + + programs.git = { + enable = true; + userName = "Mohammad Rafiq"; + userEmail = "mohammadrafiq567@gmail.com"; + }; + + #TODO add neovim option + + #TODO add starship + + programs.bash = { + enable = true; + enableCompletion = true; + shellAliases = { + ll = "ls -la"; + }; + }; + + home.stateVersion = "24.11"; + programs.home-manager.enable = true; +} + +