reformat with nixfmt-rfc-style

This commit is contained in:
Artemis Tosini 2024-06-06 00:11:34 +00:00
parent 99c062b6af
commit 4ff4e7b859
Signed by: artemist
GPG key ID: ADFFE553DCBB831E
22 changed files with 444 additions and 215 deletions

View file

@ -6,8 +6,14 @@
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }:
utils.lib.eachDefaultSystem (system:
outputs =
{
self,
nixpkgs,
utils,
}:
utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
@ -15,27 +21,38 @@
};
inherit (pkgs) lib;
names = builtins.attrNames (self.overlays.default pkgs pkgs);
in {
in
{
devShells = {
plotter = pkgs.callPackage ./shells/plotter { };
ryujinx = pkgs.callPackage ./shells/ryujinx { };
zephyr = pkgs.callPackage ./shells/zephyr { };
};
formatter = pkgs.nixfmt;
packages = builtins.listToAttrs (lib.concatMap (name:
let pkg = pkgs.${name};
in lib.optional (builtins.typeOf pkg == "set") {
formatter = pkgs.nixfmt-rfc-style;
packages = builtins.listToAttrs (
lib.concatMap (
name:
let
pkg = pkgs.${name};
in
lib.optional (builtins.typeOf pkg == "set") {
inherit name;
value = if lib.isDerivation pkg then
value =
if lib.isDerivation pkg then
pkg
else
pkg // {
pkg
// {
type = "derivation";
name = "dummy-attrset";
};
}) names);
}) // {
}
) names
);
}
)
// {
overlays.default = final: prev: {
attic = final.callPackage ./packages/attic { };
attic-client = final.attic.override { clientOnly = true; };
@ -52,25 +69,19 @@
axidraw = final.callPackage ./packages/axidraw/inkscape.nix { };
};
kernelPatches = prev.kernelPatches
// final.callPackage ./packages/kernelPatches { };
kernelPatches = prev.kernelPatches // final.callPackage ./packages/kernelPatches { };
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
(pythonFinal: pythonPrev:
(
pythonFinal: pythonPrev:
{
pnoise = final.callPackage ./packages/pnoise {
python3 = pythonFinal;
};
vpype =
final.callPackage ./packages/vpype { python3 = pythonFinal; };
vpype-gcode = final.callPackage ./packages/vpype-gcode {
python3 = pythonFinal;
};
} // (final.callPackage ./packages/axidraw/modules.nix {
python3 = pythonFinal;
}))
pnoise = final.callPackage ./packages/pnoise { python3 = pythonFinal; };
vpype = final.callPackage ./packages/vpype { python3 = pythonFinal; };
vpype-gcode = final.callPackage ./packages/vpype-gcode { python3 = pythonFinal; };
}
// (final.callPackage ./packages/axidraw/modules.nix { python3 = pythonFinal; })
)
];
};
};
}

View file

@ -1,14 +1,28 @@
# Based on original package.nix from zhaofengli
{ lib, stdenv, rustPlatform, fetchFromGitHub, pkg-config, installShellFiles, nix
, boost, darwin
{
lib,
stdenv,
rustPlatform,
fetchFromGitHub,
pkg-config,
installShellFiles,
nix,
boost,
darwin,
# Only build the client
, clientOnly ? false
# Only build the client
clientOnly ? false,
# Only build certain crates
, crates ?
if clientOnly then [ "attic-client" ] else [ "attic-client" "attic-server" ]
crates ?
if clientOnly then
[ "attic-client" ]
else
[
"attic-client"
"attic-server"
],
}:
rustPlatform.buildRustPackage {
@ -27,25 +41,27 @@ rustPlatform.buildRustPackage {
allowBuiltinFetchGit = true;
};
nativeBuildInputs = [ pkg-config installShellFiles ];
nativeBuildInputs = [
pkg-config
installShellFiles
];
buildInputs = [ nix boost ] ++ lib.optionals stdenv.isDarwin
(with darwin.apple_sdk.frameworks; [ SystemConfiguration ]);
buildInputs = [
nix
boost
] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ SystemConfiguration ]);
cargoBuildFlags = lib.concatMapStrings (c: "-p ${c} ") crates;
ATTIC_DISTRIBUTOR = "artemist";
# Workaround for https://github.com/NixOS/nixpkgs/issues/166205
env = lib.optionalAttrs stdenv.cc.isClang {
NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}";
};
env = lib.optionalAttrs stdenv.cc.isClang { NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}"; };
# Recursive Nix is not stable yet
doCheck = false;
postInstall =
lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
if [[ -f $out/bin/attic ]]; then
installShellCompletion --cmd attic \
--bash <($out/bin/attic gen-completions bash) \

