From 7612127bae7484f47aff7b6fff73174d035ae59b Mon Sep 17 00:00:00 2001 From: eeva Date: Tue, 28 Feb 2017 22:09:06 +0100 Subject: [PATCH] Initial commit --- configuration.nix | 259 +++++++++++++++++++++++++++++++++++++ hardware-configuration.nix | 44 +++++++ vim.nix | 110 ++++++++++++++++ 3 files changed, 413 insertions(+) create mode 100644 configuration.nix create mode 100644 hardware-configuration.nix create mode 100644 vim.nix diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..49dd323 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,259 @@ +{ config, pkgs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + ]; + + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + cleanTmpDir = true; + initrd.supportedFilesystems = [ "btrfs" ]; + supportedFilesystems = [ "btrfs" ]; + tmpOnTmpfs = true; + }; + + environment = { + shells = [ pkgs.zsh ]; + systemPackages = with pkgs; [ + wget emacs + zathura qutebrowser + chromium optipng + oh-my-zsh stow + bar git st + msmtp neomutt mu ripmime + nethogs + (import ./vim.nix) + (texlive.combine { inherit (texlive) scheme-small latexmk bibtex; }) #for vimtex + ghostscript + ]; + }; + + hardware = { + bluetooth.enable = false; + cpu.intel.updateMicrocode = true; + pulseaudio = { + enable = true; + package = pkgs.pulseaudioLight; + }; + trackpoint.enable = true; + }; + + i18n = { + consoleFont = "Lat2-Terminus16"; + consoleKeyMap = "fr-bepo"; + defaultLocale = "en_US.UTF-8"; + supportedLocales = [ + "de_DE.UTF-8/UTF-8" + "en_US.UTF-8/UTF-8" + "fr_FR.UTF-8/UTF-8" + "fi_FI.UTF-8/UTF-8" ]; + }; + + networking = { + hostName = "era"; + extraHosts = '' + 192.168.1.1 router + 163.172.81.107 sahkopoika + 163.172.25.159 protonpack + 195.154.102.65 kromuniste + ''; + networkmanager.enable = false; + }; + + nix.useSandbox = true; + + programs = { + bash.enableCompletion = true; + zsh.enable = true; + zsh.enableCompletion = true; + adb.enable = true; + mosh.enable = true; + tmux.enable = true; + }; + + security = { + sudo.wheelNeedsPassword = false; + pki.certificates = [ + #(builtins.readFile ./MarvidCA.crt) + '' + -----BEGIN CERTIFICATE----- + MIIDPTCCAiWgAwIBAgIJAMbx5WIu+oU+MA0GCSqGSIb3DQEBBQUAMDUxCzAJBgNV + BAYTAkZSMRUwEwYDVQQKDAxVbml0ZWQgUm9vdHMxDzANBgNVBAMMBk1hcnZpZDAe + Fw0xNDExMDMwMDI1NTNaFw0xOTExMDIwMDI1NTNaMDUxCzAJBgNVBAYTAkZSMRUw + EwYDVQQKDAxVbml0ZWQgUm9vdHMxDzANBgNVBAMMBk1hcnZpZDCCASIwDQYJKoZI + hvcNAQEBBQADggEPADCCAQoCggEBANl+Yqu63ivUX3ihurub0sreLmCKMPQg5Huh + F0kB9qJBiZZcRF92Fa12w9619AEVofRstlxB/Zj2H1HxfE1hVrHFq/5qUg9sBsYd + uXKLgjhXlUSjXDBy8qajOyoag7stQFFciglCwdMv26eEzLt0bpfNj6RjOn3MWeMj + BsYnY/U4VP1KcrlQnxHFjJtzL6uMHSvLGckUE29AvpB8B0ZADkxmQAy5HuCnPweQ + X3gNffR/niRnaIyatihI8yL5of01PJ/TiF+KAv99noaFEa3YgBIjtlego5S1lhUx + cDL4vsQ5aYvuyxmYQ/KYuNotGiSBeDNJSDV43cHujZnwqPWuUbMCAwEAAaNQME4w + HQYDVR0OBBYEFJopvu7AhwhzskjBKlrMe/NS/AqxMB8GA1UdIwQYMBaAFJopvu7A + hwhzskjBKlrMe/NS/AqxMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEB + AJdtOVybiIf7IXDHO68lOe2Ob14WnAadE/FyzmWAsUbR4cVzAu6ObhcwiWWX5Ij2 + aLx1hLWdIxyoxY76lCvvQ60rZ/9hbUR5n8rVNWPOqCBo7TCWpFT8KJFLpGKJkwKi + icC6dqBpjeX2hd2ahPyaaGdUnLYxY4znLz1/RgSrzzTGUmjIHN9Go4ACVimJB5IR + 3paGD4ntvfuwWZevF7SFdGJiMl+yECXVO3+3fWvEJXCwq5F9eE4f2HYljgdFE4GT + X8aV5rzT5g2j9piZWLoX3wh4XwhItFT7WFtEwuoVi0jWRKpU6DRTuqAqXSbuGboo + ozM+r1wQMF2wE4aNnT+g0EQ= + -----END CERTIFICATE----- + '' ]; + }; + + services = { + offlineimap = { + enable = true; + onCalendar = "*:0/5"; + }; + cron.enable = false; + nixosManual.enable = false; + printing = { + enable = true; + # drivers = [ pkgs.hplip ]; # Pas testé depuis un an :D + }; + + compton = { + enable = true; + fade = true; + }; + redshift = { + enable = true; + latitude = "48.8534100"; # La force de la main + longitude = "2.3488000"; + }; + + openssh = { + enable = true; + permitRootLogin = "no"; + passwordAuthentication = false; + startWhenNeeded = true; + }; + + #openvpn.servers.client = { + # autoStart = false; + # config = builtins.readFile ./era.ovpn; # Pas top ._. + #}; + + xserver = { + enable = true; + layout = "fr"; + xkbVariant = "bepo"; + autorun = true; + displayManager.sessionCommands = '' + xset r rate 200 75 + xrandr --output eDP1 --mode 1920x1080 + feh -s --bg-fill /home/eeva/.xmonad/artwork/nix-wallpaper-stripes-logo.png + ''; + + synaptics = { + enable = true; + palmDetect = true; + twoFingerScroll = true; + }; + + #videoDrivers = [ "intel" ]; + + windowManager.xmonad = { + enable = true; + enableContribAndExtras = true; + }; + desktopManager.xterm.enable = false; + }; + }; + + + #systemd.mounts = [ + # { what = "/dev/sdb1"; + # where = "/mnt/usb1"; + # mountConfig = { + # TimeoutSec = "1"; + # Options = "uid=1000"; + # }; + # } + #]; + #systemd.automounts = [ # Marche bueno, I recommend hotly + # { where = "/mnt/usb1"; + # automountConfig = { TimeoutIdleSec = "1"; }; + # wantedBy = [ "default.target" ]; + # } + #]; + + #systemd.user.services = { + #backup = { + # description = "backup: Backup the Candies."; + # path = [ pkgs.rsync pkgs.openssh ]; + # script = "rsync -az /home/eeva/Candies eeva@protonpack:"; + # startAt = "*:0/30"; + # wantedBy = [ "timers.target" ]; + #}; + #}; + + time.timeZone = "Europe/Paris"; + + users = { + extraGroups = { + eeva.gid = 1000; + vboxusers.members = [ "eeva" ]; + vboxsf.members = [ "eeva" ]; + }; + + extraUsers.eeva = { + isNormalUser = true; + home = "/home/eeva"; + extraGroups = [ "wheel" ]; + shell = pkgs.zsh; + uid = 1000; + }; + + mutableUsers = true; # Need this to change passwords. + motd = "Death to the DeathStar"; + }; + + networking.wireless = { + enable = true; + interfaces = [ "wlo1" ]; + userControlled.enable = true; + networks = { + ">o_/" = { + pskRaw = "9d38f38d5d49fae47605cfd6437bd00b136f6a266c04bc5b8f4cf05bf7907c0b"; + }; + "42" = { + pskRaw = "d4806ea095c4c2ef267307f75975031b6bc2d2c79861bf53c96c9a7ff70b068a"; + }; + "Wi-Fi_Info_Etudiant" = {}; + }; + }; + + # Extra fonts + fonts.fonts = with pkgs; [ + tewi-font + ]; + + # Rasvaton / Fet-fri + nix.gc.automatic = true; + nix.gc.dates = "02:22"; + + # Upgrade when possible + system.autoUpgrade.enable = true; + system.stateVersion = "17.03"; + + ## Special config + nixpkgs.overlays = [ (self: super: { + st = super.st.override { + patches = builtins.map super.fetchurl [ + { url = "http://st.suckless.org/patches/st-no_bold_colors-20160727-308bfbf.diff"; + sha256 = "2e8cdbeaaa79ed067ffcfdcf4c5f09fb5c8c984906cde97226d4dd219dda39dc"; + } + { url = "http://st.suckless.org/patches/st-solarized-both-20160727-308bfbf.diff"; + sha256 = "b7b25ba01b7ae87ec201ebbb1bf82742d5979788ecc6773a356eebe7d90a9703"; + } + ]; + }; + }) ]; + +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..8dd3b0d --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,44 @@ +# 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 = + [ + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/3ed3af55-46f5-4b81-9567-7d13af93ca9b"; + fsType = "btrfs"; + options = [ "subvol=@root" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/3ed3af55-46f5-4b81-9567-7d13af93ca9b"; + fsType = "btrfs"; + options = [ "subvol=@home" ]; + }; + + fileSystems."/var" = + { device = "/dev/disk/by-uuid/3ed3af55-46f5-4b81-9567-7d13af93ca9b"; + fsType = "btrfs"; + options = [ "subvol=@var" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/A916-64F5"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/b082c75e-214c-4e4a-8604-750659c4cb94"; } + ]; + + nix.maxJobs = lib.mkDefault 4; + powerManagement.cpuFreqGovernor = "powersave"; +} diff --git a/vim.nix b/vim.nix new file mode 100644 index 0000000..eeb6cff --- /dev/null +++ b/vim.nix @@ -0,0 +1,110 @@ +with import {}; + +vim_configurable.customize { + # Specifies the vim binary name. + # E.g. set this to "my-vim" and you need to type "my-vim" to open this vim + # This allows to have multiple vim packages installed (e.g. with a different set of plugins) + name = "vim"; + vimrcConfig.vam.knownPlugins = pkgs.vimPlugins; + vimrcConfig.vam.pluginDictionaries = [ + { names = [ + # Here you can place all your vim plugins + # They are installed managed by `vam` (a vim plugin manager) + "vim-nix" + "Solarized" + "fugitive" + "surround" + "elm-vim" + "vimtex" + #"vim/.vim/bundle/VOoM" is missing + #"vim/.vim/bundle/vim-better-whitespace is missing + #"vim/.vim/bundle/vim-systemd-syntax is missing + #"vim/.vim/bundle/vim-obsession is missing + #"vim/.vim/bundle/vim-opencl is missing + ]; } + ]; + vimrcConfig.customRC = '' + " Must have for vim + set nocompatible + + " Display nbsp + set listchars=tab:\|\ ,nbsp:· + set list + + " Remap ESC on ,, + map ,, + imap ,, + + scriptencoding utf-8 + + " Must be *after* pathogen + filetype plugin indent on + + " Leader + let mapleader="," + nnoremap a :echo("\ works! It is set to ") + " let maplocalleader = "-" + + " Highlighting + syntax enable + if has('gui_running') + " When gui is running, it pretty much sets its own colors + set background=light + set guifont=Inconsolata\ 16 + else + " If we're in a terminal, then we stay default, terminal will choose + " which colors it likes. + set background=dark + endif + + let g:solarized_termcolors=16 + colorscheme solarized + + " Set line numbering + set number + + " Don't wrap lines, it's ugly + set nowrap + + " Deal with tabs + set softtabstop=2 + set tabstop=2 " 1 tab = 2 spaces + set shiftwidth=2 " Indent with 2 spaces + set expandtab " Insert spaces instead of tabs + + " Set par as default wrapper + set formatprg=par\ -w80 + + " Set mouse on + set mouse=a + + " Don't set timeout - this breaks the leader use + set notimeout + set ttimeout + + let &colorcolumn=join(range(81,999),",") + + " vimtex options + let g:vimtex_fold_enabled=1 + let g:vimtex_fold_manual=1 + + " nice pluginless stuff + set path+=** + set wildmenu + + " Tag generation + command! MakeTags !ctags -R . + + " Less noise in netrw + let g:netrw_banner=0 + let g:netrw_browse_split=4 + let g:netrw_altv=1 + let g:netrw_liststyle=3 + let g:netrw_list_hide=netrw_gitignore#Hide() + let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+' + + " Normal backspace + set backspace=indent,eol,start + ''; + +}