tachikoma/flake.nix
2024-04-06 14:42:48 -04:00

77 lines
2.2 KiB
Nix

{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs, ...} @ inputs: let
systems = [
"aarch64-linux"
"x86_64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
in rec {
devShells = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.mkShell {
buildInputs = with pkgs; [
just
];
};
});
nixosModules = rec {
default = enableTachikoma;
enableTachikoma = { pkgs, ...}: {
services.akkoma.package = packages.${pkgs.system}.akkoma.tachikoma;
services.akkoma.frontends.primary = {
name = "tachikoma-fe";
ref = "stable";
package = packages.${pkgs.system}.akkoma-frontends.tachikoma-fe;
};
};
};
packages = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
patchSet = dirPath: map (file: builtins.readFile ./${dirPath}/${file}) (builtins.filter (file: lib.strings.hasSuffix ".patch" file) (builtins.attrNames (builtins.readDir dirPath)));
in rec {
default = akkoma.tachikoma;
akkoma.tachikoma = let
rev = builtins.readFile ./akkoma/upstream.txt;
in pkgs.akkoma.overrideAttrs (final: prev: {
version = "${rev}+tachikoma";
src = pkgs.fetchFromGitea {
inherit rev;
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "akkoma";
hash = "sha256-MPUZFcIxZ21fe3edwi+/Kt8qpwNBCh40wheC3QMqw2M=";
};
patches = patchSet ./akkoma;
patchFlags = "-p1 -F5";
});
akkoma-frontends.tachikoma-fe = let
rev = builtins.readFile ./akkoma-fe/upstream.txt;
in pkgs.akkoma-frontends.akkoma-fe.overrideAttrs (final: prev: {
version = "${rev}+tachikoma";
src = pkgs.fetchFromGitea {
inherit rev;
domain = "akkoma.dev";
owner = "AkkomaGang";
repo = "akkoma-fe";
hash = "sha256-MPUZFcIxZ21fe3edwi+/Kt8qpwNBCh40wheC3QMqw2M=";
};
patches = patchSet ./akkoma-fe;
patchFlags = "-p1 -F5";
});
});
};
}