View file

@ -1,12 +1,16 @@
{ stdenv, lib, fetchzip, autoPatchelfHook }:
{
stdenv,
lib,
fetchzip,
autoPatchelfHook,
}:
stdenv.mkDerivation rec {
pname = "axidraw-inkscape";
version = "394";
src = fetchzip {
url =
"https://cdn.evilmadscientist.com/dl/ad/public/${version}/AxiDraw_${version}_LinX86.zip";
url = "https://cdn.evilmadscientist.com/dl/ad/public/${version}/AxiDraw_${version}_LinX86.zip";
hash = "sha256-LoNi7mR30spELnEYikRuYFvlgUWP3w8KRbQ6Ug108vU=";
};
@ -23,8 +27,7 @@ stdenv.mkDerivation rec {
meta = with lib; {
description = "Inkscape extension for managing axidraw";
homepage =
"https://wiki.evilmadscientist.com/Axidraw_Software_Installation";
homepage = "https://wiki.evilmadscientist.com/Axidraw_Software_Installation";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ artemist ];
platforms = [ "x86_64-linux" ];

View file

@ -1,22 +1,26 @@
{ python3, fetchPypi, fetchzip, fetchurl }:
{
python3,
fetchPypi,
fetchzip,
fetchurl,
}:
let
inherit (python3) buildPythonPackage;
axicliVersion = "3.9.0";
axicliVer = builtins.replaceStrings [ "." ] [ "" ] axicliVersion;
axicliSrc = fetchzip {
url =
"https://github.com/evil-mad/axidraw/releases/download/v${axicliVersion}/AxiDraw_API_${axicliVer}.zip";
url = "https://github.com/evil-mad/axidraw/releases/download/v${axicliVersion}/AxiDraw_API_${axicliVer}.zip";
hash = "sha256-RPh00jiiH1RqqKZ10ylFP1J+iBYl5VOmZ8g0vFH8Ibg=";
};
in {
in
{
drawsvg = buildPythonPackage {
pname = "drawsvg";
version = "2.3.0";
format = "wheel";
src = fetchurl {
url =
"https://files.pythonhosted.org/packages/27/4f/65d72a014026495d8d2847e66bbe542cf899e50f087a50e0abab9c58ef3c/drawsvg-2.3.0-py3-none-any.whl";
url = "https://files.pythonhosted.org/packages/27/4f/65d72a014026495d8d2847e66bbe542cf899e50f087a50e0abab9c58ef3c/drawsvg-2.3.0-py3-none-any.whl";
sha256 = "1gqa5q5b7y38isyw1kgq2lprw5709jv13pic9s6bk80dbm32pbck";
};
};
@ -39,15 +43,17 @@ in {
hash = "sha256-YxSASXBNXqRyGp7x6jlTU0UYJHJkiKdlEzfDMzUtKXk=";
};
doCheck = false;
propagatedBuildInputs = with python3; [ ink-extensions pyserial ];
propagatedBuildInputs = with python3; [
ink-extensions
pyserial
];
};
axidrawinternal = buildPythonPackage {
pname = "axidrawinternal";
version = axicliVersion;
format = "wheel";
src =
"${axicliSrc}/prebuilt_dependencies/axidrawinternal-${axicliVersion}-py2.py3-none-any.whl";
src = "${axicliSrc}/prebuilt_dependencies/axidrawinternal-${axicliVersion}-py2.py3-none-any.whl";
propagatedBuildInputs = with python3; [
ink-extensions
requests

View file

@ -1,4 +1,13 @@
{ stdenv, lib, fetchFromGitHub, autoconf, automake, boost, cups, ... }:
{
stdenv,
lib,
fetchFromGitHub,
autoconf,
automake,
boost,
cups,
...
}:
stdenv.mkDerivation {
pname = "cups-dymo";
@ -11,9 +20,15 @@ stdenv.mkDerivation {
hash = "sha256-IwdTJxCOKyqsl1B5UQqCDpepz04U4VF+G3mqaJTQJ/w=";
};
nativeBuildInputs = [ autoconf automake ];
nativeBuildInputs = [
autoconf
automake
];
buildInputs = [ boost cups ];
buildInputs = [
boost
cups
];
preConfigure = ''
touch NEWS AUTHORS INSTALL README ChangeLog

View file

@ -1,4 +1,9 @@
{ lib, buildDotnetModule, dotnetCorePackages, fetchFromGitHub }:
{
lib,
buildDotnetModule,
dotnetCorePackages,
fetchFromGitHub,
}:
buildDotnetModule rec {
pname = "hactoolnet";
@ -22,8 +27,7 @@ buildDotnetModule rec {
meta = with lib; {
homepage = "https://github.com/Thealexbarney/LibHac";
description =
"Example program for LibHac, which implements parts of Horizon OS";
description = "Example program for LibHac, which implements parts of Horizon OS";
license = licenses.mit;
platforms = platforms.unix;
};

View file

@ -1,7 +1,8 @@
# This file was automatically generated by passthru.fetch-deps.
# Please dont edit it manually, your changes might get overwritten!
{ fetchNuGet }: [
{ fetchNuGet }:
[
(fetchNuGet {
pname = "Microsoft.AspNetCore.App.Ref";
version = "7.0.16";

View file

@ -1,4 +1,11 @@
{ lib, buildGo122Module, fetchFromGitHub, unicorn, libusb, pkg-config }:
{
lib,
buildGo122Module,
fetchFromGitHub,
unicorn,
libusb,
pkg-config,
}:
buildGo122Module rec {
pname = "ipsw";
@ -15,14 +22,20 @@ buildGo122Module rec {
patches = [ ./fix-build.patch ];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ unicorn libusb ];
buildInputs = [
unicorn
libusb
];
ldflags = [
"-s"
"-w"
"-X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppVersion=${version}"
"-X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppBuildTime=19700101"
];
tags = [ "unicorn" "libusb" ];
tags = [
"unicorn"
"libusb"
];
doCheck = false;
meta = with lib; {

View file

@ -1,10 +1,29 @@
{ stdenv, lib, fetchurl, autoPatchelfHook, fontconfig, freetype, libgcc, libusb
, libICE, libSM, ncurses5, udev, libX11, libXext, libXcursor, libXfixes
, libXrender, libXrandr }:
{
stdenv,
lib,
fetchurl,
autoPatchelfHook,
fontconfig,
freetype,
libgcc,
libusb,
libICE,
libSM,
ncurses5,
udev,
libX11,
libXext,
libXcursor,
libXfixes,
libXrender,
libXrandr,
}:
let
conf = (lib.importJSON ./version.json).${stdenv.hostPlatform.system} or (throw
"unsupported system ${stdenv.hostPlatform.system}");
in stdenv.mkDerivation rec {
conf =
(lib.importJSON ./version.json).${stdenv.hostPlatform.system}
or (throw "unsupported system ${stdenv.hostPlatform.system}");
in
stdenv.mkDerivation rec {
pname = "jlink";
version = conf.version;
@ -52,7 +71,12 @@ in stdenv.mkDerivation rec {
homepage = "https://www.segger.com/downloads/jlink";
description = "SEGGER J-Link";
license = licenses.unfree;
platforms = [ "x86_64-linux" "i686-linux" "armv7l-linux" "aarch64-linux" ];
platforms = [
"x86_64-linux"
"i686-linux"
"armv7l-linux"
"aarch64-linux"
];
maintainers = with maintainers; [ artemist ];
};
}

View file

@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
increase_max_topo = {
name = "increase-max-topo";
patch = ./increase-max-topo.patch;

View file

@ -1,4 +1,8 @@
{ lib, python3, fetchFromGitHub }:
{
lib,
python3,
fetchFromGitHub,
}:
python3.buildPythonPackage rec {
pname = "pnoise";

View file

@ -1,4 +1,9 @@
{ stdenv, fetchFromGitHub, pkg-config, libusb1 }:
{
stdenv,
fetchFromGitHub,
pkg-config,
libusb1,
}:
stdenv.mkDerivation rec {
pname = "stlink-tool";

View file

@ -1,4 +1,8 @@
{ lib, python3, fetchFromGitHub }:
{
lib,
python3,
fetchFromGitHub,
}:
python3.buildPythonPackage rec {
pname = "vpype";
@ -12,7 +16,11 @@ python3.buildPythonPackage rec {
hash = "sha256-waSHw4DBgozcBwNTgZwGfvmg0UHaENJIGrCqnMu0ruU=";
};
propagatedBuildInputs = with python3; [ click numpy vpype ];
propagatedBuildInputs = with python3; [
click
numpy
vpype
];
meta = with lib; {
description = "gcode extension for vpype";

View file

@ -1,4 +1,9 @@
{ lib, python3, fetchFromGitHub, withViewer ? true }:
{
lib,
python3,
fetchFromGitHub,
withViewer ? true,
}:
python3.buildPythonPackage rec {
pname = "vpype";
@ -15,8 +20,10 @@ python3.buildPythonPackage rec {
nativeBuildInputs = with python3; [ poetry-core ];
propagatedBuildInputs = with python3;
([
propagatedBuildInputs =
with python3;
(
[
asteval
cachetools
click
@ -29,19 +36,20 @@ python3.buildPythonPackage rec {
svgelements
svgwrite
tomli
] ++ lib.optionals withViewer [
]
++ lib.optionals withViewer [
glcontext
matplotlib
moderngl
pillow
pyside6
]);
]
);
# No checks since they want OpenGL and a GUI
meta = with lib; {
description =
"The Swiss-Army-knife command-line tool for plotter vector graphics";
description = "The Swiss-Army-knife command-line tool for plotter vector graphics";
homepage = "https://vpype.readthedocs.io/en/latest/";
license = with licenses; [ mit ];
maintainers = with maintainers; [ artemist ];

View file

@ -1,19 +1,27 @@
{ callPackage, stdenv, lib, fetchFromGitHub }:
{
callPackage,
stdenv,
lib,
fetchFromGitHub,
}:
let
assets = lib.importJSON ./assets.json;
modules = lib.importJSON ./modules.json;
buildModule = module: callPackage ./module.nix { inherit module; };
in {
in
{
host-tools = callPackage ./host-tools.nix {
inherit (assets) version hosts;
sources = assets.host_tools;
};
toolchains = lib.mapAttrs (target: sources:
toolchains = lib.mapAttrs (
target: sources:
callPackage ./toolchain.nix {
inherit target sources;
inherit (assets) version hosts;
}) assets.toolchains;
}
) assets.toolchains;
sdk = callPackage ./sdk.nix {
inherit (assets) version hosts;

View file

@ -1,9 +1,21 @@
{ stdenv, fetchurl, hosts, lib, python3, sources, version, which }:
{
stdenv,
fetchurl,
hosts,
lib,
python3,
sources,
version,
which,
}:
stdenv.mkDerivation rec {
pname = "zephyr-host-tools";
inherit version;
nativeBuildInputs = [ python3 which ];
nativeBuildInputs = [
python3
which
];
src = fetchurl (sources."${stdenv.hostPlatform.system}");
dontUnpack = true;

View file

@ -1,14 +1,21 @@
{ stdenvNoCC, lib, fetchFromGitHub, symlinkJoin, fetchurl, version ? null
, module }:
{
stdenvNoCC,
lib,
fetchFromGitHub,
symlinkJoin,
fetchurl,
version ? null,
module,
}:
let
labeledName = label:
if version != null then
"${module.name}-${label}-${version}"
else
"${module.name}-${label}";
fetchBlob = blob:
let blobFile = fetchurl { inherit (blob) url sha256; };
in stdenvNoCC.mkDerivation {
labeledName =
label: if version != null then "${module.name}-${label}-${version}" else "${module.name}-${label}";
fetchBlob =
blob:
let
blobFile = fetchurl { inherit (blob) url sha256; };
in
stdenvNoCC.mkDerivation {
name = "blob-${blob.path}";
passAsFile = [ "buildCommand" ];
buildCommand = ''
@ -16,12 +23,21 @@ let
ln -s ${blobFile} $out/${blob.path}
'';
};
baseSrc = fetchFromGitHub { inherit (module) owner repo rev name sha256; };
baseSrc = fetchFromGitHub {
inherit (module)
owner
repo
rev
name
sha256
;
};
blobbedSrc = symlinkJoin {
name = labeledName "with-blobs";
paths = [ baseSrc ] ++ (map fetchBlob module.blobs);
};
in stdenvNoCC.mkDerivation (finalAttrs: {
in
stdenvNoCC.mkDerivation (finalAttrs: {
name = labeledName "wrapped";
passthru.modulePath = "${finalAttrs.finalPackage.out}/${module.name}";
@ -32,4 +48,3 @@ in stdenvNoCC.mkDerivation (finalAttrs: {
ln -s ${blobbedSrc} "$out/${module.name}"
'';
})

View file

@ -1,7 +1,17 @@
{ lib, symlinkJoin, fetchurl, zephyrPackages, source, version, hosts
, toolchains ? [ ] }:
let src = fetchurl source;
in symlinkJoin rec {
{
lib,
symlinkJoin,
fetchurl,
zephyrPackages,
source,
version,
hosts,
toolchains ? [ ],
}:
let
src = fetchurl source;
in
symlinkJoin rec {
pname = "zephyr-sdk";
inherit version;
name = "${pname}-${version}";

View file

@ -1,4 +1,13 @@
{ stdenv, lib, fetchurl, autoPatchelfHook, target, sources, version, hosts }:
{
stdenv,
lib,
fetchurl,
autoPatchelfHook,
target,
sources,
version,
hosts,
}:
stdenv.mkDerivation {
pname = "zephyr-toolchain-${target}";
@ -35,8 +44,7 @@ stdenv.mkDerivation {
meta = with lib; {
homepage = "https://www.zephyrproject.org/";
description =
"Toolchain for building Zephyr for the ${target} architecture";
description = "Toolchain for building Zephyr for the ${target} architecture";
license = licenses.asl20;
platforms = hosts;
maintainers = with maintainers; [ artemist ];

View file

@ -1,7 +1,14 @@
{ lib, mkShell, python3, inkscape-with-extensions, inkscape-extensions, jupyter
{
lib,
mkShell,
python3,
inkscape-with-extensions,
inkscape-extensions,
jupyter,
}:
mkShell {
packages = [
packages =
[
(inkscape-with-extensions.override {
inkscapeExtensions = with inkscape-extensions; [
silhouette
@ -11,7 +18,8 @@ mkShell {
})
python3
jupyter
] ++ (with python3.pkgs; [
]
++ (with python3.pkgs; [
axicli
drawsvg
ipython
@ -20,5 +28,4 @@ mkShell {
vpype
vpype-gcode
]);
}

View file

@ -1,6 +1,28 @@
{ lib, mkShell, dotnetCorePackages, libX11, libgdiplus, SDL2_mixer, openal
, libsoundio, sndio, pulseaudio, vulkan-loader, ffmpeg, libICE, libSM, libXi
, libXcursor, libXext, libXrandr, fontconfig, glew, libGL, SDL2, udev }:
{
lib,
mkShell,
dotnetCorePackages,
libX11,
libgdiplus,
SDL2_mixer,
openal,
libsoundio,
sndio,
pulseaudio,
vulkan-loader,
ffmpeg,
libICE,
libSM,
libXi,
libXcursor,
libXext,
libXrandr,
fontconfig,
glew,
libGL,
SDL2,
udev,
}:
mkShell {
packages = [

View file

@ -1,10 +1,32 @@
{ lib, mkShell, zephyrPackages, cmake, ninja, gnumake, python3
, toolchains ? with zephyrPackages.toolchains; [ arm-zephyr-eabi ]
, enableWest ? false, zephyrSrc ? zephyrPackages.src, modules ? [ ]
, extraPackages ? [ ], extraAttrs ? { } }:
let zephyr-sdk = zephyrPackages.sdk.override { inherit toolchains; };
in mkShell ({
packages = [ cmake ninja gnumake python3 ] ++ (with python3.pkgs;
{
lib,
mkShell,
zephyrPackages,
cmake,
ninja,
gnumake,
python3,
toolchains ? with zephyrPackages.toolchains; [ arm-zephyr-eabi ],
enableWest ? false,
zephyrSrc ? zephyrPackages.src,
modules ? [ ],
extraPackages ? [ ],
extraAttrs ? { },
}:
let
zephyr-sdk = zephyrPackages.sdk.override { inherit toolchains; };
in
mkShell (
{
packages =
[
cmake
ninja
gnumake
python3
]
++ (
with python3.pkgs;
[
# requirements-base.txt
pyelftools
@ -19,16 +41,22 @@ in mkShell ({
requests
anytree
intelhex
] ++ lib.optional enableWest python3.pkgs.west ++ extraPackages);
]
++ lib.optional enableWest python3.pkgs.west
++ extraPackages
);
ZEPHYR_TOOLCHAIN_VARIANT = "zephyr";
ZEPHYR_SDK_INSTALL_DIR = "${zephyr-sdk}";
} // lib.optionalAttrs (zephyrSrc != null) {
}
// lib.optionalAttrs (zephyrSrc != null) {
ZEPHYR_BASE = "${zephyrSrc}";
shellHook = ''
PATH="${zephyrSrc}/scripts:$PATH"
'';
} // lib.optionalAttrs (modules != [ ]) {
ZEPHYR_MODULES =
lib.concatStringsSep ";" (map (pkg: pkg.passthru.modulePath) modules);
} // extraAttrs)
}
// lib.optionalAttrs (modules != [ ]) {
ZEPHYR_MODULES = lib.concatStringsSep ";" (map (pkg: pkg.passthru.modulePath) modules);
}
// extraAttrs
)