diff --git a/flake.nix b/flake.nix index 9aca032..65cc84f 100644 --- a/flake.nix +++ b/flake.nix @@ -53,10 +53,6 @@ homeManagerModules = import ./home-modules; nixosConfigurations = { - unikie = inputs.nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = [./hosts/unikie/configuration.nix]; - }; x1 = inputs.nixpkgs.lib.nixosSystem { inherit specialArgs; modules = [./hosts/x1/configuration.nix]; diff --git a/home-modules/common.nix b/home-modules/common.nix index f02fe9e..4bff781 100644 --- a/home-modules/common.nix +++ b/home-modules/common.nix @@ -26,13 +26,14 @@ slack pavucontrol pcmanfm + ffmpegthumbnailer # video thumbnails obsidian gimp chromium prusa-slicer + nsxiv # cli apps - ffmpeg-full glow # render markdown on the cli ]; } diff --git a/home-modules/discord.nix b/home-modules/discord.nix index cccad69..d9d3e4a 100644 --- a/home-modules/discord.nix +++ b/home-modules/discord.nix @@ -1,10 +1,6 @@ {pkgs, ...}: { - home.packages = with pkgs; [ - (discord.override { - withOpenASAR = true; - withVencord = true; - }) - ]; + home.packages = [pkgs.vesktop]; + xdg.configFile = { "Vencord/settings/quickCss.css".text = '' @import url('https://refact0r.github.io/midnight-discord/midnight.css'); diff --git a/home-modules/neovim.nix b/home-modules/neovim.nix index f8d67fe..e671da6 100644 --- a/home-modules/neovim.nix +++ b/home-modules/neovim.nix @@ -34,6 +34,16 @@ undodir = "/home/${user}/.vim/undodir"; }; + files = { + "ftplugin/sh.lua" = { + options = { + expandtab = true; + shiftwidth = 4; + tabstop = 4; + }; + }; + }; + colorschemes.dracula.enable = true; highlightOverride = { Normal.bg = "none"; @@ -206,6 +216,7 @@ sources = { code_actions = { statix.enable = true; + refactoring.enable = true; }; diagnostics = { deadnix.enable = true; @@ -215,7 +226,15 @@ formatting = { markdownlint.enable = true; sqlfluff.enable = true; - shfmt.enable = true; + shfmt = { + enable = true; + withArgs = '' + { extra_args = { + '-i', '4', '-ci' + } } + ''; + }; + black.enable = true; stylua.enable = true; terraform_fmt.enable = true; }; @@ -258,10 +277,6 @@ enable = true; settings.plugins = { pylint.enabled = true; - pylsp_mypy = { - enabled = true; - live_mode = true; - }; isort.enabled = true; black.enabled = true; ruff.enabled = true; diff --git a/home-modules/xdg.nix b/home-modules/xdg.nix index d114833..ab437b8 100644 --- a/home-modules/xdg.nix +++ b/home-modules/xdg.nix @@ -1,4 +1,8 @@ -{user, ...}: { +{ + user, + pkgs, + ... +}: { xdg = { enable = true; userDirs = { @@ -18,5 +22,11 @@ exec = ''add-torrent %u''; mimeType = ["x-scheme-handler/magnet"]; }; + + desktopEntries."nsxiv" = { + name = "nsxiv"; + exec = ''${pkgs.nsxiv}/bin/nsxiv -a %F''; + mimeType = ["image/gif"]; + }; }; } diff --git a/hosts/hetzner/configuration.nix b/hosts/hetzner/configuration.nix index 32e316e..f93a27b 100644 --- a/hosts/hetzner/configuration.nix +++ b/hosts/hetzner/configuration.nix @@ -11,10 +11,11 @@ (modulesPath + "/profiles/qemu-guest.nix") (with outputs.nixosModules; [ common - syncthing - ssh-access docker nginx + ssh-access + syncthing + users ]) inputs.disko.nixosModules.disko ./disk-config.nix @@ -32,7 +33,6 @@ }; security.sudo.wheelNeedsPassword = false; - networking.hostName = "hetzner"; systemd.network = { enable = true; @@ -42,9 +42,14 @@ }; }; + networking = { + hostName = "hetzner"; + useNetworkd = true; + }; + environment.systemPackages = with pkgs; [ - neovim git + neovim busybox ]; diff --git a/hosts/unikie/configuration.nix b/hosts/unikie/configuration.nix deleted file mode 100644 index 97e3694..0000000 --- a/hosts/unikie/configuration.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - pkgs, - lib, - outputs, - ... -}: { - imports = lib.flatten [ - (with outputs.nixosModules; [ - common - syncthing - laptop - bluetooth - gui - work-vpn - ]) - ./hardware-configuration.nix - ]; - - networking.hostName = "unikie"; - - boot = { - kernelPackages = pkgs.linuxPackages_6_1; - supportedFilesystems = ["btrfs"]; - - loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - }; - }; - - services.syncthing = { - settings.folders = { - "work".enable = true; - }; - }; -} diff --git a/hosts/unikie/hardware-configuration.nix b/hosts/unikie/hardware-configuration.nix deleted file mode 100644 index d6e4255..0000000 --- a/hosts/unikie/hardware-configuration.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ - config, - lib, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot = { - initrd = { - availableKernelModules = ["xhci_pci" "thunderbolt" "nvme"]; - kernelModules = []; - luks.devices."enc".device = "/dev/disk/by-uuid/8791ca62-8018-41fd-b881-d59e6d008ed8"; - }; - kernelModules = ["kvm-intel"]; - extraModulePackages = []; - }; - - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/466bfd75-72b4-4795-9648-996c3dc5f49f"; - fsType = "btrfs"; - options = ["subvol=root"]; - }; - - "/nix" = { - device = "/dev/disk/by-uuid/466bfd75-72b4-4795-9648-996c3dc5f49f"; - fsType = "btrfs"; - options = ["subvol=nix"]; - }; - - "/var/log" = { - device = "/dev/disk/by-uuid/466bfd75-72b4-4795-9648-996c3dc5f49f"; - fsType = "btrfs"; - options = ["subvol=log"]; - neededForBoot = true; - }; - - "/home" = { - device = "/dev/disk/by-uuid/466bfd75-72b4-4795-9648-996c3dc5f49f"; - fsType = "btrfs"; - options = ["subvol=home"]; - }; - - "/persist" = { - device = "/dev/disk/by-uuid/466bfd75-72b4-4795-9648-996c3dc5f49f"; - fsType = "btrfs"; - options = ["subvol=persist"]; - neededForBoot = true; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/890D-72FC"; - fsType = "vfat"; - }; - }; - - swapDevices = []; - - networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/x1/configuration.nix b/hosts/x1/configuration.nix index ae608fe..3db0322 100644 --- a/hosts/x1/configuration.nix +++ b/hosts/x1/configuration.nix @@ -7,16 +7,20 @@ }: { imports = lib.flatten [ (with outputs.nixosModules; [ + bin + bluetooth + bootloader common - syncthing docker - bootloader - laptop - bluetooth + fonts gui - work-vpn keyd - bin + laptop + networking + sound + syncthing + users + work-vpn ]) (with inputs.nixos-hardware.nixosModules; [ lenovo-thinkpad-x1-11th-gen @@ -30,6 +34,15 @@ hostId = "c08d7d71"; }; + hardware = { + opengl = { + extraPackages = with pkgs; [ + intel-compute-runtime + intel-media-driver + ]; + }; + }; + services = { syncthing = { settings.folders = { diff --git a/hosts/x1/hardware-configuration.nix b/hosts/x1/hardware-configuration.nix index 3a4315f..40375d3 100644 --- a/hosts/x1/hardware-configuration.nix +++ b/hosts/x1/hardware-configuration.nix @@ -10,7 +10,7 @@ boot = { initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; - initrd.kernelModules = []; + initrd.kernelModules = ["i915"]; kernelModules = ["kvm-intel"]; extraModulePackages = []; }; diff --git a/hosts/zeus/configuration.nix b/hosts/zeus/configuration.nix index caa3a42..8a611b4 100644 --- a/hosts/zeus/configuration.nix +++ b/hosts/zeus/configuration.nix @@ -2,20 +2,25 @@ inputs, outputs, lib, - pkgs, ... }: { imports = lib.flatten [ (with outputs.nixosModules; [ + bin + bluetooth + bootloader common - syncthing docker - bootloader - bluetooth + fonts + gaming gui - work-vpn keyd - bin + networking + sound + syncthing + transmission + users + work-vpn ]) (with inputs.nixos-hardware.nixosModules; [ common-cpu-amd @@ -46,7 +51,7 @@ "work".enable = true; }; }; - }; + }; services.xserver = { videoDrivers = ["amdgpu"]; diff --git a/modules/bluetooth.nix b/modules/bluetooth.nix index 2c56e79..2e1bb5a 100644 --- a/modules/bluetooth.nix +++ b/modules/bluetooth.nix @@ -1,10 +1,13 @@ -{ +{pkgs, ...}: { hardware = { bluetooth = { enable = true; + package = pkgs.bluez5-experimental; powerOnBoot = false; settings.General = { Enable = "Source,Sink,Media,Socket"; + Experimental = true; + FastConnectable = true; }; }; }; diff --git a/modules/bootloader.nix b/modules/bootloader.nix index de71bc4..bc652b3 100644 --- a/modules/bootloader.nix +++ b/modules/bootloader.nix @@ -1,7 +1,10 @@ { boot = { loader = { - systemd-boot.enable = true; + systemd-boot = { + enable = true; + configurationLimit = 5; + }; efi.canTouchEfiVariables = true; }; }; diff --git a/modules/common.nix b/modules/common.nix index 7f53920..7bd7705 100644 --- a/modules/common.nix +++ b/modules/common.nix @@ -1,6 +1,5 @@ { pkgs, - user, ... }: { system.stateVersion = "23.11"; @@ -8,9 +7,16 @@ time.timeZone = "Europe/Helsinki"; i18n.defaultLocale = "en_US.UTF-8"; + location.provider = "geoclue2"; + services.geoclue2.enable = true; + + # disable beeping motherboard speaker boot.blacklistedKernelModules = ["pcspkr"]; - hardware.enableAllFirmware = true; + hardware = { + enableAllFirmware = true; + enableRedistributableFirmware = true; + }; nixpkgs.config.allowUnfree = true; @@ -30,39 +36,17 @@ "cache.vedenemo.dev:8NhplARANhClUSWJyLVk4WMyy1Wb4rhmWW2u8AejH9E=" "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE=" ]; - trusted-users = [user]; - experimental-features = ["nix-command" "flakes"]; - auto-optimise-store = true; - }; - }; - - systemd.services.NetworkManager-wait-online.enable = false; - - programs.zsh.enable = true; - environment = { - pathsToLink = ["/share/zsh"]; - shells = [pkgs.zsh]; - }; + trusted-users = ["root" "@wheel"]; + experimental-features = ["nix-command" "flakes"]; - users = { - defaultUserShell = pkgs.zsh; - users."${user}" = { - isNormalUser = true; - extraGroups = ["wheel" "docker" "networkmanager"]; - initialPassword = "asdf"; - home = "/home/${user}"; - shell = pkgs.zsh; + auto-optimise-store = true; + builders-use-substitutes = true; + keep-derivations = true; + keep-outputs = true; }; }; - # login automatically to my user - # this is fine because the hard drive is encrypted anyway - services.getty = { - autologinUser = user; - helpLine = ""; - }; - console = { font = "ter-v24b"; packages = [pkgs.terminus_font]; @@ -80,27 +64,17 @@ polkit.enable = true; }; - networking = { - networkmanager.enable = true; - firewall.enable = true; - }; - environment.systemPackages = with pkgs; [ - busybox + git fastfetch file bottom - xdotool - playerctl - pulseaudio jq fd # faster find dig rsync - xclip pciutils usbutils - wirelesstools - acpi + ffmpeg-full ]; } diff --git a/modules/default.nix b/modules/default.nix index 2c01ed9..65096ff 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -5,15 +5,17 @@ bootloader = import ./bootloader.nix; common = import ./common.nix; docker = import ./docker.nix; + fonts = import ./fonts.nix; gaming = import ./gaming.nix; gui = import ./gui.nix; keyd = import ./keyd.nix; laptop = import ./laptop.nix; + networking = import ./networking.nix; nginx = import ./nginx.nix; sound = import ./sound.nix; ssh-access = import ./ssh-access.nix; syncthing = import ./syncthing.nix; - trackpoint = import ./trackpoint.nix; transmission = import ./transmission.nix; + users = import ./users.nix; work-vpn = import ./work-vpn.nix; } diff --git a/modules/fonts.nix b/modules/fonts.nix new file mode 100644 index 0000000..f83c1bc --- /dev/null +++ b/modules/fonts.nix @@ -0,0 +1,28 @@ +{pkgs, ...}: { + fonts = { + fontconfig = { + enable = true; + + defaultFonts = { + emoji = ["Twitter Color Emoji"]; + monospace = ["Fira Code Nerd Font" "Sarasa Gothic"]; + sansSerif = ["Cantarell" "Sarasa Gothic"]; + }; + + hinting.style = "full"; + subpixel.rgba = "rgb"; + }; + + fontDir = { + enable = true; + decompressFonts = true; + }; + + packages = with pkgs; [ + (nerdfonts.override {fonts = ["FiraCode"];}) + cantarell-fonts + twitter-color-emoji + sarasa-gothic + ]; + }; +} diff --git a/modules/gaming.nix b/modules/gaming.nix index b365b4c..9808cd0 100644 --- a/modules/gaming.nix +++ b/modules/gaming.nix @@ -24,8 +24,11 @@ hardware.xone.enable = true; environment.systemPackages = with pkgs; [ + # vulkan vulkan-tools - mangohud + vulkan-loader + vulkan-validation-layers + vulkan-extension-layer # open source minecraft launcher prismlauncher ]; diff --git a/modules/gui.nix b/modules/gui.nix index 2186a70..b8d1dd2 100644 --- a/modules/gui.nix +++ b/modules/gui.nix @@ -1,18 +1,8 @@ -{pkgs, ...}: { - fonts = { - packages = with pkgs; [ - (nerdfonts.override {fonts = ["FiraCode"];}) - cantarell-fonts - twitter-color-emoji - sarasa-gothic - ]; - fontconfig.defaultFonts = { - emoji = ["Twitter Color Emoji"]; - monospace = ["Fira Code Nerd Font" "Sarasa Gothic"]; - sansSerif = ["Cantarell" "Sarasa Gothic"]; - }; - }; - +{ + pkgs, + user, + ... +}: { xdg.portal = { enable = true; xdgOpenUsePortal = false; @@ -30,7 +20,7 @@ image-viewer = "imv-dir.desktop"; in { "application/pdf" = ["org.pwmt.zathura-pdf-mupdf.desktop"]; - "image/gif" = [image-viewer]; + "image/gif" = ["nsxiv.desktop"]; "image/jpeg" = [image-viewer]; "image/png" = [image-viewer]; "image/webp" = [image-viewer]; @@ -54,6 +44,13 @@ }; }; + # login automatically to my user + # this is fine because the hard drive is encrypted anyway + services.getty = { + autologinUser = user; + helpLine = ""; + }; + # use X11 keyboard settings in tty console.useXkbConfig = true; @@ -87,5 +84,8 @@ environment.systemPackages = with pkgs; [ libnotify + xdotool + xclip + mesa ]; } diff --git a/modules/laptop.nix b/modules/laptop.nix index 76aaec0..2a958bc 100644 --- a/modules/laptop.nix +++ b/modules/laptop.nix @@ -1,13 +1,9 @@ {pkgs, ...}: { environment.systemPackages = with pkgs; [ - # backlight brightness utility brightnessctl - - # screen locker physlock - - # manage displays when docking mons + acpi ]; services.xserver = { @@ -28,9 +24,23 @@ boot.kernelParams = ["mem_sleep_default=deep"]; # battery life improvements - powerManagement.enable = true; - powerManagement.powertop.enable = true; - services.tlp.enable = true; + powerManagement = { + enable = true; + powertop.enable = true; + }; + + services.upower = { + enable = true; + percentageLow = 20; + percentageCritical = 10; + percentageAction = 5; + criticalPowerAction = "Hibernate"; + }; + + # Enable the auto-cpufreq daemon + services.auto-cpufreq.enable = true; + # Enable thermald, the temperature management daemon + services.thermald.enable = true; # turn off wifi without sudo security.sudo.extraRules = [ diff --git a/modules/networking.nix b/modules/networking.nix new file mode 100644 index 0000000..3f884bd --- /dev/null +++ b/modules/networking.nix @@ -0,0 +1,28 @@ +{ + pkgs, + user, + ... +}: { + networking = { + networkmanager = { + enable = true; + dns = "systemd-resolved"; + wifi = { + backend = "iwd"; + powersave = true; + }; + }; + + firewall.enable = true; + }; + + systemd.services.NetworkManager-wait-online.enable = false; + + services.resolved.enable = true; + + users.users."${user}".extraGroups = ["networkmanager"]; + + environment.systemPackages = with pkgs; [ + wirelesstools + ]; +} diff --git a/modules/sound.nix b/modules/sound.nix index bb991aa..977374c 100644 --- a/modules/sound.nix +++ b/modules/sound.nix @@ -1,4 +1,4 @@ -{ +{pkgs, ...}: { services.pipewire = { enable = true; alsa.enable = true; @@ -11,4 +11,10 @@ hardware.pulseaudio.daemon.config = { default-sample-format = "float32le"; }; + + environment.systemPackages = with pkgs; [ + alsa-utils + pulseaudio + playerctl + ]; } diff --git a/modules/ssh-access.nix b/modules/ssh-access.nix index 31aa37e..1328a3f 100644 --- a/modules/ssh-access.nix +++ b/modules/ssh-access.nix @@ -14,7 +14,7 @@ services.fail2ban.enable = true; users.users.${user}.openssh.authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDdrlMsN+yqst4ThORcm9Jf2g5JNVWcjIkzkRow8BCChZjC/EqbVCAeN8LfdGniefre49KNc40IxJENnrtu3TitFHDBhuRYrFJ1csK6dD1pZBeFrCPrWjr7b1e9PwusQddI7Xi/amSf8XlmBvDMXRnvqFnBD4xNdmd5DMPDi2Q5FjzNqlsuEAPPegahb0OoGIYGbwUfHtVDtUtuN6oYUYuQbiz92Fjpy5tyz/Bb4Wrw7iphL5nITM0l/BdtGFv4D/UUa3cju74xIm5Qi93qBaNXhQwRVv1c2pzBQvwQltjQYxV9kvTcG24cI+iS/XUaalKV539q/wXaC9h5aKEYyMn+TzuATZsvcP45JQeZpkMcOsCCKroIvOzeizfYbIW7+T5rdhkC0PFfmo1/WYQ4fcbukgEBa3OjuG8LGZvHo7BLj46s+qW3dV+WemhIHiFXYI9sTaXzL4pxgXI1DwYaz1tSMOQTOh+rYqjhUaaqsQqLdbcdBlrpInIvZqpC3VUkTyU= join@cerberus" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII6EoeiMBiiwfGJfQYyuBKg8rDpswX0qh194DUQqUotL joonas@buutti" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGlFqSQFoSSuAS1IjmWBFXie329I5Aqf71QhVOnLTBG+ joonas@x1" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB3h/Aj66ndKFtqpQ8H53tE9KbbO0obThC0qbQQKFQRr joonas@zeus" ]; } diff --git a/modules/trackpoint.nix b/modules/trackpoint.nix deleted file mode 100644 index 07afdf6..0000000 --- a/modules/trackpoint.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - hardware.trackpoint = { - enable = true; - sensitivity = 132; - speed = 158; - }; -} diff --git a/modules/users.nix b/modules/users.nix new file mode 100644 index 0000000..a123e7e --- /dev/null +++ b/modules/users.nix @@ -0,0 +1,22 @@ +{ + pkgs, + user, + ... +}: { + programs.zsh.enable = true; + + environment = { + pathsToLink = ["/share/zsh"]; + shells = [pkgs.zsh]; + }; + + users = { + defaultUserShell = pkgs.zsh; + + users."${user}" = { + isNormalUser = true; + extraGroups = ["wheel"]; + initialPassword = "asdf"; + }; + }; +}