Files
AstralRinth/flake.nix
Danielle 10610e157f Refactor Library
The launcher code was in a position ripe for sphagetti, so this rewrites it in a more robust way.
In addition to cleaner code, this provides the following changes:
- Removal of obsolete Mojang authentication
- The rebasing of some internal state into a Sled database
- Tweaks which make some internal mechanisms more robust (e.g. profiles which fail to load can be removed)
- Additional tooling integration such as direnv
- Distinct public API to avoid messing with too much internal code
- Unified error handling in the form of `theseus::Error` and `theseus::Result`
2022-06-27 15:53:25 -07:00

83 lines
2.1 KiB
Nix

{
description = "The official Modrinth launcher";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{self, ...}:
inputs.utils.lib.eachDefaultSystem (system: let
pkgs = import inputs.nixpkgs { inherit system; };
fenix = inputs.fenix.packages.${system};
utils = inputs.utils.lib;
toolchain = with fenix;
combine [
minimal.rustc minimal.cargo
];
naersk = inputs.naersk.lib.${system}.override {
rustc = toolchain;
cargo = toolchain;
};
deps = with pkgs; {
global = [
openssl pkg-config gcc
];
gui = [
gtk4 gdk-pixbuf atk webkitgtk dbus
];
shell = [
toolchain
(with fenix; combine [toolchain default.clippy rust-analyzer])
git
jdk17 jdk8
];
};
in {
packages = {
theseus-cli = naersk.buildPackage {
pname = "theseus_cli";
src = ./.;
buildInputs = deps.global;
cargoBuildOptions = x: x ++ ["-p" "theseus_cli"];
};
};
apps = {
cli = utils.mkApp {
drv = self.packages.${system}.theseus-cli;
};
cli-test = utils.mkApp {
drv = pkgs.writeShellApplication {
name = "theseus-test-cli";
runtimeInputs = [
(self.packages.${system}.theseus-cli.overrideAttrs (old: old // {
release = false;
}))
];
text = ''
DUMMY_ID="$(printf '%0.sa' {1..32})"
theseus_cli profile run -t "" -n "Test" -i "$DUMMY_ID" "$@"
'';
};
};
};
devShell = pkgs.mkShell {
buildInputs = with deps;
global ++ gui ++ shell;
};
})
}