From a79752801a94c774a0cb2a8660b6dc615419110e Mon Sep 17 00:00:00 2001 From: Sijmen Date: Mon, 25 Jul 2022 16:59:32 +0200 Subject: [PATCH] initial commit --- configuration.nix | 157 +++++++++++++++++++++++++++++++++++++ dconf.nix | 69 ++++++++++++++++ hardware-configuration.nix | 40 ++++++++++ home-manager.nix | 105 +++++++++++++++++++++++++ nvim.lua | 48 ++++++++++++ 5 files changed, 419 insertions(+) create mode 100644 configuration.nix create mode 100644 dconf.nix create mode 100644 hardware-configuration.nix create mode 100644 home-manager.nix create mode 100644 nvim.lua diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..980879e --- /dev/null +++ b/configuration.nix @@ -0,0 +1,157 @@ +{ config, pkgs, ... }: + +{ + nixpkgs.config.allowUnfree = true; + + imports = [ + ./hardware-configuration.nix + + + ./home-manager.nix + ]; + + boot = { + loader = { + timeout = 0; + efi.canTouchEfiVariables = true; + + systemd-boot = { + enable = true; + consoleMode = "auto"; + }; + }; + + kernelPackages = pkgs.linuxPackages_latest; + kernelParams = [ + "quiet" + "splash" + "vga=current" + "mitigations=off" + "udev.log_level=3" + ]; + + initrd = { + verbose = false; + kernelModules = [ "i915" ]; + }; + + consoleLogLevel = 0; + + plymouth.enable = true; + }; + + console = { + earlySetup = true; + font = "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz"; + packages = with pkgs; [ terminus_font ]; + keyMap = "us"; + }; + + networking = { + hostName = "sijmen-laptop"; + networkmanager.enable = true; + }; + + hardware.pulseaudio.enable = true; + hardware.bluetooth.enable = true; + sound.enable = true; + + time.timeZone = "Europe/Amsterdam"; + + # Select internationalisation properties. + i18n = { + defaultLocale = "en_US.UTF-8"; + supportedLocales = [ + "en_US.UTF-8/UTF-8" + "nl_NL.UTF-8/UTF-8" + ]; + }; + + environment.gnome.excludePackages = (with pkgs; [ + gnome-photos + gnome-tour + ]) ++ (with pkgs.gnome; [ + gnome-calendar + gnome-music + epiphany # web browser + geary # email reader + totem # video player + tali # poker game + iagno # go game + hitori # sudoku game + atomix # puzzle game + ]); + + users.users.sijmen = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + }; + + environment.systemPackages = with pkgs; [ + gnome.adwaita-icon-theme + ]; + + services.pipewire.enable = true; + services.printing.enable = true; + + services.xserver = { + enable = true; + displayManager.gdm.enable = true; + desktopManager.gnome.enable = true; + }; + + services.openssh = { + enable = true; + passwordAuthentication = false; + }; + + services.throttled.enable = true; + + services.syncthing = { + enable = true; + user = "sijmen"; + dataDir = config.users.users.sijmen.home; + overrideDevices = true; + overrideFolders = true; + + devices = { + "nas".id = "5XADATO-6ZKNZFK-YIX2TU3-RTUOAXR-OMWOAH6-OIUB7LE-TWM5B3C-W2I2FQU"; + }; + + folders = { + "vhuse-qjbcl" = { + path = "${config.users.users.sijmen.home}/Sync"; + devices = [ "nas" ]; + }; + }; + }; + + networking.firewall = { + allowedTCPPorts = [ + 22 # ssh + 22000 # syncthing sync + 51414 # transmission + 57621 # spotify connect + ]; + + allowedUDPPorts = [ + 21027 # syncthing discovery + 22000 # syncthing sync + ]; + }; + + fonts.fonts = with pkgs; [ + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + nerdfonts + ]; + + # 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 = "22.05"; # Did you read the comment? +} diff --git a/dconf.nix b/dconf.nix new file mode 100644 index 0000000..f7a208e --- /dev/null +++ b/dconf.nix @@ -0,0 +1,69 @@ +{ lib, ... }: + with lib.hm.gvariant; +{ + dconf.settings = { + "system/locale" = { region = "nl_NL.UTF-8"; }; + + "org/gnome/desktop/peripherals/mouse" = { accel-profile = "flat"; }; + "org/gnome/desktop/peripherals/touchpad" = { disable-while-typing = false; }; + "org/gnome/desktop/sound" = { allow-volume-above-100-percent = true; }; + "org/gnome/tweaks" = { show-extensions-notice = false; }; + + "org/gnome/desktop/wm/preferences" = { + button-layout = "appmenu:minimize,close"; + resize-with-right-button = true; + }; + + "org/gnome/desktop/session" = { + idle-delay = mkUint32 600; + sleep-inactive-ac-type = "nothing"; + }; + + "org/gnome/mutter" = { + experimental-features = [ "scale-monitor-framebuffer" ]; + attach-modal-dialogs = false; + }; + + "org/gnome/desktop/interface" = { + clock-show-seconds = true; + clock-show-weekday = true; + show-battery-percentage = true; + }; + + "org/gnome/desktop/notifications/application/telegramdesktop" = { + application-id = "telegramdesktop.desktop"; + enable = true; + enable-sound-alerts = false; + force-expanded = true; + }; + + "org/gnome/gnome-system-monitor" = { + cpu-stacked-area-chart = true; + show-dependencies = true; + show-whose-processes = "all"; + }; + + "org/gnome/settings-daemon/plugins/color" = { + night-light-enabled = true; + night-light-temperature = mkUint32 3330; + }; + + "org/gnome/shell" = { + favorite-apps = [ + "org.gnome.Nautilus.desktop" + "firefox.desktop" + "telegramdesktop.desktop" + "org.gnome.Console.desktop" + "org.gnome.Settings.desktop" + ]; + + disable-user-extensions = false; + enabled-extensions = [ "openweather-extension@jenslody.de" ]; + }; + + "org/gnome/nautilus/preferences" = { + default-folder-viewer = "list-view"; + search-view = "list-view"; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..8998e27 --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,40 @@ +# 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 = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/551542c4-8817-496d-8a7d-654f6acafd51"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/D414-7DBB"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; + + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + # high-resolution display + hardware.video.hidpi.enable = lib.mkDefault true; +} diff --git a/home-manager.nix b/home-manager.nix new file mode 100644 index 0000000..030cc0b --- /dev/null +++ b/home-manager.nix @@ -0,0 +1,105 @@ +{ config, pkgs, ... }: + +{ + home-manager.users.sijmen = { + nixpkgs.config.allowUnfree = true; + + home = { + stateVersion = config.system.stateVersion; + + packages = with pkgs; [ + aerc + discord + mpv + pika-backup + python3 + spotify + sublime-merge + tdesktop + thunderbird + transmission-gtk + unzip + vscode-fhs + w3m + wget + wl-clipboard + tig + + gnome.gnome-tweaks + gnomeExtensions.openweather + ]; + + sessionVariables = { + MOZ_ENABLE_WAYLAND = 1; + NIXOS_OZONE_WL = 1; + QT_QPA_PLATFORM = "wayland"; + SDL_VIDEODRIVER = "wayland"; + EDITOR = "nvim"; + }; + + shellAliases = { + ".." = "cd .."; + "..." = "cd ../.."; + config = "vim /etc/nixos/configuration.nix"; + switch = "sudo nixos-rebuild switch"; + }; + }; + + programs.git = { + enable = true; + lfs.enable = true; + + userName = "Sijmen"; + userEmail = "me@sijman.nl"; + + extraConfig = { + fetch.prune = true; + init.defaultBranch = "main"; + push.autoSetupRemote = true; + safe.directory = [ "/etc/nixos" ]; + }; + }; + + programs.firefox = { + enable = true; + package = pkgs.wrapFirefox pkgs.firefox-unwrapped { + forceWayland = true; + }; + }; + + programs.neovim = { + enable = true; + vimAlias = true; + + extraConfig = '' + luafile /etc/nixos/nvim.lua + ''; + + extraPackages = with pkgs; [ + gcc + rnix-lsp + nodePackages.pyright + ]; + + plugins = with pkgs.vimPlugins; [ + bufferline-nvim + galaxyline-nvim + indentLine + neorg + nvim-colorizer-lua + nvim-compe + nvim-lspconfig + nvim-tree-lua + nvim-treesitter + nvim-web-devicons + pears-nvim + plenary-nvim + Spacegray-vim + vim-closetag + vim-nix + ]; + }; + + imports = [ ./dconf.nix ]; + }; +} diff --git a/nvim.lua b/nvim.lua new file mode 100644 index 0000000..7b37484 --- /dev/null +++ b/nvim.lua @@ -0,0 +1,48 @@ +local opt = vim.opt +local g = vim.g + +vim.cmd [[ + colorscheme spacegray +]] + +g.mapleader = ' ' + +opt.undofile = true +opt.undodir = "/home/sijmen/.cache/nvim/undo" +opt.backupdir = "/home/sijmen/.cache/nvim/backup" + +opt.smartindent = true +opt.autoindent = true +opt.tabstop = 2 +opt.shiftwidth = 2 +opt.expandtab = true + +opt.mouse = "a" + +opt.termguicolors = true +opt.cursorline = true +opt.relativenumber = true + +opt.viminfo = "" +opt.viminfofile = "NONE" + +opt.smartcase = true +opt.ttimeoutlen = 5 +opt.compatible = false +opt.autoread = true +opt.incsearch = true +opt.hidden = true +opt.shortmess = "atI" + +require("nvim-tree").setup() + +require("nvim-treesitter.configs").setup { + auto_install = true, + highlight = { + enable = true, + }, +} + +local lspconfig = require("lspconfig") +lspconfig.rnix.setup{} +lspconfig.pyright.setup{}