diff --git a/flake.nix b/flake.nix index 84980b9..222d687 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,7 @@ outputs = { self, nixpkgs, unstable, home-manager, ... }@inputs: let system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; unstable-overlay = final: prev: { unstable = import unstable { inherit system; @@ -63,5 +64,11 @@ # system = "x86_64-linux"; # modules = [ ./hosts/NixFrame/configuration.nix ]; # }; + + homeConfigurations."benson" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + specialArgs = { inherit inputs }; + modules = [ ./home/home.nix ]; + }; }; } diff --git a/home/flake.lock b/home/flake.lock deleted file mode 100644 index 5d9e9eb..0000000 --- a/home/flake.lock +++ /dev/null @@ -1,48 +0,0 @@ -{ - "nodes": { - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1704358952, - "narHash": "sha256-yazDFmdyKr0JGMqmzQ5bYOW5FWvau8oFvsQ8eSB2f3A=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "c36cb65c4a0ba17ab9262ab3c30920429348746c", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1704194953, - "narHash": "sha256-RtDKd8Mynhe5CFnVT8s0/0yqtWFMM9LmCzXv/YKxnq4=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "bd645e8668ec6612439a9ee7e71f7eac4099d4f6", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "home-manager": "home-manager", - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/home/flake.nix b/home/flake.nix deleted file mode 100644 index d9c8512..0000000 --- a/home/flake.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - description = "Home Manager configuration of benson"; - - inputs = { - # Specify the source of Home Manager and Nixpkgs. - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - }; - - outputs = { nixpkgs, home-manager, ... }: - let - system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; - in { - homeConfigurations."benson" = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - - # Specify your home configuration modules here, for example, - # the path to your home.nix. - modules = [ ./home.nix ]; - - # Optionally use extraSpecialArgs - # to pass through arguments to home.nix - }; - }; -} diff --git a/home/home.nix b/home/home.nix index 9800e60..e5d5d97 100644 --- a/home/home.nix +++ b/home/home.nix @@ -1,11 +1,16 @@ { config, pkgs, ... }: { + imports = [ + ./modules/ + ]; # Home Manager needs a bit of information about you and the paths it should # manage. home.username = "benson"; home.homeDirectory = "/home/benson"; + my.bash-config.enable = true; + # This value determines the Home Manager release that your configuration is # compatible with. This helps avoid breakage when a new Home Manager release # introduces backwards incompatible changes. diff --git a/modules/bash-config/default.nix b/home/modules/bash-config/default.nix similarity index 100% rename from modules/bash-config/default.nix rename to home/modules/bash-config/default.nix diff --git a/home/modules/default.nix b/home/modules/default.nix new file mode 100644 index 0000000..851ef02 --- /dev/null +++ b/home/modules/default.nix @@ -0,0 +1,30 @@ +# What's the difference between lib and pkg? +{ config, lib, ... }: + +{ + # For each found file/folder, make it an absolute path by adding + # "./." to the front. + imports = map (x: ./. + "/${x}") ( + lib.attrNames ( + # Don't include default.nix, and files that don't end with + # .nix. This means every subfolder MUST have a + # default.nix. + # + # Perhaps, there's a way to do a tree traversal and grab ALL + # .nix files? + lib.filterAttrs + ( + n: t: n != "default.nix" && ( + t == "directory" || lib.hasSuffix ".nix" n + ) + ) + # Extract all files and folders in module directory. Returns + # an attribute map with file name as key, and file type as + # value. + # + # For some reason, the current directory is denoted as "./." + # instead of "./". Why? + (builtins.readDir ./.) + ) + ); +} diff --git a/hosts/NixFrame/configuration.nix b/hosts/NixFrame/configuration.nix index 9bf62b6..a40d73c 100644 --- a/hosts/NixFrame/configuration.nix +++ b/hosts/NixFrame/configuration.nix @@ -16,8 +16,6 @@ in networking.hostName = "NixFrame"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - my.bash-config.enable = true; - home-manager.users.benson = { ... }: { home.stateVersion = "23.11"; };