normalize whitespace

This commit is contained in:
Qyriad 2026-02-17 20:17:39 +01:00
parent d76474c524
commit a91c419858
5 changed files with 208 additions and 206 deletions

View file

@ -1,5 +1,3 @@
root = true
[*] [*]
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true

View file

@ -1,18 +1,18 @@
{ {
pkgs ? import <nixpkgs> { }, pkgs ? import <nixpkgs> { },
qpkgs ? let qpkgs ? let
src = fetchTree (builtins.parseFlakeRef "github:Qyriad/nur-packages"); src = fetchTree (builtins.parseFlakeRef "github:Qyriad/nur-packages");
in import src { inherit pkgs; }, in import src { inherit pkgs; },
}: let }: let
inherit (qpkgs) lib; inherit (qpkgs) lib;
dynix = qpkgs.callPackage ./package.nix { } dynix = qpkgs.callPackage ./package.nix { }
|> qpkgs.stdlib.mkStdenvPretty; |> qpkgs.stdlib.mkStdenvPretty;
byStdenv = lib.mapAttrs (stdenvName: stdenv: let byStdenv = lib.mapAttrs (stdenvName: stdenv: let
withStdenv = dynix.override { inherit stdenv; }; withStdenv = dynix.override { clangStdenv = stdenv; };
dynix' = withStdenv.overrideAttrs (prev: { dynix' = withStdenv.overrideAttrs (prev: {
pname = "${prev.pname}-${stdenvName}"; pname = "${prev.pname}-${stdenvName}";
}); });
in dynix') qpkgs.validStdenvs; in dynix') qpkgs.validStdenvs;
in dynix.overrideAttrs (prev: lib.recursiveUpdate prev { in dynix.overrideAttrs (prev: lib.recursiveUpdate prev {
passthru = { inherit byStdenv; }; passthru = { inherit byStdenv; };
}) })

View file

@ -1,51 +1,55 @@
{ {
inputs = { inputs = {
nixpkgs = { nixpkgs = {
url = "github:NixOS/nixpkgs/nixpkgs-unstable"; url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake = false; flake = false;
}; };
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
fenix = { fenix = {
url = "github:nix-community/fenix"; url = "github:nix-community/fenix";
flake = false; flake = false;
}; };
qyriad-nur = { qyriad-nur = {
url = "github:Qyriad/nur-packages"; url = "github:Qyriad/nur-packages";
flake = false; flake = false;
}; };
}; };
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
flake-utils, flake-utils,
fenix, fenix,
qyriad-nur, qyriad-nur,
}: flake-utils.lib.eachDefaultSystem (system: let }: flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
qpkgs = import qyriad-nur { inherit pkgs; }; qpkgs = import qyriad-nur { inherit pkgs; };
inherit (qpkgs) lib; inherit (qpkgs) lib;
fenixLib = import fenix { inherit pkgs; }; fenixLib = import fenix { inherit pkgs; };
dynix = import ./default.nix { inherit pkgs qpkgs; }; dynix = import ./default.nix { inherit pkgs qpkgs; };
extraVersions = lib.mapAttrs' (stdenvName: value: { extraVersions = lib.mapAttrs' (stdenvName: value: {
name = "${stdenvName}-dynix"; name = "${stdenvName}-dynix";
inherit value; inherit value;
}) dynix.byStdenv; }) dynix.byStdenv;
devShell = import ./shell.nix { inherit pkgs qpkgs dynix fenixLib; }; devShell = import ./shell.nix { inherit pkgs qpkgs dynix fenixLib; };
extraDevShells = lib.mapAttrs' (stdenvName: value: { extraDevShells = lib.mapAttrs' (stdenvName: value: {
name = "${stdenvName}-dynix"; name = "${stdenvName}-dynix";
inherit value; inherit value;
}) dynix.byStdenv; }) dynix.byStdenv;
in { in {
packages = extraVersions // { packages = extraVersions // {
default = dynix; default = dynix;
inherit dynix; inherit dynix;
}; };
devShells = extraDevShells // { devShells = extraDevShells // {
default = devShell; default = devShell;
}; };
});
checks = self.packages.${system}.default.tests // {
default = self.packages.${system}.default.allTests;
};
});
} }

View file

