stylix: init droid (#778)
stylix: init nixOnDroidModules.stylix module to support Nix-on-Droid Closes: https://github.com/danth/stylix/issues/775 Link: https://github.com/danth/stylix/pull/778 Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com> Reviewed-by: Daniel Thwaites <danth@danth.me>
This commit is contained in:
parent
9dc4827488
commit
e3233ead63
8 changed files with 151 additions and 4 deletions
|
|
@ -3,9 +3,10 @@
|
|||
## About
|
||||
|
||||
Stylix is a theming framework for [NixOS](https://nixos.org), [Home
|
||||
Manager](https://nix-community.github.io/home-manager#ch-introduction), and
|
||||
[nix-darwin](https://github.com/LnL7/nix-darwin#readme) that applies color
|
||||
schemes, wallpapers, and fonts to a wide range of applications.
|
||||
Manager](https://nix-community.github.io/home-manager#ch-introduction),
|
||||
[nix-darwin](https://github.com/LnL7/nix-darwin#readme), and
|
||||
[Nix-on-Droid](https://github.com/nix-community/nix-on-droid) that applies
|
||||
color schemes, wallpapers, and fonts to a wide range of applications.
|
||||
|
||||
Unlike color scheme utilities such as
|
||||
[base16.nix](https://github.com/SenchoPens/base16.nix) or
|
||||
|
|
|
|||
|
|
@ -78,6 +78,39 @@ While this won't have an effect on the looks of MacOS, since we don't have the
|
|||
controls to theme it like we do NixOS, it will automatically set up the [Home
|
||||
Manager][nix-hm] modules for you.
|
||||
|
||||
## Nix-on-Droid
|
||||
|
||||
You can install Stylix into your
|
||||
[Nix-on-Droid](https://github.com/nix-community/nix-on-droid) configuration in
|
||||
a similar fashion to NixOS via [Flakes][nix-flakes].
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nix-on-droid = {
|
||||
url = "github:nix-community/nix-on-droid/release-24.05";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
|
||||
stylix.url = "github:danth/stylix";
|
||||
};
|
||||
|
||||
outputs = { nix-on-droid, nixpkgs, stylix, ... }: {
|
||||
nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages."aarch64-linux";
|
||||
modules = [ stylix.nixOnDroidModules.stylix ./nix-on-droid.nix ];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
<small>Minimal `flake.nix` for a Nix-on-Droid configuration.</small>
|
||||
|
||||
This will apply your configured color scheme and monospace font to the
|
||||
nix-on-droid terminal. If [Home Manager integration for
|
||||
Nix-on-Droid](https://github.com/nix-community/nix-on-droid#home-manager-integration)
|
||||
is used, Stylix will automatically set up the [Home Manager][nix-hm] modules for
|
||||
you.
|
||||
|
||||
## Home Manager
|
||||
|
||||
If you would prefer to use the standalone version of Home Manager, you can
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ The following platforms are supported:
|
|||
- NixOS (`nixos`)
|
||||
- Home Manager (`hm`)
|
||||
- Nix-Darwin (`darwin`)
|
||||
- Nix-on-Droid (`droid`)
|
||||
|
||||
Correctly named modules will be imported automatically.
|
||||
|
||||
|
|
|
|||
17
flake.nix
17
flake.nix
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
description = "Theming framework for NixOS, Home Manager, and nix-darwin";
|
||||
description = "Theming framework for NixOS, Home Manager, nix-darwin and Nix-on-Droid";
|
||||
|
||||
inputs = {
|
||||
base16-fish = {
|
||||
|
|
@ -260,5 +260,20 @@
|
|||
}
|
||||
];
|
||||
};
|
||||
|
||||
nixOnDroidModules.stylix =
|
||||
{ pkgs, ... }@args:
|
||||
{
|
||||
imports = [
|
||||
(import ./stylix/droid inputs)
|
||||
{
|
||||
stylix = {
|
||||
paletteGenerator = self.packages.${pkgs.system}.palette-generator;
|
||||
base16 = base16.lib args;
|
||||
homeManagerIntegration.module = self.homeManagerModules.stylix;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
36
modules/console/droid.nix
Normal file
36
modules/console/droid.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
options.stylix.targets.console.enable =
|
||||
config.lib.stylix.mkEnableTarget "the Nix-on-Droid console" true;
|
||||
|
||||
config =
|
||||
lib.mkIf (config.stylix.enable && config.stylix.targets.console.enable)
|
||||
{
|
||||
terminal.colors = with config.lib.stylix.colors.withHashtag; rec {
|
||||
background = base00;
|
||||
foreground = base05;
|
||||
cursor = base05;
|
||||
|
||||
# normal
|
||||
color0 = base00;
|
||||
color1 = base08;
|
||||
color2 = base0B;
|
||||
color3 = base0A;
|
||||
color4 = base0D;
|
||||
color5 = base0E;
|
||||
color6 = base0C;
|
||||
color7 = base05;
|
||||
|
||||
# bright
|
||||
color8 = base02;
|
||||
color9 = color1;
|
||||
color10 = color2;
|
||||
color11 = color3;
|
||||
color12 = color4;
|
||||
color13 = color5;
|
||||
color14 = color6;
|
||||
color15 = base07;
|
||||
};
|
||||
};
|
||||
}
|
||||
21
stylix/droid/default.nix
Normal file
21
stylix/droid/default.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
inputs:
|
||||
{ lib, ... }:
|
||||
|
||||
let
|
||||
autoload = import ../autoload.nix { inherit lib inputs; } "droid";
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
"${inputs.self}/stylix/fonts.nix"
|
||||
"${inputs.self}/stylix/home-manager-integration.nix"
|
||||
"${inputs.self}/stylix/opacity.nix"
|
||||
"${inputs.self}/stylix/palette.nix"
|
||||
"${inputs.self}/stylix/pixel.nix"
|
||||
"${inputs.self}/stylix/target.nix"
|
||||
] ++ autoload;
|
||||
|
||||
# See https://github.com/nix-community/nix-on-droid/issues/436
|
||||
options.lib = lib.mkOption {
|
||||
type = with lib.types; attrsOf attrs;
|
||||
};
|
||||
}
|
||||
30
stylix/droid/fonts.nix
Normal file
30
stylix/droid/fonts.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
mkFont =
|
||||
font:
|
||||
pkgs.runCommand "stylix-font-${font.package.name}"
|
||||
{
|
||||
FONTCONFIG_FILE = pkgs.makeFontsConf { fontDirectories = [ font.package ]; };
|
||||
}
|
||||
''
|
||||
font="$(
|
||||
${lib.getExe' pkgs.fontconfig "fc-match"} \
|
||||
${lib.escapeShellArg font.name} \
|
||||
--format %{file}
|
||||
)"
|
||||
|
||||
cp "$font" "$out"
|
||||
'';
|
||||
terminalFont = mkFont config.stylix.fonts.monospace;
|
||||
in
|
||||
{
|
||||
imports = [ ../fonts.nix ];
|
||||
|
||||
config.terminal.font = lib.mkIf config.stylix.enable terminalFont;
|
||||
}
|
||||
10
stylix/droid/palette.nix
Normal file
10
stylix/droid/palette.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
args:
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
imports = [ (import ../palette.nix args) ];
|
||||
|
||||
config = lib.mkIf config.stylix.enable {
|
||||
environment.etc = config.stylix.generated.fileTree;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue