Skip to content

Commit

Permalink
cro: abstract out and use for chromecasting radio streams
Browse files Browse the repository at this point in the history
  • Loading branch information
kmein committed Jun 9, 2024
1 parent e943718 commit e0c52b0
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
12 changes: 0 additions & 12 deletions configs/browser.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,6 @@
}: let
inherit (import ../lib) tmpfilesConfig;
in {
environment.systemPackages = [
(pkgs.writers.writeDashBin "cro" ''
${pkgs.chromium}/bin/chromium \
--disable-sync \
--no-default-browser-check \
--no-first-run \
--user-data-dir="$(mktemp -d)" \
--incognito \
"$@"
'')
];

home-manager.users.me = {
programs.firefox = {
enable = true;
Expand Down
6 changes: 6 additions & 0 deletions configs/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,15 @@ in {
niveumPackages.emailmenu
niveumPackages.closest
niveumPackages.trans
niveumPackages.cro
(niveumPackages.mpv-radio.override {
di-fm-key-file = config.age.secrets.di-fm-key.path;
})
(niveumPackages.mpv-radio.override {
di-fm-key-file = config.age.secrets.di-fm-key.path;
executableName = "cro-radio";
mpvCommand = "${niveumPackages.cro}/bin/cro";
})
(niveumPackages.mpv-tuner.override {
di-fm-key-file = config.age.secrets.di-fm-key.path;
})
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@
brassica = pkgs.callPackage packages/brassica.nix {};
cheat-sh = pkgs.callPackage packages/cheat-sh.nix {};
closest = pkgs.callPackage packages/closest {};
cro = pkgs.callPackage packages/cro.nix {};
cyberlocker-tools = pkgs.callPackage packages/cyberlocker-tools.nix {};
default-gateway = pkgs.callPackage packages/default-gateway.nix {};
depp = pkgs.callPackage packages/depp.nix {};
Expand Down
10 changes: 10 additions & 0 deletions packages/cro.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ writers, chromium }:
writers.writeDashBin "cro" ''
${chromium}/bin/chromium \
--disable-sync \
--no-default-browser-check \
--no-first-run \
--user-data-dir="$(mktemp -d)" \
--incognito \
"$@"
''
8 changes: 6 additions & 2 deletions packages/mpv-radio.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
coreutils,
gnused,
di-fm-key-file,
executableName ? "mpv-radio",
mpvCommand ? "${mpv}/bin/mpv --force-window=yes"
}: let
streams = import ../lib/streams.nix {
di-fm-key = "%DI_FM_KEY%";
Expand All @@ -19,11 +21,13 @@
}: "${station}\t${desc}\t${stream}")
streams);
in
writers.writeDashBin "mpv-radio" ''
writers.writeDashBin executableName ''
set -x
if [ -z ''${DI_FM_KEY} ]; then
DI_FM_KEY=$(cat "${di-fm-key-file}")
fi
exec ${mpv}/bin/mpv --force-window=yes "$(
exec ${mpvCommand} "$(
${dmenu}/bin/dmenu -i -l 5 < ${streams-tsv} \
| ${coreutils}/bin/cut -f3 \
| ${gnused}/bin/sed s/%DI_FM_KEY%/"$DI_FM_KEY"/
Expand Down

0 comments on commit e0c52b0

Please sign in to comment.