@ -1,160 +1,160 @@
{ {
lib, lib,
clangStdenv, clangStdenv,
callPackage, callPackage,
linkFarm, linkFarm,
rustHooks, rustHooks,
rustPackages, rustPackages,
versionCheckHook, versionCheckHook,
}: lib.callWith' rustPackages ({ }: lib.callWith' rustPackages ({
rustPlatform, rustPlatform,
cargo, cargo,
}: let }: let
stdenv = clangStdenv; stdenv = clangStdenv;
cargoToml = lib.importTOML ./Cargo.toml; cargoToml = lib.importTOML ./Cargo.toml;
cargoPackage = cargoToml.package; cargoPackage = cargoToml.package;
in stdenv.mkDerivation (finalAttrs: let in stdenv.mkDerivation (finalAttrs: let
self = finalAttrs.finalPackage; self = finalAttrs.finalPackage;
in { in {
pname = cargoPackage.name; pname = cargoPackage.name;
version = cargoPackage.version; version = cargoPackage.version;
strictDeps = true; strictDeps = true;
__structuredAttrs = true; __structuredAttrs = true;
outputs = [ "out" "modules" ]; outputs = [ "out" "modules" ];
doCheck = true; doCheck = true;
doInstallCheck = true; doInstallCheck = true;
phases = [ "unpackPhase" "patchPhase" "installPhase" ]; phases = [ "unpackPhase" "patchPhase" "installPhase" ];
src = linkFarm "dynix-source" { src = linkFarm "dynix-source" {
inherit (self) dynixCommand dynixModules; inherit (self) dynixCommand dynixModules;
}; };
installPhase = lib.dedent '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p "$out" mkdir -p "$out"
cp -r --reflink=auto "$dynixCommand/"* "$out/" cp -r --reflink=auto "$dynixCommand/"* "$out/"
mkdir -p "$modules" mkdir -p "$modules"
cp -r --reflink=auto "$dynixModules/"* "$modules/" cp -r --reflink=auto "$dynixModules/"* "$modules/"
runHook postInstall runHook postInstall
''; '';
# #
# SUB-DERIVATONS # SUB-DERIVATONS
# #
dynixCommand = stdenv.mkDerivation (finalAttrs: let dynixCommand = stdenv.mkDerivation (finalAttrs: let
commandSelf = finalAttrs.finalPackage; commandSelf = finalAttrs.finalPackage;
in { in {
pname = "${self.pname}-command"; pname = "${self.pname}-command";
inherit (self) version; inherit (self) version;
inherit (self) strictDeps __structuredAttrs; inherit (self) strictDeps __structuredAttrs;
inherit (self) doCheck doInstallCheck; inherit (self) doCheck doInstallCheck;
src = lib.fileset.toSource { src = lib.fileset.toSource {
root = ./.; root = ./.;
fileset = lib.fileset.unions [ fileset = lib.fileset.unions [
./Cargo.toml ./Cargo.toml
./Cargo.lock ./Cargo.lock
./src ./src
]; ];
}; };
cargoDeps = rustPlatform.importCargoLock { cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock; lockFile = ./Cargo.lock;
}; };
nativeBuildInputs = rustHooks.asList ++ [ nativeBuildInputs = rustHooks.asList ++ [
cargo cargo
]; ];
nativeInstallCheckInputs = [ nativeInstallCheckInputs = [
versionCheckHook versionCheckHook
]; ];
meta = { meta = {
mainProgram = "dynix"; mainProgram = "dynix";
}; };
}); });
dynixModules = stdenv.mkDerivation (finalAttrs: let dynixModules = stdenv.mkDerivation (finalAttrs: let
modulesSelf = finalAttrs.finalPackage; modulesSelf = finalAttrs.finalPackage;
in { in {
pname = "${self.pname}-modules"; pname = "${self.pname}-modules";
inherit (self) version; inherit (self) version;
inherit (self) strictDeps __structuredAttrs; inherit (self) strictDeps __structuredAttrs;
inherit (self) doCheck doInstallCheck; inherit (self) doCheck doInstallCheck;
src = lib.fileset.toSource { src = lib.fileset.toSource {
root = ./modules/dynamicism; root = ./modules/dynamicism;
fileset = lib.fileset.unions [ fileset = lib.fileset.unions [
./modules/dynamicism ./modules/dynamicism
]; ];
}; };
phases = [ "unpackPhase" "patchPhase" "installPhase" ]; phases = [ "unpackPhase" "patchPhase" "installPhase" ];
modulesOut = "${placeholder "out"}/share/nixos/modules/dynix"; modulesOut = "${placeholder "out"}/share/nixos/modules/dynix";
installPhase = lib.dedent '' installPhase = lib.dedent ''
runHook preInstall runHook preInstall
mkdir -p "$modulesOut" mkdir -p "$modulesOut"
cp -r "$src/"* "$modulesOut/" cp -r "$src/"* "$modulesOut/"
runHook postInstall runHook postInstall
''; '';
}); });
# #
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# #
passthru.mkDevShell = { passthru.mkDevShell = {
path, path,
mkShell, mkShell,
python3Packages, python3Packages,
fenixToolchain, fenixToolchain,
}: let }: let
mkShell' = mkShell.override { inherit stdenv; }; mkShell' = mkShell.override { inherit stdenv; };
pyEnv = python3Packages.python.withPackages (p: [ p.beartype ]); pyEnv = python3Packages.python.withPackages (p: [ p.beartype ]);
in mkShell' { in mkShell' {
name = "devshell-for-${self.name}"; name = "devshell-for-${self.name}";
inputsFrom = [ self ]; inputsFrom = [ self ];
packages = [ packages = [
pyEnv pyEnv
stdenv.cc stdenv.cc
fenixToolchain fenixToolchain
]; ];
env.PYTHONPATH = [ env.PYTHONPATH = [
"${pyEnv}/${pyEnv.sitePackages}" "${pyEnv}/${pyEnv.sitePackages}"
# Cursed. # Cursed.
"${path}/nixos/lib/test-driver/src" "${path}/nixos/lib/test-driver/src"
] |> lib.concatStringsSep ":"; ] |> lib.concatStringsSep ":";
}; };
passthru.modulesPath = self.modules + "/share/nixos/modules"; passthru.modulesPath = self.modules + "/share/nixos/modules";
passthru.dynix = self.modulesPath + "/dynix"; passthru.dynix = self.modulesPath + "/dynix";
passthru.tests = lib.fix (callPackage ./tests { passthru.tests = lib.fix (callPackage ./tests {
dynix = self; dynix = self;
}).packages; }).packages;
passthru.allTests = linkFarm "dynix-all-tests" self.tests; passthru.allTests = linkFarm "dynix-all-tests" self.tests;
meta = { meta = {
longDescription = lib.dedent '' longDescription = lib.dedent ''
Default output contains the Rust binary. Default output contains the Rust binary.
The `modules` output contains the modules prefixed under `/share/nixos/modules/dynix`. The `modules` output contains the modules prefixed under `/share/nixos/modules/dynix`.
The `dynix` passthru attr is a shortcut for the modules output *with* the modules prefix, The `dynix` passthru attr is a shortcut for the modules output *with* the modules prefix,
and thus `dynix.dynix` can be passed directly to `imports = [`. and thus `dynix.dynix` can be passed directly to `imports = [`.
''; '';
mainProgram = "dynix"; mainProgram = "dynix";
outputsToInstall = [ "out" "modules" ]; outputsToInstall = [ "out" "modules" ];
}; };
})) }))

