Format flake.nix and update PnpmDeps hash (#1639)

<!-- Please read
https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before
submitting your pull request -->

### Description

I ran `nix fmt` to format the flake.nix file to fit for treefmt,
beforehand running `nix flake check -L` would fail before reaching the
flake hash mismatch check, thus failing to produce the new working pnpm
deps hash for the flake (see
https://github.com/SableClient/Sable/actions/runs/30847422116/job/91799029692#step:5:908).
Also updated the hash manually.

<!-- Please include a summary of the change. Please also include
relevant motivation and context. List any dependencies that are required
for this change. -->

Fixes #1436

#### Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

### Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings

### AI disclosure:

- [ ] Partially AI assisted (clarify which code was AI assisted and
briefly explain what it does).
- [ ] Fully AI generated (explain what all the generated code does in
moderate detail).
<!-- Write any explanation required here, but do not generate the
explanation using AI!! You must prove you understand what the code in
this PR does. -->
This commit is contained in:
7w1 authored and GitHub committed 2026-08-06 03:25:47 +00:00
commit ec8eed75e8
1 file changed
+240 -234
+240 -234
View File
@@ -13,8 +13,9 @@
};
};
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.git-hooks.flakeModule
inputs.treefmt-nix.flakeModule
@@ -27,24 +28,26 @@
"aarch64-darwin"
];
perSystem = {
inputs',
config,
system,
lib,
...
}: let
pkgs = import inputs.nixpkgs {
inherit system;
perSystem =
{
inputs',
config,
system,
lib,
...
}:
let
pkgs = import inputs.nixpkgs {
inherit system;
config = {
allowUnfree = true;
android_sdk.accept_license = true;
config = {
allowUnfree = true;
android_sdk.accept_license = true;
};
};
};
rust = (
with inputs'.fenix.packages;
rust = (
with inputs'.fenix.packages;
combine [
stable.toolchain
targets.aarch64-linux-android.stable.rust-std
@@ -52,138 +55,140 @@
targets.armv7-linux-androideabi.stable.rust-std
targets.i686-linux-android.stable.rust-std
]
);
);
platformVersion = "36";
systemImageType = "default";
currentPath = builtins.getEnv "PWD";
androidEnv = pkgs.androidenv.override {licenseAccepted = true;};
androidComp = (
androidEnv.composeAndroidPackages {
cmdLineToolsVersion = "8.0";
includeNDK = true;
buildToolsVersions = ["35.0.0"];
platformVersion = "36";
systemImageType = "default";
currentPath = builtins.getEnv "PWD";
androidEnv = pkgs.androidenv.override { licenseAccepted = true; };
androidComp = (
androidEnv.composeAndroidPackages {
cmdLineToolsVersion = "8.0";
includeNDK = true;
buildToolsVersions = [ "35.0.0" ];
platformVersions = [
"30"
platformVersion
];
includeEmulator = true;
includeSystemImages = true;
systemImageTypes = [
systemImageType
];
abiVersions = [
"x86"
"x86_64"
"armeabi-v7a"
"arm64-v8a"
];
cmakeVersions = ["3.10.2"];
}
);
android-sdk = pkgs.android-studio.withSdk androidComp.androidsdk;
platformVersions = [
"30"
platformVersion
];
includeEmulator = true;
includeSystemImages = true;
systemImageTypes = [
systemImageType
];
abiVersions = [
"x86"
"x86_64"
"armeabi-v7a"
"arm64-v8a"
];
cmakeVersions = [ "3.10.2" ];
}
);
android-sdk = pkgs.android-studio.withSdk androidComp.androidsdk;
self = inputs.self;
self = inputs.self;
packageJson = builtins.fromJSON (builtins.readFile ./package.json);
packageJson = builtins.fromJSON (builtins.readFile ./package.json);
nodejs = pkgs.nodejs_24;
pnpm = pkgs.pnpm_10;
pnpmConfigHook = pkgs.pnpmConfigHook.override {inherit pnpm;};
nodejs = pkgs.nodejs_24;
pnpm = pkgs.pnpm_10;
pnpmConfigHook = pkgs.pnpmConfigHook.override { inherit pnpm; };
pnpmNativeBuildInputs = [
pkgs.pkg-config
nodejs
pnpm
pnpmConfigHook
];
pnpmNativeBuildInputs = [
pkgs.pkg-config
nodejs
pnpm
pnpmConfigHook
];
mkPnpmDeps = {
src,
version,
pnpmInstallFlags,
}:
pkgs.fetchPnpmDeps {
inherit
pnpm
src
version
pnpmInstallFlags
;
pname = "sable";
fetcherVersion = 3;
hash = "sha256-9lHy7/+hVET5c9Mt3F9DvrkW97DMxTISJsrklK/Ls2c=";
};
mkPnpmCheck = name: script:
pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "sable-${name}";
inherit (packageJson) version;
src = lib.cleanSource ./.;
pnpmInstallFlags = ["--ignore-scripts"];
pnpmDeps = mkPnpmDeps {
inherit (finalAttrs) src version pnpmInstallFlags;
mkPnpmDeps =
{
src,
version,
pnpmInstallFlags,
}:
pkgs.fetchPnpmDeps {
inherit
pnpm
src
version
pnpmInstallFlags
;
pname = "sable";
fetcherVersion = 3;
hash = "sha256-1siT4fB6ty2azmWXe5L40EFUdk0th59qIdARUB0cVOc=";
};
nativeBuildInputs = pnpmNativeBuildInputs;
mkPnpmCheck =
name: script:
pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "sable-${name}";
inherit (packageJson) version;
src = lib.cleanSource ./.;
buildPhase = ''
runHook preBuild
pnpm run ${script}
runHook postBuild
'';
pnpmInstallFlags = [ "--ignore-scripts" ];
installPhase = ''
runHook preInstall
touch $out
runHook postInstall
'';
pnpmDeps = mkPnpmDeps {
inherit (finalAttrs) src version pnpmInstallFlags;
};
doCheck = false;
});
nativeBuildInputs = pnpmNativeBuildInputs;
nativeBuildInputs = with pkgs; [
pkg-config
gobject-introspection
cargo
cargo-tauri
nodejs
xdg-utils
desktop-file-utils
wrapGAppsHook3
];
buildPhase = ''
runHook preBuild
pnpm run ${script}
runHook postBuild
'';
buildInputs = with pkgs; [
at-spi2-atk
atkmm
cairo
gdk-pixbuf
glib
glib-networking
gtk3
gsettings-desktop-schemas
harfbuzz
librsvg
libsoup_3
pango
webkitgtk_4_1
openssl
dbus
dbus.dev
libayatana-appindicator
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-ugly
gst_all_1.gst-libav
android-sdk
];
installPhase = ''
runHook preInstall
touch $out
runHook postInstall
'';
defaultPackages = [
doCheck = false;
});
nativeBuildInputs = with pkgs; [
pkg-config
gobject-introspection
cargo
cargo-tauri
nodejs
xdg-utils
desktop-file-utils
wrapGAppsHook3
];
buildInputs = with pkgs; [
at-spi2-atk
atkmm
cairo
gdk-pixbuf
glib
glib-networking
gtk3
gsettings-desktop-schemas
harfbuzz
librsvg
libsoup_3
pango
webkitgtk_4_1
openssl
dbus
dbus.dev
libayatana-appindicator
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-ugly
gst_all_1.gst-libav
android-sdk
];
defaultPackages = [
nodejs
pnpm
rust
@@ -200,112 +205,113 @@
pkgs.nixd
pkgs.jdk
];
in {
treefmt = {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
oxfmt.enable = true;
};
settings.global.excludes = [
"dist"
"node_modules"
"pnpm-lock.yaml"
"pnpm-workspace.yaml"
"package.json"
"LICENSE"
"CHANGELOG.md"
"./changeset"
];
};
pre-commit.settings.hooks = {
in
{
treefmt = {
enable = true;
package = config.treefmt.build.wrapper;
};
};
packages.sable = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "sable";
inherit (packageJson) version;
src = lib.cleanSource ./.;
# ignoring knope for building
pnpmInstallFlags = ["--ignore-scripts"];
pnpmDeps = mkPnpmDeps {
inherit (finalAttrs) src version pnpmInstallFlags;
};
nativeBuildInputs = pnpmNativeBuildInputs;
env.VITE_BUILD_HASH = self.shortRev or self.dirtyShortRev or "";
env.SABLE_BUILD_FLAVOR = "stable";
buildPhase = ''
runHook preBuild
pnpm run build
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r dist $out
runHook postInstall
'';
});
packages.android-emulator = androidEnv.emulateApp {
name = "emulate-sable";
platformVersion = platformVersion;
abiVersion = "x86_64"; # arm64-v8a
systemImageType = systemImageType;
};
packages.default = config.packages.sable;
checks = {
build = config.packages.sable;
lint = mkPnpmCheck "lint" "lint";
fmt = mkPnpmCheck "fmt" "fmt:check";
test = mkPnpmCheck "test" "test:run";
typecheck = mkPnpmCheck "typecheck" "typecheck";
knip = mkPnpmCheck "knip" "knip";
};
devShells = {
default = pkgs.mkShell {
inherit buildInputs nativeBuildInputs;
packages = defaultPackages;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (nativeBuildInputs ++ buildInputs);
GIO_EXTRA_MODULES = "${pkgs.glib-networking}/lib/gio/modules";
GST_PLUGIN_SYSTEM_PATH = "${pkgs.gst_all_1.gst-plugins-base}/lib/gstreamer-1.0:${pkgs.gst_all_1.gst-plugins-good}/lib/gstreamer-1.0:${pkgs.gst_all_1.gst-plugins-bad}/lib/gstreamer-1.0";
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
android = pkgs.mkShell {
inherit buildInputs nativeBuildInputs;
packages = defaultPackages ++ [
android-sdk
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
oxfmt.enable = true;
};
settings.global.excludes = [
"dist"
"node_modules"
"pnpm-lock.yaml"
"pnpm-workspace.yaml"
"package.json"
"LICENSE"
"CHANGELOG.md"
"./changeset"
];
};
pre-commit.settings.hooks = {
treefmt = {
enable = true;
package = config.treefmt.build.wrapper;
};
};
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (nativeBuildInputs ++ buildInputs);
packages.sable = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "sable";
inherit (packageJson) version;
src = lib.cleanSource ./.;
ANDROID_HOME = "${androidComp.androidsdk}/libexec/android-sdk";
ANDROID_SDK_ROOT = "${androidComp.androidsdk}/libexec/android-sdk";
ANDROID_NDK_ROOT = "${androidComp.androidsdk}/libexec/android-sdk/ndk-bundle";
# ignoring knope for building
pnpmInstallFlags = [ "--ignore-scripts" ];
GIO_EXTRA_MODULES = "${pkgs.glib-networking}/lib/gio/modules";
GST_PLUGIN_SYSTEM_PATH = "${pkgs.gst_all_1.gst-plugins-base}/lib/gstreamer-1.0:${pkgs.gst_all_1.gst-plugins-good}/lib/gstreamer-1.0:${pkgs.gst_all_1.gst-plugins-bad}/lib/gstreamer-1.0";
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
pnpmDeps = mkPnpmDeps {
inherit (finalAttrs) src version pnpmInstallFlags;
};
nativeBuildInputs = pnpmNativeBuildInputs;
env.VITE_BUILD_HASH = self.shortRev or self.dirtyShortRev or "";
env.SABLE_BUILD_FLAVOR = "stable";
buildPhase = ''
runHook preBuild
pnpm run build
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r dist $out
runHook postInstall
'';
});
packages.android-emulator = androidEnv.emulateApp {
name = "emulate-sable";
platformVersion = platformVersion;
abiVersion = "x86_64"; # arm64-v8a
systemImageType = systemImageType;
};
packages.default = config.packages.sable;
checks = {
build = config.packages.sable;
lint = mkPnpmCheck "lint" "lint";
fmt = mkPnpmCheck "fmt" "fmt:check";
test = mkPnpmCheck "test" "test:run";
typecheck = mkPnpmCheck "typecheck" "typecheck";
knip = mkPnpmCheck "knip" "knip";
};
devShells = {
default = pkgs.mkShell {
inherit buildInputs nativeBuildInputs;
packages = defaultPackages;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (nativeBuildInputs ++ buildInputs);
GIO_EXTRA_MODULES = "${pkgs.glib-networking}/lib/gio/modules";
GST_PLUGIN_SYSTEM_PATH = "${pkgs.gst_all_1.gst-plugins-base}/lib/gstreamer-1.0:${pkgs.gst_all_1.gst-plugins-good}/lib/gstreamer-1.0:${pkgs.gst_all_1.gst-plugins-bad}/lib/gstreamer-1.0";
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
android = pkgs.mkShell {
inherit buildInputs nativeBuildInputs;
packages = defaultPackages ++ [
android-sdk
];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (nativeBuildInputs ++ buildInputs);
ANDROID_HOME = "${androidComp.androidsdk}/libexec/android-sdk";
ANDROID_SDK_ROOT = "${androidComp.androidsdk}/libexec/android-sdk";
ANDROID_NDK_ROOT = "${androidComp.androidsdk}/libexec/android-sdk/ndk-bundle";
GIO_EXTRA_MODULES = "${pkgs.glib-networking}/lib/gio/modules";
GST_PLUGIN_SYSTEM_PATH = "${pkgs.gst_all_1.gst-plugins-base}/lib/gstreamer-1.0:${pkgs.gst_all_1.gst-plugins-good}/lib/gstreamer-1.0:${pkgs.gst_all_1.gst-plugins-bad}/lib/gstreamer-1.0";
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
};
};
};
};
}