Add emacs
This commit is contained in:
parent
eef31ac85b
commit
d8116e5a6a
5 changed files with 138 additions and 0 deletions
105
nixos/boxes/foureighty/modem.sh
Normal file
105
nixos/boxes/foureighty/modem.sh
Normal file
|
@ -0,0 +1,105 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
###
|
||||
# This script automate the setup of QMI supported wwan devices.
|
||||
#
|
||||
# Tested on following environment:
|
||||
# * Lenovo ThinkPad X220 (4286-CTO)
|
||||
# * Gentoo/Linux, Linux Kernel 3.9.6
|
||||
# * NTT Docomo UIM card (Xi LTE SIM)
|
||||
# * Sierra Wireless, Inc. Gobi 3000 wireless wan module
|
||||
# (FRU 60Y3257, vendor and device id is 1199:9013)
|
||||
# memo:
|
||||
# I recommend to check if your wwan module works fine
|
||||
# for your mobile broadband provider with Windows
|
||||
# especially if you imported the device from other country.
|
||||
# You may have to initialize your device for your region.
|
||||
# * Required kernel config (other modules may be also required):
|
||||
# - qmi_wwan (CONFIG_USB_NET_QMI_WWAN)
|
||||
# - qcserial (CONFIG_USB_SERIAL_QUALCOMM)
|
||||
# * Required settings:
|
||||
# - you may have to create /etc/qmi-network.conf.
|
||||
# My qmi-network.conf has only a line "APN=mopera.net".
|
||||
#
|
||||
|
||||
# your wwan device name created by qmi_wwan kernel module
|
||||
# check it with "ip a" or "ifconfig -a". it may be wwan0?
|
||||
WWAN_DEV=wwp0s29u1u4
|
||||
# your cdc_wdm modem location
|
||||
CDC_WDM=/dev/cdc-wdm0
|
||||
# this script uses following qmi commands
|
||||
QMICLI=/usr/bin/qmicli
|
||||
QMI_NETWORK=/usr/bin/qmi-network
|
||||
# the places of following commands vary depending on your distribution
|
||||
IFCONFIG=/bin/ifconfig
|
||||
DHCPCD=/sbin/dhcpcd
|
||||
SUDO=/usr/bin/sudo
|
||||
|
||||
function helpmsg {
|
||||
echo "usage: $0 {start|stop|restart|status}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
function qmi_start {
|
||||
$COMMAND_PREFIX $IFCONFIG $WWAN_DEV up
|
||||
$COMMAND_PREFIX $QMICLI -d $CDC_WDM --dms-set-operating-mode=online
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "your wwan device may be RFKilled?"
|
||||
exit 1
|
||||
fi
|
||||
$COMMAND_PREFIX $QMI_NETWORK $CDC_WDM start
|
||||
$COMMAND_PREFIX $DHCPCD $WWAN_DEV
|
||||
}
|
||||
|
||||
function qmi_stop {
|
||||
$COMMAND_PREFIX $QMI_NETWORK $CDC_WDM stop
|
||||
$COMMAND_PREFIX kill `cat /var/run/dhcpcd-${WWAN_DEV}.pid`
|
||||
$COMMAND_PREFIX $IFCONFIG $WWAN_DEV down
|
||||
}
|
||||
|
||||
function qmi_strength {
|
||||
dbm=`$COMMAND_PREFIX $QMICLI -d $CDC_WDM --nas-get-signal-strength | tr "'" " " | grep Network | head -1 | awk '{print $4}'`
|
||||
echo -n "Signal strength is "
|
||||
if [ $dbm -ge -73 ]; then
|
||||
echo -n 'Excellent'
|
||||
elif [ $dbm -ge -83 ]; then
|
||||
echo -n 'Good'
|
||||
elif [ $dbm -ge -93 ]; then
|
||||
echo -n 'OK'
|
||||
elif [ $dbm -ge -109 ]; then
|
||||
echo -n 'Marginal'
|
||||
else
|
||||
echo Unknown
|
||||
fi
|
||||
echo " (${dbm} dBm)"
|
||||
}
|
||||
|
||||
function qmi_status {
|
||||
$COMMAND_PREFIX $QMI_NETWORK $CDC_WDM status
|
||||
qmi_strength
|
||||
}
|
||||
|
||||
# check argument number
|
||||
if [ $# -ne 1 ]
|
||||
then
|
||||
helpmsg
|
||||
fi
|
||||
|
||||
# check permission
|
||||
if [ `whoami` != 'root' ]
|
||||
then
|
||||
echo "warning: root permission required. setting command prefix to 'sudo'."
|
||||
COMMAND_PREFIX=$SUDO
|
||||
fi
|
||||
|
||||
# run commands
|
||||
case $1 in
|
||||
start) qmi_start ;;
|
||||
stop) qmi_stop ;;
|
||||
restart) qmi_stop; qmi_start ;;
|
||||
status) qmi_status ;;
|
||||
*) helpmsg ;;
|
||||
esac
|
||||
|
||||
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
./programs/tmux.nix
|
||||
./programs/zsh.nix
|
||||
./programs/vim.nix
|
||||
./programs/emacs/home.nix
|
||||
./programs/kitty.nix
|
||||
./programs/newsboat.nix
|
||||
./programs.nix
|
||||
|
|
8
nixos/home-manager/programs/emacs/default.nix
Normal file
8
nixos/home-manager/programs/emacs/default.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
home-manager.users.cyryl = {...}: {
|
||||
imports = [
|
||||
./home.nix
|
||||
];
|
||||
};
|
||||
}
|
16
nixos/home-manager/programs/emacs/emacs.nix
Normal file
16
nixos/home-manager/programs/emacs/emacs.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let
|
||||
myEmacs = pkgs.emacs-nox;
|
||||
emacsWithPackages = (pkgs.emacsPackagesGen myEmacs).emacsWithPackages;
|
||||
in
|
||||
emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
|
||||
magit # ; Integrate git <C-x g>
|
||||
zerodark-theme # ; Nicolas' theme
|
||||
]) ++ (with epkgs.melpaPackages; [
|
||||
|
||||
]) ++ (with epkgs.elpaPackages; [
|
||||
beacon # ; highlight my cursor when scrolling
|
||||
nameless # ; hide current package name everywhere in elisp code
|
||||
]) ++ [
|
||||
pkgs.notmuch # From main packages set
|
||||
])
|
8
nixos/home-manager/programs/emacs/home.nix
Normal file
8
nixos/home-manager/programs/emacs/home.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
programs.emacs = {
|
||||
enable = true;
|
||||
package = (import ./emacs.nix { inherit pkgs; });
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue