mob next [ci-skip] [ci skip] [skip ci]
lastFile:inventories/personal-computer.nix
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
imports = [ ./personal-computer.nix ];
|
||||||
clan = {
|
clan = {
|
||||||
inventory = {
|
inventory = {
|
||||||
|
|
||||||
|
|||||||
10
inventories/personal-computer.nix
Normal file
10
inventories/personal-computer.nix
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
clan.inventory = {
|
||||||
|
tags = {
|
||||||
|
personal-computer = [ "rana" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
instances = { };
|
||||||
|
};
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
19
modules/clan/automatic-timezone/default.nix
Normal file
19
modules/clan/automatic-timezone/default.nix
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
_class = "clan.service";
|
||||||
|
manifest.name = "automatic-timezone";
|
||||||
|
manifest.description = "Automatic Timezone, using geoclue2 to actually set the timezone";
|
||||||
|
manifest.categories = [ "System" ];
|
||||||
|
|
||||||
|
roles.default = {
|
||||||
|
perInstance.nixosModule =
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
services.automatic-timezoned.enable = true;
|
||||||
|
services.geoclue2 = {
|
||||||
|
enableDemoAgent = lib.mkForce true;
|
||||||
|
geoProviderUrl = "https://beacondb.net/v1/geolocate";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
19
modules/clan/automatic-timezone/flake-module.nix
Normal file
19
modules/clan/automatic-timezone/flake-module.nix
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{ lib, inputs, ... }:
|
||||||
|
let
|
||||||
|
module = lib.modules.importApply ./default.nix { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
clan.modules = {
|
||||||
|
automatic-timezone = module;
|
||||||
|
};
|
||||||
|
|
||||||
|
perSystem =
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
clan.nixosTests.automatic-timezone = {
|
||||||
|
imports = [ ./tests/vm/default.nix ];
|
||||||
|
clan.modules."@clan/automatic-timezone" = module;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
31
modules/clan/automatic-timezone/tests/vm/default.nix
Normal file
31
modules/clan/automatic-timezone/tests/vm/default.nix
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
name = "service-automatic-timezone";
|
||||||
|
|
||||||
|
clan = {
|
||||||
|
directory = ./.;
|
||||||
|
inventory = {
|
||||||
|
machines.server = { };
|
||||||
|
|
||||||
|
instances = {
|
||||||
|
tz-test = {
|
||||||
|
module.name = "@clan/automatic-timezone";
|
||||||
|
module.input = "self";
|
||||||
|
roles.default.machines.server = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes = {
|
||||||
|
server = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
start_all()
|
||||||
|
|
||||||
|
server.wait_for_unit("automatic-timezoned")
|
||||||
|
|
||||||
|
server.succeed("systemctl status automatic-timezoned")
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -13,6 +13,13 @@ let
|
|||||||
polkitAllowGroups = builtins.concatStringsSep "||" (
|
polkitAllowGroups = builtins.concatStringsSep "||" (
|
||||||
builtins.map (group: ''subject.isInGroup("${group}")'') allowManageGroups
|
builtins.map (group: ''subject.isInGroup("${group}")'') allowManageGroups
|
||||||
);
|
);
|
||||||
|
|
||||||
|
printerMember = lib.map (user: user.name) (
|
||||||
|
lib.attrsets.attrsToList (
|
||||||
|
lib.attrsets.filterAttrs (name: value: value.isNormalUser) config.users.users
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services.printing = {
|
services.printing = {
|
||||||
@@ -48,22 +55,8 @@ in
|
|||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
users.groups.lpadmin.members = lib.pipe config.users.users [
|
users.groups.lpadmin.members = printerMember;
|
||||||
(lib.attrsets.filterAttrs (name: value: value.isNormalUser))
|
users.groups.lp.members = printerMember;
|
||||||
(lib.attrsets.attrsToList)
|
users.groups.scanner.members = printerMember;
|
||||||
(lib.map (user: user.name))
|
|
||||||
];
|
|
||||||
|
|
||||||
users.groups.lp.members = lib.pipe config.users.users [
|
|
||||||
(lib.attrsets.filterAttrs (name: value: value.isNormalUser))
|
|
||||||
(lib.attrsets.attrsToList)
|
|
||||||
(lib.map (user: user.name))
|
|
||||||
];
|
|
||||||
|
|
||||||
users.groups.scanner.members = lib.map (user: user.name) (
|
|
||||||
lib.attrsets.attrsToList (
|
|
||||||
lib.attrsets.filterAttrs (name: value: value.isNormalUser) config.users.users
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user