Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { config, pkgs, ... }:
- let
- lowBatteryNotifier = pkgs.writeScript "lowBatteryNotifier"
- ''
- DISPLAY=:0.0
- BAT=`${pkgs.acpi}/bin/acpi -b | ${pkgs.gnugrep}/bin/grep -P -o '[0-9]+(?=%)'`
- STAT=`${pkgs.acpi}/bin/acpi -b | ${pkgs.gnugrep}/bin/grep -P -o '\S+(harging)'`
- test $STAT = "Discharging" -a $BAT -le 15 -a $BAT -gt 7 && DISPLAY=:0.0 ${pkgs.libnotify}/bin/notify-send 'Low Battery'
- test $STAT = "Discharging" -a $BAT -le 7 && DISPLAY=:0.0 ${pkgs.libnotify}/bin/notify-send 'OMG I am dying'
- '';
- in
- {
- imports =
- [
- ./hardware-configuration.nix # Include the results of the hardware scan.
- ./packages.nix # more environment.systemPackages
- ];
- boot.loader.systemd-boot.enable = true;
- boot.loader.efi.canTouchEfiVariables = true;
- networking.hostName = "ckopo-nix";
- networking.wireless = {
- enable = true;
- userControlled.enable = true;
- userControlled.group = "wheel";
- networks = {
- # not important and sensitive
- };
- };
- networking.extraHosts = ''
- 127.0.0.1 localhost
- '';
- networking.firewall = {
- enable = true;
- allowedTCPPorts = [ 22 80 8055 8082 8080 24000 26000 ];
- allowedUDPPorts = [ 26000 ];
- };
- i18n = {
- consoleFont = "ruscii-8x16";
- # consoleKeyMap = "us";
- defaultLocale = "ru_RU.UTF-8";
- };
- time.timeZone = "Asia/Irkutsk";
- powerManagement.enable = true;
- # hardware.pulseaudio.enable = true;
- # hardware.pulseaudio.support32Bit = true;
- # hardware.bluetooth = {
- # enable = true;
- # powerOnBoot = false;
- # };
- hardware.opengl = {
- driSupport = true;
- driSupport32Bit = true;
- };
- # VirtualBox with Extension Pack
- virtualisation.virtualbox.host.enable = true;
- nixpkgs.config.virtualbox.enableExtensionPack = true;
- # Moar packages!
- nixpkgs.config.allowUnfree = true;
- # List packages installed in system profile. To search by name, run:
- # $ nix-env -qaP | grep wget
- environment = {
- systemPackages = with pkgs; [
- nox
- # wicd
- # networkmanager
- # networkmanagerapplet
- # acpi pciutils
- acpi gnugrep
- zip unzip
- wget mc
- w3m tmux byobu
- git gnumake
- # emacs # let's leave them both for this moment
- mdp
- vim xkb_switch vimPlugins.vim-xkbswitch
- gcc binutils
- zlib zlibStatic cmark # temp slibs
- python36Full
- jetbrains.pycharm-professional
- jetbrains.idea-ultimate
- aalib
- # android-studio
- acpi
- atom love
- bind
- blender
- cabal-install cabal2nix
- cmatrix
- codeblocks
- ctodo
- desmume
- dropbox
- # elm #
- # emem # Markdown to HTML
- file # file types
- freeglut
- freetype
- mesa_glu
- gnome3.gnome_terminal
- # gnum4 # m4 macro processor
- # guitarix
- gutenprint # ?
- gxmessage
- gzdoom
- # <> haxe
- # hedgewars
- # ies2-bus-arbiter
- imv
- # inotify-tools
- # ioquake3
- libcdio
- libnotify
- xorg.libSM
- lm_sensors
- mtools
- # mesa_noglu
- # mysql-workbench
- # netbeans
- netbeans
- # <> nexuiz
- # nix-repl
- nmap
- nodejs
- p7zip
- patchelf
- pciutils
- # pidgin
- psmisc
- pv
- # pypi2nix
- # python2nix
- python36Packages.tkinter
- python36Packages.numpy # matplotlib Pillow pip
- python36Packages.pyqt5 # requests setuptools sympy
- qtcreator
- # steam
- # screen
- sqlite
- sshpass
- sysstat
- system-config-printer
- tcpdump
- traceroute
- translate-shell
- unar
- usbutils
- xfce.xfce4notifyd
- # xfontsel
- xlsfonts
- xsel
- zlib
- ghc stack
- mesa_drivers mesa_glu
- xorg_sys_opengl glmark2
- # love # is user-space installed by now
- # busybox
- gksu
- scrot
- # moc
- # xdotool xlaunch
- # stalonetray xclip volumeicon
- libreoffice # do not ask
- vlc firefox gimp
- # haskellPackages.hmenu
- # haskellPackages.yeganesh
- # haskellPackages.xmobar
- # i3status
- python36Packages.i3-py
- # python35Packages.i3ipc
- # gnome2.zenity
- xorg.xmessage
- xorg.xbacklight
- # mpc_cli mpd ncmpcpp
- bar-xft conky
- dmenu
- # xfce
- # gtk # To get GTK+'s themes
- # gnome.gnomeicontheme # more icons
- hicolor_icon_theme # icons for thunar
- shared_mime_info
- xorg.xsetroot nitrogen # wallpapers
- # lxappearance gtk-engine-murrine
- # gtk_engines
- gnome2.gnome_icon_theme
- desktop_file_utils
- xfce.garcon
- xfce.thunar_volman
- xfce.gvfs
- xfce.xfce4_appfinder
- xfce.exo
- xfce.gtk_xfce_engine
- xfce.gvfs # auto mounting
- xfce.libxfce4ui
- xfce.libxfcegui4
- # xfce.thunar # file manager
- # xfce.thunar_volman # auto mounting
- # xfce.xfceutils # this should be deleted
- xfce.xfce4icontheme # for thunar
- xfce.xfce4settings
- xfce.xfconf
- xfce.mousepad
- xfce.terminal
- # zathura # pdf viewer
- ];
- shellAliases = {
- # g = "git";
- # gl = "git log --pretty=format:\"%an, %ar, %h: %s\"";
- # gs = "git status";
- # gf = "git fetch";
- # ga = "git add";
- # gcl = "git clone";
- # gc = "git commit -m";
- # gca = "git commit -a -m";
- # gm = "git merge";
- # gb = "git branch";
- # gco = "git checkout";
- # gd = "git diff";
- gp = "git pull --rebase && git push";
- gull = "git pull --rebase";
- gpp = "git pull --rebase git push";
- gush = "git push";
- gu = "git ls-files --other --exclude-standard";
- gt = "git log --graph --oneline --decorate --all";
- nixos-fix = "nix-store --verify --check-contents --repair";
- nixos-repkg = "nix-build --check -A";
- nixos-clean = "nix-collect-garbage -d";
- nixos-search = "nix-env -qaP --description \\* | sed -re \"s/^nixos\\.//g\" | fgrep -i";
- nixos-update = "nixos-rebuild switch";
- nixos-upgrade = "nixos-rebuild switch --upgrade";
- nxf = "nixos-fix";
- nxr = "nixos-repkg";
- nxc = "nixos-clean";
- nxs = "nixos-search";
- nxu = "nixos-update";
- nxg = "nixos-upgrade"; # TODO: sync git in /etc/nixos/* from imports
- nxedit = "vim -p /etc/nixos/packages.nix /etc/nixos/configuration.nix";
- # nxedit = "vim /etc/nixos/configuration.nix";
- pff = "poweroff";
- stb = "stack --nix build";
- stg = "stack --nix ghci";
- ".." = "cd ..";
- e = "$=EDITOR";
- d = "$=TILE_CMD";
- st = "$=TERM_CMD";
- cg = "grep --color=always";
- cgr = "cg -r";
- less = "less -R";
- timestamp = "date +%s -d";
- wtf-size = "du -ha -d1 | sort -h";
- my-ip = "curl ipecho.net/plain";
- shakal-1 = "nix-store --optimize";
- shakal-2 = "nix-env --delete-generations 2d";
- shakal-3 = "nix-collect-garbage --delete-older-than 2d";
- ies2-1 = "curl http://game.ies2/api/stage/prepare";
- ies2-2 = "curl http://game.ies2/api/stage/scripting";
- ies2-3 = "curl http://game.ies2/api/stage/start";
- ies2-s = "ssh game.ies2 -p 24000";
- };
- };
- # Some programs need SUID wrappers, can be configured further or are
- # started in user sessions.
- # programs.bash.enableCompletion = true;
- # programs.mtr.enable = true;
- # programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
- # Cron.
- services.cron = {
- enable = true;
- mailto = "user";
- systemCronJobs = [
- # "30 23 * * * user DISPLAY=:0.0 ${pkgs.libnotify}/bin/notify-send 'Time to go to bed'"
- "* * * * * user ${lowBatteryNotifier}"
- # "@weekly root nix-collect-garbage"
- ];
- };
- services.openssh = {
- enable = true;
- extraConfig = ''
- ClientAliveInterval 15
- X11Forwarding yes
- X11UseLocalHost no
- '';
- permitRootLogin = "no";
- ports = [ 22 ];
- passwordAuthentication = true;
- };
- # Enable CUPS to print documents.
- # services.printing.enable = true;
- # ANDROID DEBUG
- # Huawei
- # services.udev.extraRules = ''
- # SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0660", GROUP="plugdev"
- # '';
- # Acer Aspire sound device fix
- boot.extraModprobeConfig = ''
- options snd_hda_intel id=PCH,HDMI index=1,0
- '';
- # Less sudden poweroffs
- services.logind.extraConfig = ''
- HandleLidSwitch=suspend
- HandlePowerKey=ignore
- '';
- services.xserver = {
- enable = true;
- defaultDepth = 24;
- videoDriver = "intel";
- layout = "us, ru";
- xkbOptions = "compose:ralt, grp:ctrl_shift_toggle, grp_led:caps";
- # grp:caps_toggle, grp_led:caps
- # libinput.enable = true;
- # libinput.disableWhileTyping = true;
- synaptics = { # yes, I would need that
- enable = true;
- twoFingerScroll = true;
- additionalOptions = ''
- MatchProduct "ETPS/2 Elantech Touchpad"
- '';
- };
- windowManager.i3.enable = true;
- # windowManager.xmonad = {
- # enable = true;
- # enableContribAndExtras = true;
- # };
- windowManager.default = "i3";
- # displayManager.lightdm.enable = true;
- displayManager = {
- slim = {
- enable = true;
- defaultUser = "user";
- theme = pkgs.fetchurl {
- url = "https://github.com/edwtjo/nixos-black-theme/archive/v1.0.tar.gz";
- sha256 = "13bm7k3p6k7yq47nba08bn48cfv536k4ipnwwp1q1l2ydlp85r9d";
- };
- # theme = pkgs.slimThemes.subway;
- # TODO: download, hack and upload to db.tt
- # theme = pkgs.fetchurl {
- # url = "https://github.com/Hinidu/nixos-solarized-slim-theme/archive/master.zip";
- # sha256 = "f0ef5ed9518f05b9c540a5dd7e21111a26e91d405f1292ad86b1fc8704733ca8";
- # };
- };
- };
- desktopManager.xterm.enable = false;
- # displayManager.kdm.enable = true;
- # desktopManager.kde4.enable = true;
- };
- fonts = {
- enableFontDir = true;
- enableGhostscriptFonts = true;
- fonts = with pkgs; [
- font-awesome-ttf
- fira
- fira-mono
- # nerdfonts
- # input-fonts
- terminus_font
- powerline-fonts
- (let input-fonts = let version = "2017-01-23";
- in with pkgs; stdenv.mkDerivation rec {
- name = "input-fonts-${version}";
- src = pkgs.fetchurl {
- name = "Input-Font.zip";
- url = "http://input.fontbureau.com/build/?fontSelection=whole&a=0&g=ss&i=serif&l=serifs_round&zero=0&asterisk=0&braces=straight&preset=dejavu&line-height=1.2&accept=I+do&email=";
- sha256 = "15b1mw4pzck91k5msqfsc20syv5rl84di1ylbjdilnpxhq9ggz29";
- };
- nativeBuildInputs = [ unzip ];
- phases = [ "unpackPhase" "installPhase" ];
- sourceRoot = ".";
- installPhase = ''
- mkdir -p $out/share/fonts/truetype
- find Input_Fonts -name "*.ttf" -exec cp -a {} "$out"/share/fonts/truetype/ \;
- mkdir -p "$out"/share/doc
- cp -a *.txt "$out"/share/doc/
- '';
- meta = with stdenv.lib; {
- description = "Fonts for Code, from Font Bureau";
- homepage = http://input.fontbureau.com;
- license = licenses.unfree;
- maintainers = with maintainers; [ romildo ];
- platforms = platforms.all;
- };
- }; in input-fonts)
- ];
- };
- users.groups = {
- dialout = {
- members = [ "user" ];
- };
- vboxusers = {
- members = [ "user" ];
- };
- };
- users.users.user = {
- isNormalUser = true;
- uid = 1000;
- extraGroups = [ "wheel" "network" "dialout" "audio" "cdrom" ];
- shell = pkgs.bashInteractive; # Hey?
- # set password by passwd!
- };
- # Nixos Manual on tty8
- services.nixosManual.showManual = true;
- # 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 = "17.09"; # Did you read the comment?
- system.stateVersion = "18.03"; # Did you read the comment?
- # a little workaround, which didn't work with chmod issue
- nix.readOnlyStore = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement