nixos/captive-browser: add to menu bar

This commit is contained in:
Peter Hoeg 2022-03-08 11:56:13 +08:00
parent 895090bf89
commit 80b9bfdfb1

View File

@ -1,8 +1,12 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.programs.captive-browser; cfg = config.programs.captive-browser;
inherit (lib)
concatStringsSep escapeShellArgs optionalString
literalExpression mkEnableOption mkIf mkOption mkOptionDefault types;
browserDefault = chromium: concatStringsSep " " [ browserDefault = chromium: concatStringsSep " " [
''env XDG_CONFIG_HOME="$PREV_CONFIG_HOME"'' ''env XDG_CONFIG_HOME="$PREV_CONFIG_HOME"''
''${chromium}/bin/chromium'' ''${chromium}/bin/chromium''
@ -15,6 +19,15 @@ let
''-no-default-browser-check'' ''-no-default-browser-check''
''http://cache.nixos.org/'' ''http://cache.nixos.org/''
]; ];
desktopItem = pkgs.makeDesktopItem {
name = "captive-browser";
desktopName = "Captive Portal Browser";
exec = "/run/wrappers/bin/captive-browser";
icon = "nix-snowflake";
categories = [ "Network" ];
};
in in
{ {
###### interface ###### interface
@ -84,6 +97,11 @@ in
###### implementation ###### implementation
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [
(pkgs.runCommandNoCC "captive-browser-desktop-item" { } ''
install -Dm444 -t $out/share/applications ${desktopItem}/share/applications/*.desktop
'')
];
programs.captive-browser.dhcp-dns = programs.captive-browser.dhcp-dns =
let let