dotfiles/home/lib.nix

68 lines
1.6 KiB
Nix
Raw Normal View History

2023-06-15 01:40:55 +02:00
{
inputs,
pkgs,
username,
isNixOS ? true,
}: rec {
2023-12-31 06:03:50 +01:00
inherit (pkgs.stdenv) isLinux isDarwin;
2023-06-15 01:40:55 +02:00
extraSpecialArgs = {
flakePath =
2023-12-31 06:03:50 +01:00
if isDarwin
then "/Users/${username}/.config/flake"
else "/home/${username}/.config/flake";
2024-02-23 10:13:54 +01:00
inherit inputs isNixOS;
2023-06-15 01:40:55 +02:00
};
2023-12-31 06:03:50 +01:00
hmStandaloneConfig = {
2023-06-15 01:40:55 +02:00
home.homeDirectory =
if isLinux
2023-06-15 01:40:55 +02:00
then "/home/${username}"
else if isDarwin
2023-06-15 01:40:55 +02:00
then "/Users/${username}"
else throw "Unsupported system";
home.username = username;
2023-11-28 12:21:17 +01:00
isGraphical = false;
targets.genericLinux.enable = isLinux;
xdg.mime.enable = isLinux;
2023-06-15 01:40:55 +02:00
};
2023-12-31 06:03:50 +01:00
2024-02-15 18:49:22 +01:00
modules =
(with inputs; [
2024-01-27 14:47:45 +01:00
agenix.homeManagerModules.age
2023-06-15 01:40:55 +02:00
caarlos0-nur.homeManagerModules.default
nekowinston-nur.homeManagerModules.default
2024-01-27 14:47:45 +01:00
nix-index-database.hmModules.nix-index
2024-02-23 10:13:54 +01:00
vscode-server.homeModules.default
2024-02-15 18:49:22 +01:00
])
++ [
({
osConfig,
lib,
...
}: let
inherit (lib) mkOption types;
in {
options = {
isGraphical = mkOption {
default = osConfig.isGraphical;
description = "Whether the system is a graphical target";
type = types.bool;
};
location = {
latitude = mkOption {
default = osConfig.location.latitude;
type = types.nullOr types.float;
};
longitude = mkOption {
default = osConfig.location.longitude;
type = types.nullOr types.float;
};
};
};
})
2023-06-15 01:40:55 +02:00
]
2024-02-15 18:49:22 +01:00
++ pkgs.lib.optionals (!isNixOS) [hmStandaloneConfig]
++ [./.];
2023-06-15 01:40:55 +02:00
}