mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-11 07:10:39 +02:00
feat: add home-manager
This commit is contained in:
parent
04fc94267a
commit
c31e43641e
1 changed files with 49 additions and 0 deletions
49
nix/home-manager.nix
Normal file
49
nix/home-manager.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
home-manager,
|
||||||
|
nixpkgs,
|
||||||
|
templates,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (nixpkgs) lib;
|
||||||
|
hosts = (import ./hosts.nix).homeManager.all;
|
||||||
|
|
||||||
|
genModules = hostName: {homeDirectory, ...}: {
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
imports = [(../hosts + "/${hostName}")];
|
||||||
|
nix.registry = {
|
||||||
|
nixpkgs.flake = nixpkgs;
|
||||||
|
p.flake = nixpkgs;
|
||||||
|
pkgs.flake = nixpkgs;
|
||||||
|
templates.flake = templates;
|
||||||
|
};
|
||||||
|
|
||||||
|
home = {
|
||||||
|
inherit homeDirectory;
|
||||||
|
sessionVariables.NIX_PATH = lib.concatStringsSep ":" [
|
||||||
|
"nixpkgs=${config.xdg.dataHome}/nixpkgs"
|
||||||
|
"nixpkgs-overlays=${config.xdg.dataHome}/overlays"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
xdg = {
|
||||||
|
dataFile = {
|
||||||
|
nixpkgs.source = nixpkgs;
|
||||||
|
overlays.source = ../nix/overlays;
|
||||||
|
};
|
||||||
|
configFile."nix/nix.conf".text = ''
|
||||||
|
flake-registry = ${config.xdg.configHome}/nix/registry.json
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
genConfiguration = hostName: {hostPlatform, ...} @ attrs:
|
||||||
|
home-manager.lib.homeManagerConfiguration {
|
||||||
|
pkgs = self.pkgs.${hostPlatform};
|
||||||
|
modules = [(genModules hostName attrs)];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
lib.mapAttrs genConfiguration hosts
|
Loading…
Add table
Add a link
Reference in a new issue