diff --git a/.github/workflows/nix.yaml b/.github/workflows/nix.yaml new file mode 100644 index 0000000000..436142f986 --- /dev/null +++ b/.github/workflows/nix.yaml @@ -0,0 +1,16 @@ +name: "Nix Build" + +on: + workflow_dispatch: + pull_request: + push: + branches: [main, master] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v12 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - run: nix build diff --git a/README.md b/README.md index 9d7cdcc5be..abfbfaa840 100644 --- a/README.md +++ b/README.md @@ -398,6 +398,37 @@ proxy-groups: sudo apt-get install libkeybinder-3.0-dev ``` +### ❄️ NixOS + +Добавьте репозиторий в `inputs` флейка и подключите оверлей: + +`flake.nix` +```nix +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + # Новый инпут + flclashx.url = "github:pluralplay/FlClashX"; + }; + + outputs = { self, nixpkgs, flclashx, ... }: { + nixosConfigurations.myhostname = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + { + # Оверлей + nixpkgs.overlays = [ flclashx.overlays.default ]; + + # Установка пакета + environment.systemPackages = [ pkgs.flclashx ]; + } + ]; + }; + }; +} +``` + + ### Android Поддерживаются следующие действия: @@ -423,3 +454,4 @@ proxy-groups: Если хотите поддержать копеечкой, то можно сделать это тут.
**TON USDT:** `UQDSfrJ_k1BdsknhdR_zj4T3Is3OdMylD8PnDJ9mxO35i-TE` + diff --git a/README_EN.md b/README_EN.md index 3c6d9ac44b..e70cff56c3 100644 --- a/README_EN.md +++ b/README_EN.md @@ -315,6 +315,38 @@ By default, the following configuration parameters received from the subscriptio sudo apt-get install libkeybinder-3.0-dev ``` +### ❄️ NixOS + +Add the repository to your flake's `inputs` and apply the overlay: + +`flake.nix` + +```nix +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + # New input + flclashx.url = "github:pluralplay/FlClashX"; + }; + + outputs = { self, nixpkgs, flclashx, ... }: { + nixosConfigurations.myhostname = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + { + # Overlay + nixpkgs.overlays = [ flclashx.overlays.default ]; + + # Install the package + environment.systemPackages = [ pkgs.flclashx ]; + } + ]; + }; + }; +} + +``` + ### Android The following actions are supported: @@ -341,3 +373,8 @@ If you want to support with a small donation, you can $out + '' + ) + ); + preBuild = '' + mkdir -p libclash/linux + cp ${flclashCore}/bin/FlClashCore libclash/linux/FlClashCore + ''; + nativeBuildInputs = with pkgs; [ + pkg-config + wrapGAppsHook3 + ]; + buildInputs = with pkgs; [ + gtk3 + glib + gdk-pixbuf + cairo + pango + atk + harfbuzz + libepoxy + libayatana-appindicator + keybinder3 + libX11 + libXcursor + libXrandr + libXinerama + libXi + ]; + meta = with pkgs.lib; { + homepage = "https://github.com/pluralplay/FlClashX"; + license = licenses.gpl3Only; + mainProgram = "FlClashX"; + platforms = platforms.linux; + }; + }; + in + { + packages = rec { + default = flclashx; + inherit flclashx; + flclashx-core = flclashCore; + }; + devShells.default = pkgs.mkShell { + inputsFrom = [ flclashx ]; + nativeBuildInputs = with pkgs; [ + flutter + go + yq-go + ]; + }; + } + ) + // { + overlays.default = final: prev: { + flclashx = self.packages.${final.system}.flclashx; + }; + }; +}