This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
onny:notizen [2022/04/11 13:04] – [packaging] 141.52.248.3 | onny:notizen [2023/12/27 08:32] – [tests] 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== ArchLinux ===== | ||
- | ==== system ==== | ||
- | set extra capabilities for process | ||
- | <code bash> | ||
- | sudo setcap ' | ||
- | </ | ||
- | directory permissions | ||
- | <code bash> | ||
- | namei -l / | ||
- | </ | ||
- | use acl to grant permission to files for specific user | ||
- | <code bash> | ||
- | setfacl -R -m u:maddy:rX / | ||
- | </ | ||
- | pgrep get process pid by process name | ||
- | <code bash> | ||
- | $ pgrep sw3 | ||
- | 30636 | ||
- | </ | ||
- | set system time | ||
- | <code bash> | ||
- | timedatectl set-time " | ||
- | </ | ||
- | ==== packaging ==== | ||
- | git checkout aur package | ||
- | <code bash> | ||
- | git clone ssh:// | ||
- | </ | ||
- | === commands === | ||
- | update checksums inplace | ||
- | <code bash> | ||
- | updpkgsums | ||
- | </ | ||
- | building a package in a clean dev chroot, path for pacman conf ''/ | ||
- | <code bash> | ||
- | cd < | ||
- | ls PKGBUILD | ||
- | extra-x86_64-build # -c for cleaning up chroot. ~/ | ||
- | extra-x86_64-build -- -I ~/ | ||
- | </ | ||
- | advanced chroot with own packages preinstalled | ||
- | <code bash> | ||
- | mkdir ~/chroot | ||
- | export CHROOT=$HOME/ | ||
- | mkarchroot $CHROOT/ | ||
- | arch-nspawn $CHROOT/ | ||
- | makechrootpkg -r $CHROOT -I package-1.0-1-i686.pkg.tar.xz # -c for clean chroot | ||
- | # repackage: makechrootpkg -r / | ||
- | </ | ||
- | cheap python virtualenv | ||
- | <code bash> | ||
- | mkdir path | ||
- | ln -s / | ||
- | export PATH=" | ||
- | </ | ||
- | abs deprecated, using asp | ||
- | <code bash> | ||
- | asp export linux | ||
- | </ | ||
- | === PKGBUILD === | ||
- | Installation von Lizenzdateien: | ||
- | <code bash> | ||
- | install -D " | ||
- | </ | ||
- | Installation von Systemd-Units: | ||
- | <code bash> | ||
- | install -Dm644 " | ||
- | </ | ||
- | Installation von Docs: | ||
- | <code bash> | ||
- | install -Dm644 README.md " | ||
- | </ | ||
- | Installation von Tmpfiles: | ||
- | <code bash> | ||
- | install -Dm644 " | ||
- | </ | ||
- | Installation von Libs: | ||
- | <code bash> | ||
- | install -m644 libdouble-conversion.so.0.0.0* " | ||
- | </ | ||
- | do not strip binary files | ||
- | < | ||
- | options=(' | ||
- | </ | ||
- | Installation von ausführbare Dateien: | ||
- | <code bash> | ||
- | install -Dm755 shareLinkCreator " | ||
- | </ | ||
- | Nginx/ | ||
- | <code bash> | ||
- | if [[ -n $(which httpd 2> /dev/null) ]]; then | ||
- | | ||
- | fi | ||
- | | ||
- | # install apache .conf file if apache is installed | ||
- | if [[ -n $(which httpd 2> /dev/null) ]]; then | ||
- | install -d $pkgdir/ | ||
- | install -m 644 $srcdir/ | ||
- | fi | ||
- | } | ||
- | </ | ||
- | Zielname der Quelldatei ändern: | ||
- | <code bash> | ||
- | source=(" | ||
- | </ | ||
- | Architekturabhängige Build-Anweisung | ||
- | <code bash> | ||
- | | ||
- | cd " | ||
- | if [[ " | ||
- | make cudaHashcat64.bin | ||
- | else | ||
- | make cudaHashcat32.bin | ||
- | fi | ||
- | make nv_all | ||
- | } | ||
- | </ | ||
- | pkgver git | ||
- | <code bash> | ||
- | | ||
- | cd " | ||
- | #git describe --long | sed ' | ||
- | git log -1 --format=%cd.%h --date=short|tr -d - | ||
- | } | ||
- | </ | ||
- | Common install file example | ||
- | <code bash> | ||
- | post_install() { | ||
- | mkdir / | ||
- | getent group lool > /dev/null || groupadd -r lool > /dev/null | ||
- | getent passwd lool > /dev/null || useradd lool > /dev/null | ||
- | chown -R lool:lool / | ||
- | / | ||
- | } | ||
- | post_remove() { | + | ===== bash ===== |
- | | + | |
- | | + | |
- | } | + | |
- | </ | + | |
- | in pkgbuild reference | + | |
- | <code bash> | + | |
- | install=" | + | |
- | </ | + | |
- | === aurutils | + | |
- | install packages into build container | + | |
- | < | + | |
- | arch-chroot / | + | |
- | pacman --root=/ | + | |
- | </ | + | |
- | add gpg key into build container | + | |
- | <code bash> | + | |
- | sudo -u aur gpg --recv-keys EB774491D9FF06E2 | + | |
- | </ | + | |
- | rebuild prebuild package and add to custom AUR repo | + | |
- | <code bash> | + | |
- | fakepkg webkitgtk2 | + | |
- | sudo -u aur repo-add / | + | |
- | cp / | + | |
- | </ | + | |
- | ==== bluetooth ==== | + | |
- | Example session '' | + | |
- | <code bash> | + | |
- | # bluetoothctl | + | |
- | [bluetooth]# | + | |
- | [bluetooth]# | + | |
- | [bluetooth]# | + | |
- | [bluetooth]# | + | |
- | </ | + | |
- | ==== usefull stuff ==== | ||
- | pipe stderr to stdout | ||
- | <code bash> | ||
- | command 2>&1 >/ | ||
- | </ | ||
- | pipe stderr and stdout both to a file | ||
- | <code bash> | ||
- | command &> error_log | ||
- | </ | ||
- | locate pacnew files | ||
- | <code bash> | ||
- | find /etc -regextype posix-extended -regex " | ||
- | </ | ||
- | or search entire disk | ||
- | <code bash> | ||
- | find / -regextype posix-extended -regex " | ||
- | </ | ||
- | === swapfile on btrfs === | ||
- | <code bash> | ||
- | swapfile=$(losetup -f) #free loop device | ||
- | truncate -s 8G /swap # | ||
- | losetup $swapfile /swap #mount file to loop | ||
- | mkswap | ||
- | swapon | ||
- | </ | ||
- | search library availability in system, print file paths | ||
- | <code bash> | ||
- | ldconfig -p | grep blas | ||
- | </ | ||
- | |||
- | |||
- | ==== systemd nspawn (container) ==== | ||
- | <code bash> | ||
- | pacman -S arch-install-scripts | ||
- | btrfs subvol create / | ||
- | mkdir / | ||
- | pacstrap / | ||
- | systemctl enable --now systemd-networkd systemd-resolved | ||
- | systemd-nspawn --boot -nD / | ||
- | systemctl start systemd-nspawnd@archlinux-nextcloudcli | ||
- | machinectl shell root@archlinux-nextcloudcli /bin/bash -c " | ||
- | </ | ||
- | quit / exit / kill container: Hold '' | ||
- | |||
- | ==== systemd service ==== | ||
- | set environment | ||
- | <file - / | ||
- | [Unit] | ||
- | Description=PiRadio | ||
- | After=network-online.target | ||
- | After=bluetooth.service | ||
- | |||
- | [Service] | ||
- | Environment=" | ||
- | Type=simple | ||
- | User=piradio | ||
- | WorkingDirectory=/ | ||
- | ExecStartPre=/ | ||
- | ExecStart=/ | ||
- | Restart=on-abort | ||
- | |||
- | [Install] | ||
- | WantedBy=multi-user.target | ||
- | WantedBy=network-online.target | ||
- | </ | ||
- | ===== kernel ===== | ||
- | grep kernel config running system | ||
- | <code bahs> | ||
- | zcat / | ||
- | </ | ||
- | ===== fish ===== | ||
- | unset history | ||
- | < | ||
- | fish --private | ||
- | </ | ||
- | ===== bash ===== | ||
lzma hado compression and extraction | lzma hado compression and extraction | ||
<code bash> | <code bash> | ||
Line 331: | Line 88: | ||
chmod +x $FILE | chmod +x $FILE | ||
$FILE " | $FILE " | ||
- | </ | ||
- | ==== sed ==== | ||
- | Mit sed inplace eine Zeile zu einer Datei hinzufügen: | ||
- | <code bash> | ||
- | sed -i ' | ||
- | </ | ||
- | add to end of file | ||
- | <code bash> | ||
- | sed -i -e ' | ||
- | </ | ||
- | Comment out specific line matching a string | ||
- | <code bash> | ||
- | sudo sed -e '/ | ||
- | </ | ||
- | comment out multiple lines / range | ||
- | <code bash> | ||
- | sed -i "28,33 s/# *//" autogen.sh | ||
- | </ | ||
- | regex parse value of xml tags | ||
- | <code bash> | ||
- | sed -n ' | ||
- | </ | ||
- | delete multiple lines | ||
- | <code bash> | ||
- | sed -i ' | ||
</ | </ | ||
- | insert line after match | ||
- | <code bash> | ||
- | sed '/ | ||
- | </ | ||
==== grep ==== | ==== grep ==== | ||
regex match group | regex match group | ||
Line 384: | Line 112: | ||
</ | </ | ||
- | ==== rg ==== | + | execute command |
- | + | ||
- | filter file type | + | |
<code bash> | <code bash> | ||
- | rg GPIO_CFG_2MA | + | fd --type f -e doc -e docx -e pdf -i gabriel -x cp --backup=t {} / |
</ | </ | ||
- | ==== curl ==== | + | |
- | post data | + | find filenames unallowed characters |
<code bash> | <code bash> | ||
- | curl --data " | + | fd '[^A-Z a-züö@0-9._-]' |
- | </ | + | |
- | download and extract archive | + | |
- | <code bash> | + | |
- | curl http:// | + | |
- | </ | + | |
- | set host header | + | |
- | <code bash> | + | |
- | torify curl --header "Host: http.pi" | + | |
- | </ | + | |
- | ==== tcpdump ==== | + | |
- | specific ports | + | |
- | <code bash> | + | |
- | tcpdump -i eth0 -q '(tcp port 80) or (tcp port 443)' -A | + | |
- | </code> | + | |
- | exclude specific host | + | |
- | <code bash> | + | |
- | tcpdump -i eth0 -q '(ip or ip6) and (tcp port 80) or (tcp port 443) and not host ifconfig.co' | + | |
</ | </ | ||
+ | |||
+ | |||
==== patching ==== | ==== patching ==== | ||
=== appling === | === appling === | ||
Line 427: | Line 138: | ||
</ | </ | ||
+ | ==== xargs ==== | ||
+ | |||
+ | < | ||
+ | fd . | xargs -I {} rm " | ||
+ | </ | ||
===== rsync ===== | ===== rsync ===== | ||
custom ssh port | custom ssh port | ||
Line 451: | Line 167: | ||
</ | </ | ||
===== networking ===== | ===== networking ===== | ||
- | netcat | ||
- | <code bash> | ||
- | netcat -l 4444 | ||
- | </ | ||
- | <code bash> | ||
- | netcat playground.pi 4444 | ||
- | </ | ||
==== nftables ==== | ==== nftables ==== | ||
<code bash> | <code bash> | ||
Line 499: | Line 208: | ||
iptables -t nat -A OUTPUT -p tcp --dport 2222 -j DNAT --to 192.168.1.2: | iptables -t nat -A OUTPUT -p tcp --dport 2222 -j DNAT --to 192.168.1.2: | ||
</ | </ | ||
- | </ | ||
- | ==== ip ==== | ||
- | set address | ||
- | <code bash> | ||
- | ip address add dev usb0 172.16.42.1/ | ||
- | ip link set usb0 up | ||
- | </ | ||
- | route command example | ||
- | <code bash> | ||
- | ip route add 192.168.1.0/ | ||
- | ip route add default via 192.168.1.1 | ||
- | </ | ||
- | flush addresses | ||
- | <code bash> | ||
- | ip addr flush dev enp8s0 | ||
- | </ | ||
- | remove interface | ||
- | <code bash> | ||
- | ip link delete br0 | ||
- | </ | ||
- | delete address | ||
- | <code bash> | ||
- | ip addr del 192.168.178.20/ | ||
- | </ | ||
- | show only specific interface | ||
- | <code bash> | ||
- | ip a show wg0 | ||
</ | </ | ||
- | change mtu | ||
- | <code bash> | ||
- | ip link set dev eth0 mtu 1400 | ||
- | </ | ||
==== dnsmasq ==== | ==== dnsmasq ==== | ||
minimal hostapd and dnsmasq config | minimal hostapd and dnsmasq config | ||
Line 584: | Line 262: | ||
compression | compression | ||
<code bash> | <code bash> | ||
- | convert -density 200x200 -units PixelsPerInch -compress jpeg -quality 70 in.pdf out.pdf | + | gm convert -density 200x200 -units PixelsPerInch -compress jpeg -quality 70 in.pdf out.pdf |
</ | </ | ||
lossless merge | lossless merge | ||
Line 640: | Line 318: | ||
</ | </ | ||
===== security ===== | ===== security ===== | ||
+ | |||
+ | ==== web discovery ==== | ||
+ | |||
+ | === photon === | ||
+ | |||
+ | < | ||
+ | photon -u test.example.org | ||
+ | </ | ||
==== lynis ==== | ==== lynis ==== | ||
Line 655: | Line 341: | ||
==== wfuzz ==== | ==== wfuzz ==== | ||
<code bash> | <code bash> | ||
- | torify | + | wfuzz -c --hc 404 -w / |
- | torify | + | wfuzz -c --hc 404,403 -w / |
</ | </ | ||
Preparing data for LFI scan | Preparing data for LFI scan | ||
Line 671: | Line 357: | ||
* https:// | * https:// | ||
* wifite wifi auditing tool | * wifite wifi auditing tool | ||
+ | |||
+ | sec tools | ||
+ | |||
+ | * dirbuster | ||
+ | * https:// | ||
+ | * **tiger** - system sec scanner | ||
+ | * sub domain evaluation | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * subfinder (passive, external sources) | ||
+ | * vhost scanning | ||
+ | * https:// | ||
+ | * bettercap - wifi network | ||
+ | * iodine dns tunnel https:// | ||
+ | * command searchsploit in exploitdb | ||
+ | * NixOS for Pentesting Overview https:// | ||
===== chromium / chrome ===== | ===== chromium / chrome ===== | ||
Line 678: | Line 380: | ||
</ | </ | ||
===== docker ===== | ===== docker ===== | ||
- | Short example | + | |
+ | Pull | ||
<code bash> | <code bash> | ||
- | sudo systemctl start docker | + | docker |
- | gpasswd -a onny docker | + | docker |
- | | + | |
- | | + | |
</ | </ | ||
+ | |||
+ | Run | ||
+ | <code bash> | ||
+ | docker run -td ubuntu: | ||
+ | </ | ||
+ | |||
+ | Executing | ||
+ | <code bash> | ||
+ | docker exec -it ffffdfdfsdfsdfsfsffsdfs /bin/bash | ||
+ | </ | ||
+ | |||
+ | Nextcloud | ||
+ | <code bash> | ||
+ | docker run -d -p 80:80 rootlogin/ | ||
+ | docker run -v / | ||
+ | </ | ||
+ | |||
Debugging it | Debugging it | ||
<code bash> | <code bash> | ||
Line 690: | Line 408: | ||
| | ||
</ | </ | ||
+ | |||
Pull from repository | Pull from repository | ||
< | < | ||
Line 700: | Line 419: | ||
| | ||
</ | </ | ||
- | Pull specific tagged image | + | |
- | <code bash> | + | |
- | docker pull rootlogin/ | + | |
- | </ | + | |
Build from Dockerfile | Build from Dockerfile | ||
< | < | ||
Line 727: | Line 443: | ||
docker system prune -a | docker system prune -a | ||
</ | </ | ||
- | docker stop all container | + | |
- | <code bash> | + | |
- | docker stop (docker ps -a -q) | + | |
- | </ | + | |
prevent from auto start | prevent from auto start | ||
+ | |||
<code bash> | <code bash> | ||
docker update --restart=no client-iaro_db_1 | docker update --restart=no client-iaro_db_1 | ||
Line 929: | Line 643: | ||
</ | </ | ||
- | delete | + | |
+ | delete branch | ||
<code bash> | <code bash> | ||
- | git push onny --delete | + | git branch # list |
+ | git branch -d swaybar | ||
+ | git push onny -d samsung-treltexx | ||
</ | </ | ||
Line 962: | Line 680: | ||
git checkout 13243f2eafc4292917178051fe1bb5aab2774dca -p include/ | git checkout 13243f2eafc4292917178051fe1bb5aab2774dca -p include/ | ||
</ | </ | ||
- | delete branch | + | |
- | <code bash> | + | |
- | git branch # list | + | |
- | git branch -d swaybar | + | |
- | </ | + | |
rebase | rebase | ||
+ | |||
<code bash> | <code bash> | ||
git remote add upstream https:// | git remote add upstream https:// | ||
Line 1028: | Line 743: | ||
</ | </ | ||
- | delete remote branch | + | modify older or specific commit |
<code bash> | <code bash> | ||
- | git push -d onny cups | + | git rebase |
+ | # make changes | ||
+ | git commit --all --amend --no-edit | ||
+ | git rebase --continue | ||
+ | </ | ||
+ | |||
+ | add co-author / co-authors to commit | ||
+ | <code bash> | ||
+ | git commit --amend | ||
+ | # Add line: Co-authored-by: | ||
</ | </ | ||
===== yum ===== | ===== yum ===== | ||
Line 1234: | Line 959: | ||
ngrep -q -W byline " | ngrep -q -W byline " | ||
</ | </ | ||
- | * sec | ||
- | * https:// | ||
- | * **tiger** - system sec scanner | ||
- | * sub domain evaluation | ||
- | * https:// | ||
- | * https:// | ||
- | * subfinder (passive, external sources) | ||
- | * vhost scanning | ||
- | * https:// | ||
- | * bettercap - wifi network | ||
- | * iodine dns tunnel https:// | ||
- | * command searchsploit in exploitdb | ||
* sys | * sys | ||
* **usbtop** | * **usbtop** | ||
Line 1326: | Line 1039: | ||
</ | </ | ||
===== nixos ===== | ===== nixos ===== | ||
+ | |||
apply changes to system | apply changes to system | ||
- | < | + | |
- | nixos-rebuild switch | + | < |
+ | sudo nixos-rebuild switch | ||
+ | sudo nixos-rebuild boot --flake '/ | ||
</ | </ | ||
+ | |||
update channel, rebuild and switch | update channel, rebuild and switch | ||
+ | |||
<code bash> | <code bash> | ||
nixos-rebuild switch --upgrade | nixos-rebuild switch --upgrade | ||
</ | </ | ||
+ | |||
search package | search package | ||
+ | |||
<code bash> | <code bash> | ||
nix search gedit | nix search gedit | ||
</ | </ | ||
+ | |||
nixos testing environement | nixos testing environement | ||
+ | |||
<code bash> | <code bash> | ||
nix-shell -p toilet | nix-shell -p toilet | ||
</ | </ | ||
+ | |||
install unstable package | install unstable package | ||
+ | |||
<code bash> | <code bash> | ||
nix-channel --add https:// | nix-channel --add https:// | ||
Line 1348: | Line 1072: | ||
nix-env -iA unstable.pdfarranger | nix-env -iA unstable.pdfarranger | ||
</ | </ | ||
+ | |||
custom local repository, list packages | custom local repository, list packages | ||
+ | |||
<code bash> | <code bash> | ||
nix-env -f / | nix-env -f / | ||
</ | </ | ||
+ | |||
install package from local repo | install package from local repo | ||
+ | |||
<code bash> | <code bash> | ||
nix-env -f / | nix-env -f / | ||
</ | </ | ||
+ | |||
package shell script | package shell script | ||
+ | |||
< | < | ||
# Here we but a shell script into path, which lets us start sway.service (after importing the environment of the login shell). | # Here we but a shell script into path, which lets us start sway.service (after importing the environment of the login shell). | ||
Line 1410: | Line 1140: | ||
nix-env --query | nix-env --query | ||
</ | </ | ||
+ | |||
python virtualenv | python virtualenv | ||
+ | |||
<code bash> | <code bash> | ||
nix-shell -p python3Packages.virtualenv | nix-shell -p python3Packages.virtualenv | ||
Line 1417: | Line 1149: | ||
pip install -r requirements.txt | pip install -r requirements.txt | ||
</ | </ | ||
+ | |||
local repository (nixpkgs clone) as systemwide channel | local repository (nixpkgs clone) as systemwide channel | ||
+ | |||
<code bash> | <code bash> | ||
$ nix-build nixos/ | $ nix-build nixos/ | ||
Line 1426: | Line 1160: | ||
$ sudo nix-channel --update | $ sudo nix-channel --update | ||
</ | </ | ||
+ | |||
test packages git pull request | test packages git pull request | ||
+ | |||
< | < | ||
let | let | ||
Line 1451: | Line 1187: | ||
)]; | )]; | ||
</ | </ | ||
+ | |||
retrieve hash | retrieve hash | ||
+ | |||
<code bash> | <code bash> | ||
curl -sL https:// | curl -sL https:// | ||
Line 1460: | Line 1198: | ||
env NIXPKGS_ALLOW_UNFREE=1 nix-env -f / | env NIXPKGS_ALLOW_UNFREE=1 nix-env -f / | ||
</ | </ | ||
+ | |||
build local package | build local package | ||
+ | |||
<code bash> | <code bash> | ||
+ | cd nixpkgs | ||
+ | nix build -f ./. python310Packages.baserow | ||
+ | nix build -f ./. nodePackages.hyperpotamus | ||
nix-build -E 'with import < | nix-build -E 'with import < | ||
- | nix-build -E 'with import /home/onny/projects/nixpkgs {}; nodePackages.hyperpotamus' | + | nix-build -E 'with import / |
</ | </ | ||
+ | |||
rebuilding with progress indication | rebuilding with progress indication | ||
+ | |||
<code bash> | <code bash> | ||
nix build '(with import < | nix build '(with import < | ||
nixos-rebuild -I nixpkgs=/ | nixos-rebuild -I nixpkgs=/ | ||
</ | </ | ||
- | quick launch | + | |
+ | run program | ||
<code bash> | <code bash> | ||
- | nix run nixpkgs.electrum --command | + | nix run nixpkgs#electrum |
+ | nix run github: | ||
+ | nix shell nixpkgs# | ||
</ | </ | ||
+ | |||
review repository | review repository | ||
+ | |||
<code bash> | <code bash> | ||
git clone https:// | git clone https:// | ||
Line 1480: | Line 1232: | ||
nixpkgs-review pr 98044 | nixpkgs-review pr 98044 | ||
</ | </ | ||
+ | |||
setup python virtualenv, working pip | setup python virtualenv, working pip | ||
+ | |||
< | < | ||
15.17.3.6. How to consume python modules using pip in a virtual environment like I am used to on other Operating Systems? | 15.17.3.6. How to consume python modules using pip in a virtual environment like I am used to on other Operating Systems? | ||
Line 1487: | Line 1241: | ||
which package provides certain file | which package provides certain file | ||
+ | |||
< | < | ||
command-not-found telnet | command-not-found telnet | ||
Line 1492: | Line 1247: | ||
use module from unstable | use module from unstable | ||
+ | |||
< | < | ||
let | let | ||
Line 1503: | Line 1259: | ||
{ | { | ||
- | | + | |
+ | " | ||
+ | " | ||
+ | ]; | ||
imports = [ | imports = [ | ||
" | " | ||
+ | / | ||
]; | ]; | ||
nixpkgs.config.packageOverrides = pkgs: rec { | nixpkgs.config.packageOverrides = pkgs: rec { | ||
Line 1514: | Line 1275: | ||
</ | </ | ||
- | overlay: use / overwrite package from custom | + | overlay: use / overwrite package from custom |
< | < | ||
nixpkgs.overlays = [ | nixpkgs.overlays = [ | ||
Line 1523: | Line 1285: | ||
sha256 = " | sha256 = " | ||
}) { config = { allowUnfree = true; }; }).foo2zjs; | }) { config = { allowUnfree = true; }; }).foo2zjs; | ||
+ | linux-wifi-hotspot = (import / | ||
}) | }) | ||
]; | ]; | ||
+ | </ | ||
+ | |||
+ | overlay generate package derivation which includes custom files | ||
+ | |||
+ | < | ||
+ | nwjs' = nwjs.overrideAttrs (x: { | ||
+ | ffmpegPrebuilt = fetchurl { | ||
+ | url = " | ||
+ | sha256 = " | ||
+ | }; | ||
+ | patchPhase = '' | ||
+ | cd lib | ||
+ | ${unzip}/ | ||
+ | ${x.patchPhase or "" | ||
+ | ''; | ||
+ | }); | ||
</ | </ | ||
python environment with gobject introspection etc | python environment with gobject introspection etc | ||
+ | |||
<code bash> | <code bash> | ||
nix-shell -p ' | nix-shell -p ' | ||
Line 1533: | Line 1313: | ||
package overlay and override attributes | package overlay and override attributes | ||
+ | |||
< | < | ||
nixpkgs.overlays = [ | nixpkgs.overlays = [ | ||
Line 1547: | Line 1328: | ||
rm -r $out/ | rm -r $out/ | ||
''; | ''; | ||
+ | }); | ||
+ | foo2zjs = super.foo2zjs.overrideAttrs (oldAttrs: rec { | ||
+ | src = builtins.fetchurl { | ||
+ | url = " | ||
+ | sha256 = " | ||
+ | }; | ||
+ | patches = (oldAttrs.patches or []) ++ [ | ||
+ | (pkgs.fetchpatch { | ||
+ | url = " | ||
+ | sha256 = " | ||
+ | }) | ||
+ | ]; | ||
}); | }); | ||
}) | }) | ||
Line 1552: | Line 1345: | ||
</ | </ | ||
- | fetchpatch | + | fetchpatch |
< | < | ||
- | | + | patches = map fetchpatch |
- | ./no-hardcode-fw.diff | + | /* This patch is currently necessary for the unit test suite to run correctly. |
+ | * See https://www.mail-archive.com/ | ||
+ | * and https:// | ||
+ | */ | ||
+ | #{ | ||
+ | # name = " | ||
+ | # sha256 = " | ||
+ | # url = " | ||
+ | #} | ||
- | | + | |
- | ./ | + | #{ |
- | + | # name = " | |
- | | + | # |
- | # https:// | + | # url = " |
- | (fetchpatch { | + | #} |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | ]; | + | |
</ | </ | ||
Line 1582: | Line 1378: | ||
nixos-shell usage | nixos-shell usage | ||
+ | |||
<code bash> | <code bash> | ||
QEMU_NET_OPTS=" | QEMU_NET_OPTS=" | ||
+ | sudo -E QEMU_NET_OPTS=" | ||
+ | </ | ||
+ | |||
+ | systemd one shot service | ||
+ | |||
+ | < | ||
+ | # Symlink nvim user config for root user | ||
+ | systemd.services.nvim-symlink = { | ||
+ | script = '' | ||
+ | if [[ ! -h "/ | ||
+ | ln -s "/ | ||
+ | fi | ||
+ | ''; | ||
+ | wantedBy = [ " | ||
+ | serviceConfig = { | ||
+ | Type = " | ||
+ | }; | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | nix repl | ||
+ | |||
+ | <code bash> | ||
+ | nix repl '< | ||
+ | # wordpressPackages.plugins.gutenberg.meta.license | ||
</ | </ | ||
==== packaging ==== | ==== packaging ==== | ||
Line 1628: | Line 1450: | ||
< | < | ||
{ lib | { lib | ||
- | , mkDerivation | + | , stdenv |
, fetchFromGitLab | , fetchFromGitLab | ||
, cmake | , cmake | ||
Line 1638: | Line 1460: | ||
}: | }: | ||
- | mkDerivation rec { | + | stdenv.mkDerivation rec { |
pname = " | pname = " | ||
version = " | version = " | ||
Line 1868: | Line 1690: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | packaging java / jar file | ||
+ | |||
+ | < | ||
+ | installPhase = '' | ||
+ | mkdir -p $out/ | ||
+ | cp ${src}/ | ||
+ | makeWrapper ${openjdk}/ | ||
+ | --add-flags "-jar $out/ | ||
+ | ''; | ||
+ | </ | ||
+ | |||
==== nixops ==== | ==== nixops ==== | ||
Line 1922: | Line 1756: | ||
fatlabel /dev/sdb1 " | fatlabel /dev/sdb1 " | ||
</ | </ | ||
+ | |||
resize extX partition | resize extX partition | ||
+ | |||
<code bash> | <code bash> | ||
sfdisk -l /dev/sdb | sfdisk -l /dev/sdb | ||
Line 2007: | Line 1843: | ||
</ | </ | ||
- | ===== avahi ===== | + | |
- | discover local services | + | |
- | <code bash> | + | |
- | avahi-browse --all --ignore-local --resolve --terminate | + | |
- | </ | + | |
===== curlftpfs ===== | ===== curlftpfs ===== | ||
<code bash> | <code bash> | ||
Line 2193: | Line 2025: | ||
qemu-system-arm -M virt -m 512M -cpu cortex-a15 -kernel vmlinuz-lts -initrd initramfs-lts -append " | qemu-system-arm -M virt -m 512M -cpu cortex-a15 -kernel vmlinuz-lts -initrd initramfs-lts -append " | ||
</ | </ | ||
+ | |||
+ | ===== postgresql ===== | ||
+ | |||
+ | list all databases | ||
+ | <code bash> | ||
+ | sudo -u postgres psql | ||
+ | # \l | ||
+ | </ | ||
+ | |||
+ | drop database | ||
+ | <code bash> | ||
+ | sudo -u postgres psql | ||
+ | # drop database gitlabhq_production; | ||
+ | # drop database gitlabhq_production WITH (FORCE); | ||
+ | </ | ||
+ | |||
+ | list tables | ||
+ | <code bash> | ||
+ | sudo -u postgres psql | ||
+ | # \c gitlabhq_production | ||
+ | # \dt | ||
+ | </ | ||
+ | |||
+ | create and delete user | ||
+ | < | ||
+ | DROP ROLE gitlab; | ||
+ | CREATE USER gitlab WITH PASSWORD ' | ||
+ | </ | ||
+ | |||
+ | grant permissions | ||
+ | < | ||
+ | ALTER USER gitlab SUPERUSER; | ||
+ | CREATE DATABASE gitlabhq_production OWNER gitlab; | ||
+ | ALTER DATABASE gitlabhq_production OWNER TO gitlab; | ||
+ | </ | ||
+ | |||
+ | dump database | ||
+ | < | ||
+ | pg_dump -U gitlab gitlabhq_production > / | ||
+ | </ | ||
+ | |||
+ | dump all | ||
+ | < | ||
+ | pg_dumpall > / | ||
+ | </ | ||
+ | |||
+ | import database | ||
+ | < | ||
+ | psql# CREATE DATABASE gitlabhq_production; | ||
+ | psql -U gitlab gitlabhq_production < gitlab.pgsql | ||
+ | </ | ||
+ | |||
+ |