ess-helm-nixos/flake.nix

101 lines
2.6 KiB
Nix

{
description = "Element Server Suite on NixOS";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-old-stable.url = "github:nixos/nixpkgs/nixos-25.05";
synix.url = "git+https://git.sid.ovh/sid/synix.git?ref=release-25.11";
synix.inputs.nixpkgs.follows = "nixpkgs";
git-hooks.url = "github:cachix/git-hooks.nix";
git-hooks.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
nixpkgs,
...
}@inputs:
let
inherit (self) outputs;
systems = [
"x86_64-linux"
];
lib = nixpkgs.lib.extend (_final: _prev: inputs.synix.lib or { });
mkNixosConfiguration =
system: modules:
lib.nixosSystem {
inherit system modules;
specialArgs = {
inherit inputs outputs lib;
};
};
forAllSystems =
function:
lib.genAttrs systems (
system:
function (
import nixpkgs {
inherit system;
overlays = [ self.overlays.modifications ];
}
)
);
in
{
overlays = import ./overlays { inherit inputs; };
nixosModules = import ./modules/nixos;
nixosConfigurations = {
ess-helm = mkNixosConfiguration "x86_64-linux" [ ./hosts/ess-helm ];
};
packages = forAllSystems (pkgs: import ./pkgs { inherit pkgs inputs; });
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
shellHook = "export FLAKE_PATH=$(pwd)";
};
});
formatter = forAllSystems (
pkgs:
let
inherit (pkgs.stdenv.hostPlatform) system;
inherit (self.checks.${system}.pre-commit-check.config) package configFile;
in
pkgs.writeShellScriptBin "pre-commit-run" "${lib.getExe package} run --all-files --config ${configFile}"
);
checks = forAllSystems (
pkgs:
let
inherit (pkgs.stdenv.hostPlatform) system;
in
{
pre-commit-check = inputs.git-hooks.lib.${system}.run {
src = ./.;
hooks = {
actionlint.enable = true;
nixfmt.enable = true;
shellcheck.enable = true;
statix.enable = true;
yamllint.enable = true;
};
};
build-packages = pkgs.linkFarm "flake-packages-${system}" self.packages.${system};
build-overlayed-packages = pkgs.linkFarm "flake-overlayed-packages-${system}" (
self.overlays.modifications pkgs pkgs
);
}
);
};
}