rename home-manager.nix -> home.nix

add options.users.users.<name>.manageHome
This commit is contained in:
do butterflies cry? 2026-03-07 18:18:10 +10:00
parent 180889411f
commit feb2cabb34
Signed by: cry
GPG key ID: F68745A836CA0412
3 changed files with 69 additions and 54 deletions

View file

@ -33,7 +33,7 @@
]
++ (
if _cerulean.homeManager != null
then [./home-manager.nix]
then [./home.nix]
else []
);

View file

@ -1,51 +0,0 @@
# Copyright 2025-2026 _cry64 (Emile Clark-Boman)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{
root,
config,
lib,
_cerulean,
...
} @ args: let
inherit
(builtins)
attrNames
filter
pathExists
;
in {
imports = [
_cerulean.homeManager.nixosModules.default
];
home-manager = {
users =
config.users.users
|> attrNames
|> filter (x: pathExists /${root}/homes/${x})
|> (x:
lib.genAttrs x (y:
import /${root}/homes/${y}));
extraSpecialArgs = _cerulean.specialArgs;
sharedModules = [
# user configuration
(import /${root}/nixpkgs.nix)
# options declarations
(import ./nixpkgs.nix (args // {contextName = "homes";}))
./home.nix
];
};
}

View file

@ -1,3 +1,69 @@
{...}: {
programs.home-manager.enable = true; # DEBUG: why didn't i enable it already?
# Copyright 2025-2026 _cry64 (Emile Clark-Boman)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{
root,
config,
lib,
_cerulean,
...
} @ args: let
inherit
(builtins)
attrNames
filter
pathExists
;
in {
imports = [
_cerulean.homeManager.nixosModules.default
];
options = {
users.users = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule {
options.manageHome = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = ''
Whether Cerulean should automatically enable home-manager for this user,
and manage their home configuration declaratively.
Enabled by default, but can be disabled if necessary.
'';
};
});
};
};
config = {
home-manager = {
users =
config.users.users
|> attrNames
|> filter (x: pathExists (root + "/homes/${x}"))
|> (x:
lib.genAttrs x (y:
import (root + "/homes/${y}")));
extraSpecialArgs = _cerulean.specialArgs;
sharedModules = [
# user configuration
(import (root + "/nixpkgs.nix"))
# options declarations
(import ./nixpkgs.nix (args // {contextName = "homes";}))
];
};
};
}