cicd schemes
This commit is contained in:
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
|
||||
)
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user