Skip to content

Commit

Permalink
treewide: test PR #519 (v7)
Browse files Browse the repository at this point in the history
  • Loading branch information
trueNAHO committed Jan 4, 2025
1 parent f9daee0 commit a090a43
Show file tree
Hide file tree
Showing 181 changed files with 11,601 additions and 186 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
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
44 changes: 44 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
# Derived from
# https://github.com/NixOS/nixpkgs/blob/2ab6f6d61630889491f86396b27a76ffb6fbc7bb/.github/workflows/backport.yml
name: Backport

on: # yamllint disable-line rule:truthy
pull_request_target:
types: [closed, labeled]

permissions: {}

jobs:
backport:
runs-on: ubuntu-latest

if: >
(
github.repository_owner == 'danth' &&
github.event.pull_request.merged == true &&
(
github.event_name != 'labeled' ||
startsWith('backport', github.event.label.name)
)
)
steps:
# Use a GitHub App rather than the default token so that GitHub Actions
# workflows may run on the created pull request.
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.BACKPORT_APP_ID }}
private-key: ${{ secrets.BACKPORT_PRIVATE_KEY }}

- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ steps.app-token.outputs.token }}

- uses: korthout/backport-action@v3
with:
github_token: ${{ steps.app-token.outputs.token }}
pull_title: "[${target_branch}] ${pull_title}"
pull_description: "This is an automated backport of #${pull_number}."
83 changes: 83 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
name: Check

on: # yamllint disable-line rule:truthy
push:

permissions:
contents: read

jobs:
get-derivations:
runs-on: ubuntu-24.04

steps:
- uses: DeterminateSystems/nix-installer-action@v16
- uses: DeterminateSystems/magic-nix-cache-action@v8

- id: get-derivations
run: |
nix flake show --json \
github:${{
github.repository
}}/${{
github.event.pull_request.head.sha || github.sha
}} |
jq --raw-output '
def format_output($arch; $type):
{
arch: $arch,
key: .,
os: (
if $arch == "x86_64-linux" then
"ubuntu-24.04"
else
"macos-14"
end
),
type: $type
};
[
["x86_64-linux", "x86_64-darwin"][] as $arch |
(.checks[$arch] | keys) as $checks |
(.packages[$arch] | keys) as $packages |
(($checks - $packages)[] | format_output($arch; "checks")),
($packages[] | format_output($arch; "packages"))
] |
"derivations=\(.)"
' >> $GITHUB_OUTPUT
outputs:
derivations: ${{ steps.get-derivations.outputs.derivations }}

check:
runs-on: ${{ matrix.check.os }}

name: ${{ matrix.check.key }} on ${{ matrix.check.arch }}
needs: get-derivations

strategy:
fail-fast: false
matrix:
check: ${{ fromJSON(needs.get-derivations.outputs.derivations) }}

steps:
- uses: DeterminateSystems/nix-installer-action@v16
- uses: DeterminateSystems/magic-nix-cache-action@v8

- run: |
nix build --no-update-lock-file --print-build-logs \
github:${{
github.repository
}}/${{
github.event.pull_request.head.sha || github.sha
}}#${{
matrix.check.type
}}.${{
matrix.check.arch
}}.${{
matrix.check.key
}}
36 changes: 36 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Docs

on: # yamllint disable-line rule:truthy
push:
branches:
- master

concurrency:
cancel-in-progress: true
group: pages

jobs:
docs:
runs-on: ubuntu-24.04

permissions:
contents: read
id-token: write
pages: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v16
- uses: DeterminateSystems/magic-nix-cache-action@v8
- run: nix build .#docs

- uses: actions/upload-pages-artifact@v3
with:
path: result

- uses: actions/deploy-pages@v4
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.direnv/
/.pre-commit-config.yaml
result
result-*
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020-2025 Daniel Thwaites and the Stylix contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Stylix

Stylix is a NixOS module which applies the same colour scheme, font and
wallpaper to a range of applications and desktop environments.

## What's this?

