-
-
Save kf5grd/cf17fe6eb34d195b4753aa1691c1be6e to your computer and use it in GitHub Desktop.
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
# ~/.config/nixpkgs/home.nix | |
{ config, pkgs, ... }: | |
let | |
#nur-no-pkgs = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {}; | |
nur-no-pkgs = import (/home/user/nur-packages) {}; | |
in | |
{ | |
# Let Home Manager install and manage itself. | |
programs.home-manager.enable = true; | |
# Home Manager needs a bit of information about you and the | |
# paths it should manage. | |
home.username = "user"; | |
home.homeDirectory = "/home/user"; | |
imports = [ | |
nur-no-pkgs.modules.sxmo | |
]; | |
home.packages = with pkgs; [ | |
jq | |
kbfs | |
keybase | |
megapixels | |
tmux | |
vim | |
]; | |
programs.sxmo = { | |
enable = true; | |
}; | |
home.file.toggleSSH = { | |
executable = true; | |
target = "${config.xdg.configHome}/sxmo/userscripts/toggle-ssh"; | |
text = with pkgs; '' | |
#!${bash}/bin/bash | |
export SUDO_ASKPASS="${ssh-askpass-fullscreen}/bin/ssh-askpass-fullscreen" | |
STATUS="$(service --nocolor sshd status | cut -d ':' -f 2 | tr -d " ")" | |
if [[ "$STATUS" == "started" ]]; then | |
sudo -A service sshd stop | |
else | |
sudo -A service sshd start | |
fi | |
STATUS="$(service --nocolor sshd status | cut -d ':' -f 2 | tr -d " ")" | |
if [[ "$STATUS" == "started" ]]; then | |
EXTRA="\n" | |
for profile in $(nmcli -g name connection show); do | |
EXTRA="$EXTRA\n<b>$profile:</b> $(nmcli -g ip4.address connection show $profile | cut -d "/" -f 1)" | |
done | |
fi | |
${gnome3.zenity}/bin/zenity --width 480 --info --text="SSH daemon is: <b>$STATUS</b> $EXTRA" | |
''; | |
}; | |
home.file.nixUpdate = { | |
executable = true; | |
target = "${config.xdg.configHome}/sxmo/userscripts/update-nix"; | |
text = with pkgs; '' | |
#!${bash}/bin/bash | |
nix-channel --update && home-manager switch | |
''; | |
}; | |
home.file.smsHook = { | |
executable = true; | |
target = "${config.xdg.configHome}/sxmo/hooks/sms"; | |
text = with pkgs; '' | |
#!/usr/bin/env sh | |
# This script is executed after you received a text | |
#You can use it to play a notification sound or forward the sms elsewhere | |
#The following parameters are provided: | |
#CONTACTNAME="$1" | |
#TEXT="$2" | |
mpv --quiet --no-video /usr/share/sxmo/notify.ogg | |
KBUSER="dxb" | |
keybase chat send "$KBUSER" "<*$1*>: $2" | |
''; | |
}; | |
# This value determines the Home Manager release that your | |
# configuration is compatible with. This helps avoid breakage | |
# when a new Home Manager release introduces backwards | |
# incompatible changes. | |
# | |
# You can update Home Manager without changing this value. See | |
# the Home Manager release notes for a list of state version | |
# changes in each release. | |
home.stateVersion = "21.05"; | |
} |
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
# nur-packages/modules/sxmo.nix | |
{ config, lib, pkgs ? import <nixpkgs> {} }: | |
with lib; | |
let | |
cfg = config.programs.sxmo; | |
in | |
{ | |
options = { | |
programs.sxmo = { | |
enable = mkOption { | |
type = types.str; | |
description = "Whether to write sxmo config files"; | |
default = false; | |
}; | |
background = mkOption { | |
type = types.str; | |
description = "Path to desktop background image"; | |
default = "/usr/share/sxmo/background.jpg"; | |
}; | |
conkyConfig = mkOption { | |
type = types.str; | |
description = "Path to conky config"; | |
default = "/usr/share/sxmo/appcfg/conky.conf"; | |
}; | |
startupSound = mkOption { | |
type = types.nullOr types.str; | |
description = "Path to startup sound. No startup sound if null"; | |
example = "/usr/share/sxmo/startup.ogg"; | |
default = null; | |
}; | |
enableModem = mkOption { | |
type = types.bool; | |
description = "Enable modemmonitor on boot"; | |
default = false; | |
}; | |
}; | |
}; | |
config = mkIf cfg.enable { | |
home-manager.home.file.sxmoXinit = { | |
executable = true; | |
target = "${home-manager.config.xdg.configHome}/sxmo/xinit"; | |
text = '' | |
feh --bg-fill ${cfg.background} | |
conky -c ${cfg.conkyConfig} -d | |
sxmo_audioout.sh Speaker | |
amixer sset 'Line Out Source' 'Mono Differential','Mono Differential' | |
amixer set "Line Out" 50% | |
''; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment