Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Commit

Permalink
fix: nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
tulilirockz committed Mar 12, 2024
1 parent 3de1db6 commit 7b6faac
Showing 1 changed file with 67 additions and 47 deletions.
114 changes: 67 additions & 47 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,69 +8,89 @@
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz";
};

outputs = { self, flake-schemas, nixpkgs, nix-pre-commit-hooks, bluebuild }:
let
supportedSystems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" "aarch64-linux" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f rec {
pkgs = import nixpkgs { inherit system; };
lib = pkgs.lib;
inherit system;
});
in {
schemas = flake-schemas.schemas;
outputs = {
self,
flake-schemas,
nixpkgs,
nix-pre-commit-hooks,
bluebuild,
}: let
supportedSystems = ["x86_64-linux" "aarch64-darwin" "x86_64-darwin" "aarch64-linux"];
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
f rec {
pkgs = import nixpkgs {inherit system;};
lib = pkgs.lib;
inherit system;
});
in {
schemas = flake-schemas.schemas;

checks = forEachSupportedSystem ({system, pkgs,...}: {
pre-commit-check = nix-pre-commit-hooks.lib.${system}.run {
src = ./.;

default_stages = ["manual" "push"];
hooks = {
alejandra.enable = true;
shellcheck.enable = true;
markdownlint.enable = true;
yamllint.enable = true;
commitizen.enable = true;
};
checks = forEachSupportedSystem ({
system,
pkgs,
...
}: {
pre-commit-check = nix-pre-commit-hooks.lib.${system}.run {
src = ./.;

default_stages = ["manual" "push"];
hooks = {
alejandra.enable = true;
shellcheck.enable = true;
markdownlint.enable = true;
yamllint.enable = true;
commitizen.enable = true;
};
});
};
});

packages = forEachSupportedSystem ({ system, pkgs, lib, ... }: {
# Inherit de-annoyify flake for packages!
packages = forEachSupportedSystem ({
system,
pkgs,
lib,
...
}: {
# Inherit de-annoyify flake for packages!

build-image = pkgs.writers.writeNuBin "build-image" ''
build-image = pkgs.writers.writeNuBin "build-image" ''
def "main" [--prefix (-p): string, ...recipes: string] {
mut recipe_prefix: string = ""
if $prefix != null {
$recipe_prefix = $"($prefix)\/"
}
let final_prefix = $recipe_prefix
$recipes | par-each { |recipe| do {${bluebuild.packages.${system}.bluebuild}/bin/bluebuild build $"config/recipes/($final_prefix)($recipe).yml"} & }
}
'';
# This script is surprisingly fast!
generate-logo = pkgs.writers.writeNuBin "generate-logo" ''
'';

# This script is surprisingly fast!
generate-logo = pkgs.writers.writeNuBin "generate-logo" ''
def "main" [inputFile: string, outputFolder: string, outputName: string, extension: string, ...rest] {
mkdir $outputFolder
[ 16 32 64 128 256 ] | par-each {
|size| do { ${lib.getExe pkgs.ffmpeg} -y -i $inputFile -vf $"scale=($size):($size)" $"($outputFolder)/($outputName)-($size)x($size).($extension)" }
[ 16 32 64 128 256 ] | par-each {
|size| do { ${lib.getExe pkgs.ffmpeg} -y -i $inputFile -vf $"scale=($size):($size)" $"($outputFolder)/($outputName)-($size)x($size).($extension)" }
}
${lib.getExe pkgs.ffmpeg} -y -i $inputFile $"($outputFolder)/($outputName).($extension)" &
}
'';
});
'';
});

devShells = forEachSupportedSystem ({ system, pkgs, ... }: {
default = pkgs.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
packages = with pkgs; [
git
nixpkgs-fmt
nushell
bluebuild.packages.${system}.bluebuild
];
};
});
};
devShells = forEachSupportedSystem ({
system,
pkgs,
...
}: {
default = pkgs.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
packages = with pkgs; [
git
nixpkgs-fmt
nushell
bluebuild.packages.${system}.bluebuild
];
};
});
};
}

0 comments on commit 7b6faac

Please sign in to comment.