Browse Source

init commit

master
Alexander Karl 2 years ago
parent
commit
caebec45e5
  1. 26
      configuration.nix
  2. 32
      hardware-configuration.nix
  3. 25
      import.nix
  4. 21
      modules/boot.nix
  5. 23
      modules/disk.nix
  6. 11
      modules/env.nix
  7. 15
      modules/hardware.nix
  8. 16
      modules/networking.nix
  9. 13
      modules/opengl.nix
  10. 114
      modules/pkgs.nix
  11. 9
      modules/power.nix
  12. 46
      modules/programs.nix
  13. 73
      modules/services.nix
  14. 6
      modules/sound.nix
  15. 8
      modules/users.nix

26
configuration.nix

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, callPackage, ... }:
{
imports =
[ # Include the results of the hardware scan.
<nixos-hardware/lenovo/thinkpad/t440s>
./hardware-configuration.nix
./import.nix
];
# Define a user account. Don't forget to set a password with ‘passwd’.
# 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.03"; # Did you read the comment?
}

32
hardware-configuration.nix

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/ebbcbc37-f46d-4789-afca-80c51ee371c8";
fsType = "ext4";
};
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/e05c1da9-7b1b-4030-bcd8-0aa69f0d01c3";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/5A2A-3D3A";
fsType = "vfat";
};
swapDevices = [ ];
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}

25
import.nix

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
{ ... }:
{
imports =
[
# Boot
./modules/boot.nix
./modules/disk.nix
# Hardware and networking
./modules/hardware.nix
./modules/power.nix
./modules/networking.nix
./modules/sound.nix
./modules/opengl.nix
# Env
./modules/users.nix
./modules/env.nix
# Packages and services
./modules/pkgs.nix
./modules/programs.nix
./modules/services.nix
];
}

21
modules/boot.nix

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
{pkgs, ...}:
{
boot = {
kernelPackages = pkgs.linuxPackages_latest;
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
plymouth.enable = true;
extraModprobeConfig = ''
options thinkpad_acpi fan_control=1
'';
initrd.kernelModules = [ "i915" ];
initrd.availableKernelModules = [ "i915"];
};
}

23
modules/disk.nix

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
{...}:
{
fileSystems."/" = {
device = "/dev/disk/by-uuid/ebbcbc37-f46d-4789-afca-80c51ee371c8";
fsType = "ext4";
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/5489dfc6-69a5-4873-9d95-886da7106cf2";
fsType = "ext4";
};
boot.initrd.luks.devices = {
"cryptroot" = {
device = "/dev/disk/by-uuid/e05c1da9-7b1b-4030-bcd8-0aa69f0d01c3";
};
"crypthome" = {
device = "/dev/disk/by-uuid/ca007185-7d40-455b-a8e0-5d868a0678a8";
};
};
}

11
modules/env.nix

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
{ pkgs, ... }:
{
environment = {
pathsToLink = [ "/libexec" ];
variables = {
OH_MY_ZSH = [ "${pkgs.oh-my-zsh}/share/oh-my-zsh" ];
};
};
time.timeZone = "Europe/Amsterdam";
}

15
modules/hardware.nix

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
{ pkgs, ... }:
{
nixpkgs.config.packageOverrides = pkgs: {
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
};
hardware = {
bluetooth = {
enable = true;
package = pkgs.bluezFull;
};
cpu.intel.updateMicrocode = true;
};
}

16
modules/networking.nix

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
{...}:
{
networking = {
hostName = "d0nnerpad"; # Define your hostname.
useDHCP = false;
interfaces.enp0s25.useDHCP = true;
interfaces.wlp3s0.useDHCP = true;
networkmanager.enable = true;
firewall = {
enable = true;
allowPing = true;
};
};
}

13
modules/opengl.nix

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
{ pkgs, ... }:
{
# OpenGL
hardware.opengl = {
driSupport32Bit = true;
extraPackages = with pkgs; [
vaapiIntel
vaapiVdpau
libvdpau-va-gl
intel-media-driver
];
};
}

114
modules/pkgs.nix

