Merge 'Refactor the `shared/core` namespace' (#15)

Reviewed-on: #15
This commit is contained in:
Riley Apeldoorn 2023-06-17 21:37:01 +02:00
commit d00f97e3be
6 changed files with 57 additions and 50 deletions

View File

@ -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 {

View File

@ -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
]);
};
}

19
shared/core/services.nix Normal file
View File

@ -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;
}

View File

@ -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" ];
};
}

29
shared/core/users.nix Normal file
View File

@ -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" ];
};
}

View File

@ -1,9 +0,0 @@
{ ... }: {
services.tailscale = {
# TODO: configure declaratively
enable = true;
interfaceName = "ts0";
};
}