[base16.nix](https://github.com/SenchoPens/base16.nix#readme) allows you to
import colours from [base16](https://github.com/chriskempson/base16#readme)
into Nix code. Stylix takes this a step further:

- Automatically colours and changes the font of apps
- Sets your wallpaper
- Exports the colour scheme to be used manually for anything we missed
- Can also generate themes based on an image

For those not familiar with [NixOS](https://nixos.org/) and
[Home Manager](https://github.com/nix-community/home-manager#readme):

- NixOS is a Linux distribution
- Home Manager is a program which runs anywhere
- Both use the Nix language and package manager
- Both let you install programs and change settings via code

Stylix supports either NixOS + Home Manager, or Home Manager on its own.
Certain features are only available with NixOS.

## Resources

Please refer to the [Stylix book](https://danth.github.io/stylix/)
for instructions and a list of supported apps.

For a visual guide, watch the [*Ricing Linux Has Never Been Easier | NixOS +
Stylix*](https://youtu.be/ljHkWgBaQWU) YouTube video by
[Vimjoyer](https://www.youtube.com/@vimjoyer).

> [!NOTE]
>
> It's now necessary to include `stylix.enable = true` in your configuration
> for any other settings to take effect. This is not mentioned in the video
> linked above.
If you have any questions, you are welcome to
join our [Matrix room](https://matrix.to/#/#stylix:danth.me),
or ask on [GitHub Discussions](https://github.com/danth/stylix/discussions).

## Example configurations

### GNOME 46

![GNOME 46](./gnome.png)

Photos by [Clay Banks](https://unsplash.com/photos/three-bicycles-parked-in-front-of-building-hwLAI5lRhdM)
and [Derrick Cooper](https://unsplash.com/photos/brown-road-in-forest-during-daytime-L505cPnmIds).

Try a live demo of this theme by running
`nix run github:danth/stylix#testbed-gnome-light` or
`nix run github:danth/stylix#testbed-gnome-dark`.

### KDE Plasma 5

![KDE Plasma 5](./kde.png)

Photos by [Aniket Deole](https://unsplash.com/photos/mountain-surrounded-by-trees-under-cloudy-sky-T-tOgjWZ0fQ)
and [Tom Gainor](https://unsplash.com/photos/landscape-photography-of-body-of-water-overlooking-mountain-range-ZqLeQDjY6fY).

KDE theming is still a work in progress - so some manual steps may be needed
to apply the settings completely.
14 changes: 9 additions & 5 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
imports = [
./stylix/default.nix
];
}
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
) { src = ./.; }).defaultNix
9 changes: 9 additions & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[book]
title = "Stylix"
language = "en"

[output.html]
site-url = "/stylix/"
git-repository-url = "https://github.com/danth/stylix"
edit-url-template = "https://github.com/danth/stylix/edit/master/docs/{path}"

78 changes: 78 additions & 0 deletions docs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
pkgs,
lib,
inputs,
...
}:

let
makeOptionsDoc =
configuration:
pkgs.nixosOptionsDoc {
inherit (configuration) options;

# Filter out any options not beginning with `stylix`
transformOptions =
option:
option
// {
visible = option.visible && builtins.elemAt option.loc 0 == "stylix";
};
};

nixos = makeOptionsDoc (
lib.nixosSystem {
inherit (pkgs) system;
modules = [
inputs.home-manager.nixosModules.home-manager
inputs.self.nixosModules.stylix
./settings.nix
];
}
);

homeManager = makeOptionsDoc (
inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
inputs.self.homeManagerModules.stylix
./settings.nix
{
home = {
homeDirectory = "/home/book";
stateVersion = "22.11";
username = "book";
};
}
];
}
);

in
pkgs.stdenvNoCC.mkDerivation {
name = "stylix-book";
src = ./.;

patchPhase = ''
cp ${../README.md} src/README.md
cp ${../gnome.png} src/gnome.png
cp ${../kde.png} src/kde.png
# mdBook doesn't support this Markdown extension yet
substituteInPlace **/*.md \
--replace-quiet '> [!NOTE]' '> **Note**' \
--replace-quiet '> [!TIP]' '> **Tip**' \
--replace-quiet '> [!IMPORTANT]' '> **Important**' \
--replace-quiet '> [!WARNING]' '> **Warning**' \
--replace-quiet '> [!CAUTION]' '> **Caution**'
# The "declared by" links point to a file which only exists when the docs
# are built locally. This removes the links.
sed '/*Declared by:*/,/^$/d' <${nixos.optionsCommonMark} >>src/options/nixos.md
sed '/*Declared by:*/,/^$/d' <${homeManager.optionsCommonMark} >>src/options/hm.md
'';

buildPhase = ''
${pkgs.mdbook}/bin/mdbook build --dest-dir $out
'';
}
Loading

0 comments on commit a090a43

Please sign in to comment.