Skip to content

Commit

Permalink
Merge branch 'danth:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
i-am-logger authored Sep 19, 2024
2 parents ec197e8 + 149b313 commit aff52a5
Show file tree
Hide file tree
Showing 20 changed files with 298 additions and 80 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
version: 2

updates:
- package-ecosystem: github-actions

commit-message:
prefix: ci

directory: /

schedule:
interval: daily
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: cp -r --dereference --no-preserve=mode,ownership result/ public/

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: public/

Expand All @@ -54,4 +54,4 @@ jobs:
steps:
- name: Deploy docs to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
1 change: 0 additions & 1 deletion docs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ in pkgs.stdenvNoCC.mkDerivation {
cp ${../README.md} src/README.md
cp ${../gnome.png} src/gnome.png
cp ${../kde.png} src/kde.png
cp ${../CONTRIBUTING.md} src/contributing.md
# mdBook doesn't support this Markdown extension yet
substituteInPlace **/*.md \
Expand Down
2 changes: 1 addition & 1 deletion docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# Contributing

- [Contributing](contributing.md)
- [Commit Convention](commit_convention.md)
- [Adding modules](modules.md)
- [Testbeds](testbeds.md)
- [Style guide](styling.md)
6 changes: 2 additions & 4 deletions CONTRIBUTING.md → docs/src/commit_convention.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Contributing to Stylix

## Commit messages
# Commit Convention

To keep things consistent, commit messages should follow a format
[similar to Nixpkgs](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#commit-conventions):
Expand Down Expand Up @@ -31,7 +29,7 @@ punctuation.
Most commits to `master` will also include a pull request number in brackets
after the summary. GitHub adds this automatically when creating a squash merge.

### Old commits
## Old commits

Commits before 2024 did not follow any particular format.
Some have emojis from [GitMoji](https://gitmoji.dev).
6 changes: 3 additions & 3 deletions docs/src/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ The current scheme can be previewed in a web browser at either
### Handmade schemes

If you prefer a handmade color scheme, you can choose anything from
[the Tinted Theming repository](https://github.com/tinted-theming/base16-schemes):
[the Tinted Theming repository](https://github.com/tinted-theming/schemes):

```nix
{
Expand All @@ -89,11 +89,11 @@ only the user override is used.

When passing colors to unsupported targets or creating custom modules, it
is possible to access values from the configured color scheme through
`lib.stylix.colors`.
`config.lib.stylix.colors`.
An overview of the available values is shown below.

```nix
lib.stylix.colors = {
config.lib.stylix.colors = {
base08 = "ff0000";
base08-hex-r = "ff";
base08-dec-r = "0.996094";
Expand Down
57 changes: 47 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 29 additions & 27 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
url = "github:edolstra/flake-compat";
};

flake-utils = {
inputs.systems.follows = "systems";
url = "github:numtide/flake-utils";
};

gnome-shell = {
flake = false;

Expand All @@ -53,37 +58,34 @@
};

nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

# Interface flake systems.
systems.url = "github:nix-systems/default";
};

outputs =
{ nixpkgs, base16, self, ... }@inputs:
{
packages = nixpkgs.lib.genAttrs [
"aarch64-darwin"
"aarch64-linux"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
] (
system:
let
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};

universalPackages = {
docs = import ./docs { inherit pkgs inputs lib; };
palette-generator = pkgs.callPackage ./palette-generator { };
};

# Testbeds are virtual machines based on NixOS, therefore they are
# only available for Linux systems.
testbedPackages = lib.optionalAttrs
(lib.hasSuffix "-linux" system)
(import ./stylix/testbed.nix { inherit pkgs inputs lib; });
in
universalPackages // testbedPackages
);

inputs.flake-utils.lib.eachDefaultSystem (
system: let
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
in {
packages = let
universalPackages = {
docs = import ./docs { inherit pkgs inputs lib; };
palette-generator = pkgs.callPackage ./palette-generator { };
};

# Testbeds are virtual machines based on NixOS, therefore they are
# only available for Linux systems.
testbedPackages = lib.optionalAttrs
(lib.hasSuffix "-linux" system)
(import ./stylix/testbed.nix { inherit pkgs inputs lib; });
in
universalPackages // testbedPackages;
}
)
// {
nixosModules.stylix = { pkgs, ... }@args: {
imports = [
(import ./stylix/nixos inputs {
Expand Down
3 changes: 2 additions & 1 deletion modules/emacs/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ with config.stylix.fonts;

let
emacsOpacity = builtins.toString (builtins.ceil (config.stylix.opacity.applications * 100));
emacsSize = builtins.toString (sizes.terminal * 1.0);
in
{
options.stylix.targets.emacs.enable =
Expand Down Expand Up @@ -65,7 +66,7 @@ in
(setq base16-theme-256-color-source 'colors)
(load-theme 'base16-stylix t)
;; Set font
(set-face-attribute 'default t :font "${monospace.name}" )
(set-face-attribute 'default t :font (font-spec :family "${monospace.name}" :size ${emacsSize}))
;; -----------------------------
;; set opacity
(add-to-list 'default-frame-alist '(alpha-background . ${emacsOpacity}))
Expand Down
6 changes: 5 additions & 1 deletion modules/fish/prompt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ let
};
in ''
source ${theme}
base16-${config.lib.stylix.colors.slug}
# See https://github.com/tomyun/base16-fish/issues/7 for why this condition exists
if status --is-interactive && test -z "$TMUX"
base16-${config.lib.stylix.colors.slug}
end
''
28 changes: 13 additions & 15 deletions modules/gnome/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,22 @@ in {
# As Stylix is controlling the wallpaper, there is no need for this
# pack of default wallpapers to be installed.
# If you want to use one, you can set stylix.image to something like
# "${pkgs.gnome.gnome-backgrounds}/path/to/your/preferred/background"
# "${pkgs.gnome-backgrounds}/path/to/your/preferred/background"
# which will then download the pack regardless of its exclusion below.
environment.gnome.excludePackages = [ pkgs.gnome.gnome-backgrounds ];
environment.gnome.excludePackages = [ pkgs.gnome-backgrounds ];

nixpkgs.overlays = [(self: super: {
gnome = super.gnome.overrideScope (gnomeSelf: gnomeSuper: {
gnome-shell = gnomeSuper.gnome-shell.overrideAttrs (oldAttrs: {
# Themes are usually applied via an extension, but extensions are
# not available on the login screen. The only way to change the
# theme there is by replacing the default.
postFixup = (oldAttrs.postFixup or "") + ''
cp ${theme}/share/gnome-shell/gnome-shell-theme.gresource \
$out/share/gnome-shell/gnome-shell-theme.gresource
'';
patches = (oldAttrs.patches or []) ++ [
./shell_remove_dark_mode.patch
];
});
gnome-shell = super.gnome-shell.overrideAttrs (oldAttrs: {
# Themes are usually applied via an extension, but extensions are
# not available on the login screen. The only way to change the
# theme there is by replacing the default.
postFixup = (oldAttrs.postFixup or "") + ''
cp ${theme}/share/gnome-shell/gnome-shell-theme.gresource \
$out/share/gnome-shell/gnome-shell-theme.gresource
'';
patches = (oldAttrs.patches or []) ++ [
./shell_remove_dark_mode.patch
];
});
})];

Expand Down
2 changes: 1 addition & 1 deletion modules/hyprland/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ in {

config =
lib.mkIf
(config.stylix.enable && config.stylix.targets.hyprland.enable)
(config.stylix.enable && config.stylix.targets.hyprland.enable && config.wayland.windowManager.hyprland.enable)
{
services.hyprpaper.enable = true;
stylix.targets.hyprpaper.enable = true;
Expand Down
9 changes: 6 additions & 3 deletions modules/kde/testbed.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
services.xserver = {
enable = true;
desktopManager.plasma5.enable = true;
services = {
displayManager.sddm.enable = true;

xserver = {
enable = true;
desktopManager.plasma5.enable = true;
};
};
}
33 changes: 33 additions & 0 deletions modules/ncspot/hm.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{ config, lib, ... }:

{
options.stylix.targets.ncspot.enable =
config.lib.stylix.mkEnableTarget "Ncspot" true;

config = lib.mkIf (config.stylix.enable && config.stylix.targets.ncspot.enable) {
programs.ncspot.settings =
let
colors = config.lib.stylix.colors.withHashtag;
in {
theme = with colors; {
background = base00;
primary = base05;
secondary = base03;
title = base06;
playing = base05;
playing_selected = base06;
playing_bg = base02;
highlight = base05;
highlight_bg = base02;
error = base07;
error_bg = base0F;
statusbar = base00;
statusbar_progress = base04;
statusbar_bg = base04;
cmdline = base05;
cmdline_bg = base00;
search_match = base05;
};
};
};
}
Loading

0 comments on commit aff52a5

Please sign in to comment.