From 703c69edeadc94fb4cb78a5466da7aa8833c12a3 Mon Sep 17 00:00:00 2001 From: horhik Date: Sun, 30 May 2021 22:10:25 +0300 Subject: [PATCH] split nix config by files --- nix/configuration.nix | 212 +++++++++++++++++++++++++++++++++ nix/fonts.nix | 39 ++++++ nix/hardware-configuration.nix | 30 +++++ nix/modules/discord.nix | 4 + nix/modules/gtk.nix | 19 +++ nix/modules/hosts.nix | 10 ++ nix/modules/picom.nix | 23 ++++ nix/modules/sound.nix | 65 ++++++++++ nix/modules/steam.nix | 9 ++ nix/modules/syncthing.nix | 10 ++ nix/modules/wm.nix | 26 ++++ nix/modules/zsh.nix | 20 ++++ 12 files changed, 467 insertions(+) create mode 100644 nix/configuration.nix create mode 100644 nix/fonts.nix create mode 100644 nix/hardware-configuration.nix create mode 100644 nix/modules/discord.nix create mode 100644 nix/modules/gtk.nix create mode 100644 nix/modules/hosts.nix create mode 100644 nix/modules/picom.nix create mode 100644 nix/modules/sound.nix create mode 100644 nix/modules/steam.nix create mode 100644 nix/modules/syncthing.nix create mode 100644 nix/modules/wm.nix create mode 100644 nix/modules/zsh.nix diff --git a/nix/configuration.nix b/nix/configuration.nix new file mode 100644 index 0000000..cfb1ce8 --- /dev/null +++ b/nix/configuration.nix @@ -0,0 +1,212 @@ +# 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, ... }: + +{ + nix = { + package = pkgs.nixUnstable; + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ./modules/wm.nix + ./modules/syncthing.nix + ./modules/discord.nix + ./modules/gtk.nix + ./modules/hosts.nix + ./modules/picom.nix + ./modules/sound.nix + ./modules/steam.nix + ./modules/zsh.nix + + ]; + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.grub.device = "/dev/nvme0n1"; + boot.loader.grub.useOSProber = true; + nixpkgs.config.allowUnfree = true; + nixpkgs.config.allowBroken = true; + networking.hostName = "lap"; # Define your hostname. + environment.variables = { + MAIN_DISK="/dev/nvme0n1"; + TERMINAL="alacritty"; + }; + # let inputs = { + # home-manager = { + # url = "github:rycee/home-manager/release-20.09"; + # inputs = { + # nixpkgs.follows = "nixpkgs"; + # }; + # }; + # nur.url = "github:nix-community/NUR"; + # emacs-overlay.url = "github:nix-community/emacs-overlay"; + # neovim-overlay.url = "github:nix-community/neovim-nightly-overlay"; + # + # nixpkgs.url = "github:nixos/nixpkgs/nixos-20.09"; + # unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + # master.url = "github:nixos/nixpkgs/master"; + #}; + # + # nur = final: prev: { + # nur = import inputs.nur { nurpkgs = final.unstable; pkgs = final.unstable; }; + # }; + # networking.wireless.enable = true; + # enable = true; + # networks={ + # Goga = { + # hidden = true; + # pskRaw = "aaeb0f9e9709a1f25bc93d34290054849e3f8b37071801bbfa4eef5e2eac5084"; + # }; + # }; + # }; + # Set your time zone. + time.timeZone = "Europe/Moscow"; + + # 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; + networking.interfaces.wlp2s0.useDHCP = 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"; + }; + + + + # Configure keymap in X11 + # Enable CUPS to print documents. + services.printing.enable = true; + services.blueman.enable = true; + hardware.bluetooth.enable = true; + # Enable sound. + + # Enable touchpad support (enabled default in most desktopManager). + services.xserver.libinput.enable = true; + services.xserver.libinput.touchpad.tapping = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.defaultUserShell = pkgs.zsh; + users.users.horhik = { + isNormalUser = true; + extraGroups = [ "wheel" "networkmanager" "audio" "docker" "light" "adbusers" ]; # Enable ‘sudo’ for the user. + }; + system.autoUpgrade.enable = true; + system.autoUpgrade.channel = https://nixos.org/channels/nixos-unstable; + # List packages installed in system profile. To search, run: + # $ nix search wget + + environment.systemPackages = with pkgs; [ + papirus-icon-theme pop-gtk-theme + wget git vim neovim emacs alacritty xterm zsh tmux stow dunst + # haskellPackages.xmonad haskellPackages.xmobar haskellPackages.xmonad-contrib haskellPackages.xmonad-utils + i3 surf dmenu st qutebrowser + lightdm rofi nitrogen rofi-emoji + mononoki fontmatrix + firefox + connman + wpa_supplicant python3 xkblayout-state acpi yaru-theme + pipewire pulsemixer nerdfonts + feh compton ninja meson cmake + anki clang zathura redshift rustup neofetch tree + killall audacity thefuck + polkit etcher gsettings-qt appimage-run pamixer unzip qjackctl gnome3.nautilus bluez pkgconfig pavucontrol bpytop + #nur.repos.reedrw.picom-next-ibhagwan + picom + spotify obsidian discord + ]; + + # 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? + ### OH MY ZSH ### + + #programs.zsh.interactiveShellInit = '' + # export ZSH=${pkgs.oh-my-zsh}/share/oh-my-zsh/ + # export CC=/usr/bin/clang + # export CXX=/usr/bin/clang++ + # export _JAVA_AWT_WM_NONREPARENTING=1 + # export ANDROID_SDK_ROOT=/home/horhik/Android/Sdk/ + # export NDK_HOME=/home/horhik/Android/Sdk/ndk/22.0.7026061/ + # ZSH_THEME="cloud" + # plugins=(git colorize colored-man-pages emoji rustup sudo zsh-syntax-highlighting zsh-autosuggestions zsh-completions) + # autoload -U compinit && compinit + # source $ZSH/oh-my-zsh.sh + # export PATH=$HOME/.local/bin:$PATH + # export PATH=/usr/local/bin:$PATH + # export PATH=$HOME/.cargo/bin:$PATH + # export PATH=$HOME/.emacs.d/bin:$PATH + # export PATH=$HOME/Desktop:$PATH + # export PATH=/home/horhik/code/projects/potato-notify:$PATH + # export PATH="/root/.deno/bin:$PATH" + # alias vim=nvim + # alias vi=vim + # alias libvirtdaemon="sudo start-stop-daemon --start libvirtd" + # alias virtm="sudo start-stop-daemon --start virtlogd &; sudo start-stop-daemon --start libvirtd &; virt-manager &" + # alias clip=xclip -selection clipboard + # alias suspend="loginctl suspend" + # if [ -f '/home/horhik/yandex-cloud/path.bash.inc' ]; then source '/home/horhik/yandex-cloud/path.bash.inc'; fi + # if [ -f '/home/horhik/yandex-cloud/completion.zsh.inc' ]; then source '/home/horhik/yandex-cloud/completion.zsh.inc'; fi + # alias rd='rustc -g --emit="obj,link"' + # + # + # alias rdr=compile_and_run + # alias aia=ankiaudio + # alias picom="killall picom; picom --experimental-backends &;" + # alias cc="cargo check" + # alias ct="cargo test" + # alias gc="git clone" + # alias gs="git status" + # alias vim="nvim" + # + # neofetch + # + # eval $(thefuck --alias) + # source $ZSH/oh-my-zsh.sh + #''; + # + # + + + ### FONTS ### + + + + + programs.adb.enable = true; +} diff --git a/nix/fonts.nix b/nix/fonts.nix new file mode 100644 index 0000000..5703a90 --- /dev/null +++ b/nix/fonts.nix @@ -0,0 +1,39 @@ +{config, pkgs, ...}: +{ + fonts = { + fonts = with pkgs; [ + # icon fonts + material-design-icons + + # normal fonts + noto-fonts + mononoki + noto-fonts-cjk + noto-fonts-emoji + twitter-color-emoji + liberation_ttf_v1 + hack-font + ubuntu_font_family + + # bitmap fonts + gohufont + tewi-font + + # nerdfonts + (nerdfonts.override { fonts = [ "FiraCode" "JetBrainsMono" "Mononoki" ]; }) + ]; + + # use fonts specified by user rather than default ones + enableDefaultFonts = false; + + # user defined fonts + # the reason there's Noto Color Emoji everywhere is to override DejaVu's + # B&W emojis that would sometimes show instead of some Color emojis + fontconfig.defaultFonts = { + serif = [ "Noto Serif" "Twitter Color Emoji" ]; + sansSerif = [ "Noto Sans" "Twitter Color Emoji"]; + monospace = [ "Mononoki Nerd Font" "Twitter Color Emoji"]; + emoji = [ "Twitter Color Emoji" ]; + }; + }; +} diff --git a/nix/hardware-configuration.nix b/nix/hardware-configuration.nix new file mode 100644 index 0000000..0ef6ae0 --- /dev/null +++ b/nix/hardware-configuration.nix @@ -0,0 +1,30 @@ +# 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" "xhci_pci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/1dd41f8e-142f-4799-a5e5-cc916cf016c1"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/7555-74BA"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/4d03f0d2-c4d2-4f50-9b0c-86ab4df15cfd"; } + ]; + +} diff --git a/nix/modules/discord.nix b/nix/modules/discord.nix new file mode 100644 index 0000000..7083451 --- /dev/null +++ b/nix/modules/discord.nix @@ -0,0 +1,4 @@ +{config, pkgs, ...}: +{ + nixpkgs.overlays = [(self: super: { discord = super.discord.overrideAttrs (_: { src = builtins.fetchTarball "https://discord.com/api/download/stable?platform=linux&format=tar.gz"; });})]; +} diff --git a/nix/modules/gtk.nix b/nix/modules/gtk.nix new file mode 100644 index 0000000..4ac65fe --- /dev/null +++ b/nix/modules/gtk.nix @@ -0,0 +1,19 @@ +{config, pkgs, ...}: +{ + services.xserver.desktopManager.cde.extraPackages = with pkgs; + options.services.xserver.desktopManager.cde.extraPackages.default ++ [ + cde-gtk-theme + ]; + environment.etc."xdg/gtk-2.0/gtkrc".text = '' + gtk-theme-name="Yaru" + ''; + environment.etc."xdg/gtk-3.0/settings.ini".text = '' + [Settings] + gtk-theme-name=yaru-theme + ''; + qt5 = { + enable = true; + platformTheme = "gtk2"; + style = "gtk2"; + }; +} diff --git a/nix/modules/hosts.nix b/nix/modules/hosts.nix new file mode 100644 index 0000000..1524ea0 --- /dev/null +++ b/nix/modules/hosts.nix @@ -0,0 +1,10 @@ +{config, pkgs, ...}: +{ + networking.extraHosts = + '' + 127.0.0.1 www.youtube.com + 127.0.0.1 m.youtube.com + 127.0.0.1 youtube.com + ''; + +} diff --git a/nix/modules/picom.nix b/nix/modules/picom.nix new file mode 100644 index 0000000..e8945b3 --- /dev/null +++ b/nix/modules/picom.nix @@ -0,0 +1,23 @@ +{config, pkgs, ...}: +{ + services.picom = { + # package = pkgs.nur.repos.reedrw.picom-next-ibhagwan; + enable = true; + #detect-rounded-corners = true; + backend = "glx"; + shadow = true; + vSync = true; + activeOpacity = 1.0; + inactiveOpacity = 0.75 ; + experimentalBackends = true; + settings = { + blur = { + method = "kawase"; + size = 50; + deviation = 7.0; + }; + }; + }; + + +} diff --git a/nix/modules/sound.nix b/nix/modules/sound.nix new file mode 100644 index 0000000..00058ae --- /dev/null +++ b/nix/modules/sound.nix @@ -0,0 +1,65 @@ +{config, pkgs, ...}: +{ + ### PIPEWIRE ### + hardware.pulseaudio.enable = true; + hardware.pulseaudio.support32Bit = true; + nixpkgs.config.pulseaudio = true; + # sound + # security.rtkit.enable = true; + # services.pipewire = { + # enable = true; + # alsa.enable = true; + # alsa.support32Bit = true; + # #jack.enable = true; + # pulse.enable = true; + # media-session.enable = true; + # }; + # config = { + # pipewire = { + # "context.properties" = { + # # Properties for the DSP configuration. + # "default.clock.rate" = 48000; + # "default.clock.quantum" = 256; + # "default.clock.min-quantum" = 16; + # }; + # }; + # }; + # + # config.pipewire-pulse = { + # "context.properties" = { + # "log.level" = 2; + # }; + # "context.modules" = [ + # { + # name = "libpipewire-module-rtkit"; + # args = { + # "nice.level" = -15; + # "rt.prio" = 88; + # "rt.time.soft" = 200000; + # "rt.time.hard" = 200000; + # }; + # flags = [ "ifexists" "nofail" ]; + # } + # { name = "libpipewire-module-protocol-native"; } + # { name = "libpipewire-module-client-node"; } + # { name = "libpipewire-module-adapter"; } + # { name = "libpipewire-module-metadata"; } + # { + # name = "libpipewire-module-protocol-pulse"; + # args = { + # "pulse.min.req" = "32/48000"; + # "pulse.default.req" = "32/48000"; + # "pulse.max.req" = "32/48000"; + # "pulse.min.quantum" = "32/48000"; + # "pulse.max.quantum" = "32/48000"; + # "server.address" = [ "unix:native" ]; + # }; + # } + # ]; + # "stream.properties" = { + # "node.latency" = "32/48000"; + # "resample.quality" = 1; + # }; + # }; + # }; +} diff --git a/nix/modules/steam.nix b/nix/modules/steam.nix new file mode 100644 index 0000000..3a96a3a --- /dev/null +++ b/nix/modules/steam.nix @@ -0,0 +1,9 @@ +{config, pkgs, ...}: +{ + nixpkgs.config.packageOverrides = pkgs: { + steam = pkgs.steam.override { + nativeOnly = true; + }; + }; + programs.steam.enable = true; +} diff --git a/nix/modules/syncthing.nix b/nix/modules/syncthing.nix new file mode 100644 index 0000000..9ff3a88 --- /dev/null +++ b/nix/modules/syncthing.nix @@ -0,0 +1,10 @@ +{config, pkgs, ...}: +{ + services.syncthing = { + enable = true; + user = "horhik"; + dataDir = "/home/horhik/Notes"; + configDir = "/home/horhik/.config/syncthing"; + }; + +} diff --git a/nix/modules/wm.nix b/nix/modules/wm.nix new file mode 100644 index 0000000..d0758d3 --- /dev/null +++ b/nix/modules/wm.nix @@ -0,0 +1,26 @@ +{config, pkgs, ...}: +{ + services.dbus.packages = with pkgs; [ gnome2.GConf ]; + programs.dconf.enable = true; + services.xserver = { + enable = true; + layout = "us"; + xkbOptions = "eurosign:e"; + windowManager.i3.enable = true; + displayManager.gdm.enable = true; + displayManager.setupCommands = "xrandr --output HDMI-A-0 --left-of eDP"; + desktopManager.gnome.enable = true; + windowManager.xmonad = { + enable = true; + enableContribAndExtras = true; + extraPackages = haskellPackages: [ + haskellPackages.xmonad-contrib + haskellPackages.xmonad-extras + haskellPackages.xmonad-utils + haskellPackages.xmonad + haskellPackages.xmobar + ]; + }; + displayManager.defaultSession = "none+xmonad"; + }; +} diff --git a/nix/modules/zsh.nix b/nix/modules/zsh.nix new file mode 100644 index 0000000..161f06f --- /dev/null +++ b/nix/modules/zsh.nix @@ -0,0 +1,20 @@ +{config, pkgs, ...}: +{ + programs.zsh.promptInit = ""; + programs.zsh = { + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + enable = true; + # ohMyZsh = { + # enable = true; + # plugins = ["git" "colorize" "colored-man-pages" "emoji" "rustup" "sudo" "zsh-syntax-highlighting" "zsh-autosuggestions" "zsh-completions"]; + # theme = "cloud"; + # customPkgs = [ + # pkgs.zsh-syntax-highlighting + # pkgs.zsh-autosuggestions + # pkgs.zsh-completions + # ]; + # }; + }; + +}