mirror of
https://github.com/voidlhf/StarRailGrubThemes.git
synced 2025-01-05 10:16:54 +08:00
feat(nix): added nix flake into repository
This commit is contained in:
parent
41a004ca19
commit
ca24f67d5c
35
.github/workflows/nix.yml
vendored
Normal file
35
.github/workflows/nix.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
name: Check nix packages
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
push:
|
||||
branches: [master]
|
||||
jobs:
|
||||
check:
|
||||
name: Check Nix
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Check Nix flake inputs
|
||||
uses: DeterminateSystems/flake-checker-action@v5
|
||||
with:
|
||||
send-statistics: false
|
||||
fail-mode: true
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@v9
|
||||
- name: Check repository
|
||||
run: nix flake check
|
||||
- name: Build packages
|
||||
run: nix build .#${{ matrix.theme }}-grub-theme
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
theme: [ acheron argenti blackswan dr.ratio hanya huohuo luocha ruanmei sparkle acheron_cn argenti_cn blackswan_cn dr.ratio_cn hanya_cn huohuo_cn luocha_cn ruanmei_cn sparkle_cn ]
|
||||
name: Build Nix
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/nix-installer-action@v9
|
||||
- name: Build packages
|
||||
run: nix build .#${{ matrix.theme }}-grub-theme
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
.envrc
|
||||
.direnv
|
||||
.vscode
|
||||
result
|
21
README.md
21
README.md
@ -38,6 +38,27 @@ sudo grub-mkconfig -o /boot/grub/grub.cfg
|
||||
```
|
||||
|
||||
6. Reboot the computer
|
||||
|
||||
### For NixOS users
|
||||
1. Added flake into your configuration
|
||||
```nix
|
||||
inputs.honkai-railway-grub-theme.url = "github:voidlhf/StarRailGrubThemes";
|
||||
```
|
||||
|
||||
2. Set up theme in your configuration
|
||||
```nix
|
||||
honkai-railway-grub-theme = {
|
||||
enable = true;
|
||||
# Remember
|
||||
# Theme name should have the same name as in assets/themes directory e.g. Dr.Ratio_cn is correct
|
||||
# 'theme' field is optional. Default theme is Acheron.
|
||||
theme = "RuanMei";
|
||||
};
|
||||
```
|
||||
|
||||
3. Rebuild your system
|
||||
4. Reboot computer to see your theme :)
|
||||
|
||||
## Preview
|
||||
![Acheron](/preview/Acheron.png)
|
||||
![BlackSwan](/preview/BlackSwan.png)
|
||||
|
27
default.nix
Normal file
27
default.nix
Normal file
@ -0,0 +1,27 @@
|
||||
{ stdenvNoCC
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, theme
|
||||
}:
|
||||
|
||||
let
|
||||
themes = builtins.attrNames (builtins.readDir ./assets/themes);
|
||||
in
|
||||
|
||||
assert builtins.any (x: x == theme) themes;
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "StarRailGrubThemes";
|
||||
|
||||
src = ./.;
|
||||
|
||||
installPhase = "cp -r ./assets/themes/${theme} $out";
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/voidlhf/StarRailGrubThemes";
|
||||
description = "A pack of GRUB2 themes for Honkai: Star Rail";
|
||||
license = licenses.gpl3;
|
||||
maintainers = with maintainers; [ Wittano ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
61
flake.lock
Normal file
61
flake.lock
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1712791164,
|
||||
"narHash": "sha256-3sbWO1mbpWsLepZGbWaMovSO7ndZeFqDSdX0hZ9nVyw=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1042fd8b148a9105f3c0aca3a6177fd1d9360ba5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
36
flake.nix
Normal file
36
flake.nix
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
description = "A pack of GRUB2 themes for Honkai: Star Rail";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
let
|
||||
systems = [ "aarch64-linux" "i686-linux" "x86_64-linux" ];
|
||||
in
|
||||
flake-utils.lib.eachSystem systems (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
themeNames = builtins.attrNames (builtins.readDir ./assets/themes);
|
||||
themePackages = builtins.listToAttrs (builtins.map
|
||||
(theme: {
|
||||
name = "${pkgs.lib.strings.toLower theme}-grub-theme";
|
||||
value = pkgs.callPackage ./default.nix { inherit theme; };
|
||||
})
|
||||
themeNames);
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
default = pkgs.callPackage ./default.nix { theme = "Acheron"; };
|
||||
} // themePackages;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [ nixpkgs-fmt nixd ];
|
||||
};
|
||||
|
||||
nixosModules.default = ./module.nix;
|
||||
});
|
||||
}
|
26
module.nix
Normal file
26
module.nix
Normal file
@ -0,0 +1,26 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.honkai-railway-grub-theme;
|
||||
themeNames = builtins.attrNames (builtins.readDir ./assets/themes);
|
||||
in
|
||||
{
|
||||
options = {
|
||||
honkai-railway-grub-theme = {
|
||||
enable = mkEnableOption "Enable Honaki Railway GRUB2 theme";
|
||||
theme = mkOption {
|
||||
type = types.enum themeNames;
|
||||
default = "Acheron";
|
||||
example = "Dr.Ratio";
|
||||
description = "Selected theme name. IMPORTANT! Theme name must be the same as in assert/themes directory";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable) {
|
||||
boot.loader.grub = {
|
||||
theme = pkgs.callPackage ./default.nix { theme = cfg.theme; };
|
||||
splashImage = ./assets/themes/${cfg.theme}/background.png;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user