Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cachix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
with:
name: freesmlauncher
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- run: nix-build | cachix push freesmlauncher
- run: nix build | cachix push freesmlauncher
- run: |
nix develop
echo "OK"
10 changes: 0 additions & 10 deletions default.nix

This file was deleted.

17 changes: 0 additions & 17 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

132 changes: 55 additions & 77 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,104 +15,82 @@
};

inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};

nix-filter = {
url = "github:numtide/nix-filter";
};

nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nix-filter.url = "github:numtide/nix-filter";
libnbtplusplus = {
url = "github:FreesmTeam/libnbtplusplus";
flake = false;
};

flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};

outputs = {
self,
nixpkgs,
libnbtplusplus,
nix-filter,
libnbtplusplus,
...
}: let
inherit (nixpkgs) lib;
systems = lib.systems.flakeExposed;
forAllSystems = lib.genAttrs systems;
nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];

forEachSystem = nixpkgs.lib.genAttrs systems;
in {
formatter = forAllSystems (system: nixpkgsFor.${system}.alejandra);
devShells = forAllSystems (
system: let
pkgs = nixpkgsFor.${system};
in {
default = pkgs.mkShell {
inputsFrom = [
self.packages.${system}.freesmlauncher-unwrapped
];
buildInputs = [
pkgs.ccache
pkgs.ninja
];
shellHook = ''
# https://discourse.nixos.org/t/qt-development-environment-on-a-flake-system/23707/5
setQtEnvironment=$(mktemp)
random=$(openssl rand -base64 20 | sed "s/[^a-zA-Z0-9]//g")
makeWrapper "$(type -p sh)" "$setQtEnvironment" "''${qtWrapperArgs[@]}" --argv0 "$random"
sed "/$random/d" -i "$setQtEnvironment"
source "$setQtEnvironment"
'';
};
}
);
overlays.default = final: prev: {
freesmlauncher-unwrapped = final.callPackage ./nix/unwrapped.nix {
inherit nix-filter libnbtplusplus self;
};

freesmlauncher = final.callPackage ./nix/wrapper.nix;
};

overlays = {
default = final: prev: {
freesmlauncher-unwrapped = prev.callPackage ./nix/unwrapped.nix {
inherit
libnbtplusplus
nix-filter
self
;
};
packages = forEachSystem (system: let
pkgs = import nixpkgs {inherit system;};

freesmlauncher = final.callPackage ./nix/wrapper.nix {};
freesmlauncher-unwrapped = pkgs.callPackage ./nix/unwrapped.nix {
inherit nix-filter libnbtplusplus self;
};

freesmlauncher = pkgs.callPackage ./nix/wrapper.nix {
inherit freesmlauncher-unwrapped;
};
};

packages = forAllSystems (
system: let
pkgs = nixpkgsFor.${system};
freesmlauncher-unwrapped-debug = freesmlauncher-unwrapped.overrideAttrs {
cmakeBuildType = "Debug";
dontStrip = true;
};

freesmPackages = lib.makeScope pkgs.newScope (final: self.overlays.default final pkgs);
freesmlauncher-debug = pkgs.callPackage ./nix/wrapper.nix {
freesmlauncher-unwrapped = freesmlauncher-unwrapped-debug;
};
in {
inherit freesmlauncher freesmlauncher-unwrapped freesmlauncher-debug freesmlauncher-unwrapped-debug;

packages = {
inherit (freesmPackages) freesmlauncher-unwrapped freesmlauncher;
default = freesmPackages.freesmlauncher;
};
in
lib.filterAttrs (_: lib.meta.availableOn pkgs.stdenv.hostPlatform) packages
);
default = freesmlauncher;
});

legacyPackages = forAllSystems (
system: let
freesmPackages = self.packages.${system};
legacyPackages = self.legacyPackages.${system};
in {
freesmlauncher-debug = freesmPackages.freesmlauncher.override {
freesmlauncher-unwrapped = legacyPackages.freesmlauncher-unwrapped-debug;
};
devShells = forEachSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [self.overlays.default];
};
in {
default = pkgs.mkShell {
inputsFrom = [pkgs.freesmlauncher-unwrapped];

packages = with pkgs; [
ccache
ninja
];
};
});

freesmlauncher-unwrapped-debug = freesmPackages.freesmlauncher-unwrapped.overrideAttrs {
cmakeBuildType = "Debug";
dontStrip = true;
};
}
formatter = forEachSystem (
system:
(import nixpkgs {inherit system;}).alejandra
);
};
}
97 changes: 72 additions & 25 deletions nix/README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,84 @@
# NixOS

> [!IMPORTANT]
> We are using **Garnix CI** for binary caching.
> To add the binary cache manually, proceed to read [this](https://garnix.io/docs/ci/caching).
> We use **Garnix CI** for binary caching.
> To configure the cache manually, follow the official guide:
>
> - [Garnix binary cache guide](https://garnix.io/docs/ci/caching)
>
> We also use **[Cachix](https://app.cachix.org/cache/freesmlauncher#pull)** as a second cache for binary caching.
> For more information, check out [this guide](https://docs.cachix.org/getting-started#using-binaries-with-nix).
> We also provide a secondary cache through [**Cachix**](https://app.cachix.org/cache/freesmlauncher#pull).
> Additional information is available in the official
> [Cachix getting started guide](https://docs.cachix.org/getting-started#using-binaries-with-nix).

<div align="center">

# Running and installing on NixOS

---
This guide explains how to run and install **FreesmLauncher** on NixOS.

</div>

## Running without installation

```fish
nix run github:FreesmTeam/FreesmLauncher#freesmlauncher
```

### <div align="center"> Using on NixOS / Nixpkgs </div>
## Installation

Currently, **Freesm** isn't in `nixpkgs` (yet?). To use it, you'll need to add it in your `flake.nix`:
Add the flake input to your `flake.nix`:

```nix
{
inputs = {
freesmlauncher = {
url = "github:FreesmTeam/FreesmLauncher";
inputs = {
nixpkgs = {
follows = "nixpkgs";
};
};
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

freesmlauncher = {
url = "github:FreesmTeam/FreesmLauncher";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
nixpkgs,
home-manager,
freesmlauncher,
...
} @ inputs :
... # rest of flake.
};

outputs = { self, nixpkgs, freesmlauncher, ... }: {
# your outputs
};
}
```

### NixOS configuration

```nix
{ pkgs, system, freesmlauncher, ... }:

{
environment.systemPackages = [
freesmlauncher.packages.${system}.freesmlauncher
];
}
```

After that, you can add freesmlauncher to environment.systemPackages, users.users.<>.packages, or home.packages.
### Home Manager configuration

```nix
{ pkgs, system, freesmlauncher, ... }:

{
home.packages = [
freesmlauncher.packages.${system}.freesmlauncher
];
}
```

## Updating

To update the flake input:

```fish
nix flake update freesmlauncher
```

Or update all inputs:

```fish
nix flake update
```
Loading
Loading