From a91c419858ff377e5b1911b68cdd9afd2179d8ef Mon Sep 17 00:00:00 2001 From: Qyriad Date: Tue, 17 Feb 2026 20:17:39 +0100 Subject: [PATCH] normalize whitespace --- .editorconfig | 2 - default.nix | 28 +++--- flake.nix | 94 ++++++++++--------- package.nix | 252 +++++++++++++++++++++++++------------------------- shell.nix | 38 ++++---- 5 files changed, 208 insertions(+), 206 deletions(-) diff --git a/.editorconfig b/.editorconfig index 061699c..4753adb 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,3 @@ -root = true - [*] end_of_line = lf insert_final_newline = true diff --git a/default.nix b/default.nix index 4372c35..2375445 100644 --- a/default.nix +++ b/default.nix @@ -1,18 +1,18 @@ { - pkgs ? import { }, - qpkgs ? let - src = fetchTree (builtins.parseFlakeRef "github:Qyriad/nur-packages"); - in import src { inherit pkgs; }, + pkgs ? import { }, + qpkgs ? let + src = fetchTree (builtins.parseFlakeRef "github:Qyriad/nur-packages"); + in import src { inherit pkgs; }, }: let - inherit (qpkgs) lib; - dynix = qpkgs.callPackage ./package.nix { } - |> qpkgs.stdlib.mkStdenvPretty; - byStdenv = lib.mapAttrs (stdenvName: stdenv: let - withStdenv = dynix.override { inherit stdenv; }; - dynix' = withStdenv.overrideAttrs (prev: { - pname = "${prev.pname}-${stdenvName}"; - }); - in dynix') qpkgs.validStdenvs; + inherit (qpkgs) lib; + dynix = qpkgs.callPackage ./package.nix { } + |> qpkgs.stdlib.mkStdenvPretty; + byStdenv = lib.mapAttrs (stdenvName: stdenv: let + withStdenv = dynix.override { clangStdenv = stdenv; }; + dynix' = withStdenv.overrideAttrs (prev: { + pname = "${prev.pname}-${stdenvName}"; + }); + in dynix') qpkgs.validStdenvs; in dynix.overrideAttrs (prev: lib.recursiveUpdate prev { - passthru = { inherit byStdenv; }; + passthru = { inherit byStdenv; }; }) diff --git a/flake.nix b/flake.nix index f4270f0..276cfb0 100644 --- a/flake.nix +++ b/flake.nix @@ -1,51 +1,55 @@ { - inputs = { - nixpkgs = { - url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - flake = false; - }; - flake-utils.url = "github:numtide/flake-utils"; - fenix = { - url = "github:nix-community/fenix"; - flake = false; - }; - qyriad-nur = { - url = "github:Qyriad/nur-packages"; - flake = false; - }; - }; + inputs = { + nixpkgs = { + url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake = false; + }; + flake-utils.url = "github:numtide/flake-utils"; + fenix = { + url = "github:nix-community/fenix"; + flake = false; + }; + qyriad-nur = { + url = "github:Qyriad/nur-packages"; + flake = false; + }; + }; - outputs = { - self, - nixpkgs, - flake-utils, - fenix, - qyriad-nur, - }: flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { inherit system; }; - qpkgs = import qyriad-nur { inherit pkgs; }; - inherit (qpkgs) lib; - fenixLib = import fenix { inherit pkgs; }; + outputs = { + self, + nixpkgs, + flake-utils, + fenix, + qyriad-nur, + }: flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs { inherit system; }; + qpkgs = import qyriad-nur { inherit pkgs; }; + inherit (qpkgs) lib; + fenixLib = import fenix { inherit pkgs; }; - dynix = import ./default.nix { inherit pkgs qpkgs; }; - extraVersions = lib.mapAttrs' (stdenvName: value: { - name = "${stdenvName}-dynix"; - inherit value; - }) dynix.byStdenv; + dynix = import ./default.nix { inherit pkgs qpkgs; }; + extraVersions = lib.mapAttrs' (stdenvName: value: { + name = "${stdenvName}-dynix"; + inherit value; + }) dynix.byStdenv; - devShell = import ./shell.nix { inherit pkgs qpkgs dynix fenixLib; }; - extraDevShells = lib.mapAttrs' (stdenvName: value: { - name = "${stdenvName}-dynix"; - inherit value; - }) dynix.byStdenv; - in { - packages = extraVersions // { - default = dynix; - inherit dynix; - }; + devShell = import ./shell.nix { inherit pkgs qpkgs dynix fenixLib; }; + extraDevShells = lib.mapAttrs' (stdenvName: value: { + name = "${stdenvName}-dynix"; + inherit value; + }) dynix.byStdenv; + in { + packages = extraVersions // { + default = dynix; + inherit dynix; + }; - devShells = extraDevShells // { - default = devShell; - }; - }); + devShells = extraDevShells // { + default = devShell; + }; + + checks = self.packages.${system}.default.tests // { + default = self.packages.${system}.default.allTests; + }; + }); } diff --git a/package.nix b/package.nix index 448ab31..309f2d4 100644 --- a/package.nix +++ b/package.nix @@ -1,160 +1,160 @@ { - lib, - clangStdenv, - callPackage, - linkFarm, - rustHooks, - rustPackages, - versionCheckHook, + lib, + clangStdenv, + callPackage, + linkFarm, + rustHooks, + rustPackages, + versionCheckHook, }: lib.callWith' rustPackages ({ - rustPlatform, - cargo, + rustPlatform, + cargo, }: let - stdenv = clangStdenv; - cargoToml = lib.importTOML ./Cargo.toml; - cargoPackage = cargoToml.package; + stdenv = clangStdenv; + cargoToml = lib.importTOML ./Cargo.toml; + cargoPackage = cargoToml.package; in stdenv.mkDerivation (finalAttrs: let - self = finalAttrs.finalPackage; + self = finalAttrs.finalPackage; in { - pname = cargoPackage.name; - version = cargoPackage.version; + pname = cargoPackage.name; + version = cargoPackage.version; - strictDeps = true; - __structuredAttrs = true; + strictDeps = true; + __structuredAttrs = true; - outputs = [ "out" "modules" ]; + outputs = [ "out" "modules" ]; - doCheck = true; - doInstallCheck = true; + doCheck = true; + doInstallCheck = true; - phases = [ "unpackPhase" "patchPhase" "installPhase" ]; + phases = [ "unpackPhase" "patchPhase" "installPhase" ]; - src = linkFarm "dynix-source" { - inherit (self) dynixCommand dynixModules; - }; + src = linkFarm "dynix-source" { + inherit (self) dynixCommand dynixModules; + }; - installPhase = lib.dedent '' - runHook preInstall + installPhase = '' + runHook preInstall - mkdir -p "$out" - cp -r --reflink=auto "$dynixCommand/"* "$out/" - mkdir -p "$modules" - cp -r --reflink=auto "$dynixModules/"* "$modules/" + mkdir -p "$out" + cp -r --reflink=auto "$dynixCommand/"* "$out/" + mkdir -p "$modules" + cp -r --reflink=auto "$dynixModules/"* "$modules/" - runHook postInstall - ''; + runHook postInstall + ''; - # - # SUB-DERIVATONS - # + # + # SUB-DERIVATONS + # - dynixCommand = stdenv.mkDerivation (finalAttrs: let - commandSelf = finalAttrs.finalPackage; - in { - pname = "${self.pname}-command"; - inherit (self) version; - inherit (self) strictDeps __structuredAttrs; - inherit (self) doCheck doInstallCheck; + dynixCommand = stdenv.mkDerivation (finalAttrs: let + commandSelf = finalAttrs.finalPackage; + in { + pname = "${self.pname}-command"; + inherit (self) version; + inherit (self) strictDeps __structuredAttrs; + inherit (self) doCheck doInstallCheck; - src = lib.fileset.toSource { - root = ./.; - fileset = lib.fileset.unions [ - ./Cargo.toml - ./Cargo.lock - ./src - ]; - }; + src = lib.fileset.toSource { + root = ./.; + fileset = lib.fileset.unions [ + ./Cargo.toml + ./Cargo.lock + ./src + ]; + }; - cargoDeps = rustPlatform.importCargoLock { - lockFile = ./Cargo.lock; - }; + cargoDeps = rustPlatform.importCargoLock { + lockFile = ./Cargo.lock; + }; - nativeBuildInputs = rustHooks.asList ++ [ - cargo - ]; + nativeBuildInputs = rustHooks.asList ++ [ + cargo + ]; - nativeInstallCheckInputs = [ - versionCheckHook - ]; + nativeInstallCheckInputs = [ + versionCheckHook + ]; - meta = { - mainProgram = "dynix"; - }; - }); + meta = { + mainProgram = "dynix"; + }; + }); - dynixModules = stdenv.mkDerivation (finalAttrs: let - modulesSelf = finalAttrs.finalPackage; - in { - pname = "${self.pname}-modules"; - inherit (self) version; - inherit (self) strictDeps __structuredAttrs; - inherit (self) doCheck doInstallCheck; + dynixModules = stdenv.mkDerivation (finalAttrs: let + modulesSelf = finalAttrs.finalPackage; + in { + pname = "${self.pname}-modules"; + inherit (self) version; + inherit (self) strictDeps __structuredAttrs; + inherit (self) doCheck doInstallCheck; - src = lib.fileset.toSource { - root = ./modules/dynamicism; - fileset = lib.fileset.unions [ - ./modules/dynamicism - ]; - }; + src = lib.fileset.toSource { + root = ./modules/dynamicism; + fileset = lib.fileset.unions [ + ./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 '' - runHook preInstall + installPhase = lib.dedent '' + runHook preInstall - mkdir -p "$modulesOut" - cp -r "$src/"* "$modulesOut/" + mkdir -p "$modulesOut" + cp -r "$src/"* "$modulesOut/" - runHook postInstall - ''; - }); + runHook postInstall + ''; + }); - # - # ---------------------------------------------------------------------------- - # + # + # ---------------------------------------------------------------------------- + # - passthru.mkDevShell = { - path, - mkShell, - python3Packages, - fenixToolchain, - }: let - mkShell' = mkShell.override { inherit stdenv; }; - pyEnv = python3Packages.python.withPackages (p: [ p.beartype ]); - in mkShell' { - name = "devshell-for-${self.name}"; - inputsFrom = [ self ]; - packages = [ - pyEnv - stdenv.cc - fenixToolchain - ]; - env.PYTHONPATH = [ - "${pyEnv}/${pyEnv.sitePackages}" - # Cursed. - "${path}/nixos/lib/test-driver/src" - ] |> lib.concatStringsSep ":"; - }; + passthru.mkDevShell = { + path, + mkShell, + python3Packages, + fenixToolchain, + }: let + mkShell' = mkShell.override { inherit stdenv; }; + pyEnv = python3Packages.python.withPackages (p: [ p.beartype ]); + in mkShell' { + name = "devshell-for-${self.name}"; + inputsFrom = [ self ]; + packages = [ + pyEnv + stdenv.cc + fenixToolchain + ]; + env.PYTHONPATH = [ + "${pyEnv}/${pyEnv.sitePackages}" + # Cursed. + "${path}/nixos/lib/test-driver/src" + ] |> lib.concatStringsSep ":"; + }; - passthru.modulesPath = self.modules + "/share/nixos/modules"; - passthru.dynix = self.modulesPath + "/dynix"; + passthru.modulesPath = self.modules + "/share/nixos/modules"; + passthru.dynix = self.modulesPath + "/dynix"; - passthru.tests = lib.fix (callPackage ./tests { - dynix = self; - }).packages; + passthru.tests = lib.fix (callPackage ./tests { + dynix = self; + }).packages; - passthru.allTests = linkFarm "dynix-all-tests" self.tests; + passthru.allTests = linkFarm "dynix-all-tests" self.tests; - meta = { - longDescription = lib.dedent '' - Default output contains the Rust binary. - 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, - and thus `dynix.dynix` can be passed directly to `imports = [`. - ''; - mainProgram = "dynix"; - outputsToInstall = [ "out" "modules" ]; - }; + meta = { + longDescription = lib.dedent '' + Default output contains the Rust binary. + 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, + and thus `dynix.dynix` can be passed directly to `imports = [`. + ''; + mainProgram = "dynix"; + outputsToInstall = [ "out" "modules" ]; + }; })) diff --git a/shell.nix b/shell.nix index e2af1b4..4b93b7f 100644 --- a/shell.nix +++ b/shell.nix @@ -1,26 +1,26 @@ { - pkgs ? import { - config = { - checkMeta = true; - allowAliases = false; - }; - }, - qpkgs ? let - src = fetchTarball "https://github.com/Qyriad/nur-packages/archive/main.tar.gz"; - in import src { inherit pkgs; }, - dynix ? import ./default.nix { inherit pkgs qpkgs; }, - fenixLib ? let - src = fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz"; - in import src { inherit pkgs; }, - fenixToolchain ? fenixLib.latest.toolchain, + pkgs ? import { + config = { + checkMeta = true; + allowAliases = false; + }; + }, + qpkgs ? let + src = fetchTarball "https://github.com/Qyriad/nur-packages/archive/main.tar.gz"; + in import src { inherit pkgs; }, + dynix ? import ./default.nix { inherit pkgs qpkgs; }, + fenixLib ? let + src = fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz"; + in import src { inherit pkgs; }, + fenixToolchain ? fenixLib.latest.toolchain, }: let - inherit (pkgs) lib; + inherit (pkgs) lib; - mkDevShell = dynix: qpkgs.callPackage dynix.mkDevShell { inherit fenixToolchain; }; - devShell = mkDevShell dynix; + mkDevShell = dynix: qpkgs.callPackage dynix.mkDevShell { inherit fenixToolchain; }; + devShell = mkDevShell dynix; - byStdenv = lib.mapAttrs (lib.const mkDevShell) dynix.byStdenv; + byStdenv = lib.mapAttrs (lib.const mkDevShell) dynix.byStdenv; in devShell.overrideAttrs (prev: { - passthru = { inherit byStdenv; }; + passthru = { inherit byStdenv; }; })