From dfc33b227931d06cc3510022cb6fe815ef690463 Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 2 Jul 2023 14:17:43 -0400 Subject: !hercules-ci -> garnix --- .github/dependabot.yml | 8 +++ README.md | 26 ++++++++-- flake.nix | 72 +++++++++++++-------------- garnix.yaml | 5 ++ lib/default.nix | 4 +- pkgs/_theseus.nix | 128 ++++++++++++++++++++++++++++++++++++++++++++++++ pkgs/default.nix | 18 +++++++ pkgs/discord-canary.nix | 1 - pkgs/discord.nix | 1 - pkgs/theseus.nix | 128 ------------------------------------------------ 10 files changed, 217 insertions(+), 174 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 garnix.yaml create mode 100644 pkgs/_theseus.nix create mode 100644 pkgs/default.nix delete mode 100644 pkgs/discord-canary.nix delete mode 100644 pkgs/discord.nix delete mode 100644 pkgs/theseus.nix diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..1d662ce --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + commit-message: + prefix: "actions" diff --git a/README.md b/README.md index ab42e63..6d04d43 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,30 @@ # nix-exprs -[![hercules-ci build status](https://img.shields.io/badge/dynamic/json?label=hercules-ci%20builds&query=%24.state&url=https%3A%2F%2Fapi.github.com%2Frepos%2Fgetchoo%2Fnix-exprs%2Fcommits%2Fmain%2Fstatus&color=8f97cb&style=flat-square&logo=github)](https://hercules-ci.com/github/getchoo/nix-exprs) +[![built with garnix](https://img.shields.io/badge/Built_with-Garnix-blue?style=flat-square&logo=nixos&link=https%3A%2F%2Fgarnix.io)](https://garnix.io) ## how to use -### enable cachix +### enable binary cache -i have a binary cache at , make sure to enable it -in your flake or nixos/darwin config or use `nix run nixpkgs#cachix use getchoo` -for cli support. +all packages are built with [garnix](https://garnix.io/), and cached on their servers. you can use this +yourself by following the instructions [here](https://garnix.io/docs/caching). i would also recommend +[donating](https://opencollective.com/garnix_io) if you can! + +example: + +```nix +{ + nix.settings = { + trusted-substituters = [ + "https://cache.garnix.io" + ]; + + trusted-public-keys = [ + "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" + ]; + } +} +``` ### library diff --git a/flake.nix b/flake.nix index 0a58a08..b76910f 100644 --- a/flake.nix +++ b/flake.nix @@ -2,8 +2,12 @@ description = "getchoo's nix expressions"; nixConfig = { - extra-substituters = ["https://nix-community.cachix.org"]; - extra-trusted-public-keys = ["nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="]; + extra-substituters = [ + "https://cache.garnix.io" + ]; + extra-trusted-public-keys = [ + "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" + ]; }; inputs = { @@ -27,26 +31,18 @@ ]; forAllSystems = nixpkgs.lib.genAttrs systems; - nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); - forEachSystem = fn: forAllSystems (s: fn nixpkgsFor.${s}); - - packageSet = pkgs: - with pkgs; { - cartridges = callPackage ./pkgs/cartridges.nix {}; - huion = callPackage ./pkgs/huion.nix {}; - mommy = callPackage ./pkgs/mommy.nix {}; - # broken due to upstrea adopting pnpm - # theseus = callPackage ./pkgs/theseus.nix {}; - treefetch = callPackage ./pkgs/treefetch.nix {}; - swhkd = callPackage ./pkgs/swhkd {}; - vim-just = callPackage ./pkgs/vim-just.nix {}; - xwaylandvideobridge = callPackage ./pkgs/xwaylandvideobridge.nix {}; - }; + nixpkgsFor = forAllSystems (system: + import nixpkgs { + inherit system; + overlays = [self.overlays.default]; + }); - overrides = prev: { - discord = import ./pkgs/discord.nix prev; - discord-canary = import ./pkgs/discord-canary.nix prev; - }; + forEachSystem = fn: + forAllSystems (system: + fn { + inherit system; + pkgs = nixpkgsFor.${system}; + }); in { flakeModules = { default = import ./modules/flake; @@ -54,36 +50,38 @@ hydraJobs = import ./modules/flake/hydraJobs.nix; }; - formatter = forEachSystem (pkgs: pkgs.alejandra); + formatter = forEachSystem ({pkgs, ...}: pkgs.alejandra); - herculesCI = let + checks = let ciSystems = [ "x86_64-linux" "aarch64-linux" ]; - lib = self.lib {inherit (self) inputs;}; - inherit (lib.ci ciSystems) mkCompatiblePkgs; - in { - inherit ciSystems; - - onPush.default = { - outputs = { - packages = mkCompatiblePkgs self.packages; - }; - }; - }; + pkgs = (self.lib.ci ciSystems).mkCompatiblePkgs self.packages; + in + nixpkgs.lib.genAttrs ciSystems (sys: pkgs.${sys}); packages = forEachSystem ( - pkgs: let - p = packageSet pkgs; + {pkgs, ...}: let + inherit (builtins) attrNames filter listToAttrs map readDir substring; + inherit (nixpkgs.lib) removeSuffix; + + pkgNames = filter (p: substring 0 1 p != "_") (attrNames (readDir ./pkgs)); + pkgs' = map (removeSuffix ".nix") pkgNames; + + p = listToAttrs (map (name: { + inherit name; + value = pkgs.${name}; + }) + pkgs'); in p // {default = p.treefetch;} ); lib = import ./lib nixpkgs.lib; - overlays.default = final: prev: packageSet final // overrides prev; + overlays.default = import ./pkgs; templates = let # string -> string -> {} diff --git a/garnix.yaml b/garnix.yaml new file mode 100644 index 0000000..92f2c79 --- /dev/null +++ b/garnix.yaml @@ -0,0 +1,5 @@ +builds: + exclude: [] + include: + - "checks.x86_64-linux.*" + - "checks.aarch64-linux.*" diff --git a/lib/default.nix b/lib/default.nix index ccdb0bf..10ac688 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,4 +1,4 @@ -lib: {inputs, ...}: { +lib: { ci = import ./ci.nix lib; - configs = import ./configs.nix inputs; + configs = import ./configs.nix; } diff --git a/pkgs/_theseus.nix b/pkgs/_theseus.nix new file mode 100644 index 0000000..c458896 --- /dev/null +++ b/pkgs/_theseus.nix @@ -0,0 +1,128 @@ +{ + lib, + dbus, + freetype, + fetchFromGitHub, + fetchYarnDeps, + flite, + glfw, + glib-networking, + gtk3, + jdk8, + jdk17, + jdks ? [jdk8 jdk17], + libappindicator-gtk3, + libGL, + libpulseaudio, + librsvg, + libsoup, + mkYarnPackage, + openal, + openssl, + pkg-config, + rustPlatform, + stdenv, + webkitgtk, + wrapGAppsHook, + xorg, + ... +}: let + inherit (lib) licenses maintainers makeBinPath makeLibraryPath platforms; + pname = "theseus"; + + rev = "e0e9c3f1666d3db220cd8918acfa091ec4eecb36"; + src = fetchFromGitHub { + owner = "modrinth"; + repo = "theseus"; + inherit rev; + sha256 = "sha256-pIJQQAYSQBalW1pQBCirkcxmS6DBGj/E6zKL8/Nc8Ww="; + }; + + theseus-frontend = let + source = src + "/theseus_gui"; + in + mkYarnPackage { + pname = "${pname}-frontend"; + + src = source; + + offlineCache = fetchYarnDeps { + yarnLock = source + "/yarn.lock"; + sha256 = "sha256-UFPILd1f4kp0VTPlBccp36kTpsHUrcsxkfHMCtaDX3Y="; + }; + + packageJson = source + "/package.json"; + + buildPhase = '' + export HOME=$(mktemp -d) + yarn --offline run build + cp -r deps/theseus_gui/dist $out + ''; + + distPhase = "true"; + dontInstall = true; + }; +in + rustPlatform.buildRustPackage { + inherit pname src; + version = builtins.substring 0 7 rev; + + postPatch = '' + substituteInPlace theseus_gui/src-tauri/tauri.conf.json \ + --replace '"distDir": "../dist",' '"distDir": "${theseus-frontend}",' + ''; + + cargoSha256 = "sha256-xleTO3AEW3yfkfJY2XjJt8g1WotdaB3tW6u/naxDszE="; + + buildInputs = [ + dbus + freetype + gtk3 + libappindicator-gtk3 + librsvg + libsoup + openssl + webkitgtk + wrapGAppsHook + ]; + + nativeBuildInputs = [pkg-config]; + + preFixup = let + libPath = makeLibraryPath ([ + flite + glfw + libGL + libpulseaudio + openal + stdenv.cc.cc.lib + ] + ++ (with xorg; [ + libX11 + libXcursor + libXext + libXxf86vm + libXrandr + ])); + binPath = makeBinPath ([xorg.xrandr] ++ jdks); + in '' + gappsWrapperArgs+=( + --set LD_LIBRARY_PATH /run/opengl-driver/lib:${libPath} + --prefix GIO_MODULE_DIR : ${glib-networking}/lib/gio/modules/ + --prefix PATH : ${binPath} + ) + + runHook postInstall + ''; + + meta = { + description = "Modrinth's future game launcher"; + longDescription = '' + Modrinth's future game launcher which can be used as a CLI, GUI, and a library for creating and playing Modrinth projects. + ''; + homepage = "https://modrinth.com"; + license = licenses.gpl3Plus; + #maintainers = [maintainers.getchoo]; + platforms = with platforms; linux ++ darwin; + }; + } diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..d245bec --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,18 @@ +final: prev: let + inherit (final) callPackage; +in { + # original packages + cartridges = callPackage ./cartridges.nix {}; + huion = callPackage ./huion.nix {}; + mommy = callPackage ./mommy.nix {}; + ## broken due to upstream adopting pnpm + ## theseus = callPackage ./theseus.nix {}; + treefetch = callPackage ./treefetch.nix {}; + swhkd = callPackage ./swhkd {}; + vim-just = callPackage ./vim-just.nix {}; + xwaylandvideobridge = callPackage ./xwaylandvideobridge.nix {}; + + # modified packages + discord = prev.discord.override {withOpenASAR = true;}; + discord-canary = prev.discord-canary.override {withOpenASAR = true;}; +} diff --git a/pkgs/discord-canary.nix b/pkgs/discord-canary.nix deleted file mode 100644 index 6cb9d27..0000000 --- a/pkgs/discord-canary.nix +++ /dev/null @@ -1 +0,0 @@ -prev: prev.discord-canary.override {withOpenASAR = true;} diff --git a/pkgs/discord.nix b/pkgs/discord.nix deleted file mode 100644 index 3cfa01d..0000000 --- a/pkgs/discord.nix +++ /dev/null @@ -1 +0,0 @@ -prev: prev.discord.override {withOpenASAR = true;} diff --git a/pkgs/theseus.nix b/pkgs/theseus.nix deleted file mode 100644 index c458896..0000000 --- a/pkgs/theseus.nix +++ /dev/null @@ -1,128 +0,0 @@ -{ - lib, - dbus, - freetype, - fetchFromGitHub, - fetchYarnDeps, - flite, - glfw, - glib-networking, - gtk3, - jdk8, - jdk17, - jdks ? [jdk8 jdk17], - libappindicator-gtk3, - libGL, - libpulseaudio, - librsvg, - libsoup, - mkYarnPackage, - openal, - openssl, - pkg-config, - rustPlatform, - stdenv, - webkitgtk, - wrapGAppsHook, - xorg, - ... -}: let - inherit (lib) licenses maintainers makeBinPath makeLibraryPath platforms; - pname = "theseus"; - - rev = "e0e9c3f1666d3db220cd8918acfa091ec4eecb36"; - src = fetchFromGitHub { - owner = "modrinth"; - repo = "theseus"; - inherit rev; - sha256 = "sha256-pIJQQAYSQBalW1pQBCirkcxmS6DBGj/E6zKL8/Nc8Ww="; - }; - - theseus-frontend = let - source = src + "/theseus_gui"; - in - mkYarnPackage { - pname = "${pname}-frontend"; - - src = source; - - offlineCache = fetchYarnDeps { - yarnLock = source + "/yarn.lock"; - sha256 = "sha256-UFPILd1f4kp0VTPlBccp36kTpsHUrcsxkfHMCtaDX3Y="; - }; - - packageJson = source + "/package.json"; - - buildPhase = '' - export HOME=$(mktemp -d) - yarn --offline run build - cp -r deps/theseus_gui/dist $out - ''; - - distPhase = "true"; - dontInstall = true; - }; -in - rustPlatform.buildRustPackage { - inherit pname src; - version = builtins.substring 0 7 rev; - - postPatch = '' - substituteInPlace theseus_gui/src-tauri/tauri.conf.json \ - --replace '"distDir": "../dist",' '"distDir": "${theseus-frontend}",' - ''; - - cargoSha256 = "sha256-xleTO3AEW3yfkfJY2XjJt8g1WotdaB3tW6u/naxDszE="; - - buildInputs = [ - dbus - freetype - gtk3 - libappindicator-gtk3 - librsvg - libsoup - openssl - webkitgtk - wrapGAppsHook - ]; - - nativeBuildInputs = [pkg-config]; - - preFixup = let - libPath = makeLibraryPath ([ - flite - glfw - libGL - libpulseaudio - openal - stdenv.cc.cc.lib - ] - ++ (with xorg; [ - libX11 - libXcursor - libXext - libXxf86vm - libXrandr - ])); - binPath = makeBinPath ([xorg.xrandr] ++ jdks); - in '' - gappsWrapperArgs+=( - --set LD_LIBRARY_PATH /run/opengl-driver/lib:${libPath} - --prefix GIO_MODULE_DIR : ${glib-networking}/lib/gio/modules/ - --prefix PATH : ${binPath} - ) - - runHook postInstall - ''; - - meta = { - description = "Modrinth's future game launcher"; - longDescription = '' - Modrinth's future game launcher which can be used as a CLI, GUI, and a library for creating and playing Modrinth projects. - ''; - homepage = "https://modrinth.com"; - license = licenses.gpl3Plus; - #maintainers = [maintainers.getchoo]; - platforms = with platforms; linux ++ darwin; - }; - } -- cgit v1.2.3