From 5d18d935ff732363db2858dd04a1d7d7245c620b Mon Sep 17 00:00:00 2001 From: Julian T Date: Fri, 26 Mar 2021 23:09:31 +0100 Subject: Move desktop and thinkpad options out of main file --- configuration.nix | 194 +++++++-------------------------------------- desktop.nix | 94 ++++++++++++++++++++++ hardware-configuration.nix | 33 ++++++++ pc_t14.nix | 35 +++++++- 4 files changed, 186 insertions(+), 170 deletions(-) create mode 100644 desktop.nix create mode 100644 hardware-configuration.nix diff --git a/configuration.nix b/configuration.nix index c55e8af..e410470 100644 --- a/configuration.nix +++ b/configuration.nix @@ -5,24 +5,20 @@ { config, pkgs, ... }: { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - # ./pc_t14.nix - ]; - - boot = { - # Use the GRUB 2 boot loader. - loader.grub = { - enable = true; - version = 2; - }; - tmpOnTmpfs = true; - supportedFilesystems = [ "ntfs" ]; - kernel.sysctl = { + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ./pc_t14.nix + ./desktop.nix + ]; + + boot = { + tmpOnTmpfs = true; + supportedFilesystems = [ "ntfs" ]; + kernel.sysctl = { "kernel.sysrq"=1; }; - }; + }; # Enable sound. sound.enable = true; @@ -31,33 +27,10 @@ opengl.enable = true; enableRedistributableFirmware = true; - # Thinkpad stuff - acpilight.enable = true; - bluetooth.enable = false; - - pulseaudio = { - enable = true; - # Stupid but need it to control sound from acpid - # systemWide = true; - - # Enable bluetooth audio - package = pkgs.pulseaudioFull; - }; }; networking = { - # Hostname and wireless enabled - # set in device specific file - - # wireless.enable = true; - - # 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. - interfaces.enp0s25.useDHCP = true; - interfaces.wlp3s0.useDHCP = true; - # Firewall configuration # firewall.enable = true; yeah who needs that shit @@ -84,165 +57,52 @@ # Enable the OpenSSH daemon. # services.openssh.enable = true; - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - pinentryFlavor = "gtk2"; + programs = { + ssh.startAgent = false; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + pinentryFlavor = "gtk2"; + }; }; programs.dconf.enable = true; - # Enable the X11 windowing system. services = { - xserver = { - enable = true; - layout = "us"; - xkbVariant = "altgr-intl"; - exportConfiguration = true; - - windowManager = { - i3 = { - enable = false; - package = pkgs.i3-gaps; - }; - qtile.enable = false; - }; - - displayManager = { - defaultSession = "none+script"; - session = [{ - name = "script"; - manage = "window"; - start = - '' - /home/julian/.nixxstart - ''; - }]; - }; - - desktopManager = { - xterm.enable = false; - }; - - # Touchpad studd - libinput.enable = true; - - # Start dbus? - startDbusSession = true; - }; - # Auto mounting - gvfs.enable = true; - - # Yubikey - pcscd.enable = true; - - # Thinkpad - acpid = { - enable = true; - # Turn down sound when inserting headphones - handlers = { - headphone = { - action = - '' - vals=($1) - case ''${vals[2]} in - plug) - whoami >> /tmp/acpi.log - amixer set Master 10% - ;; - esac - ''; - event = "jack/headphone.*"; - }; - }; - }; - tlp.enable = true; - - # Evolution - gnome3 = { - gnome-keyring.enable = true; - evolution-data-server.enable = true; - }; - - # Enable CUPS to print documents. - printing.enable = true; - - # blueman.enable = true; - - postgresql = { - enable = false; - initialScript = pkgs.writeText "backend-initScript" '' - CREATE ROLE julian WITH LOGIN PASSWORD 'hejmeddig' CREATEDB; - CREATE DATABASE julian; - GRANT ALL PRIVILEGES ON DATABASE julian TO julian; - ''; - }; + udev.packages = [ pkgs.yubikey-personalization ]; }; # Define a user account. Don't forget to set a password with ‘passwd’. users.users.julian = { isNormalUser = true; shell = pkgs.zsh; - extraGroups = [ "wheel" "video" ]; - }; - - virtualisation.docker = { - enable = false; + extraGroups = [ "wheel" "video" "vboxusers" "cdrom" ]; }; + virtualisation.docker.enable = false; # This value determines the NixOS release with which your system is to be # compatible, in order to avoid breaking some software such as database # servers. You should change this only after NixOS release notes say you # should. - system.stateVersion = "20.09"; # Did you read the comment? - - fonts.fonts = with pkgs; [ - noto-fonts noto-fonts-emoji liberation_ttf ubuntu_font_family cozette - ]; + system.stateVersion = "21.05"; # Did you read the comment? # List packages installed in system profile. To search, run: # $ nix search wget nixpkgs.config.allowUnfree = true; environment = { - etc = { - "docker/daemon.json".text = '' - { "dns": [ "1.1.1.1", "9.9.9.9" ] } - ''; - }; systemPackages = with pkgs; [ # General stuff wget vim neovim git htop zsh stow pass tree dnsutils gnupg zip - unzip gopass tig file imagemagick whois nmap usbutils lshw gnumake + unzip tig file imagemagick whois nmap usbutils lshw gnumake aspell aspellDicts.da aspellDicts.en pv acpi jq killall netcat-gnu perl gopass - cowsay gdb man-pages sox + cowsay gdb man-pages sox gcc binutils python3 python - # Landuage support - rustup gcc binutils python3 python go clang-tools + # Nixos stuff + nox # Network stuff networkmanagerapplet networkmanager-openconnect iw batctl wirelesstools - - # X stuff - feh xscreensaver dmenu rofi xorg.xmodmap xss-lock xclip - acpilight xdotool dunst xcompmgr scrot libnotify i3lock - - # Gui applications - firefox pavucontrol okular leafpad inkscape gimp - meld pinentry gnome3.gnome-system-monitor gnome3.dconf - termite quasselClient wireshark spotify - gnome3.file-roller gnome3.gnome-calculator - gnome3.simple-scan vlc mpv xorg.xev gnome3.evolution - evolution-data-server vimHugeX tor-browser-bundle-bin - (mumble.override { pulseSupport = true; }) - libreoffice-fresh liferea qutebrowser - - # Other stuff - # texlive.combined.scheme-full biber - youtube-dl sshpass - - # Hardware stuff. X230 and T14 - linuxPackages.acpi_call ]; }; } diff --git a/desktop.nix b/desktop.nix new file mode 100644 index 0000000..2da180f --- /dev/null +++ b/desktop.nix @@ -0,0 +1,94 @@ +{ config, pkgs, ... }: + +{ + hardware.pulseaudio = { + enable = true; + # Stupid but need it to control sound from acpid + # systemWide = true; + + # Enable bluetooth audio + package = pkgs.pulseaudioFull; + }; + + services = { + xserver = { + enable = true; + layout = "us"; + xkbVariant = "altgr-intl"; + exportConfiguration = true; + + windowManager = { + i3 = { + enable = true; + package = pkgs.i3-gaps; + }; + }; + + displayManager = { + defaultSession = "none+i3"; + }; + + desktopManager = { + xterm.enable = false; + }; + + # Touchpad studd + libinput.enable = true; + + # Start dbus? + # startDbusSession = true; + }; + # Auto mounting + gvfs.enable = true; + + # Evolution + gnome3 = { + gnome-keyring.enable = true; + evolution-data-server.enable = true; + }; + + # Enable CUPS to print documents. + printing.enable = true; + + postgresql = { + enable = false; + initialScript = pkgs.writeText "backend-initScript" '' + CREATE ROLE julian WITH LOGIN PASSWORD 'hejmeddig' CREATEDB; + CREATE DATABASE julian; + GRANT ALL PRIVILEGES ON DATABASE julian TO julian; + ''; + }; + }; + + + virtualisation.virtualbox.host.enable = true; + + fonts.fonts = with pkgs; [ + noto-fonts noto-fonts-emoji liberation_ttf ubuntu_font_family cozette + ]; + + environment.systemPackages = with pkgs; [ + gopass + + # Developing + rustup gcc go clang-tools + + # X stuff + feh rofi xorg.xmodmap xss-lock xclip xorg.xkill + acpilight xdotool dunst xcompmgr scrot libnotify i3lock + + # Gui applications + firefox pavucontrol evince leafpad inkscape gimp + meld pinentry gnome3.gnome-system-monitor + termite quasselClient wireshark spotify + gnome3.file-roller gnome3.gnome-calculator + gnome3.simple-scan vlc mpv xorg.xev tor-browser-bundle-bin + evolution evolution-data-server vimHugeX + (mumble.override { pulseSupport = true; }) + libreoffice-fresh liferea qutebrowser mate.caja + + # Other stuff + texlive.combined.scheme-medium biber + youtube-dl sshpass python38Packages.pynvim + ]; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..e38eebc --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,33 @@ +# 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, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/stuff/root"; + fsType = "ext4"; + }; + + fileSystems."/home" = + { device = "/dev/stuff/home"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/7178-78A1"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + +} diff --git a/pc_t14.nix b/pc_t14.nix index 221e6ba..e72671c 100644 --- a/pc_t14.nix +++ b/pc_t14.nix @@ -1,7 +1,36 @@ -{ config, ... }; +{ config, pkgs, ... }: { - boot.loader.grub.device = "/dev/sda"; - networking.hostName = "nixT14s"; + networking = { + hostName = "nixT14s"; + + interfaces.enp2s0f0.useDHCP = true; + interfaces.wlp3s0.useDHCP = true; + }; + + boot = { + kernelPackages = pkgs.linuxPackages_latest; + loader = { + systemd-boot.enable = true; + + efi.canTouchEfiVariables = true; + efi.efiSysMountPoint = "/boot"; + }; + initrd.luks.devices = { + lvmroot = { + device = "/dev/disk/by-uuid/3aa2923c-928d-4050-82dc-21be53b2af8e"; + preLVM = true; + }; + }; + + }; + + hardware.acpilight.enable = true; + + services.tlp.enable = true; + + environment.systemPackages = with pkgs; [ + linuxPackages.acpi_call + ]; } -- cgit v1.2.3