diff --git a/flake.lock b/flake.lock index d559241..e8308d4 100644 --- a/flake.lock +++ b/flake.lock @@ -223,7 +223,7 @@ "niten-doom-config": "niten-doom-config" }, "locked": { - "narHash": "sha256-YU6DAPd4yJtUAwkuXltTi9gJhL+J2W23OQw2KYUEEQc=", + "narHash": "sha256-45L0HqvqGw7+s87MvKMR14cxEhBJHRnanmTpJlw7E78=", "path": "./nix-home", "type": "path" }, @@ -242,7 +242,7 @@ "ssh-keypairs": "ssh-keypairs" }, "locked": { - "narHash": "sha256-5lkN+UzOEgzUIDhX8tRdWyqO6aqDCzTK0DvCJ2AgUSw=", + "narHash": "sha256-p257NrEQFyj3GYNy+F9NBzEtOqMdyOsrpwMtnGnrOYc=", "path": "/state/secrets", "type": "path" }, diff --git a/flake.nix b/flake.nix index c95ea28..5b0be36 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,7 @@ fudo-secrets.url = "path:/state/secrets"; }; - outputs = { self, nixpkgs, fudo-secrets, ... }: { + outputs = { self, nixpkgs, fudo-secrets, fudo-home, ... }: { nixosConfigurations = let lib = nixpkgs.lib; @@ -37,6 +37,7 @@ system = hostOpts.arch; modules = [ + fudo-home.nixosModule fudo-secrets.nixosModule (import ./initialize.nix { inherit hostname pkgs build-timestamp fudo-secrets; diff --git a/lib/default.nix b/lib/default.nix index ace0f0b..c66e400 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -14,6 +14,7 @@ with lib; { ./fudo/distributed-builds.nix ./fudo/dns.nix ./fudo/domains.nix + ./fudo-lib.nix ./fudo/garbage-collector.nix ./fudo/git.nix ./fudo/global.nix diff --git a/lib/fudo-lib.nix b/lib/fudo-lib.nix index 2aa313d..71189ac 100644 --- a/lib/fudo-lib.nix +++ b/lib/fudo-lib.nix @@ -1,6 +1,15 @@ { lib, ... }: -{ +let ip = import ./ip.nix { inherit lib; }; dns = import ./dns.nix { inherit lib; }; +in +{ + lib.overlays = [ + (final: prev: { + fudo = { + inherit ip dns; + }; + }) + ]; } diff --git a/lib/fudo/users-common.nix b/lib/fudo/users-common.nix index 1066610..0dffd6a 100644 --- a/lib/fudo/users-common.nix +++ b/lib/fudo/users-common.nix @@ -3,8 +3,6 @@ with lib; let - sys = import ../system.nix { inherit lib config; }; - list-contains = lst: item: any (i: i == item) lst; domain-realm = domain: domainOpts: domainOpts.gssapi-realm; @@ -30,5 +28,5 @@ let }; in { - config.home-manager.users = mapAttrs user-config sys.local-users; + config.home-manager.users = mapAttrs user-config config.instance.local-users; } diff --git a/lib/fudo/users.nix b/lib/fudo/users.nix index 84c2329..a2a6c46 100644 --- a/lib/fudo/users.nix +++ b/lib/fudo/users.nix @@ -265,8 +265,8 @@ in { }; }; - home-manager.userGlobalPkgs = true; - # home-manager.userGlobalPkgs = { + home-manager.useGlobalPkgs = true; + # home-manager.useGlobalPkgs = { # useGlobalPkgs = true; # users = let diff --git a/lib/system.nix b/lib/system.nix index 6da9a79..809885d 100644 --- a/lib/system.nix +++ b/lib/system.nix @@ -28,11 +28,44 @@ let filterAttrs (host: hostOpts: hostOpts.site == local-site) config.fudo.hosts; in { - local-host = local-host; - local-domain = local-domain; - local-site = local-site; - local-users = local-users; - local-admins = local-admins; - local-groups = local-groups; - local-hosts = local-hosts; + options.instance = with types; { + local-host = mkOption { + type = str; + description = "Name of the current local host."; + }; + local-domain = mkOption { + type = str; + description = "Domain name of the current local host."; + }; + local-site = mkOption { + type = str; + description = "Site name of the current local host."; + }; + local-users = mkOption { + type = listOf str; + description = "List of users who should have access to the local host."; + }; + local-admins = mkOption { + type = listOf str; + description = "List of users who should have admin access to the local host."; + }; + local-groups = mkOption { + type = listOf str; + description = "List of groups which should be created on the local host."; + }; + local-hosts = mkOption { + type = listOf str; + description = "List of hosts that should be considered local to the current host."; + }; + }; + + config.instance = { + local-host = local-host; + local-domain = local-domain; + local-site = local-site; + local-users = local-users; + local-admins = local-admins; + local-groups = local-groups; + local-hosts = local-hosts; + }; } diff --git a/nix-home b/nix-home index fe65fa2..94f5f25 160000 --- a/nix-home +++ b/nix-home @@ -1 +1 @@ -Subproject commit fe65fa2566388d7a259a8abf92d7166fb75e29b4 +Subproject commit 94f5f2560a40b167ce368812c6b883bd7c6df5c1