From 76cac9af51269fc9cf94c89d71071ab132a520bc Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 25 Jun 2021 20:40:34 +0200 Subject: [PATCH] modules: change username configuration option It makes more sense to have a `my.user` option. --- flake.nix | 2 +- modules/default.nix | 12 +++++++----- modules/home.nix | 2 +- modules/system/users.nix | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index b7fd152..4f0460f 100644 --- a/flake.nix +++ b/flake.nix @@ -72,7 +72,7 @@ } home-manager.nixosModules.home-manager ({ config, ... }: { - home-manager.users.${config.my.username} = import ./home; + home-manager.users.${config.my.user.name} = import ./home; # Nix Flakes compatibility home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; diff --git a/modules/default.nix b/modules/default.nix index 46c2e8e..061da01 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -10,11 +10,13 @@ ]; options.my = with lib; { - username = mkOption { - type = types.str; - default = "ambroisie"; - example = "alice"; - description = "my username"; + user = { + name = mkOption { + type = types.str; + default = "ambroisie"; + example = "alice"; + description = "my username"; + }; }; }; } diff --git a/modules/home.nix b/modules/home.nix index a6fbc80..be0aedf 100644 --- a/modules/home.nix +++ b/modules/home.nix @@ -1,7 +1,7 @@ # Simplify setting home options { config, lib, ... }: let - actualPath = [ "home-manager" "users" config.my.username "my" "home" ]; + actualPath = [ "home-manager" "users" config.my.user.name "my" "home" ]; aliasPath = [ "my" "home" ]; in { diff --git a/modules/system/users.nix b/modules/system/users.nix index 4493c75..3897ad7 100644 --- a/modules/system/users.nix +++ b/modules/system/users.nix @@ -20,8 +20,8 @@ in inherit (secrets.users.root) hashedPassword; }; - ${config.my.username} = { - inherit (secrets.users.${config.my.username}) hashedPassword; + ${config.my.user.name} = { + inherit (secrets.users.${config.my.user.name}) hashedPassword; description = "Bruno BELANYI"; isNormalUser = true; shell = pkgs.zsh;