diff --git a/flake.nix b/flake.nix index 3b9ce78..142f8bb 100644 --- a/flake.nix +++ b/flake.nix @@ -18,13 +18,7 @@ let mkUserConfig = path: { imports = [ home-manager.nixosModules.home-manager ]; config = { - home-manager.users."riley" = a: lib.pipe a [ - (import "${path}/home.nix") - (x: x // { - imports = [ ./shared/home ]; - isNixos = true; - }) - ]; + home-manager.users."riley" = (import "${path}/home.nix"); }; }; in { diff --git a/shared/core/default.nix b/shared/core/default.nix index f52127c..c2e68bf 100644 --- a/shared/core/default.nix +++ b/shared/core/default.nix @@ -3,28 +3,21 @@ { imports = [ + ./services.nix ./backups.nix + ./users.nix ./gui.nix ./nix.nix - ./ssh.nix - ./vpn.nix ]; config = { - users.users."riley" = { - - shell = pkgs.bash; - - isNormalUser = true; - extraGroups = ["wheel"]; - packages = [ pkgs.helix pkgs.neovim ]; - - }; - time.timeZone = "Europe/Amsterdam"; - environment.systemPackages = (import ../env.nix pkgs); - - services.earlyoom.enable = true; + environment.systemPackages = (import ../env.nix pkgs) ++ (with pkgs; [ + # For Mae + neovim + # For me + helix + ]); }; } diff --git a/shared/core/services.nix b/shared/core/services.nix new file mode 100644 index 0000000..7cd2e44 --- /dev/null +++ b/shared/core/services.nix @@ -0,0 +1,19 @@ +# Services that are common and don't require complex configuration. If there are options +# involved, consider moving the service to its own module. + +{ ... }: { + + services.openssh = { + enable = true; + settings.PasswordAuthentication = false; + }; + + services.tailscale = { + # TODO: configure declaratively + enable = true; + interfaceName = "ts0"; + }; + + services.earlyoom.enable = true; + +} diff --git a/shared/core/ssh.nix b/shared/core/ssh.nix deleted file mode 100644 index 0991bdc..0000000 --- a/shared/core/ssh.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ pkgs, ... }: - -{ - - services.openssh = { - enable = true; - settings.PasswordAuthentication = false; - }; - - users.users."riley" = { - # Add ssh client - packages = [ pkgs.openssh ]; - # Authorize `riley` user on other machines to SSH into this machine. - openssh.authorizedKeys.keyFiles = - let userKey = sys: ../../system/${sys}/keys/riley.pub; - in map userKey [ "dev-lt-63" "strawberry" "lime" ]; - }; - -} \ No newline at end of file diff --git a/shared/core/users.nix b/shared/core/users.nix new file mode 100644 index 0000000..ba2d3c3 --- /dev/null +++ b/shared/core/users.nix @@ -0,0 +1,29 @@ +# Manage user settings that don't specifically fit anywhere else. + +{ pkgs, config, home-manager, lib, ... }: { + + imports = [ + home-manager.nixosModules.home-manager + ]; + + config.home-manager.users."riley" = { + imports = [ ../home ]; + isNixos = true; + home.stateVersion = lib.mkDefault config.system.stateVersion; + }; + + config.users.users."riley" = { + # TODO: Switch to a less ancient shell + shell = pkgs.bash; + isNormalUser = true; + extraGroups = [ + # User is sudoer + "wheel" + ]; + # Authorize `riley` user on other machines to SSH into this machine. + openssh.authorizedKeys.keyFiles = + let userKey = sys: ../../system/${sys}/keys/riley.pub; + in map userKey [ "dev-lt-63" "strawberry" "lime" ]; + }; + +} diff --git a/shared/core/vpn.nix b/shared/core/vpn.nix deleted file mode 100644 index 631519c..0000000 --- a/shared/core/vpn.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: { - - services.tailscale = { - # TODO: configure declaratively - enable = true; - interfaceName = "ts0"; - }; - -}