Log in New API Help About

6.3 KB of JSON
Created 2 months ago — expires in 305 days
https://dpaste.com/F8MHEKK4B
SOFT WRAP RAW TEXT DUPLICATE DIFF
{ config, pkgs, lib, ... }:

let
  ## Stable channel
  stable = import
  (builtins.fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-20.09.tar.gz)
  { config = config.nixpkgs.config; };
  ## FontConfig
  fontconf = pkgs.fetchurl {
    url = "https://git.sr.ht/~dan4ik605743/dotfiles/blob/master/home/dan4ik/.config/fontconfig/fonts.conf";
    sha256 = "0aqzf5hkffywfqb40lrvjjxxlgja349b1kldagc0r65m95nhwij4";
  };
  ## Neovim
  myneovim = pkgs.neovim.override {
    withNodeJs = true;
    withRuby = false;
    vimAlias = false;
    viAlias = false;
    configure = {
      customRC = ''
        let g:NERDTreeDirArrowExpandable = '▸'
        let g:NERDTreeDirArrowCollapsible = '▾'
        let g:lightline = {
        \ 'colorscheme': 'wombat',
        \ }
        syntax on
        set number
        set mouse=a
        nnoremap <C-n> :NERDTree<CR>
        autocmd BufReadPost *
        \ if line("'\"") > 0 && line("'\"") <= line("$") |
        \ exe "normal! g`\"" |
        \ endif
        '';
      plug.plugins = with pkgs.vimPlugins; [
        vim-nix
        vim-closetag
        lightline-vim
        coc-nvim
        nerdtree
      ];
    };
  };
in
  {
    imports = [
      ./kernel.nix
      ./hardware-configuration.nix
      (import "${pkgs.callPackage ./packages/home-manager.nix {}}/nixos")
      #(import "${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos")
    ];
    
    nixpkgs.config = {
      allowUnfree = true;
      allowBroken = true;
    };

    nix = {
      package = pkgs.nixStable;
    };

    qt5 = {
      enable = true;
      platformTheme = "gnome";
      style = "adwaita-dark";
    };

    zramSwap = {
      enable = true;
      memoryPercent = 40;
      priority = 10;
      swapDevices = 1;
    };

    home-manager = { users.dan4ik = (import ./home.nix {inherit config pkgs lib stable;}); };
    programs.dconf.enable = true;
    security.sudo.wheelNeedsPassword = false;
    time.timeZone = "Asia/Krasnoyarsk";
    sound.enable = true;
    system.stateVersion = "20.03";

    networking = {
      hostName = "nixos";
      firewall.enable = false;
      dhcpcd.wait = "background";
      wireless = {
        enable = false;
        interfaces = [ "wlp3s0" ];
        networks.TP-Link_D482.psk = "Qq135790-";
      };
    };

    hardware = {
      bluetooth.enable = false;
      pulseaudio = {
        enable = true;
        support32Bit = true;
      };
      opengl = {
        enable = true;
        driSupport32Bit = true;
        extraPackages = with pkgs; [
          intel-media-driver
          vaapiVdpau
          libvdpau-va-gl
        ];
      };
      nvidia.prime = {
        offload.enable = true;
        intelBusId = "PCI:0:2:0";
        nvidiaBusId = "PCI:4:0:0";
      };
    };

    i18n.defaultLocale = "en_US.UTF-8";
    console = {
      font = "Lat2-Terminus16";
      keyMap = "us";
    };

    boot = {
      kernelParams = [ "intel_idle.max_cstate=1" "mitigations=off" ];
      supportedFilesystems = [ "xfs" "ntfs" ];
      loader = {
        efi.canTouchEfiVariables = true;
        systemd-boot = {
          enable = true;
          consoleMode = "2";
        };
      };
    };

    environment = {
      systemPackages = with pkgs; [
      # system
      wget 
      feh
      jmtpfs  
      bpytop
      killall 
      brightnessctl 
      pciutils usbutils 
      wpa_supplicant
      p7zip
      xorg.xev 
      maim xclip
      libva-utils mesa-demos 
      pavucontrol playerctl
      nix-prefetch-scripts
      gparted 
      pywal
      lm_sensors
      lxappearance
      neofetch

      # apps
      pinta vlc wpsoffice google-chrome qbittorrent

      # mypkgs
      (callPackage ./packages/lyra-cursors.nix {})
      (callPackage ./packages/vk-cli.nix {})
      myneovim

      # scripts
      (pkgs.writeShellScriptBin "prime-run" '' __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia "$@" '')
      (pkgs.writeShellScriptBin "dotup" '' sudo cp -r /etc/nixos/* ~/dotfiles/etc/nixos-unstable/nixos/ && sudo cp -r ~/packages/* ~/dotfiles/home/dan4ik/packages/ && echo Finish! '')
    ];
  };

    services = {
      blueman.enable = true;
      udisks2.enable = false;
      teamviewer.enable = false;
      udev.packages = [ pkgs.android-udev-rules ];

      openvpn = {
        #servers = {
        #  freeVPN = { config = ''config /home/dan4ik/Documents/freevpn/Server1-UDP53.ovpn''; };
        #};
      };
      
      xserver = {
        enable = true;
        videoDrivers = [ "nvidia" ];
        synaptics = {
          enable = true;
          twoFingerScroll = true;
          tapButtons = false;
          additionalOptions = ''
            Option "TapButton1" "1"
            Option "TapButton2" "0"
            Option "TapButton3" "3"
            '';
          };
        desktopManager = {
          xterm.enable = true;
        };
        displayManager = {
          defaultSession = "xterm";
          lightdm = {
            enable = true;
            greeters.mini = {
              enable = true;
              user = "dan4ik";
              extraConfig = ''
                [greeter]
                show-password-label = false
                [greeter-theme]
                background-image = ""
                '';
              };
            };
          };
        };
      logind = {
        extraConfig = "HandlePowerKey=suspend";
        lidSwitch = "ignore";
        lidSwitchDocked = "ignore";
        lidSwitchExternalPower = "ignore";
      };
    };

    users = {
      mutableUsers = false;
      users.dan4ik = {
        isNormalUser = true;
        shell = pkgs.zsh;
        hashedPassword = "$6$JXAfjAuNeCsxAF5e$pUbTjZ9mVOw8rdk/61ZvzT1RaRLrY2qamAiopPneYvrJa6SnAIHHNM3UJ6Ie1mU6v/a8t6z2CBjyVS4F1yqlh.";
        extraGroups = [ "wheel" "audio" "video" ];    
      };
    };

    fonts = {
      fonts = with pkgs; [
        (nerdfonts.override{fonts = ["JetBrainsMono" "Iosevka"];})
        (callPackage ./packages/waffle-font.nix {})
        font-awesome
        font-awesome-ttf
        noto-fonts-emoji
        unifont
        roboto
        siji
      ];
      fontconfig.localConf = builtins.readFile "${fontconf}";
    };
}