diff options
| author | aristote <quentin.aristote@irif.fr> | 2025-07-29 15:25:11 +0200 |
|---|---|---|
| committer | aristote <quentin.aristote@irif.fr> | 2025-07-29 15:25:11 +0200 |
| commit | fc019d789523ce5f89436b8dbc458cf3b79abf43 (patch) | |
| tree | ec56fd1b1ed9fc75096c0b09db48a152975e4d53 /modules/nixos/personal/user.nix | |
| parent | a3d19bc509d9f39fb41256cd55d2bd7706de202f (diff) | |
reformat everything with nixfmt
Diffstat (limited to 'modules/nixos/personal/user.nix')
| -rw-r--r-- | modules/nixos/personal/user.nix | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/modules/nixos/personal/user.nix b/modules/nixos/personal/user.nix index 938e8f7..29a35cb 100644 --- a/modules/nixos/personal/user.nix +++ b/modules/nixos/personal/user.nix @@ -2,13 +2,13 @@ config, lib, ... -} @ extraArgs: let +}@extraArgs: +let cfg = config.personal.user; importedHomeManager = extraArgs ? home-manager; -in { - imports = - lib.optional importedHomeManager - extraArgs.home-manager.nixosModules.home-manager; +in +{ + imports = lib.optional importedHomeManager extraArgs.home-manager.nixosModules.home-manager; options.personal.user = { enable = lib.mkEnableOption "main user"; @@ -16,31 +16,33 @@ in { type = lib.types.str; default = "qaristote"; }; - homeManager = {enable = lib.mkEnableOption "home-manager";}; + homeManager = { + enable = lib.mkEnableOption "home-manager"; + }; }; - config = lib.mkIf cfg.enable ({ + config = lib.mkIf cfg.enable ( + { users.users."${cfg.name}" = { isNormalUser = true; - extraGroups = - ["wheel"] - ++ lib.optional config.networking.networkmanager.enable - "networkmanager"; + extraGroups = [ "wheel" ] ++ lib.optional config.networking.networkmanager.enable "networkmanager"; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK4wGbl3++lqCjLUhoRyABBrVEeNhIXYO4371srkRoyq qaristote@latitude-7490" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEvPsKWQXX/QsFQjJU0CjG4LllvUVZme45d9JeS/yhLt qaristote@precision-3571" ]; }; - assertions = let - missingArgAssertion = name: { - assertion = lib.hasAttr name extraArgs || !cfg.homeManager.enable; - message = "attribute ${name} missing: add it in lib.nixosSystem's specialArgs, or set config.personal.user.homeManager.enable to false"; - }; - in [ - (missingArgAssertion "homeModules") - (missingArgAssertion "home-manager") - ]; + assertions = + let + missingArgAssertion = name: { + assertion = lib.hasAttr name extraArgs || !cfg.homeManager.enable; + message = "attribute ${name} missing: add it in lib.nixosSystem's specialArgs, or set config.personal.user.homeManager.enable to false"; + }; + in + [ + (missingArgAssertion "homeModules") + (missingArgAssertion "home-manager") + ]; } // lib.optionalAttrs (importedHomeManager && extraArgs ? homeModules) { home-manager = lib.mkIf cfg.homeManager.enable { @@ -51,11 +53,10 @@ in { useGlobalPkgs = lib.mkDefault true; useUserPackages = lib.mkDefault true; # TODO fix this: only config.personal options seem to be passed (or not ?) - extraSpecialArgs = - (extraArgs.homeSpecialArgs or {}) - // { - osConfig = lib.mkDefault config; - }; + extraSpecialArgs = (extraArgs.homeSpecialArgs or { }) // { + osConfig = lib.mkDefault config; + }; }; - }); + } + ); } |