View file

@ -1,26 +1,26 @@
{ {
pkgs ? import <nixpkgs> { pkgs ? import <nixpkgs> {
config = { config = {
checkMeta = true; checkMeta = true;
allowAliases = false; allowAliases = false;
}; };
}, },
qpkgs ? let qpkgs ? let
src = fetchTarball "https://github.com/Qyriad/nur-packages/archive/main.tar.gz"; src = fetchTarball "https://github.com/Qyriad/nur-packages/archive/main.tar.gz";
in import src { inherit pkgs; }, in import src { inherit pkgs; },
dynix ? import ./default.nix { inherit pkgs qpkgs; }, dynix ? import ./default.nix { inherit pkgs qpkgs; },
fenixLib ? let fenixLib ? let
src = fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz"; src = fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz";
in import src { inherit pkgs; }, in import src { inherit pkgs; },
fenixToolchain ? fenixLib.latest.toolchain, fenixToolchain ? fenixLib.latest.toolchain,
}: let }: let
inherit (pkgs) lib; inherit (pkgs) lib;
mkDevShell = dynix: qpkgs.callPackage dynix.mkDevShell { inherit fenixToolchain; }; mkDevShell = dynix: qpkgs.callPackage dynix.mkDevShell { inherit fenixToolchain; };
devShell = mkDevShell dynix; devShell = mkDevShell dynix;
byStdenv = lib.mapAttrs (lib.const mkDevShell) dynix.byStdenv; byStdenv = lib.mapAttrs (lib.const mkDevShell) dynix.byStdenv;
in devShell.overrideAttrs (prev: { in devShell.overrideAttrs (prev: {
passthru = { inherit byStdenv; }; passthru = { inherit byStdenv; };
}) })