From 4de5606de5df71369dac5a61ac8c3949115d2741 Mon Sep 17 00:00:00 2001 From: Sijmen Date: Mon, 1 Aug 2022 23:11:10 +0200 Subject: [PATCH] prepare for multiple hosts --- .gitignore | 2 + common/configuration.nix | 7 + dconf.nix => common/dconf.nix | 0 home-manager.nix => common/home-manager.nix | 15 +- nvim.lua => common/nvim.lua | 13 +- configuration.nix | 165 +------------------- thinkpad/configuration.nix | 164 +++++++++++++++++++ 7 files changed, 198 insertions(+), 168 deletions(-) create mode 100644 .gitignore create mode 100644 common/configuration.nix rename dconf.nix => common/dconf.nix (100%) rename home-manager.nix => common/home-manager.nix (93%) rename nvim.lua => common/nvim.lua (76%) mode change 100644 => 120000 configuration.nix create mode 100644 thinkpad/configuration.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4e644f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/configuration.nix +/hardware-configuration.nix diff --git a/common/configuration.nix b/common/configuration.nix new file mode 100644 index 0000000..1a1e1c6 --- /dev/null +++ b/common/configuration.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./home-manager.nix + ]; +} diff --git a/dconf.nix b/common/dconf.nix similarity index 100% rename from dconf.nix rename to common/dconf.nix diff --git a/home-manager.nix b/common/home-manager.nix similarity index 93% rename from home-manager.nix rename to common/home-manager.nix index 3dc966c..f71c5c7 100644 --- a/home-manager.nix +++ b/common/home-manager.nix @@ -1,6 +1,10 @@ { config, pkgs, ... }: { + imports = [ + + ]; + home-manager.users.sijmen = { nixpkgs.config.allowUnfree = true; @@ -9,20 +13,26 @@ packages = with pkgs; [ aerc + bacon discord + fd + gimp + inkscape mpv pika-backup python3 + silver-searcher spotify sublime-merge tdesktop + tig transmission-gtk unzip + virt-manager vscode-fhs w3m wget wl-clipboard - tig gnome.gnome-tweaks gnomeExtensions.openweather @@ -73,7 +83,7 @@ vimAlias = true; extraConfig = '' - luafile /etc/nixos/nvim.lua + luafile /etc/nixos/common/nvim.lua ''; extraPackages = with pkgs; [ @@ -95,6 +105,7 @@ nvim-web-devicons pears-nvim plenary-nvim + rust-tools-nvim Spacegray-vim vim-closetag vim-nix diff --git a/nvim.lua b/common/nvim.lua similarity index 76% rename from nvim.lua rename to common/nvim.lua index 7b37484..9636530 100644 --- a/nvim.lua +++ b/common/nvim.lua @@ -3,6 +3,10 @@ local g = vim.g vim.cmd [[ colorscheme spacegray + + if has("autocmd") + au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + endif ]] g.mapleader = ' ' @@ -11,6 +15,8 @@ opt.undofile = true opt.undodir = "/home/sijmen/.cache/nvim/undo" opt.backupdir = "/home/sijmen/.cache/nvim/backup" +opt.shada = "!,'100,<50,s10,h" + opt.smartindent = true opt.autoindent = true opt.tabstop = 2 @@ -34,6 +40,7 @@ opt.incsearch = true opt.hidden = true opt.shortmess = "atI" + require("nvim-tree").setup() require("nvim-treesitter.configs").setup { @@ -44,5 +51,7 @@ require("nvim-treesitter.configs").setup { } local lspconfig = require("lspconfig") -lspconfig.rnix.setup{} -lspconfig.pyright.setup{} +lspconfig.rnix.setup {} +lspconfig.pyright.setup {} + +require("rust-tools").setup {} diff --git a/configuration.nix b/configuration.nix deleted file mode 100644 index 0ef2e6d..0000000 --- a/configuration.nix +++ /dev/null @@ -1,164 +0,0 @@ -{ 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" - ]; - }; - - users.users.sijmen = { - isNormalUser = true; - extraGroups = [ "wheel" ]; - }; - - 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 - ]); - - 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"; - desktop-fedora.id = "RE3BCEP-2FVDNPA-C72KDCX-5NRTLD4-DEJZAIX-PJAMJAN-LJDFHOY-WOXNPQW"; - }; - - folders = { - "vhuse-qjbcl" = { - path = "${config.users.users.sijmen.home}/Sync"; - devices = [ "nas" "desktop-fedora" ]; - }; - }; - }; - - 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 - ]; - - programs.steam = { - enable = true; - remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play - dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server - }; - - # 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/configuration.nix b/configuration.nix new file mode 120000 index 0000000..f26b3fd --- /dev/null +++ b/configuration.nix @@ -0,0 +1 @@ +thinkpad/configuration.nix \ No newline at end of file diff --git a/thinkpad/configuration.nix b/thinkpad/configuration.nix new file mode 100644 index 0000000..c901a96 --- /dev/null +++ b/thinkpad/configuration.nix @@ -0,0 +1,164 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../hardware-configuration.nix + ../common/configuration.nix + ]; + + nixpkgs.config.allowUnfree = true; + + 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" + ]; + }; + + users.users.sijmen = { + isNormalUser = true; + extraGroups = [ "wheel" "libvirtd" ]; + }; + + 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 + ]); + + 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"; + desktop-fedora.id = "RE3BCEP-2FVDNPA-C72KDCX-5NRTLD4-DEJZAIX-PJAMJAN-LJDFHOY-WOXNPQW"; + }; + + folders = { + "vhuse-qjbcl" = { + path = "${config.users.users.sijmen.home}/Sync"; + devices = [ "nas" "desktop-fedora" ]; + }; + }; + }; + + 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 + ]; + + programs.steam = { + enable = true; + remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play + dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server + }; + + virtualisation.libvirtd.enable = true; + + # 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? +}