-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from zakuciael/master
feat: add nix flake
- Loading branch information
Showing
8 changed files
with
296 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Check nix packages | ||
on: | ||
pull_request: | ||
paths: | ||
- "./*.nix" | ||
- ".github/workflows/nix.yml" | ||
- "assets/**" | ||
- "customize/**" | ||
push: | ||
branches: [master] | ||
paths: | ||
- "./*.nix" | ||
- ".github/workflows/nix.yml" | ||
- "assets/**" | ||
- "customize/**" | ||
jobs: | ||
flake: | ||
name: Check flake | ||
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 | ||
matrix: | ||
name: Generate build matrix | ||
runs-on: ubuntu-latest | ||
outputs: | ||
themes: ${{ steps.generate-matrix.outputs.themes }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Generate matrix | ||
id: generate-matrix | ||
run: | | ||
THEMES=$(ls assets/backgrounds/ | sed 's/\.png$//g' | jq --raw-input | jq --slurp -c) | ||
echo "themes=$THEMES" >> $GITHUB_OUTPUT | ||
build: | ||
name: Check nix build for theme ${{ matrix.theme }} | ||
runs-on: ubuntu-latest | ||
needs: | ||
- matrix | ||
strategy: | ||
matrix: | ||
theme: ${{ fromJSON(needs.matrix.outputs.themes) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@v9 | ||
- name: Build package | ||
run: nix build .#${{ matrix.theme }}-grub-theme | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.envrc | ||
.direnv | ||
.vscode | ||
result |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ stdenvNoCC, lib, theme }: | ||
let | ||
themes = builtins.map (theme: (builtins.head (lib.strings.splitString "." theme))) (builtins.attrNames (builtins.readDir ./../assets/backgrounds)); | ||
in | ||
assert builtins.any (x: x == theme) themes; | ||
|
||
stdenvNoCC.mkDerivation { | ||
name = "distro-grub-themes"; | ||
src = ./../.; | ||
|
||
installPhase = '' | ||
mkdir -p $out | ||
cp ./assets/backgrounds/${theme}.png $out/background.png | ||
cp ./assets/splash_image.jpg $out/splash_image.jpg | ||
cp -r ./assets/icons $out | ||
cp -r ./assets/fonts/. $out | ||
cp -r ./assets/menu/. $out | ||
cp -r ./assets/theme.txt $out | ||
''; | ||
|
||
meta = with lib; { | ||
homepage = "https://github.com/AdisonCavani/distro-grub-themes"; | ||
description = "A pack of GRUB2 themes for each Linux distribution"; | ||
license = licenses.gpl3; | ||
maintainers = with maintainers; [ zakuciael ]; | ||
platforms = platforms.linux; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ pks, lib, config, ... }: | ||
with lib; | ||
let | ||
cfg = config.distro-grub-themes; | ||
themes = builtins.map (theme: (builtins.head (lib.strings.splitString "." theme))) (builtins.attrNames (builtins.readDir ./../assets/backgrounds)); | ||
in | ||
{ | ||
options.distro-grub-themes = { | ||
enable = mkEnableOption "Enable Distro Grub Theme"; | ||
theme = mkOption { | ||
type = types.enum themes; | ||
default = "nixos"; | ||
example = "arch-linux"; | ||
description = '' | ||
Selected theme name. | ||
IMPORTANT! Theme name must be the same as in assert/backgrounds directory without the extension | ||
''; | ||
}; | ||
}; | ||
|
||
config = mkIf (cfg.enable) | ||
{ | ||
boot.loader.grub = { | ||
theme = pkgs.callPackage ./default.nix { theme = cfg.theme; }; | ||
splashImage = ./assets/splash_image.jpg; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
description = "A pack of GRUB2 themes for each Linux distribution"; | ||
|
||
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/backgrounds); | ||
themePackages = builtins.listToAttrs (builtins.map | ||
(theme: | ||
let name = (builtins.head (pkgs.lib.strings.splitString "." theme)); in { | ||
name = name + "-grub-theme"; | ||
value = pkgs.callPackage ./build/default.nix { theme = name; }; | ||
}) | ||
themeNames); | ||
in | ||
{ | ||
packages = { | ||
default = pkgs.callPackage ./build/default.nix { theme = "nixos"; }; | ||
} // themePackages; | ||
|
||
devShells.default = pkgs.mkShell { | ||
nativeBuildInputs = with pkgs; [ nixd nixpkgs-fmt act jq ]; | ||
}; | ||
|
||
nixosModules.default = ./build/module.nix; | ||
} | ||
); | ||
} | ||
|