dotfiles/home/lib.nix

65 lines
1.6 KiB
Nix
Raw Normal View History

2023-06-15 01:40:55 +02:00
{
inputs,
pkgs,
username,
isNixOS ? true,
2024-05-07 18:20:52 +02:00
}:
rec {
2023-12-31 06:03:50 +01:00
inherit (pkgs.stdenv) isLinux isDarwin;
2024-09-19 21:52:54 +02:00
inherit (pkgs.lib) mkDefault mkOption types;
2023-12-31 06:03:50 +01:00
2023-06-15 01:40:55 +02:00
extraSpecialArgs = {
flakePath =
2024-05-07 18:20:52 +02: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 =
2024-05-07 18:20:52 +02:00
if isLinux then
"/home/${username}"
else if isDarwin then
"/Users/${username}"
else
throw "Unsupported system";
2024-09-19 21:52:54 +02:00
home.username = mkDefault username;
isGraphical = mkDefault false;
targets.genericLinux.enable = mkDefault isLinux;
xdg.mime.enable = mkDefault 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
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
])
++ [
2024-05-07 18:20:52 +02:00
(
2024-09-19 21:52:54 +02:00
{ osConfig, ... }:
2024-05-07 18:20:52 +02:00
{
options = {
isGraphical = mkOption {
default = osConfig.isGraphical;
description = "Whether the system is a graphical target";
type = types.bool;
2024-02-15 18:49:22 +01:00
};
2024-05-07 18:20:52 +02:00
location = {
latitude = mkOption {
default = osConfig.location.latitude;
type = types.nullOr types.float;
};
longitude = mkOption {
default = osConfig.location.longitude;
type = types.nullOr types.float;
};
2024-02-15 18:49:22 +01:00
};
};
2024-05-07 18:20:52 +02:00
}
)
2023-06-15 01:40:55 +02:00
]
2024-05-07 18:20:52 +02:00
++ pkgs.lib.optionals (!isNixOS) [ hmStandaloneConfig ]
++ [ ./. ];
2023-06-15 01:40:55 +02:00
}