From ff3313e030c1f3988c620715b140b6c71fbd825e Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Sat, 3 Dec 2022 15:09:37 -0500 Subject: [PATCH] Refactor mkHomeModule --- flake.nix | 2 +- nixos/default.nix | 37 ++++++++++++++++++------------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/flake.nix b/flake.nix index 0398e7c..9382d88 100644 --- a/flake.nix +++ b/flake.nix @@ -61,7 +61,7 @@ ./systems/hetzner/ax41.nix ./nixos/server/harden.nix # I share my Hetzner server with other people who need it. - self.nixosModules.other-people + self.nixosModules.guests ]; }; # Configurations for my only[^1] macOS machine (using nix-darwin) diff --git a/nixos/default.nix b/nixos/default.nix index ba197ba..7d2a068 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,27 +1,26 @@ { self, inputs, config, ... }: +let + mkHomeModule = name: extraModules: { + users.users.${name}.isNormalUser = true; + home-manager.users.${name} = { + imports = [ + self.homeModules.common-linux + ../home/git.nix + ] ++ extraModules; + }; + }; +in { # Configuration common to all Linux systems flake = { nixosModules = { - other-people = { - # Temporarily sharing with Uday. - users.users.uday.isNormalUser = true; - home-manager.users."uday" = { - imports = [ - self.homeModules.common-linux - ../home/git.nix - ]; - }; - }; - myself = { - home-manager.users.${config.people.myself} = { pkgs, ... }: { - imports = [ - self.homeModules.common-linux - ../home/shellcommon.nix - ../home/git.nix - ]; - }; - }; + guests.imports = [ + # Temporarily sharing with Uday, until he gets better machine. + (mkHomeModule "uday" [ ]) + ]; + myself = mkHomeModule "srid" [ + ../home/shellcommon.nix + ]; default.imports = [ self.nixosModules.home-manager self.nixosModules.myself