cicd schemes
This commit is contained in:
parent
1ba04c465f
commit
e15b93c43a
52
.github/workflows/build-schemes.yml
vendored
Normal file
52
.github/workflows/build-schemes.yml
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
name: Build All Color Schemes
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'config/schemes.nix'
|
||||
- 'config/scheme-utils.nix'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-schemes:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Nix
|
||||
uses: cachix/install-nix-action@v23
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixpkgs-unstable
|
||||
|
||||
- name: Get available schemes
|
||||
id: schemes
|
||||
run: |
|
||||
SCHEMES=$(nix eval --raw --expr '
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
inputs = {};
|
||||
utils = import ./scripts/scheme-utils.nix { inherit pkgs inputs; };
|
||||
in
|
||||
builtins.concatStringsSep " " utils.availableSchemes
|
||||
')
|
||||
echo "schemes=$SCHEMES" >> $GITHUB_OUTPUT
|
||||
echo "Available schemes: $SCHEMES"
|
||||
|
||||
- name: Build all schemes
|
||||
run: |
|
||||
for scheme in ${{ steps.schemes.outputs.schemes }}; do
|
||||
echo "Building scheme: $scheme"
|
||||
nix build .#nixosConfigurations.${HOSTNAME}.config.system.build.toplevel \
|
||||
--override-input stylix-scheme $scheme \
|
||||
--out-link ./result-$scheme &
|
||||
done
|
||||
wait
|
||||
echo "All schemes built successfully!"
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: nixos-configurations
|
||||
path: ./result-*
|
||||
retention-days: 7
|
||||
34
scripts/build-all-schemes.nix
Normal file
34
scripts/build-all-schemes.nix
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
hostname ? "server",
|
||||
}:
|
||||
let
|
||||
utils = import ./scheme-utils.nix { inherit pkgs inputs; };
|
||||
schemes = utils.availableSchemes;
|
||||
mkBuildScript =
|
||||
scheme:
|
||||
pkgs.writeShellScript "build-${scheme}" ''
|
||||
echo "Building NixOS configuration with scheme: ${scheme}"
|
||||
nix build .#nixosConfigurations.${hostname}.config.system.build.toplevel \
|
||||
--override-input stylix-scheme ${scheme} \
|
||||
--out-link ./result-${scheme}
|
||||
echo "Build completed for scheme: ${scheme}"
|
||||
'';
|
||||
buildAllScript = pkgs.writeShellScript "build-all-schemes" ''
|
||||
echo "Building all ${toString (builtins.length schemes)} schemes in parallel..."
|
||||
echo "Schemes: ${builtins.concatStringsSep " " schemes}"
|
||||
${builtins.concatStringsSep "\n" (map (scheme: "${mkBuildScript scheme} &") schemes)}
|
||||
wait
|
||||
echo "All schemes built successfully!"
|
||||
echo "Results available in ./result-* directories"
|
||||
'';
|
||||
|
||||
in
|
||||
{
|
||||
inherit schemes buildAllScript;
|
||||
buildScripts = builtins.listToAttrs (
|
||||
map (scheme: pkgs.lib.nameValuePair "build-${scheme}" (mkBuildScript scheme)) schemes
|
||||
);
|
||||
inherit (utils) lightSchemes darkSchemes availableColors;
|
||||
}
|
||||
47
scripts/list-schemes.sh
Executable file
47
scripts/list-schemes.sh
Executable file
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
# Script to list all available schemes from schemes.nix
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
echo "Available schemes:"
|
||||
nix eval --raw --impure --expr "
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
inputs = {};
|
||||
utils = import ./scripts/scheme-utils.nix { inherit pkgs inputs; };
|
||||
in
|
||||
builtins.concatStringsSep \"\n\" utils.availableSchemes
|
||||
"
|
||||
|
||||
echo -e "\nLight schemes:"
|
||||
nix eval --raw --impure --expr "
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
inputs = {};
|
||||
utils = import ./scripts/scheme-utils.nix { inherit pkgs inputs; };
|
||||
in
|
||||
builtins.concatStringsSep \"\n\" utils.lightSchemes
|
||||
"
|
||||
|
||||
echo -e "\nDark schemes:"
|
||||
nix eval --raw --impure --expr "
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
inputs = {};
|
||||
utils = import ./scripts/scheme-utils.nix { inherit pkgs inputs; };
|
||||
in
|
||||
builtins.concatStringsSep \"\n\" utils.darkSchemes
|
||||
"
|
||||
|
||||
echo -e "\nAvailable colors:"
|
||||
nix eval --raw --impure --expr "
|
||||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
inputs = {};
|
||||
utils = import ./scripts/scheme-utils.nix { inherit pkgs inputs; };
|
||||
in
|
||||
builtins.concatStringsSep \"\n\" utils.availableColors
|
||||
"
|
||||
28
scripts/scheme-utils.nix
Normal file
28
scripts/scheme-utils.nix
Normal file
@ -0,0 +1,28 @@
|
||||
{ pkgs, inputs }:
|
||||
let
|
||||
schemesConfig = import ../config/schemes.nix { inherit pkgs inputs; };
|
||||
availableSchemes = builtins.attrNames schemesConfig.schemes;
|
||||
in
|
||||
{
|
||||
inherit availableSchemes;
|
||||
lightSchemes = builtins.filter (
|
||||
name: schemesConfig.schemes.${name}.polarity == "light"
|
||||
) availableSchemes;
|
||||
darkSchemes = builtins.filter (
|
||||
name: schemesConfig.schemes.${name}.polarity == "dark"
|
||||
) availableSchemes;
|
||||
schemesByColor =
|
||||
color: builtins.filter (name: schemesConfig.schemes.${name}.color == color) availableSchemes;
|
||||
getScheme = name: schemesConfig.schemes.${name};
|
||||
isValidScheme = name: builtins.hasAttr name schemesConfig.schemes;
|
||||
availableColors = pkgs.lib.unique (
|
||||
builtins.filter (color: color != null) (
|
||||
builtins.map (name: schemesConfig.schemes.${name}.color) availableSchemes
|
||||
)
|
||||
);
|
||||
availableBase16Schemes = pkgs.lib.unique (
|
||||
builtins.filter (name: name != null) (
|
||||
builtins.map (name: schemesConfig.schemes.${name}.name) availableSchemes
|
||||
)
|
||||
);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user