mirror of
https://github.com/youwen5/nixos.git
synced 2025-01-18 05:02:10 -08:00
refactor: modularize theming
This commit is contained in:
parent
ddfcbd78c8
commit
4c72a5cb8b
5 changed files with 102 additions and 53 deletions
|
@ -22,6 +22,10 @@
|
|||
firewallPresets.vite = true;
|
||||
cloudflareNameservers.enable = true;
|
||||
};
|
||||
fonts.enable = true;
|
||||
};
|
||||
theming = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
../../modules/linux/networking
|
||||
../../modules/linux/fonts
|
||||
../../modules/linux/greeter
|
||||
# ../../modules/linux/spotifyd
|
||||
../../modules/linux/core
|
||||
../../modules/linux/desktop-portal
|
||||
../../modules/linux/stylix
|
||||
|
|
|
@ -1,19 +1,31 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.liminalOS.system.fonts;
|
||||
in
|
||||
{
|
||||
options.liminalOS.system.fonts = {
|
||||
enable = lib.mkEnableOption "fonts";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
fonts = {
|
||||
enableDefaultPackages = true;
|
||||
# fontconfig = {
|
||||
# defaultFonts = {
|
||||
# serif = [ "Noto Serif" ];
|
||||
# sansSerif = [ "Noto Sans" ];
|
||||
# };
|
||||
# };
|
||||
packages = with pkgs; [
|
||||
# noto-fonts
|
||||
packages =
|
||||
with pkgs;
|
||||
[
|
||||
noto-fonts-cjk-sans
|
||||
# noto-fonts-emoji
|
||||
# (nerdfonts.override { fonts = [ "CascadiaCode" ]; })
|
||||
(google-fonts.override { fonts = [ "Lora" ]; })
|
||||
];
|
||||
]
|
||||
++ (lib.optionals (!config.liminalOS.theming.enable) [
|
||||
noto-fonts
|
||||
noto-fonts-emoji
|
||||
nerd-fonts.caskaydia-cove
|
||||
]);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,9 +1,30 @@
|
|||
{ inputs, pkgs, ... }:
|
||||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.liminalOS.theming;
|
||||
in
|
||||
{
|
||||
options.liminalOS.theming = {
|
||||
enable = lib.mkEnableOption "theming";
|
||||
stylixName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "stylix";
|
||||
description = ''
|
||||
Name of Stylix module defined in `inputs`. Defaults to `stylix`. You must define `inputs.stylix.url` in your `flake.nix` to enable this option
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
inputs.stylix.nixosModules.stylix
|
||||
];
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
stylix = {
|
||||
enable = true;
|
||||
image = "${inputs.wallpapers}/aesthetic/afterglow_city_skyline_at_night.png";
|
||||
|
@ -37,4 +58,11 @@
|
|||
size = 26;
|
||||
};
|
||||
};
|
||||
assertions = [
|
||||
{
|
||||
assertion = builtins.hasAttr cfg.stylixName inputs;
|
||||
message = ''You enabled theming but did not add a Stylix module to your flake inputs, or did not set `liminalOS.theming.stylixName` to the name of your Stylix input, if it is not `stylix`. Please set `inputs.stylix.url = "github:danth/stylix"` or set the stylixName option to the name of your stylix flake input.'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,17 +8,17 @@ let
|
|||
cfg = config.liminalOS.wsl;
|
||||
in
|
||||
{
|
||||
imports = lib.mkIf cfg.enable [
|
||||
inputs.nixos-wsl.nixosModules.default
|
||||
imports = [
|
||||
inputs.${cfg.wslName}.nixosModules.default
|
||||
];
|
||||
|
||||
options = {
|
||||
enable = lib.mkEnableOption "wsl";
|
||||
module = lib.mkOption {
|
||||
type = lib.types.submodule;
|
||||
default = inputs.nixos-wsl.nixosModules.default;
|
||||
enable = lib.mkEnableOption "WSL";
|
||||
wslName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "nixos-wsl";
|
||||
description = ''
|
||||
NixOS WSL module. Defaults to <https://github.com/nix-community/NixOS-WSL>
|
||||
Name of the NixOS WSL module in your flake inputs. You should define `inputs.nixos-wsl.url = "github:nixos-community/nixos-wsl", and set `liminalOS.wsl.wslName` if you did not call it `nixos-wsl`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
@ -28,4 +28,10 @@ in
|
|||
defaultUser = config.liminalOS.username;
|
||||
useWindowsDriver = true;
|
||||
};
|
||||
assertions = [
|
||||
{
|
||||
assertion = builtins.hasAttr cfg.wslName inputs;
|
||||
message = ''You enabled WSL but did not add the WSL module to your flake inputs, or did not set `liminalOS.theming.wslName` to the name of your NixOS WSL input, if it is not `nixos-wsl`. Please set `inputs.nixos-wsl.url = "github:nix-community/nixos-wsl"` or set the wslName option to the name of your WSL flake input.'';
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue