Compare commits
4 commits
23449396f7
...
39ec2e62d0
| Author | SHA1 | Date | |
|---|---|---|---|
| 39ec2e62d0 | |||
| 1c68485dcf | |||
| 34a8c23537 | |||
| 169bf2bf48 |
4 changed files with 57 additions and 20 deletions
20
cerulean/home/default.nix
Normal file
20
cerulean/home/default.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
# NOTE: you can access the system configuration via the `osConfig` arg
|
||||||
|
{
|
||||||
|
username,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# WARNING: required for home-manager to work
|
||||||
|
programs.home-manager.enable = true; # user must apply lib.mkForce
|
||||||
|
# Nicely reload systemd units when changing configs
|
||||||
|
systemd.user.startServices = lib.mkDefault "sd-switch";
|
||||||
|
|
||||||
|
home = {
|
||||||
|
username = lib.mkDefault username;
|
||||||
|
homeDirectory = lib.mkDefault "/home/${username}";
|
||||||
|
|
||||||
|
sessionVariables = {
|
||||||
|
NIX_SHELL_PRESERVE_PROMPT = lib.mkDefault 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -12,18 +12,22 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
{
|
{
|
||||||
root,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
_cerulean,
|
_cerulean,
|
||||||
|
config,
|
||||||
|
root,
|
||||||
|
lib,
|
||||||
...
|
...
|
||||||
} @ args: let
|
} @ args: let
|
||||||
inherit
|
inherit
|
||||||
(builtins)
|
(builtins)
|
||||||
attrNames
|
|
||||||
filter
|
|
||||||
pathExists
|
pathExists
|
||||||
;
|
;
|
||||||
|
|
||||||
|
inherit
|
||||||
|
(lib)
|
||||||
|
filterAttrs
|
||||||
|
mapAttrs
|
||||||
|
;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
_cerulean.homeManager.nixosModules.default
|
_cerulean.homeManager.nixosModules.default
|
||||||
|
|
@ -49,18 +53,27 @@ in {
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
home-manager = {
|
home-manager = {
|
||||||
|
useUserPackages = lib.mkDefault false;
|
||||||
|
useGlobalPkgs = lib.mkDefault true;
|
||||||
|
|
||||||
|
overwriteBackup = lib.mkDefault false;
|
||||||
|
backupFileExtension = lib.mkDefault "bak";
|
||||||
|
|
||||||
users =
|
users =
|
||||||
config.users.users
|
config.users.users
|
||||||
|> attrNames
|
|> filterAttrs (name: value: value.manageHome && pathExists /${root}/homes/${name})
|
||||||
|> filter (x: pathExists (root + "/homes/${x}"))
|
|> mapAttrs (name: _: {...}: {
|
||||||
|> (x:
|
imports = [/${root}/homes/${name}];
|
||||||
lib.genAttrs x (y:
|
|
||||||
import (root + "/homes/${y}")));
|
# per-user arguments
|
||||||
|
_module.args.username = name;
|
||||||
|
});
|
||||||
|
|
||||||
extraSpecialArgs = _cerulean.specialArgs;
|
extraSpecialArgs = _cerulean.specialArgs;
|
||||||
sharedModules = [
|
sharedModules = [
|
||||||
# user configuration
|
../home
|
||||||
(import (root + "/nixpkgs.nix"))
|
|
||||||
|
(import /${root}/nixpkgs.nix)
|
||||||
# options declarations
|
# options declarations
|
||||||
(import ./nixpkgs.nix (args // {contextName = "homes";}))
|
(import ./nixpkgs.nix (args // {contextName = "homes";}))
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -73,19 +73,23 @@ in {
|
||||||
_module.args = removeAttrs repos ["pkgs" "base"];
|
_module.args = removeAttrs repos ["pkgs" "base"];
|
||||||
|
|
||||||
nixpkgs = let
|
nixpkgs = let
|
||||||
nixpkgConfig = {
|
nixpkgsConfig = {
|
||||||
config = lib.mkForce (basePkgs.config or {});
|
config = lib.mkForce (basePkgs.config or {});
|
||||||
overlays = lib.mkForce (basePkgs.overlays or []);
|
overlays = lib.mkForce (basePkgs.overlays or []);
|
||||||
};
|
};
|
||||||
in
|
|
||||||
if contextName == "hosts"
|
nixpkgsHostsConfig =
|
||||||
then
|
nixpkgsConfig
|
||||||
nixpkgConfig
|
|
||||||
// {
|
// {
|
||||||
flake.source = lib.mkForce base;
|
flake.source = lib.mkForce base;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
nixpkgsHomesConfig = lib.mkIf (!config.home-manager.useGlobalPkgs) nixpkgsConfig;
|
||||||
|
in
|
||||||
|
if contextName == "hosts"
|
||||||
|
then nixpkgsHostsConfig
|
||||||
else if contextName == "homes"
|
else if contextName == "homes"
|
||||||
then nixpkgConfig
|
then nixpkgsHomesConfig
|
||||||
else {};
|
else {};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
# flatten recursion result
|
# flatten recursion result
|
||||||
|> concatLists
|
|> concatLists
|
||||||
# find import location
|
# find import location
|
||||||
|> map (group: nt.findImport (/${root}/groups/${group._name})
|
|> map (group: nt.findImport /${root}/groups/${group._name})
|
||||||
# filter by uniqueness
|
# filter by uniqueness
|
||||||
|> nt.prim.unique
|
|> nt.prim.unique
|
||||||
# ignore missing groups
|
# ignore missing groups
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue