From 041210735c3c06b428c78ea09ddf2cbb8b41f708 Mon Sep 17 00:00:00 2001 From: lelgenio Date: Sun, 22 Jan 2023 14:59:45 -0300 Subject: [PATCH] Initial commit --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ default.nix | 54 ++++++++++++++++++++++++++++++++++++++++ flake.lock | 43 ++++++++++++++++++++++++++++++++ flake.nix | 24 ++++++++++++++++++ 4 files changed, 193 insertions(+) create mode 100644 README.md create mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..9aa4f20 --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +Install dzgui on nix-based systems + +# Installation + +## Using flake profiles (manual updates) + +``` +# install +nix profile install github:lelgenio/dzgui-nix + +# update +nix profile upgrade '.*dzgui.*' +``` + +## As a flake input (auto updates) + +Flake users are expected to have a `flake.nix` file and a `configuration.nix`. + +Note that this is just a suggestion on how to to it, you may have different configuration structure. + +1 - Add `dzgui` as a flake input: + +```nix +# flake.nix +{ + inputs.dzgui = { + # url of this repository, may change in the future + url = "github:lelgenio/dzgui-nix"; + # save storage by not having duplicates of packages + inputs.nixpkgs.follows = "nixpkgs"; + }; + # outputs... +} +``` + +2 - Pass `inputs` to your to you system config + +```nix +# flake.nix +{ + outputs = inputs@{pkgs, ...}: { + nixosConfigurations.your-hostname-here = lib.nixosSystem { + specialArgs = { inherit inputs; }; + # modules... + }; + }; +} +``` + +3 - Add dzgui as a package in your system: + +```nix +# configuration.nix +# this is the file generate by `nixos-generate-config` +{ inputs, pkgs, ... }: { + environment.systemPackages = [ + inputs.dzgui.packages.${pkgs.system}.dzgui + ]; +} +``` + +4 - Rebuild your system + +```sh +nixos-rebuild --switch --flake .#your-hostname-here +``` + +Now dzgui will auto update together with your system. + +## On non flake systems + +Good luck. diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..5c6e8bc --- /dev/null +++ b/default.nix @@ -0,0 +1,54 @@ +{ pkgs, lib, stdenv, fetchFromGitHub, makeWrapper }: +stdenv.mkDerivation rec { + pname = "dzgui"; + version = "0.1"; + + src = fetchFromGitHub { + owner = "aclist"; + repo = "dztui"; + rev = "10c29c0542a07fb81b5922f96b416e3a2e8079cc"; + sha256 = "sha256-VmW0ohXK+9CAr4yGaA/NSW7+E1vUvZthom8MculmOEs="; + }; + + nativeBuildInputs = [ makeWrapper ]; + + runtimeDeps = with pkgs; [ + curl + jq + python3 + wmctrl + xdotool + gnome.zenity + + ## Here we don't declare steam as a dependency because + ## we could either use the native or flatpack version + ## and also so this does not become a non-free package + # steam + ]; + + patchPhase = '' + sed -i \ + -e 's|/usr/bin/zenity|${pkgs.gnome.zenity}/bin/zenity|' \ + -e 's|2>/dev/null||' \ + dzgui.sh + ''; + + installPhase = '' + install -Dm777 -T dzgui.sh $out/bin/.dzgui-unwrapped_ + makeWrapper $out/bin/.dzgui-unwrapped_ $out/bin/dzgui \ + --prefix PATH ':' ${lib.makeBinPath runtimeDeps} + ''; + + meta = with lib; { + homepage = "https://github.com/pronovic/banner"; + description = "DayZ TUI/GUI server browser"; + license = licenses.gpl3; + + longDescription = '' + DZGUI allows you to connect to both official and modded/community DayZ + servers on Linux and provides a graphical interface for doing so. + ''; + + platforms = platforms.all; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fb34775 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "dzgui": { + "flake": false, + "locked": { + "lastModified": 1674148870, + "narHash": "sha256-VmW0ohXK+9CAr4yGaA/NSW7+E1vUvZthom8MculmOEs=", + "owner": "aclist", + "repo": "dztui", + "rev": "10c29c0542a07fb81b5922f96b416e3a2e8079cc", + "type": "github" + }, + "original": { + "owner": "aclist", + "repo": "dztui", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1674211260, + "narHash": "sha256-xU6Rv9sgnwaWK7tgCPadV6HhI2Y/fl4lKxJoG2+m9qs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5ed481943351e9fd354aeb557679624224de38d5", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "dzgui": "dzgui", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..cf863e6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,24 @@ +{ + description = "DayZ TUI/GUI server browser"; + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + dzgui = { + url = "github:aclist/dztui"; + flake = false; + }; + }; + outputs = { self, nixpkgs, dzgui, ... }: + let + # DayZ only runs on x86_64 systems + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in with pkgs; { + packages.${system} = { + default = self.packages.${system}.dzgui; + dzgui = (pkgs.callPackage ./. { }).overrideAttrs (_: { src = dzgui; }); + }; + + devShells.${system}.default = + mkShell { buildInputs = self.packages.${system}.default.runtimeDeps; }; + }; +}