mirror of
https://github.com/danth/stylix
synced 2025-02-16 13:28:35 +00:00
treewide: add linters and apply pending suggestions (#426)
This commit is contained in:
parent
29044a0242
commit
80e8e1e2f6
35 changed files with 97 additions and 69 deletions
42
.github/workflows/lint.yml
vendored
Normal file
42
.github/workflows/lint.yml
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
name: Lint
|
||||
|
||||
on: pull_request
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@main
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
extra-conf: |
|
||||
extra-experimental-features = nix-command flakes
|
||||
|
||||
- name: Set up cache
|
||||
uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
flake='github:nixos/nixpkgs/e913ae340076bbb73d9f4d3d065c2bca7caafb16'
|
||||
nix profile install "${flake}#statix"
|
||||
nix profile install "${flake}#deadnix"
|
||||
nix profile install "${flake}#jq"
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run statix
|
||||
run: |
|
||||
statix check --format json |\
|
||||
jq --raw-output '.file as $file | .report[] | .severity as $severity | .diagnostics[] | "::warning file=\($file),line=\(.at.from.line),col=\(.at.from.column)::\(.message)"'
|
||||
|
||||
- name: Run deadnix
|
||||
run: |
|
||||
deadnix --no-lambda-arg --output-format json |\
|
||||
jq --raw-output '.file as $file | .results[] | "::warning file=\($file),line=\(.line),col=\(.column)::\(.message)"'
|
|
@ -43,7 +43,7 @@ in
|
|||
white = base07;
|
||||
red = bright-red;
|
||||
green = bright-green;
|
||||
yellow = yellow;
|
||||
inherit yellow;
|
||||
blue = bright-blue;
|
||||
magenta = bright-magenta;
|
||||
cyan = bright-cyan;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
options.stylix.targets.bat.enable =
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{pkgs, config, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
with config.lib.stylix.colors.withHashtag;
|
||||
with config.stylix.fonts;
|
||||
let
|
||||
bemenuOpacity = lib.toHexString ((((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100));
|
||||
bemenuOpacity = lib.toHexString (((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100);
|
||||
in {
|
||||
options.stylix.targets.bemenu = {
|
||||
enable = config.lib.stylix.mkEnableTarget "bemenu" true;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
with config.lib.stylix.colors.withHashtag;
|
||||
with config.stylix.fonts;
|
||||
let
|
||||
dunstOpacity = lib.toHexString ((((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100));
|
||||
dunstOpacity = lib.toHexString (((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100);
|
||||
in {
|
||||
options.stylix.targets.dunst.enable =
|
||||
config.lib.stylix.mkEnableTarget "Dunst" true;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
options.stylix.targets.fish.enable =
|
||||
config.lib.stylix.mkEnableTarget "Fish" true;
|
||||
|
||||
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fish.enable) {
|
||||
programs.fish.interactiveShellInit = import ./prompt.nix { inherit pkgs config; };
|
||||
programs.fish.interactiveShellInit = import ./prompt.nix config;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
options.stylix.targets.fish.enable =
|
||||
config.lib.stylix.mkEnableTarget "Fish" true;
|
||||
|
||||
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fish.enable) {
|
||||
programs.fish.promptInit = import ./prompt.nix { inherit pkgs config; };
|
||||
programs.fish.promptInit = import ./prompt.nix config;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config }:
|
||||
config:
|
||||
|
||||
let
|
||||
theme = config.lib.stylix.colors {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.stylix.targets.foot;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
with config.lib.stylix.colors;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
mkFzfKeyValue = lib.generators.mkKeyValueDefault { } ":";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
style = config.lib.stylix.colors {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config, lib, ... }@args:
|
||||
{ pkgs, config, lib, ... }:
|
||||
|
||||
let
|
||||
inherit (config.stylix.fonts) sansSerif serif monospace;
|
||||
|
@ -39,7 +39,9 @@ in {
|
|||
|
||||
xdg.dataFile."themes/Stylix/gnome-shell/gnome-shell.css" = {
|
||||
source =
|
||||
let theme = import ./theme.nix args;
|
||||
let theme = pkgs.callPackage ./theme.nix {
|
||||
inherit (config.lib.stylix) colors templates;
|
||||
};
|
||||
in "${theme}/share/gnome-shell/gnome-shell.css";
|
||||
onChange = ''
|
||||
if [[ -x "$(command -v gnome-extensions)" ]]; then
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
{ lib, pkgs, config, ... }@args:
|
||||
{ lib, pkgs, config, ... }:
|
||||
|
||||
let
|
||||
theme = import ./theme.nix args;
|
||||
theme = pkgs.callPackage ./theme.nix {
|
||||
inherit (config.lib.stylix) colors templates;
|
||||
};
|
||||
|
||||
in {
|
||||
options.stylix.targets.gnome.enable =
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ stdenv, sass, glib, colors, templates }:
|
||||
|
||||
let
|
||||
colors = config.lib.stylix.colors {
|
||||
colorsScss = colors {
|
||||
template = ./colors.mustache;
|
||||
extension = "scss";
|
||||
};
|
||||
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
name = "${config.lib.stylix.colors.slug}-gnome-shell-theme";
|
||||
src = config.lib.stylix.templates.gnome-shell;
|
||||
in stdenv.mkDerivation {
|
||||
name = "${colors.slug}-gnome-shell-theme";
|
||||
src = templates.gnome-shell;
|
||||
patches = [ ./shell_colors.patch ];
|
||||
postPatch = ''
|
||||
rm data/theme/gnome-shell-sass/{_colors.scss,_default-colors.scss,_palette.scss}
|
||||
cp ${colors} data/theme/gnome-shell-sass/_colors.scss
|
||||
cp ${colorsScss} data/theme/gnome-shell-sass/_colors.scss
|
||||
'';
|
||||
|
||||
nativeBuildInputs = with pkgs; [ sass glib.dev ];
|
||||
nativeBuildInputs = [ sass glib.dev ];
|
||||
buildPhase = ''
|
||||
sass data/theme/gnome-shell-light.scss \
|
||||
>data/theme/gnome-shell-light.css
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
options.stylix.targets.gtk.enable =
|
||||
|
|
|
@ -9,7 +9,7 @@ let
|
|||
unfocused = base03;
|
||||
|
||||
fonts = let
|
||||
fonts = config.stylix.fonts;
|
||||
inherit (config.stylix) fonts;
|
||||
in {
|
||||
names = [ fonts.sansSerif.name ];
|
||||
size = fonts.sizes.desktop * 1.0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.stylix.targets.kitty;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{pkgs, config, lib, options, ... }:
|
||||
{ config, lib, options, ... }:
|
||||
|
||||
with config.lib.stylix.colors.withHashtag;
|
||||
with config.stylix.fonts;
|
||||
let
|
||||
makoOpacity = lib.toHexString ((((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100));
|
||||
makoOpacity = lib.toHexString (((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100);
|
||||
in {
|
||||
options.stylix.targets.mako.enable =
|
||||
config.lib.stylix.mkEnableTarget "Mako" true;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
fonts = config.stylix.fonts;
|
||||
colors = config.lib.stylix.colors;
|
||||
opacity = config.stylix.opacity;
|
||||
inherit (config.stylix) fonts opacity;
|
||||
inherit (config.lib.stylix) colors;
|
||||
in {
|
||||
options.stylix.targets.mangohud.enable = config.lib.stylix.mkEnableTarget "mangohud" true;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ with config.lib.stylix.colors;
|
|||
config.nixpkgs.overlays = lib.mkIf (config.stylix.enable && config.stylix.targets.nixos-icons.enable) [(self: super: {
|
||||
nixos-icons = super.nixos-icons.overrideAttrs (oldAttrs: {
|
||||
src = pkgs.applyPatches {
|
||||
src = oldAttrs.src;
|
||||
inherit (oldAttrs) src;
|
||||
prePatch = ''
|
||||
substituteInPlace logo/nix-snowflake-white.svg --replace-fail '#ffffff' '#${base05}'
|
||||
|
||||
|
|
|
@ -17,25 +17,10 @@
|
|||
lib.optionalAttrs (builtins.hasAttr "nixvim" options.programs) {
|
||||
programs.nixvim = {
|
||||
colorschemes.base16 = {
|
||||
colorscheme = let
|
||||
colors = config.lib.stylix.colors.withHashtag;
|
||||
in {
|
||||
base00 = colors.base00;
|
||||
base01 = colors.base01;
|
||||
base02 = colors.base02;
|
||||
base03 = colors.base03;
|
||||
base04 = colors.base04;
|
||||
base05 = colors.base05;
|
||||
base06 = colors.base06;
|
||||
base07 = colors.base07;
|
||||
base08 = colors.base08;
|
||||
base09 = colors.base09;
|
||||
base0A = colors.base0A;
|
||||
base0B = colors.base0B;
|
||||
base0C = colors.base0C;
|
||||
base0D = colors.base0D;
|
||||
base0E = colors.base0E;
|
||||
base0F = colors.base0F;
|
||||
colorscheme = {
|
||||
inherit (config.lib.stylix.colors.withHashtag)
|
||||
base00 base01 base02 base03 base04 base05 base06 base07
|
||||
base08 base09 base0A base0B base0C base0D base0E base0F;
|
||||
};
|
||||
|
||||
enable = true;
|
||||
|
|
|
@ -199,7 +199,7 @@ in {
|
|||
};
|
||||
|
||||
indicator = {
|
||||
error = error;
|
||||
inherit error;
|
||||
start = secondary-info;
|
||||
stop = info;
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
colors = config.lib.stylix.colors;
|
||||
fonts = config.stylix.fonts;
|
||||
inherit (config.lib.stylix) colors;
|
||||
inherit (config.stylix) fonts;
|
||||
in {
|
||||
options.stylix.targets.sxiv.enable =
|
||||
config.lib.stylix.mkEnableTarget "Sxiv" true;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
theme = config.lib.stylix.colors {
|
||||
|
|
|
@ -10,7 +10,7 @@ with config.lib.stylix.colors.withHashtag; {
|
|||
config = lib.mkIf (config.stylix.enable && config.stylix.targets.tofi.enable) {
|
||||
programs.tofi.settings =
|
||||
let
|
||||
opacity = lib.toHexString ((((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100));
|
||||
opacity = lib.toHexString (((builtins.ceil (config.stylix.opacity.popups * 100)) * 255) / 100);
|
||||
background = base00 + opacity;
|
||||
foreground = base05;
|
||||
darkForeground = base04 + opacity;
|
||||
|
|
|
@ -18,7 +18,7 @@ let
|
|||
};
|
||||
|
||||
vimOptions = let
|
||||
fonts = config.stylix.fonts;
|
||||
inherit (config.stylix) fonts;
|
||||
in {
|
||||
plugins = [ themePlugin ];
|
||||
extraConfig = with config.lib.stylix.colors.withHashtag; ''
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config, lib, ... }@args:
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
# Disabled by default due to https://github.com/danth/stylix/issues/180
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
options.stylix.targets.zellij.enable =
|
||||
|
|
|
@ -9,6 +9,6 @@ for:
|
|||
if kind == "directory"
|
||||
then let
|
||||
file = "${../modules}/${path}/${for}.nix";
|
||||
in (if builtins.pathExists file then [ file ] else [ ])
|
||||
in if builtins.pathExists file then [ file ] else [ ]
|
||||
else [ ])
|
||||
(builtins.readDir ../modules))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, lib, ... } @ args:
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
options.stylix.cursor = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, config, lib, ... } @ args:
|
||||
{ pkgs, config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.stylix.fonts;
|
||||
|
|
|
@ -8,9 +8,7 @@ in {
|
|||
|
||||
config = lib.mkIf (config.stylix.enable && pkgs.stdenv.hostPlatform.isLinux) {
|
||||
home.pointerCursor = {
|
||||
name = cfg.name;
|
||||
package = cfg.package;
|
||||
size = cfg.size;
|
||||
inherit (cfg) name package size;
|
||||
x11.enable = true;
|
||||
gtk.enable = true;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
inputs:
|
||||
{ palette-generator, base16 }:
|
||||
{ config, lib, ... }:
|
||||
{ lib, ... }:
|
||||
|
||||
let
|
||||
autoload = import ../autoload.nix { inherit lib; } "hm";
|
||||
|
|
|
@ -5,7 +5,7 @@ let
|
|||
in {
|
||||
imports = [ ../fonts.nix ];
|
||||
config.fonts = lib.mkIf config.stylix.enable {
|
||||
packages = cfg.packages;
|
||||
inherit (cfg) packages;
|
||||
|
||||
fontconfig.defaultFonts = {
|
||||
monospace = [ cfg.monospace.name ];
|
||||
|
|
Loading…
Add table
Reference in a new issue