Compare commits
No commits in common. "39ec2e62d07d2173373db7b59be24851f7104bb9" and "23449396f7e9a9ffc07ed1f72691bc33997bb88d" have entirely different histories.
39ec2e62d0
...
23449396f7
4 changed files with 19 additions and 56 deletions
|
|
@ -1,20 +0,0 @@
|
||||||
# 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,22 +12,18 @@
|
||||||
# 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.
|
||||||
{
|
{
|
||||||
_cerulean,
|
|
||||||
config,
|
|
||||||
root,
|
root,
|
||||||
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
_cerulean,
|
||||||
...
|
...
|
||||||
} @ 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
|
||||||
|
|
@ -53,27 +49,18 @@ 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
|
||||||
|> filterAttrs (name: value: value.manageHome && pathExists /${root}/homes/${name})
|
|> attrNames
|
||||||
|> mapAttrs (name: _: {...}: {
|
|> filter (x: pathExists (root + "/homes/${x}"))
|
||||||
imports = [/${root}/homes/${name}];
|
|> (x:
|
||||||
|
lib.genAttrs x (y:
|
||||||
# per-user arguments
|
import (root + "/homes/${y}")));
|
||||||
_module.args.username = name;
|
|
||||||
});
|
|
||||||
|
|
||||||
extraSpecialArgs = _cerulean.specialArgs;
|
extraSpecialArgs = _cerulean.specialArgs;
|
||||||
sharedModules = [
|
sharedModules = [
|
||||||
../home
|
# user configuration
|
||||||
|
(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,23 +73,19 @@ in {
|
||||||
_module.args = removeAttrs repos ["pkgs" "base"];
|
_module.args = removeAttrs repos ["pkgs" "base"];
|
||||||
|
|
||||||
nixpkgs = let
|
nixpkgs = let
|
||||||
nixpkgsConfig = {
|
nixpkgConfig = {
|
||||||
config = lib.mkForce (basePkgs.config or {});
|
config = lib.mkForce (basePkgs.config or {});
|
||||||
overlays = lib.mkForce (basePkgs.overlays or []);
|
overlays = lib.mkForce (basePkgs.overlays or []);
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgsHostsConfig =
|
|
||||||
nixpkgsConfig
|
|
||||||
// {
|
|
||||||
flake.source = lib.mkForce base;
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgsHomesConfig = lib.mkIf (!config.home-manager.useGlobalPkgs) nixpkgsConfig;
|
|
||||||
in
|
in
|
||||||
if contextName == "hosts"
|
if contextName == "hosts"
|
||||||
then nixpkgsHostsConfig
|
then
|
||||||
|
nixpkgConfig
|
||||||
|
// {
|
||||||
|
flake.source = lib.mkForce base;
|
||||||
|
}
|
||||||
else if contextName == "homes"
|
else if contextName == "homes"
|
||||||
then nixpkgsHomesConfig
|
then nixpkgConfig
|
||||||
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