mirror of
https://github.com/AdisonCavani/distro-grub-themes.git
synced 2025-06-01 13:12:35 +02:00
feat: add nix flake
This commit is contained in:
parent
c96f868e75
commit
14ae5129f6
6 changed files with 161 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
.envrc
|
||||
.direnv
|
||||
.vscode
|
||||
result
|
BIN
assets/splash_image.jpg
Normal file
BIN
assets/splash_image.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
28
default.nix
Normal file
28
default.nix
Normal file
|
@ -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;
|
||||
};
|
||||
}
|
61
flake.lock
generated
Normal file
61
flake.lock
generated
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": 1712963716,
|
||||
"narHash": "sha256-WKm9CvgCldeIVvRz87iOMi8CFVB1apJlkUT4GGvA0iM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "cfd6b5fc90b15709b780a5a1619695a88505a176",
|
||||
"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
|
||||
}
|
40
flake.nix
Normal file
40
flake.nix
Normal file
|
@ -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 ./default.nix { theme = name; };
|
||||
})
|
||||
themeNames);
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
default = pkgs.callPackage ./default.nix { theme = "nixos"; };
|
||||
} // themePackages;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [ nixd nixpkgs-fmt act jq ];
|
||||
};
|
||||
|
||||
nixosModules.default = ./module.nix;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
28
module.nix
Normal file
28
module.nix
Normal file
|
@ -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;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue