A => flake.nix +58 -0
@@ 1,58 @@
+#
+# flake.nix *
+# ├─ ./hosts
+# │ └─ default.nix
+# └─ ./nix
+# └─ default.nix
+#
+
+{
+ description = "My Personal NixOS and Darwin System Flake Configuration";
+
+ inputs = # All flake references used to build my NixOS setup. These are dependencies.
+ {
+ nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; # Default Stable Nix Packages
+ nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # Unstable Nix Packages
+ dslr.url = "github:nixos/nixpkgs/nixos-22.11"; # Quick fix
+
+ home-manager = { # User Package Management
+ url = "github:nix-community/home-manager/release-23.05";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ nur = { # NUR Packages
+ url = "github:nix-community/NUR"; # Add "nur.nixosModules.nur" to the host modules
+ };
+
+ nixgl = { # OpenGL
+ url = "github:guibou/nixGL";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ doom-emacs = { # Nix-community Doom Emacs
+ url = "github:nix-community/nix-doom-emacs";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ outputs = inputs @ { self, nixpkgs, nixpkgs-unstable, home-manager, darwin, nur, nixgl, dslr, doom-emacs, hyprland, plasma-manager, ... }: # Function that tells my flake which to use and what do what to do with the dependencies.
+ let # Variables that can be used in the config files.
+ user = "ruther";
+ location = "$HOME/.setup";
+ in # Use above variables in ...
+ {
+ nixosConfigurations = ( # NixOS configurations
+ import ./hosts { # Imports ./hosts/default.nix
+ inherit (nixpkgs) lib;
+ inherit inputs nixpkgs nixpkgs-unstable home-manager nur user location dslr doom-emacs hyprland plasma-manager; # Also inherit home-manager so it does not need to be defined here.
+ }
+ );
+
+ homeConfigurations = ( # Non-NixOS configurations
+ import ./nix {
+ inherit (nixpkgs) lib;
+ inherit inputs nixpkgs nixpkgs-unstable home-manager nixgl user;
+ }
+ );
+ };
+}
A => hosts/configuration.nix +168 -0
@@ 1,168 @@
+#
+# Main system configuration. More information available in configuration.nix(5) man page.
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ configuration.nix *
+# └─ ./modules
+# ├─ ./editors
+# │ └─ default.nix
+# └─ ./shell
+# └─ default.nix
+#
+
+{ config, lib, pkgs, inputs, user, ... }:
+
+{
+ imports =
+ (import ../modules/editors) ++ # Native doom emacs instead of nix-community flake
+ (import ../modules/shell);
+
+ users.users.${user} = { # System User
+ isNormalUser = true;
+ extraGroups = [ "wheel" "video" "audio" "camera" "networkmanager" "lp" "scanner" "kvm" "libvirtd" "plex" ];
+ shell = pkgs.zsh; # Default shell
+ };
+ security.sudo.wheelNeedsPassword = false; # User does not need to give password when using sudo.
+
+ time.timeZone = "Europe/Brussels"; # Time zone and internationalisation
+ i18n = {
+ defaultLocale = "en_US.UTF-8";
+ extraLocaleSettings = { # Extra locale settings that need to be overwritten
+ LC_TIME = "nl_BE.UTF-8";
+ LC_MONETARY = "nl_BE.UTF-8";
+ };
+ };
+
+ console = {
+ font = "Lat2-Terminus16";
+ keyMap = "us"; # or us/azerty/etc
+ };
+
+ security.rtkit.enable = true;
+ security.polkit.enable = true;
+
+ fonts.fonts = with pkgs; [ # Fonts
+ carlito # NixOS
+ vegur # NixOS
+ source-code-pro
+ jetbrains-mono
+ font-awesome # Icons
+ corefonts # MS
+ (nerdfonts.override { # Nerdfont Icons override
+ fonts = [
+ "FiraCode"
+ ];
+ })
+ ];
+
+ environment = {
+ variables = {
+ TERMINAL = "alacritty";
+ EDITOR = "nvim";
+ VISUAL = "nvim";
+ };
+ systemPackages = with pkgs; [ # Default packages installed system-wide
+ alsa-utils
+ jq
+ killall
+ nano
+ pciutils
+ pulseaudio
+ ripgrep
+ socat
+ usbutils
+ wget
+ ];
+ };
+
+ programs = {
+ thunar = {
+ enable = true;
+ plugins = with pkgs.xfce; [
+ thunar-archive-plugin
+ thunar-volman
+ thunar-media-tags-plugin
+ ];
+ };
+ };
+
+ services = {
+ tumbler.enable = true;
+ printing = { # Printing and drivers for TS5300
+ enable = true;
+ #drivers = [ pkgs.cnijfilter2 ]; # There is the possibility cups will complain about missing cmdtocanonij3. I guess this is just an error that can be ignored for now. Also no longer need required since server uses ipp to share printer over network.
+ };
+ avahi = { # Needed to find wireless printer
+ enable = true;
+ nssmdns = true;
+ publish = { # Needed for detecting the scanner
+ enable = true;
+ addresses = true;
+ userServices = true;
+ };
+ };
+ pipewire = { # Sound
+ enable = true;
+ alsa = {
+ enable = true;
+ support32Bit = true;
+ };
+ pulse.enable = true;
+ jack.enable = true;
+ };
+ openssh = { # SSH: secure shell (remote connection to shell of server)
+ enable = true; # local: $ ssh <user>@<ip>
+ # public:
+ # - port forward 22 TCP to server
+ # - in case you want to use the domain name insted of the ip:
+ # - for me, via cloudflare, create an A record with name "ssh" to the correct ip without proxy
+ # - connect via ssh <user>@<ip or ssh.domain>
+ # generating a key:
+ # - $ ssh-keygen | ssh-copy-id <ip/domain> | ssh-add
+ # - if ssh-add does not work: $ eval `ssh-agent -s`
+ allowSFTP = true; # SFTP: secure file transfer protocol (send file to server)
+ # connect: $ sftp <user>@<ip/domain>
+ # or with file browser: sftp://<ip address>
+ # commands:
+ # - lpwd & pwd = print (local) parent working directory
+ # - put/get <filename> = send or receive file
+ extraConfig = ''
+ HostKeyAlgorithms +ssh-rsa
+ ''; # Temporary extra config so ssh will work in guacamole
+ };
+ flatpak.enable = true; # download flatpak file from website - sudo flatpak install <path> - reboot if not showing up
+ # sudo flatpak uninstall --delete-data <app-id> (> flatpak list --app) - flatpak uninstall --unused
+ # List:
+ # com.obsproject.Studio
+ # com.parsecgaming.parsec
+ # com.usebottles.bottles
+ };
+
+ nix = { # Nix Package Manager settings
+ settings ={
+ auto-optimise-store = true; # Optimise syslinks
+ };
+ gc = { # Automatic garbage collection
+ automatic = true;
+ dates = "weekly";
+ options = "--delete-older-than 2d";
+ };
+ package = pkgs.nixVersions.unstable; # Enable nixFlakes on system
+ registry.nixpkgs.flake = inputs.nixpkgs;
+ extraOptions = ''
+ experimental-features = nix-command flakes
+ keep-outputs = true
+ keep-derivations = true
+ '';
+ };
+ nixpkgs.config.allowUnfree = true; # Allow proprietary software.
+
+ system = { # NixOS settings
+ #autoUpgrade = { # Allow auto update (not useful in flakes)
+ # enable = true;
+ # channel = "https://nixos.org/channels/nixos-unstable";
+ #};
+ stateVersion = "22.05";
+ };
+}
A => hosts/default.nix +202 -0
@@ 1,202 @@
+#
+# These are the different profiles that can be used when building NixOS.
+#
+# flake.nix
+# └─ ./hosts
+# ├─ default.nix *
+# ├─ configuration.nix
+# ├─ home.nix
+# └─ ./desktop OR ./laptop OR ./work OR ./vm
+# ├─ ./default.nix
+# └─ ./home.nix
+#
+
+{ lib, inputs, nixpkgs, nixpkgs-unstable, home-manager, nur, user, location, dslr, doom-emacs, hyprland, plasma-manager, ... }:
+
+let
+ system = "x86_64-linux"; # System architecture
+
+ pkgs = import nixpkgs {
+ inherit system;
+ config.allowUnfree = true; # Allow proprietary software
+ };
+
+ unstable = import nixpkgs-unstable {
+ inherit system;
+ config.allowUnfree = true; # Allow proprietary software
+ };
+
+ fix = import dslr {
+ inherit system;
+ config.allowUnfree = true; # Allow proprietary software
+ };
+
+ lib = nixpkgs.lib;
+in
+{
+ beelink = lib.nixosSystem { # Desktop profile
+ inherit system;
+ specialArgs = {
+ inherit inputs unstable system user location fix hyprland;
+ host = {
+ hostName = "beelink";
+ mainMonitor = "HDMI-A-1";
+ secondMonitor = "HDMI-A-2";
+ };
+ }; # Pass flake variable
+ modules = [ # Modules that are used.
+ nur.nixosModules.nur
+ ./beelink
+ ./configuration.nix
+
+ home-manager.nixosModules.home-manager { # Home-Manager module that is used.
+ home-manager.useGlobalPkgs = true;
+ home-manager.useUserPackages = true;
+ home-manager.extraSpecialArgs = {
+ inherit unstable user fix doom-emacs;
+ host = {
+ hostName = "beelink";
+ mainMonitor = "HDMI-A-1";
+ secondMonitor = "HDMI-A-2";
+ };
+ }; # Pass flake variable
+ home-manager.users.${user} = {
+ imports = [
+ ./home.nix
+ ./beelink/home.nix
+ ];
+ };
+ }
+ ];
+ };
+
+ laptop = lib.nixosSystem { # Laptop profile
+ inherit system;
+ specialArgs = {
+ inherit unstable inputs user location;
+ host = {
+ hostName = "laptop";
+ mainMonitor = "eDP-1";
+ };
+ };
+ modules = [
+ ./laptop
+ ./configuration.nix
+
+ home-manager.nixosModules.home-manager {
+ home-manager.useGlobalPkgs = true;
+ home-manager.useUserPackages = true;
+ home-manager.extraSpecialArgs = {
+ inherit unstable user;
+ host = {
+ hostName = "laptop";
+ mainMonitor = "eDP-1";
+ };
+ };
+ home-manager.users.${user} = {
+ imports = [(import ./home.nix)] ++ [(import ./laptop/home.nix)];
+ };
+ }
+ ];
+ };
+
+ work = lib.nixosSystem { # Work profile
+ inherit system;
+ specialArgs = {
+ inherit unstable system inputs user location hyprland;
+ host = {
+ hostName = "work";
+ mainMonitor = "eDP-1";
+ secondMonitor = "HDMI-A-2";
+ thirdMonitor = "DP-1";
+ };
+ };
+ modules = [
+ ./work
+ ./configuration.nix
+
+ home-manager.nixosModules.home-manager {
+ home-manager.useGlobalPkgs = true;
+ home-manager.useUserPackages = true;
+ home-manager.extraSpecialArgs = {
+ inherit unstable user;
+ host = {
+ hostName = "work";
+ mainMonitor = "eDP-1";
+ secondMonitor = "HDMI-A-2";
+ thirdMonitor = "DP-1";
+ };
+ };
+ home-manager.users.${user} = {
+ imports = [(import ./home.nix)] ++ [(import ./work/home.nix)];
+ };
+ }
+ ];
+ };
+
+ vm = lib.nixosSystem { # VM profile
+ inherit system;
+ specialArgs = {
+ inherit unstable inputs user location;
+ host = {
+ hostName = "vm";
+ mainMonitor = "Virtual-1";
+ };
+ };
+ modules = [
+ ./vm
+ ./configuration.nix
+
+ home-manager.nixosModules.home-manager {
+ home-manager.useGlobalPkgs = true;
+ home-manager.useUserPackages = true;
+ home-manager.extraSpecialArgs = {
+ inherit unstable user;
+ host = {
+ hostName = "vm";
+ mainMonitor = "Virtual-1";
+ };
+ };
+ home-manager.users.${user} = {
+ imports = [(import ./home.nix)] ++ [(import ./vm/home.nix)];
+ };
+ }
+ ];
+ };
+
+ desktop = lib.nixosSystem { # DEPRECATED Desktop profile
+ inherit system;
+ specialArgs = {
+ inherit inputs unstable system user location fix hyprland;
+ host = {
+ hostName = "desktop";
+ mainMonitor = "HDMI-A-1";
+ secondMonitor = "HDMI-A-2";
+ };
+ }; # Pass flake variable
+ modules = [ # Modules that are used.
+ nur.nixosModules.nur
+ ./desktop
+ ./configuration.nix
+
+ home-manager.nixosModules.home-manager { # Home-Manager module that is used.
+ home-manager.useGlobalPkgs = true;
+ home-manager.useUserPackages = true;
+ home-manager.extraSpecialArgs = {
+ inherit unstable user fix doom-emacs;
+ host = {
+ hostName = "desktop"; #For Xorg iGPU | Hyprland iGPU
+ mainMonitor = "HDMI-A-1"; #HDMIA3 | HDMI-A-3
+ secondMonitor = "HDMI-A-2"; #DP1 | DP-1
+ };
+ }; # Pass flake variable
+ home-manager.users.${user} = {
+ imports = [
+ ./home.nix
+ ./desktop/home.nix
+ ];
+ };
+ }
+ ];
+ };
+}
A => hosts/desktop/default.nix +108 -0
@@ 1,108 @@
+#
+# Specific system configuration settings for desktop
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ ./desktop
+# │ ├─ default.nix *
+# │ └─ hardware-configuration.nix
+# └─ ./modules
+# ├─ ./desktop
+# │ ├─ ./hyprland
+# │ │ └─ default.nix
+# │ └─ ./virtualisation
+# │ └─ default.nix
+# ├─ ./programs
+# │ └─ games.nix
+# └─ ./hardware
+# └─ default.nix
+#
+
+{ pkgs, lib, user, ... }:
+
+{
+ imports = # For now, if applying to other system, swap files
+ [(import ./hardware-configuration.nix)] ++ # Current system hardware config @ /etc/nixos/hardware-configuration.nix
+ [(import ../../modules/programs/games.nix)] ++ # Gaming
+ [(import ../../modules/programs/flatpak.nix)] ++ # Gaming
+ [(import ../../modules/desktop/hyprland/default.nix)] ++ # Window Manager
+ [(import ../../modules/hardware/dslr.nix)] ++ # Temp Fix DSLR Webcam
+ (import ../../modules/desktop/virtualisation) ++ # Virtual Machines & VNC
+ (import ../../modules/hardware); # Hardware devices
+
+ boot = { # Boot options
+ kernelPackages = pkgs.linuxPackages_latest;
+ initrd.kernelModules = [ "amdgpu" ]; # Video drivers
+
+ loader = { # For legacy boot:
+ systemd-boot = {
+ enable = true;
+ configurationLimit = 5; # Limit the amount of configurations
+ };
+ efi.canTouchEfiVariables = true;
+ timeout = 1; # Grub auto select time
+ };
+ };
+
+ hardware = {
+ sane = { # Used for scanning with Xsane
+ enable = true;
+ extraBackends = [ pkgs.sane-airscan ];
+ };
+ opengl = {
+ enable = true;
+ extraPackages = with pkgs; [
+ #intel-media-driver # iGPU
+ #vaapiIntel
+ # rocm-opencl-icd # AMD
+ # rocm-opencl-runtime
+ amdvlk
+ ];
+ extraPackages32 = with pkgs; [
+ driversi686Linux.amdvlk
+ ];
+ driSupport = true;
+ driSupport32Bit = true;
+ };
+ };
+
+ environment = { # Packages installed system wide
+ systemPackages = with pkgs; [ # This is because some options need to be configured.
+ discord
+ #plex
+ simple-scan
+ x11vnc
+ wacomtablet
+ clinfo
+ ];
+ #variables = {
+ # LIBVA_DRIVER_NAME = "i965";
+ #};
+ };
+
+ services = {
+ blueman.enable = true; # Bluetooth
+ samba = { # File Sharing over local network
+ enable = true; # Don't forget to set a password: $ smbpasswd -a <user>
+ shares = {
+ share = {
+ "path" = "/home/${user}";
+ "guest ok" = "yes";
+ "read only" = "no";
+ };
+ };
+ openFirewall = true;
+ };
+ };
+
+ nixpkgs.overlays = [ # This overlay will pull the latest version of Discord
+ (self: super: {
+ discord = super.discord.overrideAttrs (
+ _: { src = builtins.fetchTarball {
+ url = "https://discord.com/api/download?platform=linux&format=tar.gz";
+ sha256 = "1z980p3zmwmy29cdz2v8c36ywrybr7saw8n0w7wlb74m63zb9gpi";
+ };}
+ );
+ })
+ ];
+}
A => hosts/desktop/hardware-configuration.nix +145 -0
@@ 1,145 @@
+#
+# Hardware settings for my H310M S2H Desktop
+#
+# flake.nix
+# └─ ./hosts
+# └─ ./desktop
+# └─ hardware-configuration.nix *
+#
+# 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" "usb_storage" "usbhid" "uas" "sd_mod" ];
+ boot.initrd.kernelModules = [ ];
+ boot.kernelModules = [ "kvm-intel"];
+ boot.extraModulePackages = with config.boot.kernelPackages; [ ];
+
+ fileSystems."/" =
+ { #device = "/dev/disk/by-uuid/80e0d316-954b-4959-8c5d-06be7255a036";
+ device = "/dev/disk/by-label/nixos";
+ fsType = "ext4";
+ };
+
+ fileSystems."/boot" =
+ { #device = "/dev/disk/by-uuid/FCCC-9ECD";
+ device = "/dev/disk/by-label/boot";
+ fsType = "vfat";
+ };
+
+ #fileSystems."/ssd" =
+ # { #device = "/dev/disk/by-uuid/748e6628-0f4e-4479-8940-daa8531d3390";
+ # device = "/dev/disk/by-label/ssd";
+ # fsType = "ntfs";
+ # options = [ "nofail" ];
+ # };
+
+ #fileSystems."/hdd" =
+ # { #device = "/dev/disk/by-uuid/bbab0f8a-50f4-4a7c-a0d3-0ccb036f11d5";
+ # device = "/dev/disk/by-label/hdd";
+ # fsType = "ext4";
+ # options = [ "nofail" ];
+ # };
+
+ fileSystems."/mnt/toshiba1" =
+ { #device = "/dev/disk/by-uuid/7491ea96-a62d-4202-ada7-8d0310dfc967";
+ device = "/dev/disk/by-label/toshiba";
+ fsType = "ext4";
+ options = [ "nofail" ];
+ };
+
+ fileSystems."/mnt/toshiba2" =
+ { #device = "/dev/disk/by-uuid/21307718-de74-4a24-aaa7-dd09f7e89e32";
+ device = "/dev/disk/by-label/toshiba2";
+ fsType = "ext4";
+ options = [ "nofail" ];
+ };
+
+ fileSystems."/mnt/toshiba3" =
+ { #device = "/dev/disk/by-uuid/7f5e9ea1-2bc3-44c5-9b6a-d8fe2a311b73";
+ device = "/dev/disk/by-label/toshiba3";
+ fsType = "ext4";
+ options = [ "nofail" ];
+ };
+
+ fileSystems."/mnt/maxtor" =
+ { #device = "/dev/disk/by-uuid/36E6613DE660FE8D";
+ device = "/dev/disk/by-label/maxtor";
+ fsType = "ntfs";
+ options = [ "nofail" ];
+ };
+
+ fileSystems."/storage" =
+ { #truenas smb storage
+ device = "//192.168.0.3/storage";
+ fsType = "cifs";
+ options = let
+ automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
+ in ["${automount_opts},mfsymlinks,uid=1000,gid=100,credentials=/home/matthias/smb"];
+ };
+
+ fileSystems."/media" =
+ { #truenas smb storage
+ device = "//192.168.0.3/media";
+ fsType = "cifs";
+ options = let
+ automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
+ in ["${automount_opts},mfsymlinks,uid=1000,gid=100,credentials=/home/matthias/smb"];
+ };
+
+ #swapDevices =
+ # [
+ # { #device = "/dev/disk/by-uuid/7d0c3f66-c6eb-413c-956f-dfdd8ceb0cae";
+ # device = "/dev/disk/by-label/swap";
+ # }
+ # ];
+
+ powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
+ hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+
+ networking = {
+ useDHCP = false; # Deprecated
+ hostName = "desktop";
+ enableIPv6 = false;
+ bridges = { # Bridge so interface can be used with virtual machines
+ "br0" = {
+ interfaces = [ "enp3s0" ]; # enp2s0 without 16x PCI-e populated
+ };
+ };
+ interfaces = {
+ # enp2s0 = { # Change to correct network driver
+ # #useDHCP = true; # Disabled because fixed ip
+ # ipv4.addresses = [ { # Ip settings: *.0.50 for main machine
+ # address = "192.168.0.50";
+ # prefixLength = 24;
+ # } ];
+ # };
+ # wlp1s0.useDHCP = true; # Wireless card
+ br0.ipv4.addresses = [{
+ address = "192.168.0.50";
+ prefixLength = 24;
+ } ];
+ };
+ defaultGateway = "192.168.0.1";
+ nameservers = [ "192.168.0.4" "1.1.1.1"]; # Pi-Hole DNS
+ #nameservers = [ "1.1.1.1" "1.0.0.1" ]; # Cloudflare (when Pi-Hole is down)
+ };
+
+ #services.hostapd = { # Wifi hotspot
+ # enable = true;
+ # interface = "wlp1s0";
+ # ssid = "desktop";
+ # wpaPassphrase = "<password>";
+ # extraConfig = ''
+ # bridge=br0
+ # '';
+ #};
+}
A => hosts/desktop/home.nix +35 -0
@@ 1,35 @@
+#
+# Home-manager configuration for desktop
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ ./desktop
+# │ └─ ./home.nix
+# └─ ./modules
+# └─ ./desktop
+# └─ ./hyprland
+# └─ home.nix
+#
+
+{ pkgs, ... }:
+
+{
+ imports =
+ [
+ ../../modules/desktop/hyprland/home.nix # Window Manager
+ ];
+
+ home = { # Specific packages for desktop
+ packages = with pkgs; [
+ # Applications
+ ansible # Automation
+ sshpass # Ansible Dependency
+ hugo # Static Website Builder
+
+ # Dependencies
+ ispell # Emacs spelling
+
+ #steam # Game Launcher
+ ];
+ };
+}
A => hosts/home.nix +182 -0
@@ 1,182 @@
+#
+# General Home-manager configuration
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ home.nix *
+# └─ ./modules
+# ├─ ./programs
+# │ └─ default.nix
+# └─ ./services
+# └─ default.nix
+#
+
+{ config, lib, pkgs, unstable, user, ... }:
+
+{
+ imports = # Home Manager Modules
+ (import ../modules/programs) ++
+ (import ../modules/services);
+
+ home = {
+ username = "${user}";
+ homeDirectory = "/home/${user}";
+
+ packages = with pkgs; [
+ # Terminal
+ gtop # Resource Manager
+ htop # Resource Manager
+ ranger # File Manager
+ tldr # Helper
+ lazygit # Git tool
+
+ # Video/Audio
+ feh # Image Viewer
+ mpv # Media Player
+ pavucontrol # Audio Control
+ vlc # Media Player
+
+ # Apps
+ firefox # Browser
+ chromium # Browser
+
+ # File Management
+ zathura # PDF Viewer
+ evince # PDF Viewer
+ rsync # Syncer - $ rsync -r dir1/ dir2/
+ unzip # Zip Files
+ unrar # Rar Files
+ zip # Zip
+
+ # General configuration
+ alsa-utils # Audio Commands
+ git # Repositories
+ #jq # JSON processor
+ procps # Stop Applications
+ #pciutils # Computer Utility Info
+ pipewire # Sound
+ #usbutils # USB Utility Info
+ wacomtablet # Wacom Tablet
+ wget # Downloader
+ #socat # Data Transfer
+ #thunar # File Manager
+ #zsh # Shell
+ #
+ # General home-manager
+ alacritty # Terminal Emulator
+ #dunst # Notifications
+ #libnotify # Dependency for Dunst
+ #neovim # Text Editor
+ #rofi # Menu
+ #rofi-power-menu # Power Menu
+ #udiskie # Auto Mounting
+ vim # Text Editor
+ #
+ # Xorg configuration
+ #xclip # Console Clipboard
+ #xorg.xev # Input Viewer
+ #xorg.xkill # Kill Applications
+ #xorg.xrandr # Screen Settings
+ #xterm # Terminal
+ #
+ # Xorg home-manager
+ flameshot # Screenshot
+ picom # Compositer
+ #
+ # Wayland configuration
+ #autotiling # Tiling Script
+ #eww-wayland # Bar
+ #grim # Image Grabber
+ #slurp # Region Selector
+ #swappy # Screenshot Editor
+ #swayidle # Idle Management Daemon
+ #waybar # Bar
+ #wev # Input Viewer
+ #wl-clipboard # Console Clipboard
+ #wlr-randr # Screen Settings
+ #xwayland # X for Wayland
+ #
+ # Wayland home-manager
+ #pamixer # Pulse Audio Mixer
+ #swaylock-fancy # Screen Locker
+ #
+ # Desktop
+ #ansible # Automation
+ blueman # Bluetooth
+ #deluge # Torrents
+ discord # Chat
+ telegram-desktop # Chat
+ cinny-desktop # Chat
+ ffmpeg # Video Support (dslr)
+ #gmtp # Mount MTP (GoPro)
+ #gphoto2 # Digital Photography
+ #handbrake # Encoder
+ #heroic # Game Launcher
+ #hugo # Static Website Builder
+ #lutris # Game Launcher
+ #mkvtoolnix # Matroska Tool
+ #nvtop # Videocard Top
+ #plex-media-player# Media Player
+ #prismlauncher # MC Launcher
+ #steam # Games
+ #simple-scan # Scanning
+ #sshpass # Ansible dependency
+ #
+ # Laptop
+ #cbatticon # Battery Notifications
+ #blueman # Bluetooth
+ #light # Display Brightness
+ #libreoffice # Office Tools
+ #simple-scan # Scanning
+ #
+ # Flatpak
+ obs-studio # Recording/Live Streaming
+ thunderbird # email client
+ spotify
+ obsidian # Text Editor
+ ];
+ file.".config/wall".source = ../modules/themes/wall;
+ pointerCursor = { # This will set cursor system-wide so applications can not choose their own
+ gtk.enable = true;
+ #name = "Dracula-cursors";
+ name = "Catppuccin-Mocha-Dark-Cursors";
+ #package = pkgs.dracula-theme;
+ package = pkgs.catppuccin-cursors.mochaDark;
+ size = 16;
+ };
+ stateVersion = "22.05";
+ };
+
+ programs = {
+ home-manager.enable = true;
+ };
+
+ gtk = { # Theming
+ enable = true;
+ theme = {
+ #name = "Dracula";
+ name = "Catppuccin-Mocha-Compact-Blue-Dark";
+ #package = pkgs.dracula-theme;
+ package = pkgs.catppuccin-gtk.override {
+ accents = ["blue"];
+ size = "compact";
+ variant = "mocha";
+ };
+ };
+ iconTheme = {
+ name = "Papirus-Dark";
+ package = pkgs.papirus-icon-theme;
+ };
+ font = {
+ #name = "JetBrains Mono Medium";
+ name = "FiraCode Nerd Font Mono Medium";
+ }; # Cursor is declared under home.pointerCursor
+ };
+
+ systemd.user.targets.tray = { # Tray.target can not be found when xsession is not enabled. This fixes the issue.
+ Unit = {
+ Description = "Home Manager System Tray";
+ Requires = [ "graphical-session-pre.target" ];
+ };
+ };
+}
A => hosts/laptop/default.nix +99 -0
@@ 1,99 @@
+#
+# Specific system configuration settings for desktop
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ ./laptop
+# │ ├─ default.nix *
+# │ └─ hardware-configuration.nix
+# └─ ./modules
+# ├─ ./desktop
+# │ ├─ ./bspwm
+# │ │ └─ default.nix
+# │ └─ ./virtualisation
+# │ └─ docker.nix
+# └─ ./hardware
+# └─ default.nix
+#
+
+{ config, pkgs, user, ... }:
+
+{
+ imports = # For now, if applying to other system, swap files
+ [(import ./hardware-configuration.nix)] ++ # Current system hardware config @ /etc/nixos/hardware-configuration.nix
+ [(import ../../modules/desktop/bspwm/default.nix)] ++ # Window Manager
+ [(import ../../modules/desktop/virtualisation/docker.nix)] ++ # Docker
+ (import ../../modules/hardware); # Hardware devices
+
+ boot = { # Boot options
+ kernelPackages = pkgs.linuxPackages_latest;
+
+ loader = { # EFI Boot
+ efi = {
+ canTouchEfiVariables = true;
+ efiSysMountPoint = "/boot";
+ };
+ grub = { # Most of grub is set up for dual boot
+ enable = true;
+ devices = [ "nodev" ];
+ efiSupport = true;
+ useOSProber = true; # Find all boot options
+ configurationLimit = 2;
+ };
+ timeout = 1; # Grub auto select time
+ };
+ };
+
+ hardware.sane = { # Used for scanning with Xsane
+ enable = true;
+ extraBackends = [ pkgs.sane-airscan ];
+ };
+
+ environment = {
+ systemPackages = with pkgs; [
+ simple-scan
+ ];
+ };
+
+ programs = { # No xbacklight, this is the alterantive
+ dconf.enable = true;
+ light.enable = true;
+ };
+
+ services = {
+ tlp.enable = true; # TLP and auto-cpufreq for power management
+ #logind.lidSwitch = "ignore"; # Laptop does not go to sleep when lid is closed
+ auto-cpufreq.enable = true;
+ blueman.enable = true;
+ printing = { # Printing and drivers for TS5300
+ enable = true;
+ drivers = [ pkgs.cnijfilter2 ];
+ };
+ avahi = { # Needed to find wireless printer
+ enable = true;
+ nssmdns = true;
+ publish = { # Needed for detecting the scanner
+ enable = true;
+ addresses = true;
+ userServices = true;
+ };
+ };
+ samba = {
+ enable = true;
+ shares = {
+ share = {
+ "path" = "/home/${user}";
+ "guest ok" = "no";
+ "read only" = "no";
+ };
+ };
+ openFirewall = true;
+ };
+ };
+
+ #temporary bluetooth fix
+ systemd.tmpfiles.rules = [
+ "d /var/lib/bluetooth 700 root root - -"
+ ];
+ systemd.targets."bluetooth".after = ["systemd-tmpfiles-setup.service"];
+}
A => hosts/laptop/hardware-configuration.nix +69 -0
@@ 1,69 @@
+#
+# Hardware settings for HP ProBook 650 G1 15.6" Laptop
+# Dual boot active. Windows @ sda4 / NixOS @ sda5
+#
+# flake.nix
+# └─ ./hosts
+# └─ ./laptop
+# └─ hardware-configuration.nix *
+#
+# 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" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
+ boot.initrd.kernelModules = [ ];
+ boot.kernelModules = [ "kvm-intel" ];
+ boot.extraModulePackages = [ ];
+
+ fileSystems."/" =
+ { device = "/dev/disk/by-label/nixos";
+ fsType = "ext4";
+ };
+
+ fileSystems."/boot" =
+ { device = "/dev/disk/by-uuid/6E06-6221";
+ fsType = "vfat";
+ };
+
+ swapDevices = [ ];
+
+ networking = {
+ useDHCP = false; # Deprecated
+ hostName = "laptop";
+ networkmanager.enable = true;
+ interfaces = {
+ enp0s25 = {
+ useDHCP = true; # For versatility sake, manually edit IP on nm-applet.
+ #ipv4.addresses = [ {
+ # address = "192.168.0.51";
+ # prefixLength = 24;
+ #} ];
+ };
+ wlo1 = {
+ useDHCP = true;
+ #ipv4.addresses = [ {
+ # address = "192.168.0.51";
+ # prefixLength = 24;
+ #} ];
+ };
+ };
+ defaultGateway = "192.168.0.1";
+ nameservers = [ "192.168.0.4" ];
+ firewall = {
+ enable = false;
+ #allowedUDPPorts = [ 53 67 ];
+ #allowedTCPPorts = [ 53 80 443 9443 ];
+ };
+ };
+
+ hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+}
A => hosts/laptop/home.nix +49 -0
@@ 1,49 @@
+#
+# Home-manager configuration for laptop
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ ./laptop
+# │ └─ home.nix *
+# └─ ./modules
+# └─ ./desktop
+# └─ ./bspwm
+# └─ home.nix
+#
+
+{ pkgs, ... }:
+
+{
+ imports =
+ [
+ ../../modules/desktop/bspwm/home.nix # Window Manager
+ ];
+
+ home = { # Specific packages for laptop
+ packages = with pkgs; [
+ # Applications
+ libreoffice # Office packages
+
+ # Display
+ #light # xorg.xbacklight not supported. Other option is just use xrandr.
+
+ # Power Management
+ #auto-cpufreq # Power management
+ #tlp # Power management
+ ];
+ };
+
+ programs = {
+ alacritty.settings.font.size = 11;
+ };
+
+ services = { # Applets
+ network-manager-applet.enable = true; # Network
+# cbatticon = {
+# enable = true;
+# criticalLevelPercent = 10;
+# lowLevelPercent = 20;
+# iconType = null;
+# };
+ };
+}
A => hosts/vm/default.nix +43 -0
@@ 1,43 @@
+#
+# Specific system configuration settings for desktop
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ ./vm
+# │ ├─ default.nix *
+# │ └─ hardware-configuration.nix
+# └─ ./modules
+# └─ ./desktop
+# └─ ./bspwm
+# └─ bspwm.nix
+#
+
+{ config, pkgs, ... }:
+
+{
+ imports = [ # For now, if applying to other system, swap files
+ ./hardware-configuration.nix # Current system hardware config @ /etc/nixos/hardware-configuration.nix
+ ../../modules/desktop/gnome/default.nix # Window Manager
+ ];
+
+ boot = { # Boot options
+ kernelPackages = pkgs.linuxPackages_latest;
+
+ loader = { # For legacy boot
+ grub = {
+ enable = true;
+ device = "/dev/sda"; # Name of hard drive (can also be vda)
+ };
+ timeout = 1; # Grub auto select timeout
+ };
+ };
+
+ services = {
+ xserver = {
+ resolutions = [
+ { x = 1920; y = 1080; }
+ { x = 1920; y = 1080; }
+ ];
+ };
+ };
+}
A => hosts/vm/hardware-configuration.nix +33 -0
@@ 1,33 @@
+# 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 + "/profiles/qemu-guest.nix")
+ ];
+
+ boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
+ boot.initrd.kernelModules = [ ];
+ boot.kernelModules = [ "kvm-amd" ];
+ boot.extraModulePackages = [ ];
+
+ fileSystems."/" =
+ { device = "/dev/disk/by-uuid/d023b129-caaa-46c4-9848-52c712760b2a";
+ fsType = "ext4";
+ };
+
+ swapDevices =
+ [ { device = "/dev/disk/by-uuid/aa498dcc-a914-4730-ae9d-ea23dca89ccb"; }
+ ];
+
+ # 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.<interface>.useDHCP`.
+ networking.useDHCP = lib.mkDefault true;
+ # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
+
+ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+}
A => hosts/vm/home.nix +26 -0
@@ 1,26 @@
+#
+# Home-manager configuration for desktop
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ ./vm
+# │ └─ home.nix *
+# └─ ./modules
+# └─ ./desktop
+# └─ ./bspwm
+# └─ home.nix
+#
+
+{ pkgs, ... }:
+
+{
+ imports =
+ [
+ ../../modules/desktop/qtile/home.nix #Window Manager
+ ];
+
+ home = { # Specific packages for desktop
+ packages = with pkgs; [
+ ];
+ };
+}
A => modules/desktop/gnome/default.nix +60 -0
@@ 1,60 @@
+#
+# Gnome configuration
+#
+
+{ config, lib, pkgs, ... }:
+
+{
+ programs = {
+ zsh.enable = true;
+ dconf.enable = true;
+ kdeconnect = { # For GSConnect
+ enable = true;
+ package = pkgs.gnomeExtensions.gsconnect;
+ };
+ };
+
+ services = {
+ xserver = {
+ enable = true;
+
+ layout = "us, cz"; # Keyboard layout & €-sign
+ xkbLayout = ", qwerty";
+ xkbOptions = "eurosign:e";
+ libinput.enable = true;
+ modules = [ pkgs.xf86_input_wacom ]; # Both needed for wacom tablet usage
+ wacom.enable = true;
+
+ displayManager.gdm.enable = true; # Display Manager
+ desktopManager.gnome.enable = true; # Window Manager
+ };
+ udev.packages = with pkgs; [
+ gnome.gnome-settings-daemon
+ ];
+ };
+
+ hardware.pipewire.enable = false;
+
+ environment = {
+ systemPackages = with pkgs; [ # Packages installed
+ gnome.dconf-editor
+ gnome.gnome-tweaks
+ gnome.adwaita-icon-theme
+ ];
+ gnome.excludePackages = (with pkgs; [ # Gnome ignored packages
+ gnome-tour
+ ]) ++ (with pkgs.gnome; [
+ gedit
+ epiphany
+ geary
+ gnome-characters
+ tali
+ iagno
+ hitori
+ atomix
+ yelp
+ gnome-contacts
+ gnome-initial-setup
+ ]);
+ };
+}
A => modules/desktop/gnome/home.nix +204 -0
@@ 1,204 @@
+#
+# Gnome Home-Manager Configuration
+#
+# Dconf settings can be found by running "$ dconf watch /"
+#
+
+{ config, lib, pkgs, ... }:
+
+{
+ dconf.settings = {
+ "org/gnome/shell" = {
+ favorite-apps = [
+ "org.gnome.Settings.desktop"
+ "Alacritty.desktop"
+ "firefox.desktop"
+ "emacs.desktop"
+ "org.gnome.Nautilus.desktop"
+ "smartcode-stremio.desktop"
+ "discord.desktop"
+ "telegram-desktop.desktop"
+ "steam.desktop"
+ "retroarch.desktop"
+ "com.parsecgaming.parsec.desktop"
+ "org.remmina.Remmina.desktop"
+ "virt-manager.desktop"
+ "blueman-manager.desktop"
+ "pavucontrol.desktop"
+ ];
+ disable-user-extensions = false;
+ enabled-extensions = [
+ ];
+ };
+
+ "org/gnome/desktop/interface" = {
+ color-scheme = "prefer-dark";
+ enable-hot-corners = false;
+ clock-show-weekday = true;
+ gtk-theme = "Adwaita-dark";
+ };
+ "org/gnome/desktop/privacy" = {
+ report-technical-problems = "false";
+ };
+ "org/gnome/desktop/calendar" = {
+ show-weekdate = true;
+ };
+ "org/gnome/desktop/wm/preferences" = {
+ action-right-click-titlebar = "toggle-maximize";
+ action-middle-click-titlebar = "minimize";
+ resize-with-right-button = true;
+ mouse-button-modifier = "<Super>";
+ button-layout = ":minimize,close";
+ };
+ "org/gnome/desktop/wm/keybindings" = {
+ # maximize = ["<Super>Up"]; # For floating
+ # unmaximize = ["<Super>Down"];
+ maximize = ["@as []"]; # For tilers
+ unmaximize = ["@as []"];
+ switch-to-workspace-left = ["<Alt>Left"];
+ switch-to-workspace-right = ["<Alt>Right"];
+ switch-to-workspace-1 = ["<Alt>1"];
+ switch-to-workspace-2 = ["<Alt>2"];
+ switch-to-workspace-3 = ["<Alt>3"];
+ switch-to-workspace-4 = ["<Alt>4"];
+ switch-to-workspace-5 = ["<Alt>5"];
+ move-to-workspace-left = ["<Shift><Alt>Left"];
+ move-to-workspace-right = ["<Shift><Alt>Right"];
+ move-to-workspace-1 = ["<Shift><Alt>1"];
+ move-to-workspace-2 = ["<Shift><Alt>2"];
+ move-to-workspace-3 = ["<Shift><Alt>3"];
+ move-to-workspace-4 = ["<Shift><Alt>4"];
+ move-to-workspace-5 = ["<Shift><Alt>5"];
+ move-to-monitor-left = ["<Super><Alt>Left"];
+ move-to-monitor-right = ["<Super><Alt>Right"];
+ close = ["<Super>q" "<Alt>F4"];
+ toggle-fullscreen = ["<Super>f"];
+ };
+
+ "org/gnome/mutter" = {
+ workspaces-only-on-primary = false;
+ center-new-windows = true;
+ edge-tiling = false; # Disabled when tiling
+ };
+ "org/gnome/mutter/keybindings" = {
+ #toggle-tiled-left = ["<Super>Left"]; # For floating
+ #toggle-tiled-right = ["<Super>Right"];
+ toggle-tiled-left = ["@as []"]; # For tilers
+ toggle-tiled-right = ["@as []"];
+ };
+
+ "org/gnome/settings-daemon/plugins/power" = {
+ sleep-interactive-ac-type = "nothing";
+ };
+ "org/gnome/settings-daemon/plugins/media-keys" = {
+ custom-keybindings = [
+ "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
+ "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/"
+ "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/"
+ ];
+ };
+ "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
+ binding = "<Super>Return";
+ command = "alacritty";
+ name = "open-terminal";
+ };
+ "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
+ binding = "<Super>t";
+ command = "emacs";
+ name = "open-editor";
+ };
+ "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2" = {
+ binding = "<Super>e";
+ command = "nautilus";
+ name = "open-file-browser";
+ };
+
+ "org/gnome/shell/extension/dash-to-panel" = { # Possibly need to set this manually
+ panel-position = ''{"0":"TOP","1":"Top"}'';
+ panel-sizes = ''{"0":24,"1":24}'';
+ panel-element-positions-monitors-sync = true;
+ appicon-margin = 0;
+ appicon-padding = 4;
+ dot-position = "TOP";
+ dot-style-focused = "SOLID";
+ dot-style-unfocused = "DOTS";
+ animate-appicon-hover = true;
+ animate-appicon-hover-animation-travel = "{'SIMPLE': 0.14999999999999999, 'RIPPLE': 0.40000000000000002, 'PLANK': 0.0}";
+ isolate-monitors = true;
+ };
+ "org/gnome/shell/extensions/just-perfection" = {
+ theme = true;
+ activities-button = false;
+ app-menu = false;
+ clock-menu-position = 1;
+ clock-menu-position-offset = 7;
+ };
+ "org/gnome/shell/extensions/caffeine" = {
+ enable-fullscreen = true;
+ restore-state = true;
+ show-indicator = true;
+ show-notification = false;
+ };
+ "org/gnome/shell/extensions/blur-my-shell" = {
+ brightness = 0.9;
+ };
+ "org/gnome/shell/extensions/blur-my-shell/panel" = {
+ customize = true;
+ sigma = 0;
+ };
+ "org/gnome/shell/extensions/blur-my-shell/overview" = { # Temporary = D2D Bug
+ customize = true;
+ sigma = 0;
+ };
+ "org/gnome/shell/extensions/horizontal-workspace-indicator" = {
+ widget-position = "left";
+ widget-orientation = "horizontal";
+ icons-style = "circles";
+ };
+ "org/gnome/shell/extensions/bluetooth-quick-connect" = {
+ show-battery-icon-on = true;
+ show-battery-value-on = true;
+ };
+ "org/gnome/shell/extensions/pip-on-top" = {
+ stick = true;
+ };
+ "org/gnome/shell/extensions/forge" = {
+ window-gap-size = 8;
+ dnd-center-layout = "stacked";
+ };
+ "org/gnome/shell/extensions/forge/keybindings" = { # Set active colors manually
+ focus-border-toggle = true;
+ float-always-on-top-enabled = true;
+ window-focus-up = ["<Super>Up"];
+ window-focus-down = ["<Super>Down"];
+ window-focus-left = ["<Super>Left"];
+ window-focus-right = ["<Super>Right"];
+ # window-swap-up = ["<Shift><Super>Up"];
+ # window-swap-down = ["<Shift><Super>Down"];
+ # window-swap-left = ["<Shift><Super>Left"];
+ # window-swap-right = ["<Shift><Super>Right"];
+ window-move-up = ["<Shift><Super>Up"];
+ window-move-down = ["<Shift><Super>Down"];
+ window-move-left = ["<Shift><Super>Left"];
+ window-move-right = ["<Shift><Super>Right"];
+ window-swap-last-active = ["@as []"];
+ window-toggle-float = ["<Shift><Super>f"];
+ };
+ # "org/gnome/shell/extensions/dash-to-dock" = { # If dock if preferred
+ # multi-monitor = true;
+ # dock-fixed = true;
+ # dash-max-icon-size = 16;
+ # custom-theme-shrink = true;
+ # transparency-mode = "FIXED";
+ # background-opacity = 0.0;
+ # show-apps-at-top = true;
+ # show-trash = true;
+ # hot-keys = false;
+ # click-action = "previews";
+ # scroll-action = "cycle-windows";
+ # };
+ };
+
+ home.packages = with pkgs; [
+ ];
+}
A => modules/desktop/virtualisation/default.nix +18 -0
@@ 1,18 @@
+#
+# Specific system configuration settings for desktop
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ ./desktop
+# │ └─ default.nix
+# └─ ./modules
+# └─ ./desktop
+# └─ ./virtualisation
+# └─ default.nix *
+#
+
+[
+ ./docker.nix
+ ./qemu.nix
+ ./x11vnc.nix
+]
A => modules/desktop/virtualisation/docker.nix +23 -0
@@ 1,23 @@
+#
+# Docker
+#
+
+{ config, pkgs, user, ... }:
+
+{
+ virtualisation = {
+ docker.enable = true;
+ };
+
+ users.groups.docker.members = [ "${user}" ];
+
+ #environment = {
+ # interactiveShellInit = ''
+ # alias rtmp='docker start nginx-rtmp'
+ # ''; # Alias to easily start container
+ #};
+
+ environment.systemPackages = with pkgs; [
+ docker-compose
+ ];
+}
A => modules/desktop/virtualisation/qemu.nix +230 -0
@@ 1,230 @@
+#
+# Qemu/KVM with virt-manager
+#
+
+{ config, pkgs, user, ... }:
+
+{ # Add libvirtd and kvm to userGroups
+ boot.extraModprobeConfig = ''
+ options kvm_intel nested=1
+ options kvm_intel emulate_invalid_guest_state=0
+ options kvm ignore_nsrs=1
+ ''; # Needed to run OSX-KVM
+
+ users.groups.libvirtd.members = [ "root" "${user}" ];
+
+ virtualisation = {
+ libvirtd = {
+ enable = true; # Virtual drivers
+ #qemuPackage = pkgs.qemu_kvm; # Default
+ qemu = {
+ verbatimConfig = ''
+ nvram = [ "${pkgs.OVMF}/FV/OVMF.fd:${pkgs.OVMF}/FV/OVMF_VARS.fd" ]
+ '';
+ swtpm.enable = true;
+ };
+ };
+ spiceUSBRedirection.enable = true; # USB passthrough
+ };
+
+ environment = {
+ systemPackages = with pkgs; [
+ virt-manager
+ virt-viewer
+ qemu
+ OVMF
+ gvfs # Used for shared folders between Linux and Windows
+ swtpm
+ ];
+ };
+
+ services = { # Enable file sharing between OS
+ gvfs.enable = true;
+ };
+
+ #boot ={
+ # kernelParams = [ "intel_iommu=on" "vfio" "vfio_iommu_type1" "vfio_pci" "vfio_virqfd" ]; # or amd_iommu (cpu)
+ # kernelModules = [ "vendor-reset" "vfio" "vfio_iommu_type1" "vfio_pci" "vfio_virqfd"];
+ # extraModulePackages = [ config.boot.kernelPackages.vendor-reset ]; # Presumably fix for GPU Reset Bug
+ # extraModprobeConfig = "options vfio-pci ids=1002:67DF,1002:AAF0"; # grep PCI_ID /sys/bus/pci/devices/*/uevent
+ # kernelPatches = [
+ # {
+ # name = "vendor-reset-reqs-and-other-stuff";
+ # patch = null;
+ # extraConfig = ''
+ # FTRACE y
+ # KPROBES y
+ # FUNCTION_TRACER y
+ # HWLAT_TRACER y
+ # TIMERLAT_TRACER y
+ # IRQSOFF_TRACER y
+ # OSNOISE_TRACER y
+ # PCI_QUIRKS y
+ # KALLSYMS y
+ # KALLSYMS_ALL y
+ # '';
+ # }
+ # ];
+ #};
+}
+
+#SHARED FOLDER
+#FOR WINDOWS
+# 3 options:
+#
+# 1. Make use of host samba server
+# 1.0 Samba is installed by default. The network-shared folder is at /home/<user>/share.
+# 1.1 On host, set a password for the autentication of the samba server
+# 1.2 $ smbpasswd -a <user>
+# 1.3 Give password twice
+# 1.4 On windows, open file explorer, right click "This PC", Map network drive...
+# 1.5 fill in address: \\<ip-address>\share
+# 1.6 Log in with details entered beforehand
+#
+# 2. Since this setup make use of iommu, you can pass through external usb hard drives or a specific PCI storage devices
+# 2.1 Open details of virtual desktop in virt-manager
+# 2.2 Add hardware
+# 2.3 USB Host Device
+# 2.4 Select device and launch virtual desktop
+#
+# 3. Set up shared folders in windows guest that can be accessed by host
+# 3.0. Enable above service gvfs (this is used in the file manager to actually connect to the windows directory)
+# 3.1. Log in to Windows
+# 3.2. Go to "Network and Sharing Center"
+# 3.3. Click "Change advanced sharing settings" and enable all settings for Private, Guest or Public and All Networks
+# 3.3.1. Under "All Networks" you can disable "Password protected sharing" but it seems for optimal use, it's better to still give the password in the file manager
+# 3.4. (possibly optional), select a folder and click "Properties", "Sharing", "Advanced Sharing"
+# 3.4.1. Enable "Share this file"
+# 3.4.2. Under "Permissions", allow full control. Apply
+# 3.5. Click "Share" and use de drop down to add "Everyone" and change "Permission Level" to "Read/Write". Share, Done
+# 3.6. Search for services and open menu
+# 3.6.1. Search for below serices. Right click and select "Properties". "Startup type" = Automatic
+# 3.6.1.1. SSDP Discovery
+# 3.6.1.2. uPnPDevice Host
+# 3.6.1.3. Functions Discovery Provider Host
+# 3.6.1.4. Functions Discovery Resource Publication
+# 3.7. Find IP of virtual device and make sure you can ping it.
+# 3.8. In file manager add connection
+# 3.8.1. For example in PCManFM
+# 3.8.2. Search for smb://*ip*/
+# 3.8.3. You can even specify specific folder smb://*ip*/users/Matthias/Desktop/share
+# 3.8.4. If prompted to log in, do it, otherwise it might close on its own.
+# 3.9. If there are any issues, maybe disable firewall on guest
+# 3.10. Recommended to bookmark location for later
+# Note:
+# There is no passthrough, its recommended to install the windows kvm guest drivers.
+# Can be found on github.com/virtio-win/virtio-win-pkg-scripts/blob/master/README.md
+# Add this as CD storage in virt manager
+# It can than be accest in the windows and the guest driver exe's can be run.
+# Also, change video in virt-manager to virtio. This will fix the resolution
+
+#FOR LINUX
+# 2 options
+#
+# 1. Make use of host samba server
+# 1.0 Samba is installed by default. The network-shared folder is at /home/<user>/share.
+# 1.1 On host, set a password for the autentication of the samba server
+# 1.2 $ smbpasswd -a <user>
+# 1.3 Give password twice
+# 1.4 On virtual machine open file manager
+# 1.5 Search for smb://<ip-address>/share
+# 1.6 Log in with details entered beforehand
+#
+# 2. Passing through a filesystem
+# 2.1 Open details of virtual desktop on virt-manager
+# 2.2 Add hardware
+# 2.3 Select Filesystem: Type = mount / Mode = mapped / Source path = /home/<user>/share / Target path = /sharepoint
+# 2.4 Boot into virtual machine
+# 2.5 Create a directory to mount /sharepoint
+# 2.6 $ sudo mount -t 9p -o trans=virtio /sharepoint /<mountpoint>
+
+#SINGLE GPU PASSTHROUGH
+# General Guide: gitlab.com/risingprismtv/single-gpu-passthrough/-/wikis/home
+# 1. Download ISO
+# 2. Download latest Video BIOS from techpowerup.com/vgabios (Sapphire RX580 8Gb)
+# 2.1. $ Sudo mkdir /var/lib/libvirt/vbios/
+# 2.2. $ Sudo mv ~/Downloads/*.rom /var/lib/libvirt/vbios/GPU.rom
+# 2.3. $ Cd /var/lib/libvirt/vbios/
+# 2.4. $ Sudo chmod -R 660 GPU.rom
+# 3. Launch virt-manager
+# 4. File - Add Connection
+# 5. Create Virtual Machine
+# 5.1 Select ISO and mark it as win10
+# 5.2 Give temporary RAM
+# 5.3 Customize configuration before install
+# 5.4 Overview - Firmware - UEFI x86_64: /usr/*/OVMF_CODE.fd
+# 5.5 Allow XML Editing via Edit - Preferences
+# 5.6 Edit XML - Remove rtc & pit line. Change hpet to "yes"
+# 6. Start Installation (let it run without interference and do steps below)
+# 6.1 Press Esc, type exit, select boot-manager DVD ROM
+# 6.2 Do installation, select Pro version.
+# 6.3 Install hooks (Step 7 in guide)
+# 7. Close VM
+# 8. Edit VM
+# 8.1 Remove everything spice (Display, Video QXL, Serial, Channel Spice)
+# 8.2 Remove CD Rom
+# 8.3 Add PCI hardware (GPU: 01:00:0 & 01:00:1 (most likely))
+# 8.3 Add Mouse, Keyboard (PCI USB Controller in PCI Host Device or USB Host Device)
+# 9. Select GPU and open XML
+# 9.1 Add line "<rom file='/var/lib/libvirt/vbios/GPU.rom'/>" under "</source>"
+# 9.2 Do for both 01:00:0 and 01:00:1
+# 10. Edit CPU
+# 10.1 Disable "Copy host CPU configuration" and select "host-passthrough"
+# 10.2 Edit topology: Sockets=1 Cores=Total/2 Threads=2
+# 10.3 Edit XML cpu under topology
+# 10.3.1 Add "<feature policy='require' name='topoext'/>" for AMDCPU
+# 10.3.2 Add "<feature policy='disable' name='smep'/>" for Intel CPU
+# 11 Change memory to prefered (12GB for 16GB Total)
+# 12 Start VM
+# 13 Install correct video drivers
+
+#MACOS ON VIRT-MANAGER
+# General Guide: nixos.wiki/wiki/OSX-KVM
+# Repository: github.com/kholia/OSX-KVM
+# IMPORTANT: if you wish to start the virtual machine with virt-manager gui, clone to /home/<user>/.
+# 1. git clone https://github.com/kholia/OSX-KVM
+# 2. create a shell.nix (maybe best to store inside cloned directory)
+# 3. shell.nix content:
+# with import <nixpkgs> {};
+# mkShell {
+# buildInputs = [
+# qemu
+# python3
+# iproute2
+# ];
+# }
+# 4. In nixos configuration add:
+# virtualisation.libvirtd.enable = true;
+# users.extraUsers.<user>.extraGroups = [ "libvirtd" ];
+# boot.extraModprobeConfig = ''
+# options kvm_intel nested=1
+# options kvm_intel emulate_invalid_guest_state=0
+# options kvm ignore_msrs=1
+# '';
+# 5. Run the shell: $ nix-shell
+# 6. As mentioned in the README, run ./fetch-macOS.py
+# 6.1 Can be a specific version
+# 7. Create base image for the macOs installer
+# 8. $ qemu-img convert BaseSystem.dmg -O raw BaseSystem.img
+# 9. Create disk for macOS
+# 9.1 $ qemu-img create -f qcow2 mac_hdd_ng.img 128G
+# 10. Set up networking. If something like virbr0 does not get detected start virt-manager. Commands:
+# $ sudo ip tuntap add dev tap0 mode tap
+# $ sudo ip link set tap0 up promisc on
+# $ sudo ip link set dev virbr0 up
+# $ sudo ip link set dev tap0 master virbr0
+# 11. Boot the system
+# 11.1 $ ./OpenCore-Boot.sh
+# 12. Choose the first option to start the MacOS installer: macOS Base Systen
+# 12.1 Use Disk Utility to esase the correct drive.
+# 13. Go back and select the option to reinstall macOS
+# 13.1 After the initial installation, a reboot will happen. Do nothing and wait or select the second option 'MacOs install'.
+# 13.2 This will finalize the installaton but it will probably reboot multiple times. The second option will now have changed to the name of your drive. Use this as the boot option
+# 14. To add the installation to virt-manager:
+# 14.1 $ sed "s/CHANGEME/$USER/g" macOS-libvirt-Catalina.xml > macOS.xml
+# 14.2 Inside macOS.xml change the emulator from /usr/bin/qemu-system-x86_64 to /run/libvirt/nix-emulators/qemu-system-x86_64
+# 14.3 $ virt-xml-validate macOS.xml
+# 15. $ virsh --connect qemu:///system define macOS.xml
+# 16.(optional if permission is needed to the libvirt-qemu user)
+# 16.1 $ sudo setfacl -m u:libvirt-qemu:rx /home/$USER
+# 16.2 $ sudo setfacl -R -m u:libvirt-qemu:rx /home/$USER/OSX-KVM
A => modules/desktop/virtualisation/x11vnc.nix +43 -0
@@ 1,43 @@
+#
+# VNC Remote Connect Server
+#
+
+{ config, lib, pkgs, user, ... }:
+
+{
+ config = lib.mkIf (config.services.xserver.enable) {# Only evaluate code if using X11
+ networking.firewall.allowedTCPPorts = [ 5900 ]; # Since x11vpn defaults to port 5900. Open this port in firewall
+
+ environment = { # VNC used for remote access to the desktop
+ systemPackages = with pkgs; [
+ x11vnc
+ ];
+ };
+
+ systemd.services."x11vnc" = { # Made into a custom service
+ enable = true;
+ description = "VNC Server for X11";
+ requires = [ "display-manager.service" ];
+ after = [ "display-manager.service" ];
+ serviceConfig = { # Password is stored in document passwd at $HOME. This needs auth and link to display. Otherwise x11vnc won't detect the display
+ ExecStart = "${pkgs.x11vnc}/bin/x11vnc -passwdfile /home/${user}/passwd -noxdamage -nap -many -repeat -clear_keys -capslock -xkb -forever -loop100 -auth /var/run/lightdm/root/:0 -display :0 -clip 1920x1080+1920+0";
+ #ExecStart = "${pkgs.x11vnc}/bin/x11vnc -passwdfile /home/${user}/passwd -noxdamage -nap -many -repeat -clear_keys -capslock -xkb -forever -loop100 -auth /var/run/lightdm/root/:0 -display :0";
+ ExecStop = "${pkgs.x11vnc}/bin/x11vnc -R stop";
+ };
+ wantedBy = [ "multi-user.target" ];
+ };
+ };
+ # passwdfile: File on /home/{user}/passwd
+ # noxdamage: Quicker render (maybe not optimal)
+ # nap: If no acitivity, take longer naps
+ # many: keep listening for more connections
+ # repeat: X server key auto repeat
+ # clear_keys: clear modifier keys on startup and exit
+ # capslock: Dont ignore capslock
+ # xkb: Use xkeyboard
+ # forever: Keep listening for connection after disconnect
+ # loop100: Loop to restart service but wait 100ms
+ # auth: X authority file location so vnc also works from display manager (lightdm)
+ # display: Which display to show. Even with multiple monitors it's 0
+ # clip: Only show specific monitor using xinerama<displaynumber> or pixel coordinates you can find using $ xrandr -q. Can be removed to show all.
+}
A => modules/editors/default.nix +17 -0
@@ 1,17 @@
+#
+# Editors
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ ./home.nix
+# └─ ./modules
+# └─ ./services
+# └─ default.nix *
+# └─ ...
+#
+
+[
+ ./emacs/doom-emacs
+]
+
+# Comment out emacs if you are not using native doom emacs. (import from host configuration.nix)
A => modules/editors/emacs/default.nix +24 -0
@@ 1,24 @@
+#
+# Personal Emacs config. Can be set up with vanilla nixos or with home-manager (see comments at bottom)
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ configuration.nix
+# └─ ./modules
+# └─ ./editors
+# └─ ./emacs
+# └─ default.nix *
+#
+
+
+{ config, pkgs, ... }:
+
+{
+ services.emacs = {
+ enable = true;
+ };
+
+ home.packages = [
+ pkgs.emacs
+ ];
+}
A => modules/editors/emacs/doom-emacs/.doom.d/config.el +303 -0
@@ 1,303 @@
+;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
+
+;; Place your private configuration here! Remember, you do not need to run 'doom
+;; sync' after modifying this file!
+
+
+;; Some functionality uses this to identify you, e.g. GPG configuration, email
+;; clients, file templates and snippets. It is optional.
+(setq user-full-name "Frantisek Bohacek"
+ user-mail-address "rutherther@protonmail.com")
+
+;; Doom exposes five (optional) variables for controlling fonts in Doom:
+;;
+;; - `doom-font' -- the primary font to use
+;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
+;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
+;; presentations or streaming.
+;; - `doom-unicode-font' -- for unicode glyphs
+;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
+;;
+;; See 'C-h v doom-font' for documentation and more examples of what they
+;; accept. For example:
+;;
+;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
+;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
+;;
+;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
+;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
+;; refresh your font settings. If Emacs still can't find your font, it likely
+;; wasn't installed correctly. Font issues are rarely Doom issues!
+
+;; There are two ways to load a theme. Both assume the theme is installed and
+;; available. You can either set `doom-theme' or manually load a theme with the
+;; `load-theme' function. This is the default:
+(setq doom-theme 'doom-one)
+
+;; This determines the style of line numbers in effect. If set to `nil', line
+;; numbers are disabled. For relative line numbers, set this to `relative'.
+(setq display-line-numbers-type 'relative)
+
+;; If you use `org' and don't want your org files in the default location below,
+;; change `org-directory'. It must be set before org loads!
+(setq org-directory "~/org/")
+
+
+;; Whenever you reconfigure a package, make sure to wrap your config in an
+;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
+;;
+;; (after! PACKAGE
+;; (setq x y))
+;;
+;; The exceptions to this rule:
+;;
+;; - Setting file/directory variables (like `org-directory')
+;; - Setting variables which explicitly tell you to set them before their
+;; package is loaded (see 'C-h v VARIABLE' to look up their documentation).
+;; - Setting doom variables (which start with 'doom-' or '+').
+;;
+;; Here are some additional functions/macros that will help you configure Doom.
+;;
+;; - `load!' for loading external *.el files relative to this one
+;; - `use-package!' for configuring packages
+;; - `after!' for running code after a package has loaded
+;; - `add-load-path!' for adding directories to the `load-path', relative to
+;; this file. Emacs searches the `load-path' when you load packages with
+;; `require' or `use-package'.
+;; - `map!' for binding new keys
+;;
+;; To get information about any of these functions/macros, move the cursor over
+;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
+;; This will open documentation for it, including demos of how they are used.
+;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
+;; etc).
+;;
+;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
+;; they are implemented.
+
+
+(setq doom-localleader-key ",")
+
+(map! :leader
+ "c d" 'lsp-ui-doc-show
+ "c m" #'+make/run)
+
+(map! :map cdlatex-mode-map
+ :i "TAB" #'cdlatex-tab)
+
+(use-package! lsp-mode
+ :custom
+ (lsp-rust-analyzer-server-display-inlay-hints t)
+ (lsp-rust-analyzer-display-lifetime-elision-hints-enable "skip_trivial")
+ (lsp-rust-analyzer-display-chaining-hints t)
+ (lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names nil)
+ (lsp-rust-analyzer-display-closure-return-type-hints t)
+ (lsp-rust-analyzer-display-parameter-hints nil)
+ (lsp-rust-analyzer-diagnostics-enable-experimental t)
+ (lsp-rust-analyzer-display-reborrow-hints nil))
+(use-package! lsp-ui
+ :ensure
+ :commands lsp-ui-mode
+ :custom
+ (lsp-ui-peek-always-show t)
+ (lsp-ui-sideline-show-hover t)
+ (lsp-ui-doc-enable nil))
+
+(require 'dap-cpptools)
+
+(with-eval-after-load 'dap-cpptools
+;; Add a template specific for debugging Rust programs.
+;; It is used for new projects, where I can M-x dap-edit-debug-template
+(dap-register-debug-template "Rust::CppTools Run Configuration"
+ (list :type "cppdbg"
+ :request "launch"
+ :name "Rust::Run"
+ :MIMode "gdb"
+ :miDebuggerPath "rust-gdb"
+ :environment []
+ :program "${workspaceFolder}/target/debug/hello / replace with binary"
+ :cwd "${workspaceFolder}"
+ :console "external"
+ :dap-compilation "cargo build"
+ :dap-compilation-dir "${workspaceFolder}")))
+
+(with-eval-after-load 'dap-mode
+ (setq dap-default-terminal-kind "integrated") ;; Make sure that terminal programs open a term for I/O in an Emacs buffer
+ (dap-auto-configure-mode +1))
+
+;(add-to-list 'org-latex-classes
+;'("ctuslides" "\\documentclass[presentation]{ctuslides}"
+; ("\\section{%s}" . "\\section*{%s}")
+; ("\\subsection{%s}" . "\\subsection*{%s}")
+; ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
+
+(remove-hook 'doom-first-input-hook #'evil-snipe-mode)
+
+(setq lsp-julia-default-environment "~/.julia/environments/v1.8")
+
+;; latex
+
+(defun run-latexmk ()
+ (interactive)
+ (let ((TeX-save-query nil)
+ (TeX-process-asynchronous nil)
+ (master-file (TeX-master-file)))
+ (TeX-save-document "")
+ (TeX-run-TeX "latexmk"
+ (TeX-command-expand "latexmk -pdf %O %S" 'TeX-master-file)
+ master-file))
+ (if (plist-get TeX-error-report-switches (intern master-file))
+ (TeX-next-error t)
+ (progn
+ (demolish-tex-help)
+ (minibuffer-message "latexmk: done."))))
+
+(after! centaur-tabs (centaur-tabs-group-by-projectile-project))
+
+;; imenu
+
+(setq imenu-list-focus-after-activation t)
+(map! :leader
+ (:prefix ("t" . "Toggle")
+ :desc "Toggle imenu shown in a sidebar"
+ "i"
+ #'imenu-list-smart-toggle))
+
+;; vhdl
+
+(add-hook 'vhdl-mode-hook #'lsp!)
+(add-hook 'vhdl-ts-mode-hook #'lsp!)
+
+(defvar-local my/flycheck-local-cache nil)
+
+(defun my/flycheck-checker-get (fn checker property)
+ (or (alist-get property (alist-get checker my/flycheck-local-cache))
+ (funcall fn checker property)))
+
+(advice-add 'flycheck-checker-get :around 'my/flycheck-checker-get)
+
+(add-hook 'vhdl-ts-mode-hook #'vhdl-electric-mode)
+(add-hook 'vhdl-ts-mode-hook #'vhdl-stutter-mode)
+(add-hook 'vhdl-mode-hook #'vhdl-electric-mode)
+(add-hook 'vhdl-mode-hook #'vhdl-stutter-mode)
+
+(defun my-vhdl-setup ()
+ (setq vhdl-clock-edge-condition 'function)
+ (setq vhdl-clock-name "clk_i")
+ (setq vhdl-reset-kind 'sync)
+ (setq vhdl-reset-name "rst_in")
+ (setq lsp-vhdl--params '(server-path "/home/ruther/Documents/git_cloned/rust_hdl/target/debug/vhdl_ls" server-args nil))
+ (setq lsp-vhdl-server-path "/home/ruther/Documents/git_cloned/rust_hdl/target/debug/vhdl_ls"))
+(setq lsp-vhdl-server 'vhdl-ls)
+
+(add-hook 'vhdl-mode-hook 'my-vhdl-setup)
+(add-hook 'vhdl-ts-mode-hook 'my-vhdl-setup)
+
+;;(add-hook 'lsp-managed-mode-hook
+;; (lambda ()
+;; (when (derived-mode-p 'vhdl-mode)
+;; (setq my/flycheck-local-cache '((lsp . ((next-checkers . (vhdl-ghdl)))))))))
+
+(use-package! vhdl-ext
+ :after vhdl-mode
+ :demand
+ :mode (("\\.vhd\\'" . vhdl-mode)
+ ("\\.vhdl\\'" . vhdl-mode))
+ :init
+ (setq vhdl-ext-feature-list
+ '(font-lock
+ ;;eglot
+ lsp
+ ;;flycheck
+ beautify
+ navigation
+ template
+ compilation
+ imenu
+ which-func
+ hideshow
+ time-stamp
+ company-keywords
+ ports))
+ :hook ((vhdl-mode . vhdl-ext-mode))
+ :config
+ (vhdl-ext-mode-setup))
+
+(flycheck-define-checker vhdl-ghdl
+"A VHDL syntax checker using ghdl."
+:command ("ghdl"
+ "--std=08"
+ "-s"
+ "--std=08"
+ "--ieee=synopsys"
+ (eval (concat "--workdir=" (projectile-project-root) "/work"))
+ "-fexplicit"
+ "-fno-color-diagnostics"
+ source)
+:error-patterns
+((error line-start (file-name) ":" line ":" column
+ ": " (message) line-end))
+:modes vhdl-mode)
+
+;; org-mdoe
+(setq rmh-elfeed-org-files (list "~/Documents/notes/org/elfeed.org"))
+
+;; tree sitter and navigation
+(setq treesit-language-source-alist
+ '((rust "https://github.com/tree-sitter/tree-sitter-rust")
+ (vhdl "https://github.com/alemuller/tree-sitter-vhdl")
+ (python "https://github.com/tree-sitter/tree-sitter-python")))
+
+(use-package! combobulate
+ :preface (setq combobulate-key-prefix "SPC k"))
+
+(setq major-mode-remap-alist
+ '((yaml-mode . yaml-ts-mode)
+ ;;(rust-mode . rust-ts-mode)
+ ;;(rustic-mode . rust-ts-mode)
+ (c-mode . c-ts-mode)
+ ;;(vhdl-mode . vhdl-ts-mode)
+ (bash-mode . bash-ts-mode)
+ (js2-mode . js-ts-mode)
+ (typescript-mode . typescript-ts-mode)
+ (json-mode . json-ts-mode)
+ (css-mode . css-ts-mode)
+ (python-mode . python-ts-mode)))
+
+;;(add-hook 'lsp-ui-mode
+;; (lambda ()
+;; ))
+;;
+
+(defun my-lsp-ui-setup ()
+ (setq lsp-ui-doc-position 'top)
+ (setq lsp-ui-doc-max-height 30))
+(add-hook 'lsp-mode-hook 'my-lsp-ui-setup)
+
+(defun ~/magit-process-environment (env)
+ "Add GIT_DIR and GIT_WORK_TREE to ENV when in a special directory.
+https://github.com/magit/magit/issues/460 (@cpitclaudel)."
+ (let ((default (file-name-as-directory (expand-file-name default-directory)))
+ (home (expand-file-name "~/")))
+ (when (string= default home)
+ (let ((gitdir (expand-file-name "~/.dotFiles/")))
+ (push (format "GIT_WORK_TREE=%s" home) env)
+ (push (format "GIT_DIR=%s" gitdir) env))))
+ env)
+
+(advice-add 'magit-process-environment
+ :filter-return #'~/magit-process-environment)
+
+(use-package org-roam
+ :ensure t
+ :custom
+ (org-roam-directory "~/Documents/notes/org-roam")
+ (org-roam-dailies-directory "journals/")
+ (org-roam-capture-templates
+ '(("d" "default" plain
+ "%?" :target
+ (file+head "pages/${slug}.org" "#+title: ${title}\n")
+ :unnarrowed t)))
+ :config (org-roam-db-autosync-enable))
+
+(add-hook 'python-mode-hook #'lsp)
A => modules/editors/emacs/doom-emacs/.doom.d/custom.el +21 -0
@@ 1,21 @@
+(custom-set-variables
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(lsp-vhdl-server 'vhdl-ls)
+ '(package-selected-packages '(tree-sitter))
+ '(safe-local-variable-values
+ '((rustic-cargo-run-arguments . "--release")
+ (rustic-cargo-build-arguments . "--release")
+ (rustic-cargo-build-arguments . "--features stm32f103 --features medium --features rt")))
+ '(treesit-font-lock-level 4)
+ '(vhdl-clock-edge-condition 'function)
+ '(vhdl-modify-date-on-saving nil)
+ '(vhdl-reset-kind 'sync))
+(custom-set-faces
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ )
A => modules/editors/emacs/doom-emacs/.doom.d/init.el +194 -0
@@ 1,194 @@
+;;; init.el -*- lexical-binding: t; -*-
+
+;; This file controls what Doom modules are enabled and what order they load
+;; in. Remember to run 'doom sync' after modifying it!
+
+;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
+;; documentation. There you'll find a link to Doom's Module Index where all
+;; of our modules are listed, including what flags they support.
+
+;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
+;; 'C-c c k' for non-vim users) to view its documentation. This works on
+;; flags as well (those symbols that start with a plus).
+;;
+;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
+;; directory (for easy access to its source code).
+
+(doom! :input
+ ;;bidi ; (tfel ot) thgir etirw uoy gnipleh
+ ;;chinese
+ ;;japanese
+ ;;layout ; auie,ctsrnm is the superior home row
+
+ :completion
+ company ; the ultimate code completion backend
+ helm ; the *other* search engine for love and life
+ ;;ido ; the other *other* search engine...
+ ivy ; a search engine for love and life
+ ;;vertico ; the search engine of the future
+
+ :ui
+ deft ; notational velocity for Emacs
+ doom ; what makes DOOM look the way it does
+ doom-dashboard ; a nifty splash screen for Emacs
+ ;;doom-quit ; DOOM quit-message prompts when you quit Emacs
+ (emoji +unicode) ; 🙂
+ hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
+ ;;hydra
+ ;;indent-guides ; highlighted indent columns
+ ;;ligatures ; ligatures and symbols to make your code pretty again
+ minimap ; show a map of the code on the side
+ modeline ; snazzy, Atom-inspired modeline, plus API
+ nav-flash ; blink cursor line after big motions
+ ;;neotree ; a project drawer, like NERDTree for vim
+ ophints ; highlight the region an operation acts on
+ (popup +defaults) ; tame sudden yet inevitable temporary windows
+ ;;tabs ; a tab bar for Emacs
+ treemacs ; a project drawer, like neotree but cooler
+ ;;unicode ; extended unicode support for various languages
+ (vc-gutter +pretty) ; vcs diff in the fringe
+ vi-tilde-fringe ; fringe tildes to mark beyond EOB
+ window-select ; visually switch windows
+ workspaces ; tab emulation, persistence & separate workspaces
+ ;;zen ; distraction-free coding or writing
+
+ :editor
+ (evil +everywhere); come to the dark side, we have cookies
+ file-templates ; auto-snippets for empty files
+ fold ; (nigh) universal code folding
+ ;;(format +onsave) ; automated prettiness
+ ;;god ; run Emacs commands without modifier keys
+ ;;lispy ; vim for lisp, for people who don't like vim
+ multiple-cursors ; editing in many places at once
+ ;;objed ; text object editing for the innocent
+ ;;parinfer ; turn lisp into python, sort of
+ ;;rotate-text ; cycle region at point between text candidates
+ snippets ; my elves. They type so I don't have to
+ ;;word-wrap ; soft wrapping with language-aware indent
+
+ :emacs
+ dired ; making dired pretty [functional]
+ electric ; smarter, keyword-based electric-indent
+ ;;ibuffer ; interactive buffer management
+ undo ; persistent, smarter undo for your inevitable mistakes
+ vc ; version-control and Emacs, sitting in a tree
+
+ :term
+ ;;eshell ; the elisp shell that works everywhere
+ shell ; simple shell REPL for Emacs
+ term ; basic terminal emulator for Emacs
+ vterm ; the best terminal emulation in Emacs
+
+ :checkers
+ syntax ; tasing you for every semicolon you forget
+ (spell +flyspell) ; tasing you for misspelling mispelling
+ grammar ; tasing grammar mistake every you make
+
+ :tools
+ ;;ansible
+ ;;biblio ; Writes a PhD for you (citation needed)
+ (debugger +lsp) ; FIXME stepping through code, to help you add bugs
+ ;;direnv
+ ;;docker
+ ;;editorconfig ; let someone else argue about tabs vs spaces
+ ;;ein ; tame Jupyter notebooks with emacs
+ (eval +overlay) ; run code, run (also, repls)
+ ;;gist ; interacting with github gists
+ lookup ; navigate your code and its documentation
+ (lsp + peek) ; M-x vscode
+ magit ; a git porcelain for Emacs
+ make ; run make tasks from Emacs
+ ;;pass ; password manager for nerds
+ ;;pdf ; pdf enhancements
+ ;;prodigy ; FIXME managing external services & code builders
+ ;;rgb ; creating color strings
+ ;;taskrunner ; taskrunner for all your projects
+ ;;terraform ; infrastructure as code
+ ;;tmux ; an API for interacting with tmux
+ ;;tree-sitter ; syntax and parsing, sitting in a tree...
+ ;;upload ; map local to remote projects via ssh/ftp
+
+ :os
+ (:if IS-MAC macos) ; improve compatibility with macOS
+ ;;tty ; improve the terminal Emacs experience
+
+ :lang
+ ;;agda ; types of types of types of types...
+ ;;beancount ; mind the GAAP
+ (cc +lsp) ; C > C++ == 1
+ ;;clojure ; java with a lisp
+ ;;common-lisp ; if you've seen one lisp, you've seen them all
+ ;;coq ; proofs-as-programs
+ ;;crystal ; ruby at the speed of c
+ csharp ; unity, .NET, and mono shenanigans
+ ;;data ; config/data formats
+ ;;(dart +flutter) ; paint ui and not much else
+ ;;dhall
+ ;;elixir ; erlang done right
+ ;;elm ; care for a cup of TEA?
+ emacs-lisp ; drown in parentheses
+ ;;erlang ; an elegant language for a more civilized age
+ ess ; emacs speaks statistics
+ ;;factor
+ ;;faust ; dsp, but you get to keep your soul
+ ;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER)
+ ;;fsharp ; ML stands for Microsoft's Language
+ ;;fstar ; (dependent) types and (monadic) effects and Z3
+ ;;gdscript ; the language you waited for
+ ;;(go +lsp) ; the hipster dialect
+ ;;(graphql +lsp) ; Give queries a REST
+ (haskell +lsp) ; a language that's lazier than I am
+ ;;hy ; readability of scheme w/ speed of python
+ ;;idris ; a language you can depend on
+ json ; At least it ain't XML
+ ;;(java +lsp) ; the poster child for carpal tunnel syndrome
+ (javascript +lsp) ; all(hope(abandon(ye(who(enter(here))))))
+ (julia +lsp) ; a better, faster MATLAB
+ ;;kotlin ; a better, slicker Java(Script)
+ (latex +cdlatex +latexmk) ; writing papers in Emacs has never been so fun
+ ;;lean ; for folks with too much to prove
+ ;;ledger ; be audit you can be
+ ;;lua ; one-based indices? one-based indices
+ markdown ; writing docs for people to ignore
+ ;;nim ; python + lisp at the speed of c
+ nix ; I hereby declare "nix geht mehr!"
+ ;;ocaml ; an objective camel
+ (org +roam2 +pretty +dragndrop) ; organize your plain life in plain text
+ ;;php ; perl's insecure younger brother
+ ;;plantuml ; diagrams for confusing people more
+ ;;purescript ; javascript, but functional
+ (python +lsp) ; beautiful is better than ugly
+ ;;qt ; the 'cutest' gui framework ever
+ ;;racket ; a DSL for DSLs
+ ;;raku ; the artist formerly known as perl6
+ ;;rest ; Emacs as a REST client
+ ;;rst ; ReST in peace
+ ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
+ (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
+ ;;scala ; java, but good
+ ;;(scheme +guile) ; a fully conniving family of lisps
+ sh ; she sells {ba,z,fi}sh shells on the C xor
+ ;;sml
+ ;;solidity ; do you need a blockchain? No.
+ ;;swift ; who asked for emoji variables?
+ ;;terra ; Earth and Moon in alignment for performance.
+ ;;web ; the tubes
+ yaml ; JSON, but readable
+ ;;zig ; C, but simpler
+
+ :email
+ ;;(mu4e +org +gmail)
+ ;;notmuch
+ ;;(wanderlust +gmail)
+
+ :app
+ ;;calendar
+ ;;emms
+ ;;everywhere ; *leave* Emacs!? You must be joking
+ ;;irc ; how neckbeards socialize
+ (rss +org) ; emacs as an RSS reader
+ ;;twitter ; twitter client https://twitter.com/vnought
+
+ :config
+ ;;literate
+ (default +bindings +smartparens))
A => modules/editors/emacs/doom-emacs/.doom.d/packages.el +60 -0
@@ 1,60 @@
+;; -*- no-byte-compile: t; -*-
+;;; $DOOMDIR/packages.el
+
+;; To install a package with Doom you must declare them here and run 'doom sync'
+;; on the command line, then restart Emacs for the changes to take effect -- or
+;; use 'M-x doom/reload'.
+
+
+;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
+;(package! some-package)
+
+;; To install a package directly from a remote git repo, you must specify a
+;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
+;; https://github.com/radian-software/straight.el#the-recipe-format
+;(package! another-package
+; :recipe (:host github :repo "username/repo"))
+
+;; If the package you are trying to install does not contain a PACKAGENAME.el
+;; file, or is located in a subdirectory of the repo, you'll need to specify
+;; `:files' in the `:recipe':
+;(package! this-package
+; :recipe (:host github :repo "username/repo"
+; :files ("some-file.el" "src/lisp/*.el")))
+
+;; If you'd like to disable a package included with Doom, you can do so here
+;; with the `:disable' property:
+;(package! builtin-package :disable t)
+
+;; You can override the recipe of a built in package without having to specify
+;; all the properties for `:recipe'. These will inherit the rest of its recipe
+;; from Doom or MELPA/ELPA/Emacsmirror:
+;(package! builtin-package :recipe (:nonrecursive t))
+;(package! builtin-package-2 :recipe (:repo "myfork/package"))
+
+;; Specify a `:branch' to install a package from a particular branch or tag.
+;; This is required for some packages whose default branch isn't 'master' (which
+;; our package manager can't deal with; see radian-software/straight.el#279)
+;(package! builtin-package :recipe (:branch "develop"))
+
+;; Use `:pin' to specify a particular commit to install.
+;(package! builtin-package :pin "1a2b3c4d5e")
+
+
+;; Doom's packages are pinned to a specific commit and updated from release to
+;; release. The `unpin!' macro allows you to unpin single packages...
+;(unpin! pinned-package)
+;; ...or multiple packages
+;(unpin! pinned-package another-pinned-package)
+;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
+;(unpin! t)
+
+(package! arm-mode :recipe (:host github :repo "charje/arm-mode"))
+(package! dumb-jump)
+(package! imenu-list)
+(package! combobulate)
+(package! vhdl-ext
+ :recipe (:host github :repo "gmlarumbe/vhdl-ext"
+ :files (:defaults "snippets" "ts-mode/*.el")))
+(package! fancy-narrow)
+(package! topsy)
A => modules/editors/emacs/doom-emacs/default.nix +41 -0
@@ 1,41 @@
+#
+# Doom Emacs: Personally not a fan of github:nix-community/nix-doom-emacs due to performance issues
+# This is an ideal way to install on a vanilla NixOS installion.
+# You will need to import this from somewhere in the flake (Obviously not in a home-manager nix file)
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ configuration.nix
+# └─ ./modules
+# └─ ./editors
+# └─ ./emacs
+# └─ ./doom-emacs
+# └─ ./alt
+# └─ native.nix *
+#
+
+
+{ config, pkgs, location, ... }:
+
+let
+ doom-emacs = pkgs.callPackage (builtins.fetchTarball {
+ url = https://github.com/vlaci/nix-doom-emacs/archive/master.tar.gz;
+ }) {
+ doomPrivateDir = ./doom.d; # Directory containing your config.el init.el
+ # and packages.el files
+ };
+in {
+ home.packages = [ doom-emacs ];
+ home.file.".emacs.d/init.el".text = ''
+ (load "default.el")
+ '';
+
+ programs.emacs.package = doom-emacs;
+
+ environment.systemPackages = with pkgs; [
+ ripgrep
+ coreutils
+ fd
+ git
+ ];
+}
A => modules/editors/nvim/default.nix +50 -0
@@ 1,50 @@
+#
+# Neovim
+#
+
+{ pkgs, ... }:
+
+{
+ programs = {
+ neovim = {
+ enable = true;
+ viAlias = true;
+ vimAlias = true;
+
+ configure = {
+ customRC = ''
+ syntax enable
+ colorscheme srcery
+
+ let g:lightline = {
+ \ 'colorscheme': 'wombat',
+ \ }
+
+ highlight Comment cterm=italic gui=italic
+ hi Normal guibg=NONE ctermbg=NONE
+
+ set number
+
+ nmap <F6> :NERDTreeToggle<CR>
+ '';
+ packages.myVimPackages = with pkgs.vimPlugins; {
+ start = [
+ vim-nix
+ vim-markdown
+
+ vim-lastplace
+ auto-pairs
+ vim-gitgutter
+
+ nerdtree
+ wombat256-vim
+ srcery-vim
+
+ lightline-vim
+ indent-blankline-nvim
+ ];
+ };
+ };
+ };
+ };
+}
A => modules/editors/nvim/home.nix +52 -0
@@ 1,52 @@
+#
+# Neovim
+#
+
+{ pkgs, ... }:
+
+{
+ programs = {
+ neovim = {
+ enable = true;
+ viAlias = true;
+ vimAlias = true;
+
+ plugins = with pkgs.vimPlugins; [
+ # Syntax
+ vim-nix
+ vim-markdown
+
+ # Quality of life
+ vim-lastplace # Opens document where you left it
+ auto-pairs # Print double quotes/brackets/etc
+ vim-gitgutter # See uncommitted changes of file :GitGutterEnable
+
+ # File Tree
+ nerdtree # File Manager - set in extraConfig to F6
+
+ # Customization
+ wombat256-vim # Color scheme for lightline
+ srcery-vim # Color scheme for text
+
+ lightline-vim # Info bar at bottom
+ indent-blankline-nvim # Indentation lines
+ ];
+
+ extraConfig = ''
+ syntax enable " Syntax highlighting
+ colorscheme srcery " Color scheme text
+
+ let g:lightline = {
+ \ 'colorscheme': 'wombat',
+ \ } " Color scheme lightline
+
+ highlight Comment cterm=italic gui=italic " Comments become italic
+ hi Normal guibg=NONE ctermbg=NONE " Remove background, better for personal theme
+
+ set number " Set numbers
+
+ nmap <F6> :NERDTreeToggle<CR> " F6 opens NERDTree
+ '';
+ };
+ };
+}
A => modules/hardware/bluetooth.nix +17 -0
@@ 1,17 @@
+#
+# Bluetooth
+#
+
+{ pkgs, ... }:
+
+{
+ hardware.bluetooth = {
+ enable = true;
+ settings = {
+ General = {
+ Enable = "Source,Sink,Media,Socket";
+ };
+ };
+ };
+ services.blueman.enable = true;
+}
A => modules/hardware/default.nix +16 -0
@@ 1,16 @@
+#
+# Hardware
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ ./<host>
+# │ └─ default.nix
+# └─ ./modules
+# └─ ./hardware
+# └─ default.nix *
+# └─ ...
+#
+[
+ #./dslr.nix
+ ./bluetooth.nix
+]
A => modules/hardware/work/default.nix +18 -0
@@ 1,18 @@
+#
+# Hardware
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ ./work
+# │ └─ default.nix
+# └─ ./modules
+# └─ ./hardware
+# └─ ./work
+# └─ default.nix *
+# └─ ...
+#
+
+[
+ #./nvidia.nix
+ ./wpa.nix
+]
A => modules/hardware/work/eduroam.patch +11 -0
@@ 1,11 @@
+--- wpa_supplicant-2.10/src/crypto/tls_openssl.c
++++ src/crypto/tls_openssl.c.legacy
+@@ -1048,7 +1048,7 @@
+
+ SSL_CTX_set_options(ssl, SSL_OP_NO_SSLv2);
+ SSL_CTX_set_options(ssl, SSL_OP_NO_SSLv3);
+-
++ SSL_CTX_set_options(ssl, SSL_OP_LEGACY_SERVER_CONNECT);
+ SSL_CTX_set_mode(ssl, SSL_MODE_AUTO_RETRY);
+
+ #ifdef SSL_MODE_NO_AUTO_CHAIN
A => modules/hardware/work/nvidia.nix +38 -0
@@ 1,38 @@
+#
+# NVIDIA drivers so that the laptop video card can get offloaded to specific applications.
+# Either start the desktop or packages using nvidia-offload.
+# For example $ nvidia-offload kdenlive
+# Currently only used with work laptop using NVIDIA MX330
+#
+
+{ config, pkgs, ... }:
+
+let
+ nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
+ export __NV_PRIME_RENDER_OFFLOAD=1
+ export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
+ export __GLX_VENDOR_LIBRARY_NAME=nvidia
+ export __VK_LAYER_NV_optimus=NVIDIA_only
+ exec "$@"
+ '';
+in
+{
+ environment.systemPackages = [ nvidia-offload ];
+
+ services.xserver.videoDrivers = [ "nvidia" ];
+ hardware = {
+ opengl.enable = true;
+ nvidia = {
+ package = config.boot.kernelPackages.nvidiaPackages.stable;
+ prime = {
+ offload.enable = true;
+ intelBusId = "PCI:0:2:0";
+ nvidiaBusId = "PCI:45:0:0";
+ };
+ modesetting.enable = true;
+ powerManagement.enable = true;
+ };
+ };
+
+ #boot.kernelParams = [ "modules_blacklist=i915" ];
+}
A => modules/hardware/work/wpa.nix +15 -0
@@ 1,15 @@
+#
+# The latest OpenSSL package uses SSL3, meaning it will no longer support certain legacy protocols.
+# I guess my work's network isn't set up as securaly as they want us to think.
+# This patch makes it back available to connect to legacy servers.
+#
+
+{ config, lib, pkgs, ... }:
+
+{
+ nixpkgs.config.packageOverrides = pkgs: rec {
+ wpa_supplicant = pkgs.wpa_supplicant.overrideAttrs (attrs: {
+ patches = attrs.patches ++ [ ./eduroam.patch ];
+ });
+ };
+}
A => modules/programs/alacritty.nix +26 -0
@@ 1,26 @@
+#
+# Terminal Emulator
+#
+# Hardcoded as terminal for rofi and doom emacs
+#
+
+{ pkgs, ... }:
+
+{
+ programs = {
+ alacritty = {
+ enable = true;
+ settings = {
+ font = rec { # Font - Laptop has size manually changed at home.nix
+ normal.family = "FiraCode Nerd Font";
+ bold = { style = "Bold"; };
+ #size = 8;
+ };
+ offset = { # Positioning
+ x = -1;
+ y = 0;
+ };
+ };
+ };
+ };
+}
A => modules/programs/default.nix +16 -0
@@ 1,16 @@
+#
+# Apps
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ home.nix
+# └─ ./modules
+# └─ ./programs
+# └─ default.nix *
+# └─ ...
+#
+
+[
+ ./alacritty.nix
+ ./rofi.nix
+]
A => modules/programs/flatpak.nix +40 -0
@@ 1,40 @@
+#
+# Very janky way of declaring all flatpaks used
+# Might cause issues on new system installs
+# Only use when you know what you're doing
+#
+
+{ pkgs, ...}:
+
+{
+ services.flatpak.enable = true;
+ system.activationScripts = {
+ flatpak.text =
+ ''
+ flatpaks=(
+ "com.github.tchx84.Flatseal"
+ "com.moonlight_stream.Moonlight"
+ "com.obsproject.Studio"
+ "com.ultimaker.cura"
+ )
+
+ ${pkgs.flatpak}/bin/flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
+
+ for package in ''${flatpaks[*]}; do
+ check=$(${pkgs.flatpak}/bin/flatpak list --app | ${pkgs.gnugrep}/bin/grep $package)
+ if [[ -z "$check" ]] then
+ ${pkgs.flatpak}/bin/flatpak install -y flathub $package
+ fi
+ done
+
+ installed=($(${pkgs.flatpak}/bin/flatpak list --app | ${pkgs.gawk}/bin/awk -F$'\t*' '{$1=$3=$4=$5=""; print $0}'))
+
+ for remove in ''${installed[*]}; do
+ if [[ ! " ''${flatpaks[*]} " =~ " ''${remove} " ]]; then
+ ${pkgs.flatpak}/bin/flatpak uninstall -y $remove
+ ${pkgs.flatpak}/bin/flatpak uninstall -y --unused
+ fi
+ done
+ '';
+ };
+}
A => modules/programs/games.nix +45 -0
@@ 1,45 @@
+#
+# Gaming
+# Steam + MC + Emulation
+#
+# Do not forget to enable Steam play for all title in the settings menu
+#
+
+{ config, pkgs, nur, lib, unstable, ... }:
+
+let # No longer required because of retroarch but let's keep it for testing purposes
+ pcsx2 = pkgs.pcsx2.overrideAttrs (old: { # PCSX2 runs way better on x11. This wrappers makes it use the correct GDK Backend
+ nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.makeWrapper ];
+ postFixup = ''
+ wrapProgram $out/bin/pcsx2 \
+ --set GDK_BACKEND x11
+ '';
+ });
+in
+{
+ environment.systemPackages = [
+ pkgs.lunar-client
+ unstable.heroic
+ unstable.lutris
+ unstable.prismlauncher
+ pkgs.retroarchFull
+ unstable.steam
+ pcsx2
+ ];
+
+ programs = { # Needed to succesfully start Steam
+ steam = {
+ enable = true;
+ };
+ gamemode.enable = true; # Better gaming performance
+ # Steam: Right-click game - Properties - Launch options: gamemoderun %command%
+ # Lutris: General Preferences - Enable Feral GameMode
+ # - Global options - Add Environment Variables: LD_PRELOAD=/nix/store/*-gamemode-*-lib/lib/libgamemodeauto.so
+ };
+
+ nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
+ "steam"
+ "steam-original"
+ "steam-runtime"
+ ]; # Use Steam for Linux libraries
+}
A => modules/programs/rofi.nix +118 -0
@@ 1,118 @@
+#
+# System Menu
+#
+
+{ config, lib, pkgs, ... }:
+
+let
+ inherit (config.lib.formats.rasi) mkLiteral; # Theme.rasi alternative. Add Theme here
+ colors = import ../themes/colors.nix;
+in
+{
+ config = lib.mkIf (config.xsession.enable) {
+ home = {
+ packages = with pkgs; [
+ rofi-power-menu
+ ];
+ };
+
+ programs = {
+ rofi = {
+ enable = true;
+ terminal = "${pkgs.alacritty}/bin/alacritty"; # Alacritty is default terminal emulator
+ location = "center";
+ font = "FiraCode Nerd Font Mono 11";
+ theme = with colors.scheme.doom; {
+ "*" = {
+ bg0 = mkLiteral "#${bg}";
+ bg1 = mkLiteral "#414868";
+ fg0 = mkLiteral "#${text}";
+ fg1 = mkLiteral "#${text-alt}";
+
+ background-color = mkLiteral "transparent";
+ text-color = mkLiteral "@fg0";
+
+ margin = 0;
+ padding = 0;
+ spacing = 0;
+ };
+
+ "element-icon, element-text, scrollbar" = {
+ cursor = mkLiteral "pointer";
+ };
+
+ "window" = {
+ location = mkLiteral "northwest";
+ width = mkLiteral "280px";
+ x-offset = mkLiteral "8px";
+ y-offset = mkLiteral "34px";
+
+ background-color = mkLiteral "@bg0";
+ border = mkLiteral "1px";
+ border-color = mkLiteral "@bg1";
+ border-radius = mkLiteral "6px";
+ };
+
+ "inputbar" = {
+ spacing = mkLiteral "8px";
+ padding = mkLiteral "4px 8px";
+ children = mkLiteral "[ entry ]";
+ background-color = mkLiteral "@bg0";
+ };
+
+ "entry, element-icon, element-text" = {
+ vertical-align = mkLiteral "0.5";
+ };
+
+ "textbox" = {
+ padding = mkLiteral "4px 8px";
+ background-color = mkLiteral "@bg0";
+ };
+
+ "listview" = {
+ padding = mkLiteral "4px 0px";
+ lines = 6;
+ columns = 1;
+ scrollbar = true;
+ };
+
+ "element" = {
+ padding = mkLiteral "4px 8px";
+ spacing = mkLiteral "8px";
+ };
+
+ "element normal urgent" = {
+ text-color = mkLiteral "@fg1";
+ };
+
+ "element normal active" = {
+ text-color = mkLiteral "@fg1";
+ };
+
+ "element selected" = {
+ text-color = mkLiteral "@bg0"; #1
+ background-color = mkLiteral "@fg1";
+ };
+
+ "element selected urgent" = {
+ background-color = mkLiteral "@fg1";
+ };
+
+ "element-icon" = {
+ size = mkLiteral "0.8em";
+ };
+
+ "element-text" = {
+ text-color = mkLiteral "inherit";
+ };
+
+ "scrollbar" = {
+ handle-width = mkLiteral "4px";
+ handle-color = mkLiteral "@fg1";
+ padding = mkLiteral "0 4px";
+ };
+ };
+ };
+ };
+ };
+}
A => modules/services/default.nix +22 -0
@@ 1,22 @@
+#
+# Services
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ home.nix
+# └─ ./modules
+# └─ ./services
+# └─ default.nix *
+# └─ ...
+#
+
+[
+ ./dunst.nix
+ ./flameshot.nix
+ ./picom.nix
+ ./polybar.nix
+ ./sxhkd.nix
+ ./udiskie.nix
+]
+
+# redshift and media temporarely disables
A => modules/services/dunst.nix +70 -0
@@ 1,70 @@
+#
+# System notifications
+#
+
+{ config, lib, pkgs, ... }:
+
+let
+ colors = import ../themes/colors.nix; # Import colors theme
+in
+{
+ home.packages = [ pkgs.libnotify ]; # Dependency
+ services.dunst = {
+ enable = true;
+ iconTheme = { # Icons
+ name = "Papirus Dark";
+ package = pkgs.papirus-icon-theme;
+ size = "16x16";
+ };
+ settings = with colors.scheme.doom; { # Settings
+ global = {
+ monitor = 0;
+ # geometry [{width}x{height}][+/-{x}+/-{y}]
+ # geometry = "600x50-50+65";
+ width = 300;
+ height = 200;
+ origin = "top-right";
+ offset = "50x50";
+ shrink = "yes";
+ transparency = 10;
+ padding = 16;
+ horizontal_padding = 16;
+ frame_width = 3;
+ frame_color = "#${bg}";
+ separator_color = "frame";
+ font = "FiraCode Nerd Font 10";
+ line_height = 4;
+ idle_threshold = 120;
+ markup = "full";
+ format = ''<b>%s</b>\n%b'';
+ alignment = "left";
+ vertical_alignment = "center";
+ icon_position = "left";
+ word_wrap = "yes";
+ ignore_newline = "no";
+ show_indicators = "yes";
+ sort = true;
+ stack_duplicates = true;
+ # startup_notification = false;
+ hide_duplicate_count = true;
+ };
+ urgency_low = { # Colors
+ background = "#${bg}";
+ foreground = "#${text}";
+ timeout = 4;
+ };
+ urgency_normal = {
+ background = "#${bg}";
+ foreground = "#${text}";
+ timeout = 4;
+ };
+ urgency_critical = {
+ background = "#${bg}";
+ foreground = "#${text}";
+ frame_color = "#${red}";
+ timeout = 10;
+ };
+ };
+ };
+ xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source = "${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
+}
A => modules/services/flameshot.nix +24 -0
@@ 1,24 @@
+#
+# Screenshots
+#
+
+{ config, lib, pkgs, user, ... }:
+
+{
+ config = lib.mkIf (config.xsession.enable) { # Only evaluate code if using X11
+ services = { # sxhkd shortcut = Printscreen button (Print)
+ flameshot = {
+ enable = true;
+ settings = {
+ General = { # Settings
+ savePath = "/home/${user}/screens";
+ saveAsFileExtension = ".png";
+ uiColor = "#2d0096";
+ showHelp = "false";
+ disabledTrayIcon = "true"; # Hide from systray
+ };
+ };
+ };
+ };
+ };
+}
A => modules/services/picom.nix +82 -0
@@ 1,82 @@
+#
+# Compositor
+#
+
+{ config, lib, pkgs, ... }:
+
+{
+ config = lib.mkIf (config.xsession.enable) { # Only evaluate code if using X11
+ services.picom = {
+ enable = true;
+ package = pkgs.picom.overrideAttrs(o: {
+ src = pkgs.fetchFromGitHub {
+ #repo = "picom";
+ #owner = "pijulius";
+ #rev = "982bb43e5d4116f1a37a0bde01c9bda0b88705b9";
+ #sha256 = "YiuLScDV9UfgI1MiYRtjgRkJ0VuA1TExATA2nJSJMhM=";
+ repo = "picom";
+ owner = "jonaburg";
+ rev = "e3c19cd7d1108d114552267f302548c113278d45";
+ sha256 = "4voCAYd0fzJHQjJo4x3RoWz5l3JJbRvgIXn1Kg6nz6Y=";
+ };
+ }); # Override picom to use pijulius' version
+
+ backend = "glx"; # Rendering either with glx or xrender. You'll know if you need to switch this.
+ vSync = true; # Should fix screen tearing
+
+ #activeOpacity = 0.93; # Node transparency
+ #inactiveOpacity = 0.93;
+ #menuOpacity = 0.93;
+
+ shadow = false; # Shadows
+ shadowOpacity = 0.75;
+ fade = true; # Fade
+ fadeDelta = 10;
+ opacityRules = [ # Opacity rules if transparency is prefered
+ # "100:name = 'Picture in picture'"
+ # "100:name = 'Picture-in-Picture'"
+ # "85:class_i ?= 'rofi'"
+ "80:class_i *= 'discord'"
+ "80:class_i *= 'emacs'"
+ "80:class_i *= 'Alacritty'"
+ # "100:fullscreen"
+ ]; # Find with $ xprop | grep "WM_CLASS"
+
+ settings = {
+ daemon = true;
+ use-damage = false; # Fixes flickering and visual bugs with borders
+ resize-damage = 1;
+ refresh-rate = 0;
+ corner-radius = 5; # Corners
+ round-borders = 5;
+
+ # Animations Pijulius
+ #animations = true; # All Animations
+ #animation-window-mass = 0.5;
+ #animation-for-open-window = "zoom";
+ #animation-stiffness = 350;
+ #animation-clamping = false;
+ #fade-out-step = 1; # Will fix random border dots from not disappearing
+
+ # Animations Jonaburg
+ transition-length = 300;
+ transition-pow-x = 0.5;
+ transition-pow-y = 0.5;
+ transition-pow-w = 0.5;
+ transition-pow-h = 0.5;
+ size-transition = true;
+
+ # Extras
+ detect-rounded-corners = true; # Below should fix multiple issues
+ detect-client-opacity = false;
+ detect-transient = true;
+ detect-client-leader = false;
+ mark-wmwim-focused = true;
+ mark-ovredir-focues = true;
+ unredir-if-possible = true;
+ glx-no-stencil = true;
+ glx-no-rebind-pixmap = true;
+ }; # Extra options for picom.conf (mostly for pijulius fork)
+ };
+ };
+}
A => modules/services/redshift.nix +17 -0
@@ 1,17 @@
+#
+# Screen color temperature changer
+#
+{ config, lib, pkgs, ...}:
+
+{
+ config = lib.mkIf (config.xsession.enable) { # Only evaluate code if using X11
+ services = {
+ redshift = {
+ enable = true;
+ temperature.night = 3000;
+ latitude = 50.2332933;
+ longitude = 14.3225926;
+ };
+ };
+ };
+}
A => modules/services/udiskie.nix +15 -0
@@ 1,15 @@
+#
+# Mounting tool
+#
+
+{ config, lib, pkgs, ... }:
+
+{
+ services = {
+ udiskie = { # Udiskie wil automatically mount storage devices
+ enable = true;
+ automount = true;
+ tray = "auto"; # Will only show up in systray when active
+ };
+ };
+}
A => modules/shell/default.nix +17 -0
@@ 1,17 @@
+#
+# Shell
+#
+# flake.nix
+# ├─ ./hosts
+# │ └─ home.nix
+# └─ ./modules
+# └─ ./shell
+# └─ default.nix *
+# └─ ...
+#
+
+[
+ ./git.nix
+ ./zsh.nix
+ ./direnv.nix
+]
A => modules/shell/direnv.nix +37 -0
@@ 1,37 @@
+#
+# Direnv
+#
+# create a shell.nix
+# create a .envrc and add use nix shell.nix
+# direnv allow
+# add direnv package to emacs
+# add 'eval "$(direnv hook zsh)"' to .zshrc (and same for bash)
+#
+
+{ config, lib, pkgs, ... }:
+
+{
+ programs = lib.mkIf (config.programs.zsh.enable) {
+ zsh = {
+ shellInit = ''
+ emulate zsh -c "$(direnv hook zsh)"
+ '';
+ };
+ };
+
+ environment = {
+ systemPackages = with pkgs; [ direnv nix-direnv ];
+ pathsToLink = [
+ "/share/nix-direnv"
+ ];
+ };
+
+ nix.settings = {
+ keep-outputs = true;
+ keep-derivations = true;
+ };
+
+ nixpkgs.overlays = [
+ (self: super: { nix-direnv = super.nix-direnv.override { enableFlakes = true; }; } )
+ ];
+}
A => modules/shell/git.nix +11 -0
@@ 1,11 @@
+#
+# Git
+#
+
+{
+ programs = {
+ git = {
+ enable = true;
+ };
+ };
+}
A => modules/shell/zsh.nix +32 -0
@@ 1,32 @@
+#
+# Shell
+#
+
+{ pkgs, ... }:
+
+{
+ programs = {
+ zsh = {
+ enable = true;
+ autosuggestions.enable = true; # Auto suggest options and highlights syntax, searches in history for options
+ syntaxHighlighting.enable = true;
+ enableCompletion = true;
+ histSize = 100000;
+
+ ohMyZsh = { # Extra plugins for zsh
+ enable = true;
+ plugins = [ "git" ];
+ };
+
+ shellInit = '' # Zsh theme
+ # Spaceship
+ source ${pkgs.spaceship-prompt}/share/zsh/site-functions/prompt_spaceship_setup
+ autoload -U promptinit; promptinit
+ # Hook direnv
+ #emulate zsh -c "$(direnv hook zsh)"
+
+ #eval "$(direnv hook zsh)"
+ '';
+ };
+ };
+}
A => modules/themes/colors.nix +48 -0
@@ 1,48 @@
+#
+# System themes
+#
+
+{
+ scheme = {
+ doom = {
+ scheme = "Doom One Dark";
+ black = "000000";
+ red = "ff6c6b";
+ orange = "da8548";
+ yellow = "ecbe7b";
+ green = "95be65";
+ teal = "4db5bd";
+ blue = "6eaafb";
+ dark-blue = "2257a0";
+ magenta = "c678dd";
+ violet = "a9a1e1";
+ cyan = "6cdcf7";
+ dark-cyan = "5699af";
+ emphasis = "50536b";
+ text = "dfdfdf";
+ text-alt = "b2b2b2";
+ fg = "abb2bf";
+ bg = "282c34";
+ };
+
+ dracula = {
+ scheme = "Dracula";
+ base00 = "282936"; #background
+ base01 = "3a3c4e";
+ base02 = "4d4f68";
+ base03 = "626483";
+ base04 = "62d6e8";
+ base05 = "e9e9f4"; #foreground
+ base06 = "f1f2f8";
+ base07 = "f7f7fb";
+ base08 = "ea51b2";
+ base09 = "b45bcf";
+ base0A = "00f769";
+ base0B = "ebff87";
+ base0C = "a1efe4";
+ base0D = "62d6e8";
+ base0E = "b45bcf";
+ base0F = "00f769";
+ };
+ };
+}
A => nix/default.nix +31 -0
@@ 1,31 @@
+#
+# These are the diffent profiles that can be used when building Nix.
+#
+# flake.nix
+# └─ ./nix
+# └─ default.nix *
+#
+
+{ lib, inputs, nixpkgs, home-manager, nixgl, user, ... }:
+
+let
+ system = "x86_64-linux";
+ pkgs = nixpkgs.legacyPackages.${system};
+in
+{
+ pacman = home-manager.lib.homeManagerConfiguration { # Currently only host that can be built
+ inherit pkgs;
+ extraSpecialArgs = { inherit inputs nixgl user; };
+ modules = [
+ ./pacman.nix
+ {
+ home = {
+ username = "${user}";
+ homeDirectory = "/home/${user}";
+ packages = [ pkgs.home-manager ];
+ stateVersion = "22.05";
+ };
+ }
+ ];
+ };
+}
A => nix/pacman.nix +52 -0
@@ 1,52 @@
+#
+# Nix setup using Home-manager
+#
+# flake.nix
+# └─ ./nix
+# ├─ default.nix
+# └─ pacman.nix *
+#
+
+{ config, pkgs, inputs, nixgl, user, ... }:
+
+{
+ home = {
+ packages = [
+ (import nixgl { inherit pkgs; }).nixGLIntel # OpenGL for GUI apps. Add to aliases is recommended.
+ #.nixVulkanIntel
+ pkgs.hello
+ pkgs.emacs
+ ];
+
+ #file.".bash_aliases".text = ''
+ # alias alacritty="nixGLIntel ${pkgs.alacritty}/bin/alacritty"
+ #''; # Aliases for packages that need openGL using nixGL. Change to your shell alias file. Note that home.shellAliases does not work...
+
+ activation = { # Run script during rebuild/switch.
+ linkDesktopApplications = { # Script that will add all packages to the system menu. (Mainly tested on Gnome)
+ after = [ "writeBoundary" "createXdgUserDirectories" ];
+ before = [ ];
+ data = "sudo /usr/bin/update-desktop-database"; # This will update the database, requires sudo. Not recommended to install via home-manager so do it manually for your distro.
+ };
+ };
+ };
+
+ xdg = {
+ enable = true;
+ systemDirs.data = [ "/home/${user}/.nix-profile/share" ]; # Will add nix packages to XDG_DATA_DIRS and thus accessible from the menus.
+ };
+
+ nix = { # Nix Package Manager settings
+ settings ={
+ auto-optimise-store = true; # Optimise syslinks
+ };
+ package = pkgs.nixFlakes; # Enable nixFlakes on system
+ registry.nixpkgs.flake = inputs.nixpkgs;
+ extraOptions = ''
+ experimental-features = nix-command flakes
+ keep-outputs = true
+ keep-derivations = true
+ '';
+ };
+ nixpkgs.config.allowUnfree = true; # Allow proprietary software.
+}
A => shells/python.nix +18 -0
@@ 1,18 @@
+{ pkgs ? import <nixpkgs> {} }:
+
+pkgs.mkShell {
+ packages = with pkgs; [
+ (pkgs.python3.withPackages (ps: [
+ ps.pip
+ ps.tkinter
+ ]))
+ python-language-server
+ poetry # Instead of pip, you can use $ poetry init -n --name <name> and $ poetry add request <package> to install python packages
+ ];
+ shellHook = ''
+ export PIP_PREFIX=$(pwd)/_build/pip_packages
+ export PYTHONPATH="$PIP_PREFIX/${pkgs.python3.sitePackages}:$PYTHONPATH"
+ export PATH="$PIP_PREFIX/bin:$PATH"
+ unset SOURCE_DATE_EPOCH
+ '';
+}