summaryrefslogtreecommitdiff
path: root/util/user.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2023-03-08 02:57:57 -0500
committerseth <[email protected]>2023-03-08 15:32:06 -0500
commitfa7a407bda1b26b413702287f227629af0798f55 (patch)
tree38cc9ae1791939a0f92a3f03d37a0249e62cdf1a /util/user.nix
parent729db074dc1b93cab10b43119197c8e02a452405 (diff)
another major refactor
Diffstat (limited to 'util/user.nix')
-rw-r--r--util/user.nix109
1 files changed, 25 insertions, 84 deletions
diff --git a/util/user.nix b/util/user.nix
index 3953f11..c120e31 100644
--- a/util/user.nix
+++ b/util/user.nix
@@ -1,92 +1,33 @@
-{home-manager, ...}: let
- commonHM = {
- nixpkgs.config = {
- allowUnfree = true;
- allowUnsupportedSystem = true;
- };
- xdg.configFile."nixpkgs/config.nix".text = ''
- {
- allowUnfree = true;
- }
- '';
- };
-in {
+{
+ lib,
+ inputs,
+ mapFilterDirs,
+ ...
+}: rec {
mkHMUser = {
username,
- channel,
- modules ? [],
+ pkgs,
stateVersion ? "22.11",
- system ? "x86_64-linux",
- extraSpecialArgs ? {},
- }:
- home-manager.lib.homeManagerConfiguration {
- pkgs = channel.legacyPackages.${system};
- inherit extraSpecialArgs;
- modules =
- [
- ../users/${username}/home.nix
- ({pkgs, ...}:
- {
- home = {
- inherit username stateVersion;
- homeDirectory = "/home/${username}";
- };
-
- programs.home-manager.enable = true;
- nix = {
- package = pkgs.nixFlakes;
- settings.experimental-features = ["nix-command" "flakes"];
- };
- }
- // commonHM)
- ]
- ++ modules;
- };
- mkUser = {
- username,
- extraGroups ? [],
- extraModules ? [],
- extraSpecialArgs ? {},
- hashedPassword,
- hm ? false,
- shell,
- stateVersion,
- system ? "x86_64-linux",
}:
- [
- {
- users.users.${username} = {
- inherit extraGroups hashedPassword shell;
- isNormalUser = true;
- };
- }
- ]
- ++ extraModules
- ++ (
- if hm
- then [
- home-manager.nixosModules.home-manager
+ inputs.home-manager.lib.homeManagerConfiguration {
+ inherit pkgs;
+ modules = [
+ ../users/${username}/home.nix
{
- home-manager = {
- inherit extraSpecialArgs;
- useGlobalPkgs = true;
- useUserPackages = true;
- users.${username} =
- {
- imports = [
- ../users/${username}/home.nix
- ];
- home.stateVersion = stateVersion;
- }
- // commonHM
- // (
- if builtins.match ".*-linux" system != null
- then {systemd.user.startServices = true;}
- else {}
- );
+ home = {
+ inherit username stateVersion;
+ homeDirectory = "/home/${username}";
};
+
+ programs.home-manager.enable = true;
}
- ]
- else []
- );
+ ];
+ };
+
+ mapHMUsers = users:
+ mapFilterDirs ../users (n: v: v == "directory" && n != "root") (username: _:
+ mkHMUser {
+ inherit username;
+ inherit (users.${username}) pkgs stateVersion;
+ });
}