config: create declarative home-manager user management

This commit is contained in:
Gabriel Arazas 2023-06-23 15:43:26 +08:00
parent 4e428bf8e4
commit 87e01e119c
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 18 additions and 3 deletions

View File

@ -79,6 +79,9 @@
# support. # support.
images = lib'.importTOML ./images.toml; images = lib'.importTOML ./images.toml;
# A set of users with their metadata to be deployed with home-manager.
users = lib'.importTOML ./users.toml;
# A set of image-related utilities for the flake outputs. # A set of image-related utilities for the flake outputs.
inherit (import ./lib/images.nix { inherit inputs; lib = lib'; }) mkHost mkUser mkImage; inherit (import ./lib/images.nix { inherit inputs; lib = lib'; }) mkHost mkUser mkImage;
@ -310,8 +313,9 @@
# I can now install home-manager users in non-NixOS systems. # I can now install home-manager users in non-NixOS systems.
# NICE! # NICE!
homeConfigurations = lib'.mapAttrs homeConfigurations = lib'.mapAttrs
(_: path: (name: metadata:
let let
path = ./users/home-manager/${name};
extraModules = [ extraModules = [
({ pkgs, config, ... }: { ({ pkgs, config, ... }: {
# To be able to use the most of our config as possible, we want # To be able to use the most of our config as possible, we want
@ -329,8 +333,11 @@
path path
]; ];
in in
mkUser { inherit extraModules extraArgs; }) mkUser {
(lib'.filesToAttr ./users/home-manager); inherit extraModules extraArgs;
system = metadata.system or defaultSystem;
})
users;
# Extending home-manager with my custom modules, if anyone cares. # Extending home-manager with my custom modules, if anyone cares.
homeModules = homeModules =

8
users.toml Normal file
View File

@ -0,0 +1,8 @@
# This is project data for deploying home-manager users with this flake. Each
# of the users defined here should correspond to one of the home-manager users
# at `./users/home-manager/`.
[foodogsquared]
system = "x86_64-linux"
[plover]
system = "x86_64-linux"