-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f100bd4
commit efb8fab
Showing
31 changed files
with
346 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
writeShellApplication, | ||
tmux, | ||
... | ||
}: | ||
writeShellApplication { | ||
name = "tmx"; | ||
runtimeInputs = [tmux]; | ||
text = '' | ||
#!/usr/bin/env bash | ||
# Modified TMUX start script from: | ||
# http://forums.gentoo.org/viewtopic-t-836006-start-0.html | ||
set +u | ||
# Works because bash automatically trims by assigning to variables and by passing arguments | ||
trim() { echo "$1"; } | ||
if [[ -z "$1" ]]; then | ||
echo "Specify session name as the first argument" | ||
exit | ||
fi | ||
# Only because I often issue `ls` to this script by accident | ||
if [[ "$1" == "ls" ]]; then | ||
tmux ls | ||
exit | ||
fi | ||
base_session="$1" | ||
# This actually works without the trim() on all systems except OSX | ||
tmux_nb=$(trim "$(tmux ls | grep -c ^"""$base_session""" )") | ||
if [[ "$tmux_nb" == "0" ]]; then | ||
echo "Launching tmux base session $base_session ..." | ||
tmux new-session -s "$base_session" | ||
else | ||
# Make sure we are not already in a tmux session | ||
if [[ -z "$TMUX" ]]; then | ||
echo "Launching copy of base session $base_session ..." | ||
# Session id is date and time to prevent conflict | ||
session_id=$(date +%Y%m%d%H%M%S) | ||
# Create a new session (without attaching it) and link to base session | ||
# to share windows | ||
tmux new-session -d -t "$base_session" -s "$session_id" | ||
if [[ "$2" == "1" ]]; then | ||
# Create a new window in that session | ||
tmux new-window | ||
fi | ||
# Attach to the new session & kill it once orphaned | ||
tmux attach-session -t "$session_id" \; set-option destroy-unattached | ||
fi | ||
fi | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,5 +29,3 @@ stdenvNoCC.mkDerivation rec { | |
license = licenses.mit; | ||
}; | ||
} | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{xdg-desktop-portal, ...}: | ||
xdg-desktop-portal.overrideAttrs (o: rec { | ||
mesonFlags = o.mesonFlags ++ ["-Dpytest=disabled"]; | ||
doCheck = false; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
config, | ||
lib, | ||
pkgs, | ||
... | ||
}: let | ||
cfg = config.services.hass-report-usage; | ||
in { | ||
options.services.hass-report-usage = { | ||
enable = lib.mkEnableOption "Enable hass-report-usage"; | ||
|
||
url = lib.mkOption { | ||
type = lib.types.str; | ||
description = "URL to report to"; | ||
example = "http://192.168.0.3:8123/api/webhook/eaea48a1-30e3-47bf-a076-30f816f0d3d1"; | ||
default = "http://192.168.0.3:8123/api/webhook/eaea48a1-30e3-47bf-a076-30f816f0d3d1"; | ||
}; | ||
|
||
package = lib.mkPackageOption pkgs "hass-report-usage" {}; | ||
}; | ||
|
||
config = lib.mkIf cfg.enable { | ||
home.packages = [pkgs.xdotool]; | ||
systemd.user.services.hass-report-usage = { | ||
Unit = { | ||
Description = "Hass report usage"; | ||
}; | ||
|
||
Service = { | ||
Type = "simple"; | ||
ExecStart = "${lib.getExe cfg.package} ${lib.escapeShellArg cfg.url}"; | ||
Restart = "on-failure"; | ||
RestartSec = 1; | ||
}; | ||
|
||
Install.WantedBy = ["default.target"]; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ _: {pkgs, ...}: { | |
alsa-scarlett-gui | ||
bitwig-studio | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
services.vscode-server = { | ||
enable = true; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.