Implement home-manager support

This commit is contained in:
2022-02-13 23:06:31 +00:00
parent b5f5e7d38c
commit a30c45c01d
9 changed files with 176 additions and 38 deletions

View File

@@ -1,5 +1,6 @@
{ lib, pkgs, inputs, system, config, options, ... }:
{ lib, pkgs, inputs, homeModules, config, options, ... }:
let
inherit (builtins) attrValues;
inherit (lib) mkIf mkDefault mkAliasDefinitions;
inherit (lib.my) mkOpt';
in
@@ -7,6 +8,7 @@ in
options.my = with lib.types; {
# Pretty hacky but too lazy to figure out if there's a better way to alias the options
user = mkOpt' (attrsOf anything) { } "User definition (as `users.users.*`).";
homeConfig = mkOpt' anything {} "Home configuration (as `home-manager.users.*`)";
};
config =
@@ -25,13 +27,23 @@ in
};
};
time.timeZone = mkDefault "Europe/Dublin";
home-manager = {
useGlobalPkgs = mkDefault true;
useUserPackages = mkDefault true;
sharedModules = homeModules ++ [{
_module.args = { inherit inputs; isStandalone = false; };
}];
};
users = {
mutableUsers = false;
users.${uname} = mkAliasDefinitions options.my.user;
};
# NOTE: As the "outermost" module is still being evaluated in NixOS land, special params (e.g. pkgs) won't be
# passed to it
home-manager.users.${uname} = config.my.homeConfig;
security = {
sudo.enable = mkDefault false;
doas = {
@@ -55,6 +67,8 @@ in
};
};
time.timeZone = mkDefault "Europe/Dublin";
boot = {
# Use latest LTS release by default
kernelPackages = mkDefault pkgs.linuxKernel.packages.linux_5_15;
@@ -80,10 +94,7 @@ in
environment.systemPackages = with pkgs; [
bash-completion
tree
vim
htop
iperf3
];
services.openssh = {