From a91a9fe11092033f29595089130faad8323e3c7c Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Thu, 29 Jun 2023 13:50:26 +0800 Subject: [PATCH] config: improve home-manager user creation Now with configurable home-manager channel! Also, I've improved some usage of the metadata to be used from `users.toml`. --- flake.nix | 5 +++-- lib/images.nix | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 2de7caed..44e42612 100644 --- a/flake.nix +++ b/flake.nix @@ -326,8 +326,8 @@ nixpkgs.config.allowUnfree = true; # Setting the homely options. - home.username = builtins.baseNameOf path; - home.homeDirectory = "/home/${config.home.username}"; + home.username = metadata.username or name; + home.homeDirectory = metadata.home-directory or "/home/${config.home.username}"; }) userSharedConfig path @@ -336,6 +336,7 @@ mkUser { inherit extraModules extraArgs; system = metadata.system or defaultSystem; + home-manager-channel = metadata.home-manager-channel or "home-manager"; }) users; diff --git a/lib/images.nix b/lib/images.nix index 672b33da..6bc5f494 100644 --- a/lib/images.nix +++ b/lib/images.nix @@ -21,8 +21,8 @@ in }; # A wrapper around the home-manager configuration function. - mkUser = { system, extraModules ? [ ], extraArgs ? { } }: - inputs.home-manager.lib.homeManagerConfiguration { + mkUser = { system, extraModules ? [ ], extraArgs ? { }, home-manager-channel ? "home-manager" }: + inputs."${home-manager-channel}".lib.homeManagerConfiguration { inherit lib; extraSpecialArgs = extraArgs; pkgs = import nixpkgs { inherit system; };