flake: home-manager: use a more modular design
This means I can easily add new hosts now.
This commit is contained in:
parent
2fb3d0f9cf
commit
a046569743
|
@ -1,10 +1,22 @@
|
||||||
{ self, inputs, ... }:
|
{ self, inputs, lib, ... }:
|
||||||
{
|
let
|
||||||
perSystem = { system, ... }: {
|
defaultModules = [
|
||||||
# Work-around for https://github.com/nix-community/home-manager/issues/3075
|
# Include generic settings
|
||||||
legacyPackages = {
|
"${self}/home"
|
||||||
homeConfigurations = {
|
{
|
||||||
ambroisie = inputs.home-manager.lib.homeManagerConfiguration {
|
# Basic user information defaults
|
||||||
|
home.username = lib.mkDefault "ambroisie";
|
||||||
|
home.homeDirectory = lib.mkDefault "/home/ambroisie";
|
||||||
|
|
||||||
|
# Make it a Linux installation by default
|
||||||
|
targets.genericLinux.enable = lib.mkDefault true;
|
||||||
|
|
||||||
|
# Enable home-manager
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
mkHome = name: system: inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
# Work-around for home-manager
|
# Work-around for home-manager
|
||||||
# * not letting me set `lib` as an extraSpecialArgs
|
# * not letting me set `lib` as an extraSpecialArgs
|
||||||
# * not respecting `nixpkgs.overlays` [1]
|
# * not respecting `nixpkgs.overlays` [1]
|
||||||
|
@ -17,17 +29,8 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
modules = [
|
modules = defaultModules ++ [
|
||||||
"${self}/home"
|
"${self}/hosts/homes/${name}"
|
||||||
{
|
|
||||||
# The basics
|
|
||||||
home.username = "ambroisie";
|
|
||||||
home.homeDirectory = "/home/ambroisie";
|
|
||||||
# Let Home Manager install and manage itself.
|
|
||||||
programs.home-manager.enable = true;
|
|
||||||
# This is a generic linux install
|
|
||||||
targets.genericLinux.enable = true;
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
|
@ -35,6 +38,13 @@
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
perSystem = { system, ... }: {
|
||||||
|
# Work-around for https://github.com/nix-community/home-manager/issues/3075
|
||||||
|
legacyPackages = {
|
||||||
|
homeConfigurations = lib.mapAttrs mkHome {
|
||||||
|
ambroisie = system;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
5
hosts/homes/ambroisie/default.nix
Normal file
5
hosts/homes/ambroisie/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Default home-manager configuration
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
# Default configuration, nothing to do
|
||||||
|
}
|
Loading…
Reference in a new issue