rename home-manager.nix -> home.nix
add options.users.users.<name>.manageHome
This commit is contained in:
parent
7bd81f84e6
commit
adb939c45b
3 changed files with 70 additions and 50 deletions
|
|
@ -33,7 +33,7 @@
|
|||
]
|
||||
++ (
|
||||
if _cerulean.homeManager != null
|
||||
then [./home-manager.nix]
|
||||
then [./home.nix]
|
||||
else []
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,49 +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";}))
|
||||
];
|
||||
};
|
||||
}
|
||||
69
cerulean/nixos/home.nix
Normal file
69
cerulean/nixos/home.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
# 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";}))
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue