Skip to content

Instantly share code, notes, and snippets.

@klautcomputing
Created March 24, 2021 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klautcomputing/dde68f7ec24274510a888eb42adb26b6 to your computer and use it in GitHub Desktop.
Save klautcomputing/dde68f7ec24274510a888eb42adb26b6 to your computer and use it in GitHub Desktop.
nixos configs
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
boot = {
# acpi_call makes tlp work for newer thinkpads
kernelModules = [ "acpi_call" ];
extraModulePackages = with config.boot.kernelPackages; [ acpi_call v4l2loopback ];
# Use the systemd-boot EFI boot loader.
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
kernelPackages = pkgs.linuxPackages_latest;
initrd.luks.devices = {
root = {
device = "/dev/disk/by-uuid/91f605f7-1d54-4b59-b47e-26b872561a18";
preLVM = true;
allowDiscards = true;
};
};
};
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking = {
useDHCP = false;
# interfaces.enp0s13f0u3.useDHCP = true;
interfaces.wlp0s20f3.useDHCP = true;
nameservers = ["8.8.8.8" "8.8.4.4"];
extraHosts = ''
127.0.0.1 reddit.com
127.0.0.1 www.reddit.com
127.0.0.1 facebook.com
127.0.0.1 www.facebook.com
127.0.0.1 heise.de
127.0.0.1 www.heise.de
127.0.0.1 zeit.de
127.0.0.1 www.zeit.de
127.0.0.1 blog.fefe.de
127.0.0.1 taz.de
127.0.0.1 www.taz.de
'';
hostName = "xray";
networkmanager.enable = true;
};
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# };
# Enable the X11 windowing system.
# services.xserver.enable = true;
fonts = {
fontDir.enable = true;
enableGhostscriptFonts = true;
fonts = with pkgs; [
corefonts
vistafonts
inconsolata
terminus_font
proggyfonts
dejavu_fonts
font-awesome
font-awesome-ttf
awesome
ubuntu_font_family
source-code-pro
source-sans-pro
source-serif-pro
];
};
services = {
udev.packages = [
pkgs.android-udev-rules
];
blueman.enable = true;
dbus = {
enable = true;
};
xserver = {
enable = true;
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
dmenu
i3status
i3lock
];
};
desktopManager.xterm.enable = false;
videoDrivers = ["modesetting"];
layout = "us,de";
# swap caps and escape
xkbOptions = "caps:swapescape, eurosign:e, compose:menu, grp:alt_space_toggle";
displayManager = {
defaultSession = "none+i3";
sessionCommands = ''
xset b off
xset s noblank
xset s off
ulimit -c unlimited
# ${pkgs.xorg.xrdb}/bin/xrdb -merge <<EOF
# Xft.dpi: 192
# EOF
'';
lightdm = {
enable = true;
};
autoLogin = {
enable = true;
user = "leex";
};
};
};
printing = {
enable = true;
drivers = [ pkgs.gutenprint pkgs.hplip pkgs.epson-escpr ];
};
};
# Configure keymap in X11
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e";
# Enable sound.
sound.enable = true;
hardware = {
firmware = [ pkgs.alsa-firmware ];
enableAllFirmware = true;
bluetooth = {
enable = true;
# extraConfig = "
# [General]
# Enable=Source,Sink,Media,Socket
# ";
};
# x1 trackpoint
trackpoint = {
enable = true;
device = "TPPS/2 Elan TrackPoint";
# middle mouse button scroll
emulateWheel = true;
};
opengl = {
enable = true;
driSupport32Bit = true;
extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
};
pulseaudio = {
enable = true;
support32Bit = true;
# extraModules = [ pkgs.pulseaudio-modules-bt ];
package = pkgs.pulseaudioFull;
# extraConfig = "
# load-module module-switch-on-connect
# ";
};
cpu.intel.updateMicrocode = true;
};
time.timeZone = "Canada/Mountain";
powerManagement = {
enable = true;
powertop.enable = true;
};
nixpkgs.config = {
allowUnfree = true;
};
nix = {
gc = {
automatic = true;
dates = "monthly";
options = "--delete-older-than 7d";
};
daemonIONiceLevel = 7;
daemonNiceLevel = 19;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
users.extraUsers.leex = {
isNormalUser = true;
extraGroups = ["pulse-access" "audio" "camera" "video" "wheel" "networkmanager" "vboxusers" "docker" "adbusers"];
shell = pkgs.zsh;
openssh.authorizedKeys.keys = [
];
};
environment = {
pathsToLink = [ "/share/zsh" ];
systemPackages = with pkgs; [
# system tools
pciutils usbutils hdparm ntfs3g lm_sensors
xorg.xkill psmisc wirelesstools pmount
acpi xorg.xbacklight
# defaults
wget curl htop atop netcat nmap calc tree inotify-tools unzip
];
sessionVariables = {
SUDO_EDITOR = "vim";
EDITOR = "vim";
BROWSER = "firefox";
};
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "20.09"; # Did you read the comment?
system.autoUpgrade.enable = true;
}
user:
nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/master.tar.gz
nixpkgs-unstable https://nixos.org/channels/nixpkgs-unstable
root
nix-channel --list
nixos https://nixos.org/channels/nixos-unstable
{ config, pkgs, ... }:
let
unstable = import <nixpkgs-unstable> {
config.allowUnfree = true;
};
in
{
nixpkgs.config.allowUnfree = true;
home.packages = [
# screenshare
unstable.obs-studio
unstable.obs-v4l2sink
unstable.gphoto2
# backlight
unstable.light
unstable.brightnessctl
# redshift
unstable.redshift
unstable.geoclue2
#user applications
unstable.google-chrome-beta
unstable.signal-desktop
unstable.evince
pkgs.pwgen
pkgs.libreoffice-fresh
unstable.cabextract
unstable.tdesktop
unstable.speedtest-cli
unstable.fava
unstable.beancount
unstable.bean-add
unstable.blender
# windows usb stick
unstable.woeusb
# gaming
unstable.gnutls
# pkgs.steam meh...
unstable.freeciv
# coding
unstable.rr
unstable.wasm-pack
unstable.dnsutils
unstable.hugo
unstable.binutils
unstable.perf-tools
unstable.nix-index
unstable.lldb
pkgs.calibre
#video
pkgs.mpv
unstable.youtube-dl
unstable.ffmpeg
#audio
pkgs.blueman
pkgs.audacity
unstable.pavucontrol
# music
pkgs.vimpc
pkgs.ncmpcpp
pkgs.mpc_cli
unstable.tuxguitar
pkgs.audacity
# image stuff
pkgs.gimp
pkgs.inkscape
pkgs.scrot
pkgs.gnome3.eog
# networking
pkgs.tcpdump
pkgs.wireshark
pkgs.nmap
pkgs.netcat
unstable.filezilla
# development
pkgs.tig
pkgs.meld
# pkgs.msgpack-tools
pkgs.docker
pkgs.docker_compose
unstable.fzf
pkgs.tmux
unstable.gcc
unstable.nodejs
unstable.gdb
#embedded
unstable.minicom
unstable.openocd
#ruby
unstable.ruby_2_7
unstable.rubyPackages.sqlite3
unstable.sqlite
#rust
unstable.rustup
unstable.cargo-generate
#python
unstable.python3
pkgs.xorg.xcbutil
pkgs.xorg.libxcb
unstable.jupyter
unstable.python39Packages.jupyter
unstable.python39Packages.ipykernel
unstable.python38Packages.ipykernel
#sys tools
pkgs.sshpass
pkgs.sshfs
unstable.curlftpfs
pkgs.vnstat
pkgs.iftop
pkgs.pmount
pkgs.openbox-menu
pkgs.htop
unstable.bottom # htop in rust
pkgs.unrar
pkgs.xxd
pkgs.zip
pkgs.nix-prefetch-git
pkgs.nix-prefetch-github
pkgs.ripgrep
pkgs.openjdk
pkgs.file
# pkgs.syncthing
pkgs.android-file-transfer
#environment
pkgs.font-awesome
pkgs.powerline-fonts
pkgs.powerline-rs
pkgs.thefuck
unstable._1password
unstable.jq
pkgs.xclip
pkgs.bat
pkgs.nix-zsh-completions
pkgs.zsh
unstable.alacritty
pkgs.irssi
unstable.starship
];
programs.vscode = {
package = unstable.vscode;
enable = true;
extensions = [
unstable.vscode-extensions.bbenoist.Nix
unstable.vscode-extensions.vscodevim.vim
unstable.vscode-extensions.matklad.rust-analyzer
unstable.vscode-extensions.ms-vsliveshare.vsliveshare
];
};
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
autocd = true;
dotDir = ".config/zsh";
envExtra = ''
# bindkey '^ ' autosuggest-execute
bindkey '^ ' autosuggest-accept
eval "$(starship init zsh)"
eval $(dircolors $HOME/.config/dir_colors/dircolors.256dark)
eval $(thefuck --alias)
function rake () { nix-shell --run "bundle exec rake $1" }
function rails () { nix-shell --run "bundle exec rails $1" }
'';
shellAliases = {
rg = "rg -i";
u = "cd ..";
uu = "cd ../..";
uuu = "cd ../../..";
uuuu = "cd ../../../..";
uuuuu = "cd ../../../../..";
cdl = "cd `ls -trl | grep ^d | awk '{print $9,$10}'|tail -n 1`";
big_dir = "du -a | sort -n -r";
mount_hd = "sudo cryptsetup luksOpen /dev/sdb external; sudo mount /dev/mapper/external /mnt/external; ";
headphones="echo 'connect 04:52:C7:EF:AC:E6' | bluetoothctl";
ydl="youtube-dl --audio-quality=0";
pn = "mpv -af scaletempo $(ls -tr|tail -n 1)";
mp="mpv --no-video ";
mv="mv -v --backup=existing";
rm="rm -v";
cp="cp -v";
c="clear";
vim="nvim -p";
hm="nvim -p ~/.config/nixpkgs/home.nix; home-manager switch";
};
history = {
expireDuplicatesFirst = true;
extended = true;
ignoreDups = true;
path = "/home/leex/.config/zsh/history";
save = 20000;
share = true;
size = 20000;
};
localVariables = {
LANG = "en_US.UTF-8";
EDITOR = "nvim";
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=60";
PAGER = "less";
};
oh-my-zsh = {
enable = true;
# gpg-agent
plugins = ["sudo" "battery" "cargo" "colored-man-pages" "colorize" "docker" "extract" "encode64" "git" "kubectl" "per-directory-history" "tig" "vi-mode"];
};
};
# programs.firefox = {
# package = unstable.firefox;
# enable = true;
# };
programs.git = {
package = pkgs.gitAndTools.gitFull;
enable = true;
userName = "Felix Glaser";
userEmail = "leex@klautcomputing.de";
# signing = {
# key = "leex@klautcomputing.de";
# signByDefault = true;
# };
};
programs.i3status-rust = {
enable = true;
bars = {
bottom = {
blocks = [
{
block = "disk_space";
path = "/";
alias = "/";
info_type = "available";
unit = "GB";
interval = 60;
warning = 20.0;
alert = 10.0;
}
{
block = "sound";
format = "{output_name} {volume}%";
on_click = "pavucontrol --tab=3";
mappings = {
"alsa_output.pci-0000_00_1f.3.analog-stereo" = "";
"bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "";
};
}
{
block = "memory";
display_type = "memory";
format_mem = "{Mup}%";
format_swap = "{SUp}%";
}
{
block = "cpu";
interval = 1;
}
{
block = "load";
interval = 1;
format = "{1m}";
}
{ block = "sound"; }
{
block = "time";
interval = 60;
format = "%a %d/%m %R";
}
];
settings = {
theme = {
name = "solarized-dark";
# overrides = {
# idle_bg = "#123456";
# idle_fg = "#abcdef";
# };
};
};
icons = "awesome5";
theme = "gruvbox-dark";
};
};
};
programs.rofi = {
enable = true;
};
services = {
mpd = {
enable = true;
};
redshift = {
enable = true;
# provider = "geoclue2";
latitude = "51.0900";
longitude = "-115.3442";
tray = true;
settings.redshift.brightness-night = "0.5";
settings.redshift.brightness-day = "1.0";
provider = "manual";
temperature = {
night = 3500;
day = 6500;
};
};
};
programs.neovim = {
enable = true;
vimAlias = true;
extraConfig = builtins.readFile ~/.config/nvim/my-init.vim;
plugins = with unstable.vimPlugins; [
# programming languages
vim-nix
vim-ruby
rust-vim
vim-nix
# ui stuff
gruvbox
vim-gitgutter
vim-airline
vim-fetch # open files at line with filename:23
ale
nerdtree # tree explorer
nerdtree-git-plugin # git support
lightline-vim # statusline
fzf-vim # fzf!!!
vim-fugitive # git support
vim-rooter #cd to project root
neoformat # formating
coc-nvim # completion
coc-rust-analyzer # RUST completion
coc-solargraph # oh ruby ruby ruby
vim-anzu
incsearch-vim
is-vim
vim-easymotion
];
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
home.stateVersion = "21.03";
home.username = "leex";
home.homeDirectory = "/home/leex";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment