commit 92691d750620f6436ee2b28fb1631ebabaee0b4c Author: FredzyW Date: Sun Apr 7 18:47:20 2024 +0200 changes diff --git a/.xinitrc b/.xinitrc new file mode 100755 index 0000000..af87184 --- /dev/null +++ b/.xinitrc @@ -0,0 +1,21 @@ +#!/bin/sh +# +if test -z "$DBUS_SESSION_BUS_ADDRESS"; then + eval $(dbus-launch --exit-with-session --sh-syntax) +fi +systemctl --user import-environment DISPLAY XAUTHORITY + +if command -v dbus-update-activation-environment >/dev/null 2>&1; then + dbus-update-activation-environment DISPLAY XAUTHORITY +fi + +xrdb -merge ~/.Xresources +setxkbmap -option caps:swapescape + +feh --bg-scale ~/wallpapers/nix-black-4k.png +dwmblocks & +dunst & +xbanish & +picom -b + +exec dwm diff --git a/README.md b/README.md new file mode 100644 index 0000000..60326ca --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# NixOS + +Ett repo för att hantera konfigurationsfiler för mina datorer. + +- nix-laptop (Acer Swift 3) +- nix-desktop (Lenovo ThinkCentre) +- fw-jobb (Dell) diff --git a/config/base.nix b/config/base.nix new file mode 100644 index 0000000..bf3314a --- /dev/null +++ b/config/base.nix @@ -0,0 +1,125 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{ + inputs, + lib, + config, + pkgs, + ... +}: { + nixpkgs = { + overlays = [ + ]; + config = { + allowUnfree = true; + }; + }; + + nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + + nix.nixPath = ["/etc/nix/path"]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; + + nix.settings = { + experimental-features = "nix-command flakes"; + auto-optimise-store = true; + }; + + virtualisation.docker = { + enable = true; + }; + + hardware = { + pulseaudio.enable = true; + bluetooth = { + enable = true; + powerOnBoot = true; + }; + }; + + networking.networkmanager.enable = true; + + environment.sessionVariables = { + EDITOR = "nvim"; + TERM = "xterm-256color"; + }; + + time.timeZone = "Europe/Stockholm"; + + fonts.packages = with pkgs; [ + (nerdfonts.override { + fonts = [ + "FiraCode" + "DroidSansMono" + ]; + }) + ]; + + + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "sv_SE.UTF-8"; + LC_IDENTIFICATION = "sv_SE.UTF-8"; + LC_MEASUREMENT = "sv_SE.UTF-8"; + LC_MONETARY = "sv_SE.UTF-8"; + LC_NAME = "sv_SE.UTF-8"; + LC_NUMERIC = "sv_SE.UTF-8"; + LC_PAPER = "sv_SE.UTF-8"; + LC_TELEPHONE = "sv_SE.UTF-8"; + LC_TIME = "sv_SE.UTF-8"; + }; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + console.keyMap = "sv-latin1"; + programs.zsh.enable = true; + + services = { + openssh = { + enable = true; + }; + picom = { + enable = true; + }; + spotifyd = { + enable = true; + }; + strongswan = { + enable = true; + secrets = [ + "ipsec.d/ipsec.nm-l2tp.secrets" + ]; + }; + xserver = { + enable = true; + layout = "se"; + xkbVariant = ""; + displayManager = { + startx = { + enable = true; + }; + }; + windowManager = { + dwm = { + enable = true; + }; + }; + }; + locate = { + enable = true; + locate = pkgs.mlocate; + }; + blueman = { + enable = true; + }; + }; + + system.stateVersion = "23.11"; +} + diff --git a/config/home.nix b/config/home.nix new file mode 100644 index 0000000..740ea9f --- /dev/null +++ b/config/home.nix @@ -0,0 +1,159 @@ +# This is your home-manager configuration file +# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) +{ + inputs, + lib, + config, + pkgs, + myhostname, + ... +}: { + imports = [ + ../moduler/common/dwm.nix + ../moduler/common/dmenu.nix + ../moduler/common/kitty.nix + ../moduler/common/tmux.nix + ../moduler/common/zsh.nix + ../moduler/common/git.nix + ../moduler/common/nixpkgs.nix + ../moduler/common/firefox.nix + ../moduler/common/zathura.nix + ../moduler/common/lazygit.nix + ../moduler/common/spotifyd.nix + ../moduler/common/ssh.nix + ]; + + nixpkgs = { + overlays = []; + config = { + allowUnfree = true; + allowUnfreePredicate = _: true; + permittedInsecurePackages = [ + "electron-25.9.0" + "nix-2.16.2" + ]; + }; + }; + + + home.packages = with pkgs; [ + # System + arion + wget + alsa-utils + killall + upower + mpv + gcc + gnumake + htop + openssh + xsel + unzip + nixops_unstable + killall + cmake + feh + brightnessctl + scrot + dunst + xbanish + rofi + networkmanager + pavucontrol + fd + bat + steam-run + appimage-run + + #Terminal + git + tmux + zathura + yt-dlp + fzf + ripgrep + spotify-tui + wiki-tui + speedcrunch + + #Desktop + aerc + firefox + vimb + thunderbird + spotify + signal-desktop + darktable + discord + slack + lunarvim + kitty + neovim + neofetch + obsidian + lazygit + betterdiscordctl + + + #Dev + python3 + python311Packages.pip + ranger + python311Packages.pynvim + ueberzugpp + + #LSP + nil + python311Packages.python-lsp-server + marksman + clojure-lsp + omnisharp-roslyn + haskell-language-server + java-language-server + nodePackages_latest.bash-language-server + dockerfile-language-server-nodejs + yaml-language-server + ansible-language-server + lua-language-server + tree-sitter + nodejs_21 + nodePackages_latest.vls + nodePackages_latest.volar + vscode-langservers-extracted + + #VPN + openvpn + networkmanagerapplet + networkmanager-l2tp + strongswan + ansible + + #Funk + cabal-install + ghc + haskellPackages.hoogle + haskellPackages.fast-tags + + #Disk + clojure + leiningen + + # Jobb + remmina + dotnet-sdk_8 + mono5 + dotnetPackages.Nuget + ]; + programs.home-manager.enable = true; + + xsession.enable = true; + xsession.windowManager.command = "exec dwm"; + + home.username = "fw"; + home.homeDirectory = "/home/fw"; + + home.stateVersion = "23.11"; # Did you read the comment? + + systemd.user.startServices = "sd-switch"; +} diff --git a/config/server.nix b/config/server.nix new file mode 100644 index 0000000..ffc6a6d --- /dev/null +++ b/config/server.nix @@ -0,0 +1,98 @@ +# This is your home-manager configuration file +# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) +{ + inputs, + lib, + config, + pkgs, + myhostname, + ... +}: { + imports = [ + ../moduler/common/git.nix + ../moduler/common/nixpkgs.nix + ../moduler/common/lazygit.nix + ../moduler/common/zsh-server.nix + ]; + + nixpkgs = { + overlays = []; + config = { + allowUnfree = true; + allowUnfreePredicate = _: true; + permittedInsecurePackages = [ + "nix-2.16.2" + ]; + }; + }; + + + home.packages = with pkgs; [ + # System + arion + wget + killall + gcc + gnumake + htop + openssh + xsel + unzip + nixops_unstable + cmake + networkmanager + fd + bat + + #Terminal + git + yt-dlp + fzf + ripgrep + + #Desktop + neovim + lazygit + + #Dev + python3 + python311Packages.pip + ranger + python311Packages.pynvim + ueberzugpp + + #LSP + nil + python311Packages.python-lsp-server + marksman + clojure-lsp + omnisharp-roslyn + haskell-language-server + java-language-server + nodePackages_latest.bash-language-server + dockerfile-language-server-nodejs + yaml-language-server + ansible-language-server + lua-language-server + tree-sitter + nodejs_21 + nodePackages_latest.vls + nodePackages_latest.volar + vscode-langservers-extracted + + #VPN + openvpn + networkmanagerapplet + networkmanager-l2tp + strongswan + ansible + ]; + programs.home-manager.enable = true; + + home.username = "fw"; + home.homeDirectory = "/home/fw"; + + home.stateVersion = "23.11"; # Did you read the comment? + + systemd.user.startServices = "sd-switch"; +} diff --git a/config/users.nix b/config/users.nix new file mode 100644 index 0000000..750fba2 --- /dev/null +++ b/config/users.nix @@ -0,0 +1,27 @@ +{ config +, pkgs +, ... +}: { + # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. + users = { + defaultUserShell = pkgs.zsh; + users = { + fw = { + initialPassword = "password"; + isNormalUser = true; + description = "Fredrik Wastring"; + extraGroups = [ + "networkmanager" + "wheel" + "audio" + "docker" + ]; + openssh.authorizedKeys = { + keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDALsdpwvC0w/Aj+1fWtzJyyWoUrGkdh8o2thVHeQQBNo0D7cmVberYmi4Cv9gWGX6PaElrnOl0KRdGyro2wxOYokSxgk2VgWW67BFITAQAbKyG2NhXXPbhb4jccDo7WH7TtOG8IofuJTPRu1Duda6k4RN0I0CkyAN6LGX+zy49cq0qKf9ijXYhCDYNih3+Fu/ig0aW/SYmsVoUl2VFTWdI5x5/wLvIjTEZhmAtYIeYADaLnom356cFrUysZa++FUujQAz3Ow236BvP95XZdTsqvfWNZFNIpC9VYF72JeIDCs5wDIr0GFmanF2On1nar+jJpoOE8SdHt357p5g/PqXV5TisN2xQRkqVwO9tWtMl4sF84jA4ULnY2gQWv9jErMxymUQ1IwuPUzDDlbRHCtfexAtkBy7wv6xslKAzG1QahvF/btNs5Caj3LN31rgAuxyooCbKGKTeBP3kHPKcz1iupgidfbO/QqVXBRQJTEdGyAKa8hVmLQZZPC/XUhxESAk= fw@fw-nix" + ]; + }; + }; + }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..98d2245 --- /dev/null +++ b/flake.lock @@ -0,0 +1,121 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1710888565, + "narHash": "sha256-s9Hi4RHhc6yut4EcYD50sZWRDKsugBJHSbON8KFwoTw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "f33900124c23c4eca5831b9b5eb32ea5894375ce", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.11", + "repo": "home-manager", + "type": "github" + } + }, + "nix-gaming": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1711847810, + "narHash": "sha256-gLeUuU3hQ2ErboVIyzDNes2bywdTYDidvi6wG5+tnQ8=", + "owner": "fufexan", + "repo": "nix-gaming", + "rev": "4ec1bf4262e913af85e3f699f564769ec2f23cff", + "type": "github" + }, + "original": { + "owner": "fufexan", + "repo": "nix-gaming", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1711715736, + "narHash": "sha256-9slQ609YqT9bT/MNX9+5k5jltL9zgpn36DpFB7TkttM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "807c549feabce7eddbf259dbdcec9e0600a0660d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1709237383, + "narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1711668574, + "narHash": "sha256-u1dfs0ASQIEr1icTVrsKwg2xToIpn7ZXxW3RHfHxshg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "219951b495fc2eac67b1456824cc1ec1fd2ee659", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nix-gaming": "nix-gaming", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..821d151 --- /dev/null +++ b/flake.nix @@ -0,0 +1,86 @@ +{ + description = "NixOS Deployments"; + + inputs = { + # Nixpkgs + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; + + # Home manager + home-manager.url = "github:nix-community/home-manager/release-23.11"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + nix-gaming.url = "github:fufexan/nix-gaming"; + + # TODO: Add any other flake you might need + # hardware.url = "github:nixos/nixos-hardware"; + }; + + outputs = { + self, + nixpkgs, + home-manager, + ... + } @ inputs: let + inherit (self) outputs; + in { + # NixOS configuration entrypoint + # Available through 'nixos-rebuild --flake .#your-hostname' + nixosConfigurations = { + nix-laptop = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [./maskiner/laptop/configuration.nix]; + }; + nix-desktop = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [./maskiner/desktop/configuration.nix]; + }; + fw-jobb = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [./maskiner/jobb/configuration.nix]; + }; + server = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [./maskiner/server/configuration.nix]; + }; + }; + + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#your-username@your-hostname' + homeConfigurations = { + "fw@nix-laptop" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = { + inherit inputs outputs; + myhostname = "nix-laptop"; + }; + modules = [./config/home.nix]; + }; + "fw@nix-desktop" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = { + inherit inputs outputs; + myhostname = "nix-desktop"; + }; + # > Our main home-manager configuration file < + modules = [./config/home.nix]; + }; + "fw@fw-jobb" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = { + inherit inputs outputs; + myhostname = "fw-jobb"; + }; + # > Our main home-manager configuration file < + modules = [./config/home.nix]; + }; + "fw@server" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = { + inherit inputs outputs; + myhostname = "server"; + }; + # > Our main home-manager configuration file < + modules = [./config/server.nix]; + }; + }; + }; +} diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..d4d001f --- /dev/null +++ b/install.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +#sudo cp /etc/nixos/hardware-configuration.nix ./$1/nixos + +#sudo nixos-rebuild switch --flake ".#$2" + +sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager +sudo nix-channel --update + +nix-shell '' -A install + +#cp .xinitrc ~ + +#mkdir ~/wallpapers + +#cp ./wallpapers/nix-black-4k.png ~/wallpapers/ + +#home-manager switch --flake ".#$3@$2" diff --git a/maskiner/desktop/configuration.nix b/maskiner/desktop/configuration.nix new file mode 100644 index 0000000..913729c --- /dev/null +++ b/maskiner/desktop/configuration.nix @@ -0,0 +1,23 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{ + inputs, + lib, + config, + pkgs, + ... +}: { + # You can import other NixOS modules here + imports = [ + ./hardware-configuration.nix + ../../config/base.nix + ../../config/users.nix + ]; + + security.rtkit.enable = true; + networking.hostName = "nix-desktop"; + + services.xserver.dpi = 100; + + system.stateVersion = "23.11"; +} diff --git a/maskiner/desktop/hardware-configuration.nix b/maskiner/desktop/hardware-configuration.nix new file mode 100644 index 0000000..41d5f7c --- /dev/null +++ b/maskiner/desktop/hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/0f77fba6-7da6-4cb7-9607-b70b1964f1f7"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/67FD-B0D4"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/87dbf5cf-5a06-4bf8-bd2c-bfd269249eae"; } + ]; + + # 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; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/maskiner/jobb/configuration.nix b/maskiner/jobb/configuration.nix new file mode 100644 index 0000000..3727ec2 --- /dev/null +++ b/maskiner/jobb/configuration.nix @@ -0,0 +1,22 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{ + inputs, + lib, + config, + pkgs, + ... +}: { + # You can import other NixOS modules here + imports = [ + ./hardware-configuration.nix + ../../config/base.nix + ../../config/users.nix + ]; + + networking.hostName = "fw-jobb"; + + services.xserver.dpi = 140; + + system.stateVersion = "23.11"; +} diff --git a/maskiner/jobb/hardware-configuration.nix b/maskiner/jobb/hardware-configuration.nix new file mode 100644 index 0000000..c2ea262 --- /dev/null +++ b/maskiner/jobb/hardware-configuration.nix @@ -0,0 +1,41 @@ +# 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" "nvme" "usb_storage" "usbhid" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/231d66c5-7d08-4317-8c3c-b0a160af83e7"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/2646-A8BA"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/cc350407-ca49-4831-9780-b7757b6540a6"; } + ]; + + # 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.enp59s0u1u2.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/maskiner/laptop/configuration.nix b/maskiner/laptop/configuration.nix new file mode 100644 index 0000000..67ba1bb --- /dev/null +++ b/maskiner/laptop/configuration.nix @@ -0,0 +1,23 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{ + inputs, + lib, + config, + pkgs, + ... +}: { + # You can import other NixOS modules here + imports = [ + ./hardware-configuration.nix + ../../config/base.nix + ../../config/users.nix + ]; + + networking.hostName = "nix-laptop"; + + services.xserver.dpi = 140; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "23.11"; +} diff --git a/maskiner/laptop/hardware-configuration.nix b/maskiner/laptop/hardware-configuration.nix new file mode 100644 index 0000000..8dc9704 --- /dev/null +++ b/maskiner/laptop/hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/af77f921-bcba-43c6-8670-a90e1bde1915"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/346C-F5FE"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/3fa47cf3-f18d-4ab7-80e5-39bfaeada0d1"; } + ]; + + # 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.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/maskiner/server/configuration.nix b/maskiner/server/configuration.nix new file mode 100644 index 0000000..ba09090 --- /dev/null +++ b/maskiner/server/configuration.nix @@ -0,0 +1,112 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{ + inputs, + lib, + config, + pkgs, + ... +}: { + # You can import other NixOS modules here + imports = [ + ./hardware-configuration.nix + ../../config/users.nix + ]; + + networking.hostName = "server"; + nixpkgs = { + overlays = [ + ]; + config = { + allowUnfree = true; + }; + }; + + nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + + nix.nixPath = ["/etc/nix/path"]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; + + nix.settings = { + experimental-features = "nix-command flakes"; + auto-optimise-store = true; + }; + + virtualisation.docker = { + enable = true; + }; + + networking.networkmanager.enable = true; + + environment.sessionVariables = { + EDITOR = "nvim"; + TERM = "xterm-256color"; + }; + + time.timeZone = "Europe/Stockholm"; + + fonts.packages = with pkgs; [ + (nerdfonts.override { + fonts = [ + "FiraCode" + "DroidSansMono" + ]; + }) + ]; + + + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "sv_SE.UTF-8"; + LC_IDENTIFICATION = "sv_SE.UTF-8"; + LC_MEASUREMENT = "sv_SE.UTF-8"; + LC_MONETARY = "sv_SE.UTF-8"; + LC_NAME = "sv_SE.UTF-8"; + LC_NUMERIC = "sv_SE.UTF-8"; + LC_PAPER = "sv_SE.UTF-8"; + LC_TELEPHONE = "sv_SE.UTF-8"; + LC_TIME = "sv_SE.UTF-8"; + }; + + boot.loader.grub = { + enable = true; + device = "/dev/sdc"; + useOSProber = true; + }; + + console.keyMap = "sv-latin1"; + programs.zsh.enable = true; + + services = { + xserver = { + enable = true; + displayManager = { + startx.enable = true; + }; + }; + openssh = { + enable = true; + ports = [55502]; + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = false; + X11Forwarding = true; + }; + extraConfig = '' + AllowUsers fw + ''; + }; + locate = { + enable = true; + locate = pkgs.mlocate; + }; + }; + + system.stateVersion = "23.11"; +} diff --git a/maskiner/server/hardware-configuration.nix b/maskiner/server/hardware-configuration.nix new file mode 100644 index 0000000..3f90dc2 --- /dev/null +++ b/maskiner/server/hardware-configuration.nix @@ -0,0 +1,34 @@ +# 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" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/220bde85-e58e-48ad-bf5c-e1d3907642c0"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/f11bdce3-851b-427f-a3ab-9ebc9792269a"; } + ]; + + # 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.enp33s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/moduler/common/dmenu.nix b/moduler/common/dmenu.nix new file mode 100644 index 0000000..93401ce --- /dev/null +++ b/moduler/common/dmenu.nix @@ -0,0 +1,19 @@ +{ pkgs, lib, ... }: +let + dmenu = pkgs.dmenu.overrideAttrs (old: { + src = builtins.fetchGit { + url = "https://github.com/FredzyW/dmenu.git"; + rev = "7ec109778998462a6762745c65c47a73283b810e"; + }; + nativeBuildInputs = with pkgs; [ + xorg.libX11.dev + xorg.libXft + imlib2 + xorg.libXinerama + ]; + }); +in +{ + home.packages = [ dmenu ]; +} + diff --git a/moduler/common/dunst/default.nix b/moduler/common/dunst/default.nix new file mode 100644 index 0000000..08ade48 --- /dev/null +++ b/moduler/common/dunst/default.nix @@ -0,0 +1,24 @@ +{ config +, pkgs +, ... +}: { + services.dunst = { + enable = true; + settings = { + global = { + width = 300; + height = 300; + offset = "30x50"; + origin = "top-right"; + transparency = 5; + frame_color = "#eceff1"; + corner_radius = 10; + }; + urgency_normal = { + background = "#181818"; + foreground = "#dfdfdf"; + timeout = 10; + }; + }; + }; +} diff --git a/moduler/common/dwm-2.nix b/moduler/common/dwm-2.nix new file mode 100644 index 0000000..354e1ec --- /dev/null +++ b/moduler/common/dwm-2.nix @@ -0,0 +1,26 @@ +{ pkgs, lib, ... }: +let + dwm = pkgs.dwm.overrideAttrs (old: { + src = builtins.fetchGit { + url = "https://github.com/FredzyW/dwm-conf.git"; + rev = "99a1e812295bcf65625a4b5a0dc1022658977920"; + }; + nativeBuildInputs = with pkgs; [ + xorg.libX11.dev + xorg.libXft + imlib2 + xorg.libXinerama + ]; + }); + dwmblocks = pkgs.dwmblocks.overrideAttrs (old: { + src = builtins.fetchGit { + url = "https://github.com/FredzyW/dwmblocks.git"; + rev = "a334789ec7b9171a3c8e1fcac2ffe8463ee438dc"; + + }; + }); +in +{ + home.packages = [ dwm dwmblocks ]; +} + diff --git a/moduler/common/dwm.nix b/moduler/common/dwm.nix new file mode 100644 index 0000000..ab4db84 --- /dev/null +++ b/moduler/common/dwm.nix @@ -0,0 +1,36 @@ +{ pkgs, lib, myhostname, ... }: +let + dwm = pkgs.dwm.overrideAttrs (old: { + src = builtins.fetchGit { + # url = "https://github.com/FredzyW/dwm-conf.git"; + # rev = "99a1e812295bcf65625a4b5a0dc1022658977920"; + url = "https://git.wastring.com/fw/dwm.git"; + rev = "04039f157960b83f1ab8abebb0ea77c72a75a249"; + }; + nativeBuildInputs = with pkgs; [ + xorg.libX11.dev + xorg.libXft + imlib2 + xorg.libXinerama + ]; + }); + dwmblocks = if myhostname == "nix-desktop" then pkgs.dwmblocks.overrideAttrs (old: { + src = builtins.fetchGit { + # url = "https://github.com/FredzyW/dwmblocks.git"; + # rev = "a334789ec7b9171a3c8e1fcac2ffe8463ee438dc"; + url = "https://git.wastring.com/fw/dwmblocks.git"; + rev = "ce19d482155f3292dc77179a2485670a48d2669c"; + }; + }) else pkgs.dwmblocks.overrideAttrs (old: { + src = builtins.fetchGit { + # url = "https://github.com/FredzyW/dwmblocks.git"; + # rev = "7c81c55390f2deec2a3804217abe80221ef6f46a"; + url = "https://git.wastring.com/fw/dwmblocks.git"; + rev = "52198f692f5965b3e86577e8481e035d4c37ab52"; + }; + }); +in +{ + home.packages = [ dwm dwmblocks ]; +} + diff --git a/moduler/common/firefox.nix b/moduler/common/firefox.nix new file mode 100644 index 0000000..2f98cf6 --- /dev/null +++ b/moduler/common/firefox.nix @@ -0,0 +1,21 @@ +{ pkgs, lib, ... }: +{ + programs.firefox = { + enable = true; + profiles.default = { + isDefault = true; + userChrome = '' + @import "${ + builtins.fetchGit { + url = "https://github.com/rockofox/firefox-minima"; + ref = "main"; + rev = "c5580fd04e9b198320f79d441c78a641517d7af5"; # <-- Change this + } + }/userChrome.css"; + ''; + settings = { + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + }; + }; + }; +} diff --git a/moduler/common/git.nix b/moduler/common/git.nix new file mode 100644 index 0000000..9f8bfcc --- /dev/null +++ b/moduler/common/git.nix @@ -0,0 +1,8 @@ +{ pkgs, lib, ... }: +{ + programs.git = { + enable = true; + userName = "FredzyW"; + userEmail = "fredrik@wastring.com"; + }; +} diff --git a/moduler/common/kitty.nix b/moduler/common/kitty.nix new file mode 100644 index 0000000..e16ec38 --- /dev/null +++ b/moduler/common/kitty.nix @@ -0,0 +1,24 @@ +{ pkgs, lib, myhostname, ... }: +{ + programs.kitty = { + enable = true; + font = if myhostname == "nix-desktop" then { + name = "FiraCode Nerd Font"; + size = 18; + } else { + name = "FiraCode Nerd Font"; + size = 24; + }; + shellIntegration = { + enableZshIntegration = true; + mode = "no-cursor"; + }; + theme = "Catppuccin-Macchiato"; + settings = { + confirm_os_window_close = 2; + cursor_shape = "block"; + cursor_blink_interval = 0; + enable_audio_bell = false; + }; + }; +} diff --git a/moduler/common/lazygit.nix b/moduler/common/lazygit.nix new file mode 100644 index 0000000..a92fb64 --- /dev/null +++ b/moduler/common/lazygit.nix @@ -0,0 +1,29 @@ + +{ pkgs, lib, ... }: +{ + programs.lazygit = { + enable = true; + settings = { + gui = { + theme = { + activeBorderColor = [ "#a6da95" "bold" ]; + inactiveBorderColor = [ "#a5adcb" ]; + optionsTextColor = [ "#8aadf4" ]; + selectedLineBgColor = [ "#363a4f" ]; + cherryPickedCommitBgColor = [ "#494d64" ]; + cherryPickedCommitFgColor = [ "#a6da95" ]; + unstagedChangesColor = [ "#ed8796" ]; + defaultFgColor = [ "#cad3f5" ]; + searchingActiveBorderColor = [ "#eed49f" ]; + }; + + authorColors = { + "*" = "#b7bdf8"; + }; + showRandomTip = false; + showBottomLine = false; + sidePanelWidth = 0.5; + }; + }; + }; +} diff --git a/moduler/common/neovim/config/mappings.lua b/moduler/common/neovim/config/mappings.lua new file mode 100644 index 0000000..edf2217 --- /dev/null +++ b/moduler/common/neovim/config/mappings.lua @@ -0,0 +1,86 @@ +vim.keymap.set('n', 'z', '(leap)') +vim.keymap.set('n', 'Z', '(leap-from-window)') +vim.keymap.set({ 'x', 'o' }, 'z', '(leap-forward)') +vim.keymap.set({ 'x', 'o' }, 'Z', '(leap-backward)') + +-- Harpoon +vim.keymap.set('n', 'ha', ':lua require("harpoon.mark").add_file()') +vim.keymap.set('n', 'hf', ':Telescope harpoon marks') +vim.keymap.set('n', 'he', ':lua require("harpoon.ui").toggle_quick_menu()') +vim.keymap.set('n', 'hn', ':lua require("harpoon.ui").nav_next()') +vim.keymap.set('n', 'hb', ':lua require("harpoon.ui").nav_prev()') + +vim.cmd('highlight! HarpoonInactive guibg=NONE guifg=#63698c') +vim.cmd('highlight! HarpoonActive guibg=NONE guifg=white') +vim.cmd('highlight! HarpoonNumberActive guibg=NONE guifg=#7aa2f7') +vim.cmd('highlight! HarpoonNumberInactive guibg=NONE guifg=#7aa2f7') +vim.cmd('highlight! TabLineFill guibg=NONE guifg=white') + +local opts = { noremap = true, silent = true } + +-- Substitute +vim.keymap.set("n", "s", require('substitute').operator, { noremap = true }) +vim.keymap.set("n", "ss", require('substitute').line, { noremap = true }) +vim.keymap.set("n", "S", require('substitute').eol, { noremap = true }) +vim.keymap.set("x", "s", require('substitute').visual, { noremap = true }) + +-- Move commands +vim.keymap.set('n', '', ':MoveLine(1)', opts) +vim.keymap.set('n', '', ':MoveLine(-1)', opts) +vim.keymap.set('v', '', ':MoveBlock(1)', opts) +vim.keymap.set('v', '', ':MoveBlock(-1)', opts) + +-- Good navigation mappings for wrap +vim.api.nvim_set_keymap('n', 'j', 'gj', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'k', 'gk', { noremap = true, silent = true }) + +-- Buffer navigation +vim.api.nvim_set_keymap('n', '', ':bnext', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', ':bprevious', { noremap = true, silent = true }) + +-- Window navigation +vim.api.nvim_set_keymap('n', '', ':wincmd k', { silent = true }) +vim.api.nvim_set_keymap('n', '', ':wincmd j', { silent = true }) +vim.api.nvim_set_keymap('n', '', ':wincmd h', { silent = true }) +vim.api.nvim_set_keymap('n', '', ':wincmd l', { silent = true }) + +vim.api.nvim_set_keymap('n', 'c', ':bd', { silent = true }) + +-- Sniprun +vim.api.nvim_set_keymap('v', 'f', 'SnipRun', { silent = true }) +vim.api.nvim_set_keymap('n', 'f', 'SnipRunOperator', { silent = true }) +vim.api.nvim_set_keymap('n', 'ff', 'SnipRun', { silent = true }) + +-- Highlight yanked +vim.api.nvim_create_autocmd('TextYankPost', { + group = vim.api.nvim_create_augroup('highlight_yank', {}), + desc = 'Hightlight selection on yank', + pattern = '*', + callback = function() + vim.highlight.on_yank { higroup = 'IncSearch', timeout = 200 } + end, +}) + +-- Telescope bindings +vim.keymap.set('n', 'ff', builtin.find_files, {}) +vim.keymap.set('n', 'fg', builtin.live_grep, {}) +vim.keymap.set('n', 'fb', builtin.buffers, {}) +vim.keymap.set('n', 'fh', builtin.help_tags, {}) + + +-- Bindings for save and quit +vim.api.nvim_set_keymap('n', 'w', ':w', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'q', ':q', {}) + +-- Neotree bindings +vim.api.nvim_set_keymap('n', 'e', ':RnvimrToggle', { noremap = true, silent = true }) +vim.api.nvim_set_var('rnvimr_enable_ex', 1) +vim.api.nvim_set_var('rnvimr_enable_picker', 1) +vim.api.nvim_set_var('rnvimr_edit_cmd', 'drop') +vim.api.nvim_set_var('rnvimr_draw_border', 0) +vim.api.nvim_set_var('rnvimr_hide_gitignore', 1) +vim.api.nvim_set_var('rnvimr_border_attr', {fg = 14, bg = -1}) +vim.api.nvim_set_var('rnvimr_enable_bw', 1) +vim.api.nvim_set_var('rnvimr_shadow_winblend', 70) +vim.api.nvim_set_var('rnvimr_ranger_cmd', {'ranger', '--cmd=set draw_borders both'}) + diff --git a/moduler/common/neovim/config/options.lua b/moduler/common/neovim/config/options.lua new file mode 100644 index 0000000..9ecc2a4 --- /dev/null +++ b/moduler/common/neovim/config/options.lua @@ -0,0 +1,10 @@ +vim.opt.wrap = true +vim.opt.shiftwidth = 4 +vim.opt.tabstop = 4 +vim.o.termguicolors = true +vim.wo.relativenumber = true +vim.wo.number = true +vim.g.mapleader = ' ' + +vim.opt.termguicolors = true + diff --git a/moduler/common/neovim/config/plugins.lua b/moduler/common/neovim/config/plugins.lua new file mode 100644 index 0000000..2b7f216 --- /dev/null +++ b/moduler/common/neovim/config/plugins.lua @@ -0,0 +1,167 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + + +require("lazy").setup({ + { + 'm4xshen/autoclose.nvim', + }, + { + "BurntSushi/ripgrep", + }, + { + 'kevinhwang91/rnvimr', + }, + { + 'ThePrimeagen/harpoon', + }, + { + 'ggandor/leap.nvim', + }, + { + 'gfanto/fzf-lsp.nvim', + }, + { + 'junegunn/fzf.vim', + }, + { + "junegunn/fzf", + name = "fzf", + dir = "~/.fzf", + build = "./install --all" + }, + { + 'RRethy/base16-nvim', + }, + { + "folke/which-key.nvim", + }, + { + "folke/neodev.nvim", + }, + { + "mfussenegger/nvim-dap", + }, + { + 'neovim/nvim-lspconfig' + }, + { + 'hrsh7th/cmp-nvim-lsp' + }, + { + 'hrsh7th/nvim-cmp' + }, + { + 'nvim-focus/focus.nvim', + version = false + }, + { + "folke/neoconf.nvim", + cmd = "Neoconf" + }, + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + opts = {} + }, + { + 'mrjones2014/legendary.nvim', + -- since legendary.nvim handles all your keymaps/commands, + -- its recommended to load legendary.nvim before other plugins + priority = 10000, + lazy = false, + -- sqlite is only needed if you want to use frecency sorting + -- dependencies = { 'kkharji/sqlite.lua' } + }, + { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v3.x' + }, + { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000 + }, + { + 'kevinhwang91/nvim-bqf' + }, + { + 'akinsho/bufferline.nvim', + version = "*", + dependencies = 'nvim-tree/nvim-web-devicons' + }, + { + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' + }, + { + "L3MON4D3/LuaSnip", + version = "v2.*", + build = "make install_jsregexp" + }, + { + "gbprod/substitute.nvim", + opts = {} + }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate" + }, + { + "michaelb/sniprun", + branch = "master", + build = "sh install.sh", + config = function() + require("sniprun").setup({}) + end, + }, + { + 'nvim-telescope/telescope.nvim', + tag = '0.1.6', + dependencies = { + 'nvim-lua/plenary.nvim' + } + }, + { + 'mrcjkb/haskell-tools.nvim', + version = '^3', + ft = { 'haskell', 'lhaskell', 'cabal', 'cabalproject' }, + }, + { + "kdheepak/lazygit.nvim", + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + dependencies = { + "nvim-lua/plenary.nvim", + }, + keys = { + { "gg", "LazyGit", desc = "LazyGit" } + } + }, + { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' } + }, + { + 'numToStr/Comment.nvim', + opts = {}, + lazy = false, + }, + +}) + diff --git a/moduler/common/neovim/config/setup.lua b/moduler/common/neovim/config/setup.lua new file mode 100644 index 0000000..661611f --- /dev/null +++ b/moduler/common/neovim/config/setup.lua @@ -0,0 +1,230 @@ +-- Define a function to generate keybinds for navigating to files +local function setup_file_navigation_keybinds(start, stop) + for i = start, stop do + local keybind = string.format('h%d', i) + local command = string.format(':lua require("harpoon.ui").nav_file(%d)', i) + vim.keymap.set('n', keybind, command) + end +end + +setup_file_navigation_keybinds(1, 9) + +require'fzf_lsp'.setup() + +require("autoclose").setup({ + keys = { + ["$"] = { escape = true, close = true, pair = "$$", disabled_filetypes = { "haskell" } }, + ["'"] = { escape = true, close = true, pair = "''", disabled_filetypes = { "markdown" } }, + ["`"] = { escape = true, close = true, pair = "``", disabled_filetypes = { "markdown" } }, + }, +}) + + +require('bqf').setup() +require("ibl").setup() +require("focus").setup() +require("bufferline").setup() + +local wk = require("which-key") +wk.register(mappings, opts) + +local parser_config = require "nvim-treesitter.parsers".get_parser_configs() +parser_config.csharp = { + install_info = { + url = "https://github.com/tree-sitter/tree-sitter-c-sharp", -- local path or git repo + files = {"src/parser.c"}, -- note that some parsers also require src/scanner.c or src/scanner.cc + branch = "master", -- default branch in case of git repo if different from master + generate_requires_npm = false, -- if stand-alone parser without npm dependencies + requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c + }, + filetype = "cs", -- if filetype does not match the parser name +} + +require'nvim-treesitter.configs'.setup { + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "haskell", "python", "bash", "clojure", "nix", "dockerfile", "latex", "csharp", "markdown" }, + sync_install = false, + auto_install = true, + ignore_install = { "javascript" }, + + highlight = { + enable = true, + + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + additional_vim_regex_highlighting = false, + }, +} + + + +local function lsp() + local clients = vim.lsp.buf_get_clients() + if next(clients) == nil then + return + end + + for _, client in pairs(clients) do + return ("[" .. client.name .. "]") + end +end + +require('lualine').setup { + options = { + icons_enabled = true, + theme = 'base16', + component_separators = { left = '|', right = '|' }, + section_separators = { left = '', right = '' }, + disabled_filetypes = { + statusline = { 'neo-tree' }, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { 'filename' }, + lualine_x = { lsp }, + lualine_y = { 'filetype' }, + lualine_z = {} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { 'filename' }, + lualine_x = { 'location' }, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} +} + +require("telescope").load_extension('harpoon') + +-- LSP Setup +local lsp_zero = require('lsp-zero') + +lsp_zero.on_attach(function(client, bufnr) + lsp_zero.default_keymaps({ buffer = bufnr }) +end) +require 'lspconfig'.hls.setup {} +require 'lspconfig'.omnisharp.setup { + cmd = { "/home/fw/.nix-profile/bin/dotnet", "/nix/store/jdp56g0j6mf7yjvqy9npw28y4pxcvgsw-omnisharp-roslyn-1.39.10/lib/omnisharp-roslyn/OmniSharp.dll" }, +} +require 'lspconfig'.clojure_lsp.setup {} +require 'lspconfig'.nil_ls.setup {} +require 'lspconfig'.marksman.setup {} +require 'lspconfig'.pylsp.setup {} +require 'lspconfig'.bashls.setup {} +require 'lspconfig'.dockerls.setup {} +require 'lspconfig'.docker_compose_language_service.setup {} +require 'lspconfig'.ansiblels.setup {} +require 'lspconfig'.yamlls.setup {} +require 'lspconfig'.lua_ls.setup { + settings = { + Lua = { + diagnostics = { + globals = { 'vim' } + } + } + } +} + + +require("catppuccin").setup({ + flavour = "macchiato", + background = { + light = "latte", + dark = "mocha", + }, + transparent_background = false, + show_end_of_buffer = false, + term_colors = false, + dim_inactive = { + enabled = false, + shade = "dark", + percentage = 0.15, + }, + no_italic = false, + no_bold = false, + no_underline = false, + styles = { + comments = { "italic" }, + conditionals = { "italic" }, + loops = {}, + functions = {}, + keywords = {}, + strings = {}, + variables = {}, + numbers = {}, + booleans = {}, + properties = {}, + types = {}, + operators = {}, + }, + color_overrides = {}, + custom_highlights = {}, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + treesitter = true, + notify = false, + mini = { + enabled = true, + indentscope_color = "", + }, + }, +}) + +vim.cmd('colorscheme base16-catppuccin-macchiato') + +local cmp = require('cmp') + +cmp.setup({ + sources = { + { name = 'nvim_lsp' }, + }, + mapping = { + [''] = cmp.mapping.confirm({ select = false }), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.select_prev_item({ behavior = 'select' }), + [''] = cmp.mapping.select_next_item({ behavior = 'select' }), + [''] = cmp.mapping.select_next_item({ behavior = 'select' }), + [''] = cmp.mapping(function() + if cmp.visible() then + cmp.select_prev_item({ behavior = 'insert' }) + else + cmp.complete() + end + end), + [''] = cmp.mapping(function() + if cmp.visible() then + cmp.select_next_item({ behavior = 'insert' }) + else + cmp.complete() + end + end), + }, + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, +}) + diff --git a/moduler/common/nixpkgs.nix b/moduler/common/nixpkgs.nix new file mode 100644 index 0000000..5dd0532 --- /dev/null +++ b/moduler/common/nixpkgs.nix @@ -0,0 +1,12 @@ +{ pkgs, lib, ... }: +{ + nixpkgs = { + # Configure your nixpkgs instance + config = { + allowUnfree = true; + permittedInsecurePackages = [ + "electron-25.9.0" + ]; + }; + }; +} diff --git a/moduler/common/nvim.nix b/moduler/common/nvim.nix new file mode 100644 index 0000000..5e446bf --- /dev/null +++ b/moduler/common/nvim.nix @@ -0,0 +1,52 @@ +{ + config, + pkgs, + ... +}: { + home.packages = with pkgs; [ + ]; + programs = { + neovim = { + plugins = [ + ## Treesitter + pkgs.vimPlugins.nvim-treesitter + pkgs.vimPlugins.nvim-lspconfig + + pkgs.vimPlugins.plenary-nvim + pkgs.vimPlugins.telescope-nvim + pkgs.vimPlugins.telescope-fzf-native-nvim + + ## cmp + pkgs.vimPlugins.nvim-cmp + pkgs.vimPlugins.cmp-nvim-lsp + + pkgs.vimPlugins.luasnip + pkgs.vimPlugins.cmp_luasnip + pkgs.vimPlugins.vim-surround + pkgs.vimPlugins.vim-obsession + pkgs.vimPlugins.neoformat + pkgs.vimPlugins.lazygit-nvim + pkgs.vimPlugins.gitsigns-nvim + pkgs.vimPlugins.lualine-nvim + pkgs.vimPlugins.nvim-web-devicons + pkgs.vimPlugins.leap-nvim + pkgs.vimPlugins.vim-repeat + + ## Debugging + pkgs.vimPlugins.nvim-dap + pkgs.vimPlugins.nvim-dap-ui + pkgs.vimPlugins.nvim-dap-virtual-text + ]; + + extraConfig = '' + lua << EOF + ${builtins.readFile config/mappings.lua} + ${builtins.readFile config/options.lua} + ${builtins.readFile config/setup.lua} + ''; + enable = true; + viAlias = true; + vimAlias = true; + }; + }; +} diff --git a/moduler/common/spotifyd.nix b/moduler/common/spotifyd.nix new file mode 100644 index 0000000..a49a4d9 --- /dev/null +++ b/moduler/common/spotifyd.nix @@ -0,0 +1,10 @@ +{ pkgs, lib, myhostname, ... }: +{ + services.spotifyd = { + enable = true; + settings = { + username = "fredzyw"; + device_name = myhostname; + }; + }; +} diff --git a/moduler/common/ssh.nix b/moduler/common/ssh.nix new file mode 100644 index 0000000..7a7cc37 --- /dev/null +++ b/moduler/common/ssh.nix @@ -0,0 +1,20 @@ +{ pkgs, lib, ... }: +{ + programs.ssh = { + enable = true; + matchBlocks = { + "git.wastring.com" = { + hostname = "git.wastring.com"; + port = 55503; + user = "git"; + identityFile = "/home/fw/.ssh/gitea"; + }; + "wastring.com" = { + hostname = "wastring.com"; + port = 55502; + user = "fw"; + identityFile = "/home/fw/.ssh/id_ed25519"; + }; + }; + }; +} diff --git a/moduler/common/tmux.nix b/moduler/common/tmux.nix new file mode 100644 index 0000000..6f9c0d9 --- /dev/null +++ b/moduler/common/tmux.nix @@ -0,0 +1,47 @@ +{ pkgs, lib, ... }: +{ + programs.tmux = { + enable = true; + mouse = true; + plugins = with pkgs; [ + tmuxPlugins.sensible + tmuxPlugins.tmux-fzf + tmuxPlugins.pain-control + tmuxPlugins.sessionist + # tmuxPlugins.catppuccin + # tmuxPlugins.weather + tmuxPlugins.resurrect + tmuxPlugins.continuum + ]; + prefix = "C-a"; + terminal = "xterm-256color"; + keyMode = "vi"; + escapeTime = 0; + extraConfig = " + set -g @catppuccin_flavour 'macchiato' + set -g @catppuccin_window_left_separator '█' + set -g @catppuccin_window_right_separator '█ ' + set -g @catppuccin_window_number_position 'right' + set -g @catppuccin_window_middle_separator ' █' + + set -g @catppuccin_window_default_fill 'number' + + set -g @catppuccin_window_current_fill 'number' + set -g @catppuccin_window_current_text '#{pane_current_path}' + + set -g @catppuccin_status_left_separator '' + set -g @catppuccin_status_right_separator ' ' + set -g @catppuccin_status_fill 'all' + set -g @catppuccin_status_connect_separator 'yes' + run-shell ${pkgs.tmuxPlugins.catppuccin}/share/tmux-plugins/catppuccin/catppuccin.tmux + run-shell ${pkgs.tmuxPlugins.weather}/share/tmux-plugins/weather/weather.tmux + set -g @catppuccin_status_modules_right 'date_time weather' + set -g @catppuccin_window_number_position 'right' + set -g @continuum-boot 'on' + set -g @continuum-restore 'on' + set -g @resurrect-strategy-nvim 'session' + set -g @resurrect-capture-pane-contents 'on' + set -g @resurrect-processes 'nvim' + "; + }; +} diff --git a/moduler/common/zathura.nix b/moduler/common/zathura.nix new file mode 100644 index 0000000..9281315 --- /dev/null +++ b/moduler/common/zathura.nix @@ -0,0 +1,9 @@ +{ pkgs, lib, ... }: +{ + programs.zathura = { + enable = true; + options = { + selection-clipboard = "clipboard"; + }; + }; +} diff --git a/moduler/common/zsh-server.nix b/moduler/common/zsh-server.nix new file mode 100644 index 0000000..f355e8d --- /dev/null +++ b/moduler/common/zsh-server.nix @@ -0,0 +1,66 @@ +{ pkgs, lib, ... }: +{ + programs.zsh = { + enable = true; + initExtra = '' + [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh + export PATH=/home/fw/.local/bin:$PATH + ''; + plugins = with pkgs; [ + { + name = "zsh-z"; + file = "zsh-z.plugin.zsh"; + src = builtins.fetchGit { + url = "https://github.com/agkozak/zsh-z"; + rev = "afaf2965b41fdc6ca66066e09382726aa0b6aa04"; + }; + } + { + name = "powerlevel10k"; + src = pkgs.zsh-powerlevel10k; + file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + } + ]; + shellAliases = { + ls="ls --color=auto"; + ll="ls -al --color=auto"; + ccr="gcc intopt.c && ./a.out"; + homec="nvim ~/nix/config/home.nix"; + nvimc="nvim ~/.config/nvim/init.lua"; + sdg="sudo nix-collect-garbage -d"; + udg="nix-collect-garbage -d"; + df="df -h"; + c="clear"; + }; + enableCompletion = true; + initExtraBeforeCompInit = '' + # Lines configured by zsh-newuser-install + home() { + cd ~/nix/ && home-manager switch --flake ".#fw@$(hostname)"; + } + update() { + sudo nix-channel --update && sudo nixos-rebuild switch --upgrade --flake '.#$(hostname)' + } + reb() { + cd ~/nix/ && sudo nixos-rebuild switch --flake ".#$(hostname)" + } + + HISTFILE=~/.histfile + HISTSIZE=1000 + SAVEHIST=1000 + setopt autocd extendedglob + bindkey -v + bindkey '^R' history-incremental-search-backward + bindkey '^[[1;5C' emacs-forward-word + bindkey '^[[1;5D' emacs-backward-word + # End of lines configured by zsh-newuser-install + # The following lines were added by compinstall + zstyle :compinstall filename '/home/fw/.zshrc' + + # autoload -Uz compinit + autoload -U compinit; compinit + zstyle ':completion:*' menu select + + ''; + }; +} diff --git a/moduler/common/zsh.nix b/moduler/common/zsh.nix new file mode 100644 index 0000000..324a0c2 --- /dev/null +++ b/moduler/common/zsh.nix @@ -0,0 +1,71 @@ +{ pkgs, lib, ... }: +{ + programs.zsh = { + enable = true; + initExtra = '' + [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh + export PATH=/home/fw/.local/bin:$PATH + ''; + plugins = with pkgs; [ + { + name = "zsh-z"; + file = "zsh-z.plugin.zsh"; + src = builtins.fetchGit { + url = "https://github.com/agkozak/zsh-z"; + rev = "afaf2965b41fdc6ca66066e09382726aa0b6aa04"; + }; + } + { + name = "powerlevel10k"; + src = pkgs.zsh-powerlevel10k; + file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + } + ]; + profileExtra = " + if [[ -z $DISPLAY ]]; then + exec startx + fi + "; + shellAliases = { + ls="ls --color=auto"; + ll="ls -al --color=auto"; + ccr="gcc intopt.c && ./a.out"; + homec="nvim ~/nix/config/home.nix"; + nvimc="nvim ~/.config/nvim/init.lua"; + sdg="sudo nix-collect-garbage -d"; + udg="nix-collect-garbage -d"; + df="df -h"; + c="clear"; + }; + enableCompletion = true; + initExtraBeforeCompInit = '' + # Lines configured by zsh-newuser-install + home() { + cd ~/nix/ && home-manager switch --flake ".#fw@$(hostname)"; + } + update() { + sudo nix-channel --update && sudo nixos-rebuild switch --upgrade --flake '.#$(hostname)' + } + reb() { + cd ~/nix/ && sudo nixos-rebuild switch --flake ".#$(hostname)" + } + + HISTFILE=~/.histfile + HISTSIZE=1000 + SAVEHIST=1000 + setopt autocd extendedglob + bindkey -v + bindkey '^R' history-incremental-search-backward + bindkey '^[[1;5C' emacs-forward-word + bindkey '^[[1;5D' emacs-backward-word + # End of lines configured by zsh-newuser-install + # The following lines were added by compinstall + zstyle :compinstall filename '/home/fw/.zshrc' + + # autoload -Uz compinit + autoload -U compinit; compinit + zstyle ':completion:*' menu select + + ''; + }; +} diff --git a/themes/catppuccin.diff b/themes/catppuccin.diff new file mode 100644 index 0000000..78542a7 --- /dev/null +++ b/themes/catppuccin.diff @@ -0,0 +1,15 @@ +--- config.def.h 2024-04-02 16:17:57.987476429 +0200 ++++ config.def.h.bak 2024-04-02 16:17:42.234351421 +0200 +@@ -9,9 +9,9 @@ + static const char *prompt = NULL; /* -p option; prompt to the left of input field */ + static const char *colors[SchemeLast][2] = { + /* fg bg */ +- [SchemeNorm] = { "#cad3f5", "#24273a" }, +- [SchemeSel] = { "#181926", "#91d7e3" }, +- [SchemeOut] = { "#000000", "#91d7e3" }, ++ [SchemeNorm] = { "#bbbbbb", "#222222" }, ++ [SchemeSel] = { "#eeeeee", "#005577" }, ++ [SchemeOut] = { "#000000", "#00ffff" }, + }; + /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ + static unsigned int lines = 0; diff --git a/wallpapers/nix-black-4k.png b/wallpapers/nix-black-4k.png new file mode 100644 index 0000000..c1f20a2 Binary files /dev/null and b/wallpapers/nix-black-4k.png differ diff --git a/xresources b/xresources new file mode 100644 index 0000000..0a6242e --- /dev/null +++ b/xresources @@ -0,0 +1,34 @@ +*background: #24273A +*foreground: #CAD3F5 + +! black +*color0: #494D64 +*color8: #5B6078 + +! red +*color1: #ED8796 +*color9: #ED8796 + +! green +*color2: #A6DA95 +*color10: #A6DA95 + +! yellow +*color3: #EED49F +*color11: #EED49F + +! blue +*color4: #8AADF4 +*color12: #8AADF4 + +! magenta +*color5: #F5BDE6 +*color13: #F5BDE6 + +! cyan +*color6: #8BD5CA +*color14: #8BD5CA + +! white +*color7: #B8C0E0 +*color15: #A5ADCB