mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-12 06:19:00 +00:00
Format the Nix files
This commit is contained in:
parent
e2699c2cea
commit
2cf96cb1f3
@ -86,5 +86,7 @@
|
|||||||
}) (libExtended.filterAttrs (n: v: !libExtended.elem n excludedModules)
|
}) (libExtended.filterAttrs (n: v: !libExtended.elem n excludedModules)
|
||||||
(libExtended.filesToAttr ./users));
|
(libExtended.filesToAttr ./users));
|
||||||
|
|
||||||
|
packages = forAllSystems
|
||||||
|
(system: import ./pkgs { pkgs = import nixpkgs { inherit system; }; });
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -117,22 +117,23 @@ in rec {
|
|||||||
++ (lib.mapAttrsToList (n: v: import v) (filesToAttr ../modules));
|
++ (lib.mapAttrsToList (n: v: import v) (filesToAttr ../modules));
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Return an attribute set of valid users from a given list of users.
|
/* Return an attribute set of valid users from a given list of users.
|
||||||
|
|
||||||
Signature:
|
Signature:
|
||||||
list -> attrset
|
list -> attrset
|
||||||
Where:
|
Where:
|
||||||
- `list` is a list of usernames as strings
|
- `list` is a list of usernames as strings
|
||||||
- `attrset` is a set of valid users with the name as the key and the path as the value.
|
- `attrset` is a set of valid users with the name as the key and the path as the value.
|
||||||
Example:
|
Example:
|
||||||
# Assuming only 'foo-dogsquared' is the existing user.
|
# Assuming only 'foo-dogsquared' is the existing user.
|
||||||
getUsers [ "foo-dogsquared" "archie" "brad" ]
|
getUsers [ "foo-dogsquared" "archie" "brad" ]
|
||||||
=> { foo-dogsquared = /home/foo-dogsquared/projects/nixos-config/users/foo-dogsquared; }
|
=> { foo-dogsquared = /home/foo-dogsquared/projects/nixos-config/users/foo-dogsquared; }
|
||||||
*/
|
*/
|
||||||
getUsers = users:
|
getUsers = users:
|
||||||
let
|
let
|
||||||
userModules = filesToAttr ../users;
|
userModules = filesToAttr ../users;
|
||||||
validUsers = lib.filter (user: lib.elem user (lib.attrNames userModules)) users;
|
validUsers =
|
||||||
|
lib.filter (user: lib.elem user (lib.attrNames userModules)) users;
|
||||||
in lib.filterAttrs (n: _: lib.elem n validUsers) userModules;
|
in lib.filterAttrs (n: _: lib.elem n validUsers) userModules;
|
||||||
|
|
||||||
/* Create an attribute set from two lists (or a zip).
|
/* Create an attribute set from two lists (or a zip).
|
||||||
|
@ -64,28 +64,27 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
fonts = with pkgs;
|
fonts = with pkgs; [
|
||||||
[
|
iosevka
|
||||||
iosevka
|
|
||||||
|
|
||||||
# Noto font family
|
# Noto font family
|
||||||
noto-fonts
|
noto-fonts
|
||||||
noto-fonts-cjk
|
noto-fonts-cjk
|
||||||
noto-fonts-extra
|
noto-fonts-extra
|
||||||
noto-fonts-emoji
|
noto-fonts-emoji
|
||||||
|
|
||||||
# Adobe Source font family
|
# Adobe Source font family
|
||||||
source-code-pro
|
source-code-pro
|
||||||
source-sans-pro
|
source-sans-pro
|
||||||
source-han-sans
|
source-han-sans
|
||||||
source-serif-pro
|
source-serif-pro
|
||||||
source-han-serif
|
source-han-serif
|
||||||
source-han-mono
|
source-han-mono
|
||||||
|
|
||||||
# Math fonts
|
# Math fonts
|
||||||
stix-two
|
stix-two
|
||||||
xits-math
|
xits-math
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
@ -9,29 +9,28 @@ let
|
|||||||
nonexistentUsers = lib.filter (name: !lib.elem name users) cfg.users;
|
nonexistentUsers = lib.filter (name: !lib.elem name users) cfg.users;
|
||||||
|
|
||||||
mkUser = user: path:
|
mkUser = user: path:
|
||||||
let
|
let
|
||||||
userModule = import path;
|
userModule = import path;
|
||||||
defaultConfig = {
|
defaultConfig = {
|
||||||
home.username = user;
|
home.username = user;
|
||||||
home.homeDirectory = "/home/${user}";
|
home.homeDirectory = "/home/${user}";
|
||||||
|
|
||||||
xdg.enable = true;
|
xdg.enable = true;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
users.users.${user} = {
|
||||||
|
isNormalUser = true;
|
||||||
|
extraGroups = [ "wheel" ];
|
||||||
|
};
|
||||||
|
home-manager.users.${user} = userModule // defaultConfig;
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
users.users.${user} = {
|
|
||||||
isNormalUser = true;
|
|
||||||
extraGroups = [ "wheel" ];
|
|
||||||
};
|
|
||||||
home-manager.users.${user} = userModule // defaultConfig;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.modules.users = {
|
options.modules.users = {
|
||||||
users = lib.mkOption {
|
users = lib.mkOption {
|
||||||
default = [];
|
default = [ ];
|
||||||
type = with lib.types; listOf str;
|
type = with lib.types; listOf str;
|
||||||
description = "A list of users from the `./users` directory to be included in the NixOS config.";
|
description =
|
||||||
|
"A list of users from the `./users` directory to be included in the NixOS config.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -52,7 +51,9 @@ in
|
|||||||
config = {
|
config = {
|
||||||
assertions = [{
|
assertions = [{
|
||||||
assertion = (builtins.length nonexistentUsers) < 1;
|
assertion = (builtins.length nonexistentUsers) < 1;
|
||||||
message = "${lib.concatMapStringsSep ", " (u: "'${u}'") nonexistentUsers} is not found in the `./users` directory.";
|
message = "${
|
||||||
|
lib.concatMapStringsSep ", " (u: "'${u}'") nonexistentUsers
|
||||||
|
} is not found in the `./users` directory.";
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user