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: { let mkUserConfig = path: {
imports = [ home-manager.nixosModules.home-manager ]; imports = [ home-manager.nixosModules.home-manager ];
config = { config = {
home-manager.users."riley" = a: lib.pipe a [ home-manager.users."riley" = (import "${path}/home.nix");
(import "${path}/home.nix")
(x: x // {
imports = [ ./shared/home ];
isNixos = true;
})
];
}; };
}; };
in { in {

View file

@ -3,28 +3,21 @@
{ {
imports = [ imports = [
./services.nix
./backups.nix ./backups.nix
./users.nix
./gui.nix ./gui.nix
./nix.nix ./nix.nix
./ssh.nix
./vpn.nix
]; ];
config = { config = {
users.users."riley" = {
shell = pkgs.bash;
isNormalUser = true;
extraGroups = ["wheel"];
packages = [ pkgs.helix pkgs.neovim ];
};
time.timeZone = "Europe/Amsterdam"; time.timeZone = "Europe/Amsterdam";
environment.systemPackages = (import ../env.nix pkgs); environment.systemPackages = (import ../env.nix pkgs) ++ (with pkgs; [
# For Mae
services.earlyoom.enable = true; 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";
};
}