@ -0,0 +1,114 @@ @@ -0,0 +1,114 @@
{ pkgs, config, ... }:
let
unstableTarball =
fetchTarball
https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz;
in {
nixpkgs.config = {
packageOverrides = pkgs: {
unstable = import unstableTarball {
config = config.nixpkgs.config;
};
};
allowUnfree = true;
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# linux headers
linuxHeaders
# version control / archiving / backup
unzip zip p7zip
borgbackup unstable.vorta
# networking
wireshark wget networkmanager vnstat nmap networkmanagerapplet
openvpn
# utilities
zsh oh-my-zsh unstable.htop wpa_supplicant mpv source-code-pro fzf canon-cups-ufr2 cups-bjnp cnijfilter2 gutenprintBin
alacritty trash-cli mtr lftp mosh openssl jq pwgen gotty git youtube-dl neofetch dnsutils
# wireguard
wireguard wireguard-tools
# man pages
man man-pages
# ops
ansible
# dev tools
vscode
# terminal multiplexer
tmux
# desktop applications
thunderbird playerctl
nextcloud-client
spotify
unstable.teamspeak_client
unstable.keepassxc
unstable.tdesktop
unstable.firefox
unstable.obs-studio
unstable.flameshot
unstable.libreoffice-fresh
unstable.etcher
unstable.bitwarden
# programming lanugages
go goimports gogetdoc
# display
arandr light autorandr
imagemagick
# virtualization
virtualbox
vagrant
docker-compose
# libraries
libpcap
# filesystem utils
exfat exfat-utils
# fancy
grc
# sound
pavucontrol pulseeffects
# codecs / filesystems
mtpfs sshfs
# lockscreen
xtrlock-pam xscreensaver
# latex
# https://nixos.wiki/wiki/TexLive
# "the package containes everything in the plain scheme but includes latex"
texlive.combined.scheme-full
pandoc
# external monitor control
ddccontrol ddcutil
# notification daemon
dunst
# fix throttling issues
throttled
# security
gnupg
];
}

9
modules/power.nix

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
{ lib, ... }:
{
# powerManagerment
powerManagement = {
cpuFreqGovernor = lib.mkDefault "powersave";
powertop.enable = true;
};
}

46
modules/programs.nix

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
{pkgs, ...}:
{
programs = {
zsh = {
enable = true;
ohMyZsh = {
enable = true;
plugins = [ "git" "sudo" "docker" "ansible" ];
theme = "ys";
};
};
system-config-printer = {
enable = true;
};
# Lockscreen
xss-lock = {
enable = true;
lockerCommand = "${pkgs.betterlockscreen}/bin/betterlockscreen -l -w blur";
};
# backlight control
light = {
enable = true;
};
# don't start the ssh agent, user the gnupg agent
ssh = {
startAgent = false;
};
# use the gnupg agent for ssh
gnupg = {
agent = {
enable = true;
enableSSHSupport = true;
};
};
# allow mtr as user
mtr = {
enable = true;
};
};
}

73
modules/services.nix

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
{ pkgs, ...}:
{
services = {
logind.lidSwitch = "suspend-then-hibernate";
gnome3.gnome-keyring.enable = true;
system-config-printer.enable = true;
picom.enable = true;
xserver = {
enable = true;
layout = "de";
desktopManager = {
xterm.enable = false;
};
displayManager = {
defaultSession = "none+i3";
};
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
rofi #application launcher
i3status # gives you the default i3 status bar
i3lock #default i3 screen locker
i3blocks #if you are planning on using i3blocks over i3status
betterlockscreen # lockscreen
];
};
libinput = {
enable = true;
tapping = false;
};
};
# keybindings for changing the backlight
actkbd = {
enable = true;
bindings = [
{ keys = [ 224 ]; events = [ "key" ]; command = "/run/current-system/sw/bin/light -U 3"; }
{ keys = [ 225 ]; events = [ "key" ]; command = "/run/current-system/sw/bin/light -A 3"; }
];
};
# Enable CUPS to print documents
printing = {
enable = true;
drivers = [ pkgs.canon-cups-ufr2 pkgs.cups-bjnp pkgs.cnijfilter2 pkgs.gutenprintBin ];
};
# Enable bluetooth
blueman.enable = true;
# hotplug screens
autorandr.enable = true;
# firmware
fwupd.enable = true;
# thinkfan
thinkfan = {
enable = true;
sensors = "tp_thermal /proc/acpi/ibm/thermal (0,0,10)";
};
};
}

6
modules/sound.nix

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
{...}:
{
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
}

8
modules/users.nix

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
{pkgs, ...}:
{
users.users.akarl = {
isNormalUser = true;
shell = pkgs.zsh;
extraGroups = [ "wheel" "lp" "cups" ];
};
}
Loading…
Cancel
Save