Skip to content

Commit

Permalink
Merge pull request #5 from fufexan/main
Browse files Browse the repository at this point in the history
Install icons, add meson
  • Loading branch information
NotAShelf authored Jul 11, 2024
2 parents c9e9260 + bc7f659 commit 73282e5
Show file tree
Hide file tree
Showing 7 changed files with 284 additions and 20 deletions.
14 changes: 14 additions & 0 deletions icons/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
states = ['online', 'offline']

install_data(
'tailscale-online.svg',
install_dir: iconsdir / 'hicolor' / 'scalable' / 'apps',
rename: 'tailscale.svg',
)

foreach state : states
install_data(
'tailscale-@[email protected]'.format(state),
install_dir: iconsdir / 'hicolor' / 'symbolic' / 'apps',
)
endforeach
98 changes: 98 additions & 0 deletions icons/tailscale-offline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 98 additions & 0 deletions icons/tailscale-online.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
project(
'tailray',
'rust',
version: '0.2.1',
license: 'MIT',
meson_version: '>=0.59.0'
)

cargo = find_program('cargo', required: true)

prefix = get_option('prefix')
bindir = prefix / get_option('bindir')
datadir = prefix / get_option('datadir')
iconsdir = datadir / 'icons'

subdir('src')
subdir('icons')
40 changes: 25 additions & 15 deletions nix/package.nix
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
{
lib,
stdenv,
cargo,
dbus,
meson,
ninja,
python3,
pkg-config,
rustc,
rustPlatform,
xorg,
rev ? "dirty",
}: let
cargoToml = builtins.fromTOML (builtins.readFile ../Cargo.toml);
in
rustPlatform.buildRustPackage {
stdenv.mkDerivation {
pname = "tailray";
version = "${cargoToml.package.version}-${rev}";

src = lib.fileset.toSource {
root = ../.;
fileset =
lib.fileset.intersection
(lib.fileset.fromSource (lib.sources.cleanSource ../.))
(lib.fileset.unions [
../src
../Cargo.toml
../Cargo.lock
]);
src = builtins.path {
name = "tailray";
path = ../.;
};

cargoLock = {
cargoDeps = rustPlatform.importCargoLock {
lockFile = ../Cargo.lock;
outputHashes = {
"ksni-0.2.1" = "sha256-CKjOUGsqlMdgnNY6j29pP6S8wdZ73/v1dMyiIurlltI=";
Expand All @@ -34,13 +32,25 @@ in

strictDeps = true;

nativeBuildInputs = [pkg-config python3];
buildInputs = [dbus xorg.libxcb];
nativeBuildInputs = [
meson
ninja
pkg-config
rustPlatform.cargoSetupHook
cargo
rustc
python3
];

buildInputs = [
dbus
xorg.libxcb
];

meta = {
description = "Rust implementation of tailscale-systray";
homepage = "https://github.com/notashelf/tailray";
license = lib.licenses.gpl3Plus;
license = lib.licenses.mit;
mainProgram = "tailray";
maintainers = with lib.maintainers; [NotAShelf];
};
Expand Down
31 changes: 31 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ]
cargo_options += [ '--target-dir', meson.project_build_root() / 'src' ]

if get_option('buildtype') == 'release' or get_option('buildtype') == 'plain'
cargo_options += [ '--release' ]
rust_target = 'release'
message('Building in release mode')
else
rust_target = 'debug'
message('Building in debug mode')
endif

cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ]

custom_target(
'cargo-build',
build_by_default: true,
build_always_stale: true,
output: meson.project_name(),
console: true,
install: true,
install_dir: bindir,
command: [
'env',
cargo_env,
cargo, 'build',
cargo_options,
'&&',
'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@',
],
)
6 changes: 1 addition & 5 deletions src/tray/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ impl SysTray {
);

if output.status.success() {
let verb_result = if verb.eq("up") {
"connected"
} else {
"disconnected"
};
let verb_result = if verb.eq("up") { "online" } else { "offline" };

Notification::new()
.summary(format!("Connection {}", verb).as_str())
Expand Down

0 comments on commit 73282e5

Please sign in to comment.