enforce new flake schema. formatting.
Some checks failed
Build tests / build-hosts (pull_request) Failing after 3s
Flake check / flake-check (pull_request) Failing after 13s

This commit is contained in:
sid 2026-05-31 18:50:41 +02:00
parent 4b0a90e00d
commit ecf5132cbb
121 changed files with 1606 additions and 1554 deletions

210
flake.nix
View file

@ -3,7 +3,6 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
nix.url = "github:DeterminateSystems/nix-src/flake-schemas";
flake-schemas.url = "github:DeterminateSystems/flake-schemas";
git-hooks.url = "github:cachix/git-hooks.nix";
@ -29,50 +28,69 @@
...
}@inputs:
let
supportedSystems = [
inherit (self) outputs;
systems = [
"x86_64-linux"
"aarch64-linux" # For testing only. Use at your own risk.
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
lib = nixpkgs.lib.extend (_final: _prev: self.lib.utils or { });
nixpkgsFor = forAllSystems (
system:
mkPkgs =
{
system,
config ? { },
}:
import nixpkgs {
inherit system;
inherit config;
overlays = [
self.overlays.default
self.overlays.modifications
self.overlays.additions
inputs.nix.overlays.default
(final: prev: { synix = self.overlays.additions final prev; })
];
}
);
test = {
system = "x86_64-linux";
lib = nixpkgs.lib.extend (final: prev: self.outputs.lib or { });
inputs = inputs // {
synix = self;
};
outputs = { };
overlays = [
self.overlays.default
self.overlays.additions
self.overlays.modifications
(final: prev: { synix = self.packages."${final.system}"; })
];
};
forAllSystems =
function:
lib.genAttrs systems (
system:
function (mkPkgs {
inherit system;
})
);
mkNixosConfiguration =
system: modules:
nixpkgs.lib.nixosSystem {
inherit system modules;
specialArgs = {
inherit inputs outputs lib;
};
};
mkHomeConfiguration =
system: modules:
inputs.home-manager.lib.homeManagerConfiguration {
pkgs = mkPkgs { inherit system; };
inherit modules;
extraSpecialArgs = {
inherit inputs outputs;
};
};
in
{
inherit (inputs.flake-schemas) schemas;
apps = forAllSystems (
system:
pkgs:
let
pkgs = nixpkgs.legacyPackages.${system};
mkApp = name: desc: {
mkApp = name: description: {
type = "app";
program = pkgs.lib.getExe (pkgs.callPackage ./apps/${name} { });
meta.description = desc;
meta.description = description;
};
in
{
@ -86,13 +104,17 @@
);
lib = {
utils = import ./lib/utils.nix { lib = nixpkgs.lib; };
utils = import ./lib/utils.nix { inherit (nixpkgs) lib; };
helpers = {
inherit mkPkgs;
};
};
packages = forAllSystems (
system:
pkgs:
let
allArchs = import ./pkgs { pkgs = nixpkgs.legacyPackages.${system}; };
inherit (pkgs.stdenv.hostPlatform) system;
allArchs = import ./pkgs { inherit pkgs; };
x64only =
if system == "x86_64-linux" then
{
@ -111,109 +133,89 @@
# test configs
nixosConfigurations = {
nixos-hyprland = nixpkgs.lib.nixosSystem {
inherit (test) system;
modules = [
./tests/build/nixos-hyprland
{ nixpkgs.overlays = test.overlays; }
];
specialArgs = {
inherit (test) inputs outputs lib;
};
};
nixos-server = nixpkgs.lib.nixosSystem {
inherit (test) system;
modules = [
./tests/build/nixos-server
{ nixpkgs.overlays = test.overlays; }
];
specialArgs = {
inherit (test) inputs outputs lib;
};
};
nixos-hyprland = mkNixosConfiguration "x86_64-linux" [ ./tests/build/nixos-hyprland ];
nixos-server = mkNixosConfiguration "x86_64-linux" [ ./tests/build/nixos-server ];
};
homeConfigurations = {
hm-hyprland = inputs.home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
inherit (test) overlays system;
};
extraSpecialArgs = {
inherit (test) inputs outputs;
};
modules = [
./tests/build/hm-hyprland
];
};
hm-hyprland = mkHomeConfiguration "x86_64-linux" [ ./tests/build/hm-hyprland ];
};
devShells = forAllSystems (
system:
pkgs:
let
pkgs = nixpkgsFor.${system};
inherit (pkgs.stdenv.hostPlatform) system;
inherit (self.checks.${system}.pre-commit-check) shellHook enabledPackages;
in
{
default =
let
inherit (self.checks.${system}.pre-commit-check) shellHook enabledPackages;
in
pkgs.mkShell {
inherit shellHook;
nativeBuildInputs = [
enabledPackages
pkgs.nix
]
++ (with pkgs; [
(python313.withPackages (
p: with p; [
mkdocs
mkdocs-material
mkdocs-material-extensions
pygments
]
))
]);
};
default = pkgs.mkShell {
inherit shellHook;
nativeBuildInputs = [
enabledPackages
pkgs.nix
]
++ (with pkgs; [
(python313.withPackages (
p: with p; [
mkdocs
mkdocs-material
mkdocs-material-extensions
pygments
]
))
]);
};
nix-config = pkgs.mkShell {
inherit shellHook;
nativeBuildInputs = [ enabledPackages ];
};
install-hm = pkgs.mkShell {
NIX_CONFIG = "extra-experimental-features = nix-command flakes";
nativeBuildInputs = [ pkgs.home-manager ];
};
}
);
formatter = forAllSystems (
system:
pkgs:
let
pkgs = nixpkgs.legacyPackages.${system};
config = self.checks.${system}.pre-commit-check.config;
inherit (config) package configFile;
script = ''
${pkgs.lib.getExe package} run --all-files --config ${configFile}
'';
inherit (pkgs.stdenv.hostPlatform) system;
inherit (self.checks.${system}.pre-commit-check.config) package configFile;
in
pkgs.writeShellScriptBin "pre-commit-run" script
pkgs.writeShellScriptBin "pre-commit-run" "${pkgs.lib.getExe package} run --all-files --config ${configFile}"
);
checks = forAllSystems (
system:
pkgs:
let
pkgs = nixpkgs.legacyPackages.${system};
flakePkgs = self.packages.${system};
overlaidPkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.modifications ];
};
inherit (pkgs.stdenv.hostPlatform) system;
in
{
pre-commit-check = inputs.git-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixfmt.enable = true;
actionlint.enable = true;
nixfmt = {
enable = true;
settings.width = 120;
};
shellcheck.enable = true;
statix.enable = true;
yamllint = {
enable = true;
excludes = [ "secrets.yaml" ];
settings.configData = "{rules: {line-length: {max: 120}}}";
};
};
};
build-packages = pkgs.linkFarm "flake-packages-${system}" flakePkgs;
build-overlays = pkgs.linkFarm "flake-overlays-${system}" {
kicad = overlaidPkgs.kicad;
};
build-additions = pkgs.linkFarm "added-packages-${system}" self.packages.${system};
build-modifications = pkgs.linkFarm "modified-packages-${system}" (
lib.filterAttrs (_: v: lib.isDerivation v) (self.overlays.modifications pkgs pkgs)
);
synapse-test =
let
testPkgs = import nixpkgs {
testPkgs = mkPkgs {
inherit system;
config.permittedInsecurePackages = [ "olm-3.2.16" ];
};