From 20a3fe453846e5b47b3c5f027cb76a0e17b9685d Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Sat, 23 Dec 2023 21:20:40 +0100 Subject: [PATCH 01/44] Switch to nix-starter-configs template --- flake.lock | 186 +----------- flake.nix | 134 +++++---- home-manager/home.nix | 69 +++++ hosts/configuration.nix | 242 ---------------- hosts/convertible/default.nix | 82 ------ hosts/convertible/hardware-configuration.nix | 46 --- hosts/default.nix | 79 ----- hosts/desktop/default.nix | 71 ----- hosts/desktop/hardware-configuration.nix | 43 --- modules/coding/android-studio.nix | 19 -- modules/coding/default.nix | 6 - modules/coding/intellij.nix | 16 - modules/coding/nvim.nix | 30 -- modules/coding/vscode.nix | 87 ------ modules/desktops/awesome.nix | 82 ------ modules/desktops/default.nix | 6 - modules/desktops/gnome.nix | 66 ----- modules/desktops/hyprland.nix | 289 ------------------- modules/desktops/kde.nix | 52 ---- modules/hardware/nvidia.nix | 17 -- modules/home-manager/default.nix | 6 + modules/nixos/default.nix | 6 + modules/programs/alacritty.nix | 14 - modules/programs/games.nix | 24 -- modules/programs/librewolf.nix | 25 -- modules/secrets/gnome-keyring.nix | 11 - modules/secrets/gpg.nix | 30 -- modules/services/avahi.nix | 16 - modules/services/default.nix | 1 - modules/services/easyeffects.nix | 15 - modules/shell/default.nix | 5 - modules/shell/fish.nix | 30 -- modules/shell/git.nix | 24 -- modules/shell/zsh.nix | 59 ---- modules/theming/cursor.nix | 44 --- modules/theming/default.nix | 5 - modules/theming/gtk.nix | 20 -- modules/theming/qt.nix | 31 -- modules/virtualization/docker.nix | 18 -- modules/virtualization/qemu.nix | 42 --- nix/home.nix | 29 -- nixos/configuration.nix | 113 ++++++++ nixos/hardware-configuration.nix | 10 + overlays/default.nix | 23 ++ pkgs/default.nix | 5 + 45 files changed, 314 insertions(+), 1914 deletions(-) create mode 100644 home-manager/home.nix delete mode 100644 hosts/configuration.nix delete mode 100644 hosts/convertible/default.nix delete mode 100644 hosts/convertible/hardware-configuration.nix delete mode 100644 hosts/default.nix delete mode 100644 hosts/desktop/default.nix delete mode 100644 hosts/desktop/hardware-configuration.nix delete mode 100644 modules/coding/android-studio.nix delete mode 100644 modules/coding/default.nix delete mode 100644 modules/coding/intellij.nix delete mode 100644 modules/coding/nvim.nix delete mode 100644 modules/coding/vscode.nix delete mode 100644 modules/desktops/awesome.nix delete mode 100644 modules/desktops/default.nix delete mode 100644 modules/desktops/gnome.nix delete mode 100644 modules/desktops/hyprland.nix delete mode 100644 modules/desktops/kde.nix delete mode 100644 modules/hardware/nvidia.nix create mode 100644 modules/home-manager/default.nix create mode 100644 modules/nixos/default.nix delete mode 100644 modules/programs/alacritty.nix delete mode 100644 modules/programs/games.nix delete mode 100644 modules/programs/librewolf.nix delete mode 100644 modules/secrets/gnome-keyring.nix delete mode 100644 modules/secrets/gpg.nix delete mode 100644 modules/services/avahi.nix delete mode 100644 modules/services/default.nix delete mode 100644 modules/services/easyeffects.nix delete mode 100644 modules/shell/default.nix delete mode 100644 modules/shell/fish.nix delete mode 100644 modules/shell/git.nix delete mode 100644 modules/shell/zsh.nix delete mode 100644 modules/theming/cursor.nix delete mode 100644 modules/theming/default.nix delete mode 100644 modules/theming/gtk.nix delete mode 100644 modules/theming/qt.nix delete mode 100644 modules/virtualization/docker.nix delete mode 100644 modules/virtualization/qemu.nix delete mode 100644 nix/home.nix create mode 100644 nixos/configuration.nix create mode 100644 nixos/hardware-configuration.nix create mode 100644 overlays/default.nix create mode 100644 pkgs/default.nix diff --git a/flake.lock b/flake.lock index 014b280..05ed3b7 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1695108154, - "narHash": "sha256-gSg7UTVtls2yO9lKtP0yb66XBHT1Fx5qZSZbGMpSn2c=", + "lastModified": 1685599623, + "narHash": "sha256-Tob4CMOVHue0D3RzguDBCtUmX5ji2PsdbQDbIOIKvsc=", "owner": "nix-community", "repo": "home-manager", - "rev": "07682fff75d41f18327a871088d20af2710d4744", + "rev": "93db05480c0c0f30382d3e80779e8386dcb4f9dd", "type": "github" }, "original": { @@ -21,77 +21,13 @@ "type": "github" } }, - "hyprland": { - "inputs": { - "hyprland-protocols": "hyprland-protocols", - "nixpkgs": [ - "nixpkgs-unstable" - ], - "systems": "systems", - "wlroots": "wlroots", - "xdph": "xdph" - }, - "locked": { - "lastModified": 1697151905, - "narHash": "sha256-sfuiRn7D5D2NzDkXXN/DUUcs2d1ddlf3VmzDBzDO2Tk=", - "owner": "hyprwm", - "repo": "Hyprland", - "rev": "3a61350286de842c7f1566c38e2b42821080ddf4", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "Hyprland", - "type": "github" - } - }, - "hyprland-protocols": { - "inputs": { - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1691753796, - "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", - "owner": "hyprwm", - "repo": "hyprland-protocols", - "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprland-protocols", - "type": "github" - } - }, - "nix-filter": { - "locked": { - "lastModified": 1693833173, - "narHash": "sha256-hlMABKrGbEiJD5dwUSfnw1CQ3bG7KKwDV+Nx3bEZd7U=", - "owner": "numtide", - "repo": "nix-filter", - "rev": "ac030bd9ba98e318e1f4c4328d60766ade8ebe8b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "nix-filter", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1696983906, - "narHash": "sha256-L7GyeErguS7Pg4h8nK0wGlcUTbfUMDu+HMf1UcyP72k=", + "lastModified": 1686431482, + "narHash": "sha256-oPVQ/0YP7yC2ztNsxvWLrV+f0NQ2QAwxbrZ+bgGydEM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "bd1cde45c77891214131cbbea5b1203e485a9d51", + "rev": "d3bb401dcfc5a46ce51cdfb5762e70cc75d082d2", "type": "github" }, "original": { @@ -103,11 +39,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1697059129, - "narHash": "sha256-9NJcFF9CEYPvHJ5ckE8kvINvI84SZZ87PvqMbH6pro0=", + "lastModified": 1686501370, + "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5e4c2ada4fcd54b99d56d7bd62f384511a7e2593", + "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", "type": "github" }, "original": { @@ -117,113 +53,11 @@ "type": "github" } }, - "nur": { - "locked": { - "lastModified": 1697208312, - "narHash": "sha256-pLhWx1QA0hLBgA7KoOeYWxQYqOUYSdoTAoDEEhMGx80=", - "owner": "nix-community", - "repo": "NUR", - "rev": "90683b5b6b475583fb307cd9d557e91881dccbcd", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "NUR", - "type": "github" - } - }, "root": { "inputs": { "home-manager": "home-manager", - "hyprland": "hyprland", "nixpkgs": "nixpkgs", - "nixpkgs-unstable": "nixpkgs-unstable", - "nur": "nur", - "split-monitor-workspaces": "split-monitor-workspaces" - } - }, - "split-monitor-workspaces": { - "inputs": { - "hyprland": [ - "hyprland" - ], - "nix-filter": "nix-filter" - }, - "locked": { - "lastModified": 1697056199, - "narHash": "sha256-Tkd4cI4Vq6cczZjiZdfs1Q9Gke+4iL1+S3c2GAGhEvc=", - "owner": "Duckonaut", - "repo": "split-monitor-workspaces", - "rev": "9b40de35aeb8c62df3326eae7979b438f3ee0fb1", - "type": "github" - }, - "original": { - "owner": "Duckonaut", - "repo": "split-monitor-workspaces", - "type": "github" - } - }, - "systems": { - "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", - "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default-linux", - "type": "github" - } - }, - "wlroots": { - "flake": false, - "locked": { - "host": "gitlab.freedesktop.org", - "lastModified": 1696410538, - "narHash": "sha256-ecDhdYLXWHsxMv+EWG36mCNDvzRbu9qfjH7dLxL7aGM=", - "owner": "wlroots", - "repo": "wlroots", - "rev": "3406c1b17a4a7e6d4e2a7d9c1176affa72bce1bc", - "type": "gitlab" - }, - "original": { - "host": "gitlab.freedesktop.org", - "owner": "wlroots", - "repo": "wlroots", - "rev": "3406c1b17a4a7e6d4e2a7d9c1176affa72bce1bc", - "type": "gitlab" - } - }, - "xdph": { - "inputs": { - "hyprland-protocols": [ - "hyprland", - "hyprland-protocols" - ], - "nixpkgs": [ - "hyprland", - "nixpkgs" - ], - "systems": [ - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1694628480, - "narHash": "sha256-Qg9hstRw0pvjGu5hStkr2UX1D73RYcQ9Ns/KnZMIm9w=", - "owner": "hyprwm", - "repo": "xdg-desktop-portal-hyprland", - "rev": "8f45a6435069b9e24ebd3160eda736d7a391cbf2", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "xdg-desktop-portal-hyprland", - "type": "github" + "nixpkgs-unstable": "nixpkgs-unstable" } } }, diff --git a/flake.nix b/flake.nix index 45ec81e..61960d1 100644 --- a/flake.nix +++ b/flake.nix @@ -1,76 +1,86 @@ -# -# flake.nix * -# ├─ ./hosts -# │ └─ default.nix -# ├─ ./darwin -# │ └─ default.nix -# └─ ./nix -# └─ default.nix -# { - description = "Nix, NixOS and Nix Darwin System Flake Configuration"; + description = "Your new nix config"; - inputs = - # References Used by Flake - { - nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; # Stable Nix Packages (Default) - nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # Unstable Nix Packages + inputs = { + # Nixpkgs + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; + # You can access packages and modules from different nixpkgs revs + # at the same time. Here's an working example: + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. - home-manager = { - # User Environment Manager - url = "github:nix-community/home-manager/release-23.05"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + # Home manager + home-manager.url = "github:nix-community/home-manager/release-23.05"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; - nur = { - # NUR Community Packages - url = "github:nix-community/NUR"; # Requires "nur.nixosModules.nur" to be added to the host modules - }; + # TODO: Add any other flake you might need + # hardware.url = "github:nixos/nixos-hardware"; - hyprland = { - # Official Hyprland Flake - url = "github:hyprwm/Hyprland"; # Requires "hyprland.nixosModules.default" to be added the host modules - inputs.nixpkgs.follows = "nixpkgs-unstable"; - }; + # Shameless plug: looking for a way to nixify your themes and make + # everything match nicely? Try nix-colors! + # nix-colors.url = "github:misterio77/nix-colors"; + }; - split-monitor-workspaces = { - url = "github:Duckonaut/split-monitor-workspaces"; - inputs.hyprland.follows = "hyprland"; # <- make sure this line is present for the plugin to work as intended - }; - }; - - outputs = inputs @ { + outputs = { self, nixpkgs, - nixpkgs-unstable, home-manager, - nur, - hyprland, - split-monitor-workspaces, ... - }: - # Function telling flake which inputs to use - let - vars = { - # Variables Used In Flake - user = "ghoscht"; - location = "$HOME/.setup"; - terminal = "alacritty"; - editor = "nvim"; - }; + } @ inputs: let + inherit (self) outputs; + # Supported systems for your flake packages, shell, etc. + systems = [ + "aarch64-linux" + "i686-linux" + "x86_64-linux" + "aarch64-darwin" + "x86_64-darwin" + ]; + # This is a function that generates an attribute by calling a function you + # pass to it, with each system as an argument + forAllSystems = nixpkgs.lib.genAttrs systems; in { - nixosConfigurations = ( # NixOS Configurations - import ./hosts { - inherit (nixpkgs) lib; - inherit inputs nixpkgs nixpkgs-unstable home-manager nur hyprland split-monitor-workspaces vars; # Inherit inputs - } - ); + # Your custom packages + # Accessible through 'nix build', 'nix shell', etc + packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + # Formatter for your nix files, available through 'nix fmt' + # Other options beside 'alejandra' include 'nixpkgs-fmt' + formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); - homeConfigurations = ( # Nix Configurations - import ./nix/home.nix { - inherit (nixpkgs) lib; - inherit inputs nixpkgs nixpkgs-unstable home-manager vars hyprland split-monitor-workspaces; - } - ); + # Your custom packages and modifications, exported as overlays + overlays = import ./overlays {inherit inputs;}; + # Reusable nixos modules you might want to export + # These are usually stuff you would upstream into nixpkgs + nixosModules = import ./modules/nixos; + # Reusable home-manager modules you might want to export + # These are usually stuff you would upstream into home-manager + homeManagerModules = import ./modules/home-manager; + + # NixOS configuration entrypoint + # Available through 'nixos-rebuild --flake .#your-hostname' + nixosConfigurations = { + # FIXME replace with your hostname + your-hostname = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [ + # > Our main nixos configuration file < + ./nixos/configuration.nix + ]; + }; + }; + + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#your-username@your-hostname' + homeConfigurations = { + # FIXME replace with your username@hostname + "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + extraSpecialArgs = {inherit inputs outputs;}; + modules = [ + # > Our main home-manager configuration file < + ./home-manager/home.nix + ]; + }; + }; }; } diff --git a/home-manager/home.nix b/home-manager/home.nix new file mode 100644 index 0000000..eedacc2 --- /dev/null +++ b/home-manager/home.nix @@ -0,0 +1,69 @@ +# This is your home-manager configuration file +# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # You can import other home-manager modules here + imports = [ + # If you want to use modules your own flake exports (from modules/home-manager): + # outputs.homeManagerModules.example + + # Or modules exported from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModules.default + + # You can also split up your configuration and import pieces of it here: + # ./nvim.nix + ]; + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = _: true; + }; + }; + + # TODO: Set your username + home = { + username = "your-username"; + homeDirectory = "/home/your-username"; + }; + + # Add stuff for your user as you see fit: + # programs.neovim.enable = true; + # home.packages = with pkgs; [ steam ]; + + # Enable home-manager and git + programs.home-manager.enable = true; + programs.git.enable = true; + + # Nicely reload system units when changing configs + systemd.user.startServices = "sd-switch"; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + home.stateVersion = "23.05"; +} diff --git a/hosts/configuration.nix b/hosts/configuration.nix deleted file mode 100644 index d23c3f5..0000000 --- a/hosts/configuration.nix +++ /dev/null @@ -1,242 +0,0 @@ -{ - config, - lib, - pkgs, - unstable, - inputs, - vars, - ... -}: { - imports = - (import ../modules/desktops) ++ (import ../modules/shell) ++ [../modules/programs/librewolf.nix ../modules/programs/alacritty.nix] ++ (import ../modules/theming) ++ (import ../modules/coding); - - users.users.${vars.user} = { - # System User - isNormalUser = true; - extraGroups = ["wheel" "video" "audio" "camera" "networkmanager" "lp" "scanner" "kvm" "libvirtd" "i2c" "tty" "dialout" "wireshark"]; - }; - - boot.supportedFilesystems = ["ntfs" "exfat"]; - - # Set default shell -> move to module - users.defaultUserShell = pkgs.fish; - environment.shells = with pkgs; [fish]; - programs.fish.enable = true; - - services.flatpak.enable = true; - # Enable the X11 windowing system. - # services.xserver.enable = true; - - # programs.ssh.startAgent = true; - - services.logind.extraConfig = '' - # don’t shutdown when power button is short-pressed - HandlePowerKey=ignore - ''; - - # Enable the KDE Plasma Desktop Environment. - services.xserver.displayManager.sddm.enable = true; - # Configure keymap in X11 - # services.xserver = { - # layout = "de"; - # xkbVariant = ""; - # }; - - environment.defaultCursor = { - enable = true; - theme = "breeze_cursors"; - }; - - time.timeZone = "Europe/Berlin"; - i18n = { - defaultLocale = "en_US.UTF-8"; - extraLocaleSettings = { - LC_ADDRESS = "de_DE.UTF-8"; - LC_IDENTIFICATION = "de_DE.UTF-8"; - LC_MEASUREMENT = "de_DE.UTF-8"; - LC_MONETARY = "de_DE.UTF-8"; - LC_NAME = "de_DE.UTF-8"; - LC_NUMERIC = "de_DE.UTF-8"; - LC_PAPER = "de_DE.UTF-8"; - LC_TELEPHONE = "de_DE.UTF-8"; - LC_TIME = "de_DE.UTF-8"; - }; - }; - - console = { - # font = "Lat2-Terminus16"; - keyMap = "de"; - }; - - security = { - rtkit.enable = true; - polkit.enable = true; - }; - - fonts.fonts = with pkgs; [ - # Fonts - carlito # NixOS - vegur # NixOS - source-code-pro - jetbrains-mono - font-awesome # Icons - corefonts # MS - carlito - dejavu_fonts - ipafont - kochi-substitute - source-code-pro - ttf_bitstream_vera - inter - noto-fonts-cjk-sans - (nerdfonts.override { - # Nerdfont Icons override - fonts = [ - "JetBrainsMono" - ]; - }) - ]; - - environment = { - variables = { - # Environment Variables - TERMINAL = "${vars.terminal}"; - EDITOR = "${vars.editor}"; - VISUAL = "${vars.editor}"; - }; - systemPackages = with pkgs; - [ - # System-Wide Packages - # Terminal - btop # Resource Manager - coreutils # GNU Utilities - git # Version Control - killall # Process Killer - nano # Text Editor - neovim - nix-tree # Browse Nix Store - pciutils # Manage PCI - tldr # Helper - usbutils # Manage USB - wget # Retriever - bat - lazygit - fzf - neofetch - jmtpfs # Android MTP - ipinfo - - # Video/Audio - alsa-utils # Audio Control - feh # Image Viewer - mpv # Media Player - pavucontrol # Audio Control - pipewire # Audio Server/Control - pulseaudio # Audio Server/Control - jellyfin-media-player - - # Apps - appimage-run # Runs AppImages on NixOS - webcord - signal-desktop - alacritty - librewolf - zathura - - # File Management - unzip # Zip Files - unrar # Rar Files - zip # Zip - - # Shell - fishPlugins.grc - grc - fishPlugins.fzf - fishPlugins.tide - fishPlugins.sponge - fishPlugins.colored-man-pages - fishPlugins.autopair - nix-your-shell - # Other Packages Found @ - # - .//default.nix - # - ../modules - ] - ++ (with unstable; [ - # Terminal - eza - - # Apps - feishin - sddm - electron-mail - xournalpp - ]); - }; - - programs = { - dconf.enable = true; - }; - - i18n.inputMethod = { - enabled = "fcitx5"; - fcitx5.addons = with pkgs; [ - fcitx5-mozc - fcitx5-gtk - ]; - }; - - services = { - printing = { - # CUPS - enable = true; - }; - pipewire = { - # Sound - enable = true; - alsa = { - enable = true; - support32Bit = true; - }; - pulse.enable = true; - jack.enable = true; - }; - }; - - #hardware.pulseaudio.enable = false; - - nix = { - # Nix Package Manager Settings - settings = { - auto-optimise-store = true; - }; - # gc = { # Garbage Collection - # automatic = true; - # dates = "weekly"; - # options = "--delete-older-than 2d"; - # }; - package = pkgs.nixVersions.unstable; # Enable Flakes - 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 - stateVersion = "23.05"; - }; - - home-manager.users.${vars.user} = { - # Home-Manager Settings - home = { - stateVersion = "23.05"; - }; - - programs = { - home-manager.enable = true; - }; - }; -} diff --git a/hosts/convertible/default.nix b/hosts/convertible/default.nix deleted file mode 100644 index 5bfae33..0000000 --- a/hosts/convertible/default.nix +++ /dev/null @@ -1,82 +0,0 @@ -# NOTE: Dual booted with windows 11. Disable fast-boot in power plan and bios and turn off hibernate to get wifi and bluetooth working. This only works once but on reboot is borked again. So using the old school BLT dongle. -# -{ - lib, - pkgs, - vars, - unstable, - ... -}: { - imports = [ - ./hardware-configuration.nix - ../../modules/virtualization/docker.nix - ../../modules/virtualization/qemu.nix - ../../modules/secrets/gnome-keyring.nix - ../../modules/secrets/gpg.nix - ]; - - boot = { - # Boot Options - loader = { - systemd-boot = { - enable = true; - configurationLimit = 3; - }; - efi = { - canTouchEfiVariables = true; - }; - timeout = 5; - }; - }; - - boot.initrd.secrets = { - "/crypto_keyfile.bin" = null; - }; - - # Enable swap on luks - boot.initrd.luks.devices."luks-4397a73c-b1b9-4fd0-8f7d-21d5159269b8".device = "/dev/disk/by-uuid/4397a73c-b1b9-4fd0-8f7d-21d5159269b8"; - boot.initrd.luks.devices."luks-4397a73c-b1b9-4fd0-8f7d-21d5159269b8".keyFile = "/crypto_keyfile.bin"; - - boot.kernelParams = ["i915.force_probe=9a49"]; - hardware.opengl = { - enable = true; - extraPackages = with pkgs; [ - intel-media-driver # LIBVA_DRIVER_NAME=iHD - vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) - vaapiVdpau - libvdpau-va-gl - ]; - }; - # i18n.inputmethod = { - # enabled = "fcitx5"; - # # fcitx5.addons = with pkgs; [ - # # fcitx5-mozc - # # fcitx5-gtk - # # ]; - # }; - - gnome.enable = true; - awesome.enable = true; - - services.tailscale.enable = true; - services.tailscale.useRoutingFeatures = "client"; - - environment = { - etc = { - "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' - bluez_monitor.properties = { - ["bluez5.enable-hw-volume"] = false, - } - ''; - }; - systemPackages = with pkgs; - [ - tailscale - nextcloud-client - calibre - libreoffice - element-desktop - ] - ++ (with unstable; [xournalpp]); - }; -} diff --git a/hosts/convertible/hardware-configuration.nix b/hosts/convertible/hardware-configuration.nix deleted file mode 100644 index d4f0e34..0000000 --- a/hosts/convertible/hardware-configuration.nix +++ /dev/null @@ -1,46 +0,0 @@ -# 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" "thunderbolt" "vmd" "nvme" "usb_storage" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel"]; - boot.extraModulePackages = []; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/e36453a3-629d-4704-a42e-180bf3640722"; - fsType = "ext4"; - }; - - boot.initrd.luks.devices."luks-5f04c1e9-c3fe-42fb-97d1-0833bf66435a".device = "/dev/disk/by-uuid/5f04c1e9-c3fe-42fb-97d1-0833bf66435a"; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/A2B4-1BBE"; - fsType = "vfat"; - }; - - swapDevices = [ - {device = "/dev/disk/by-uuid/b16f0d66-5aec-4e0e-8162-c8e87e19888c";} - ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/default.nix b/hosts/default.nix deleted file mode 100644 index 594315a..0000000 --- a/hosts/default.nix +++ /dev/null @@ -1,79 +0,0 @@ -{ - lib, - inputs, - nixpkgs, - nixpkgs-unstable, - home-manager, - nur, - hyprland, - split-monitor-workspaces, - vars, - ... -}: 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; - }; - - lib = nixpkgs.lib; -in { - desktop = lib.nixosSystem { - # Desktop Profile - inherit system; - specialArgs = { - # Pass Flake Variable - inherit inputs system unstable hyprland vars split-monitor-workspaces; - host = { - hostName = "desktop"; - mainMonitor = "DP-3"; - secondMonitor = "DP-1"; - }; - }; - modules = [ - # Modules Used - nur.nixosModules.nur - hyprland.nixosModules.default - ./desktop - ./configuration.nix - home-manager.nixosModules.home-manager - { - # Home-Manager Module - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - } - ]; - }; - convertible = lib.nixosSystem { - # Desktop Profile - inherit system; - specialArgs = { - # Pass Flake Variable - inherit inputs system unstable hyprland vars split-monitor-workspaces; - host = { - hostName = "convertible"; - mainMonitor = "DP-3"; - secondMonitor = "DP-1"; - }; - }; - modules = [ - # Modules Used - nur.nixosModules.nur - hyprland.nixosModules.default - ./convertible - ./configuration.nix - home-manager.nixosModules.home-manager - { - # Home-Manager Module - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - } - ]; - }; -} diff --git a/hosts/desktop/default.nix b/hosts/desktop/default.nix deleted file mode 100644 index 9c6625a..0000000 --- a/hosts/desktop/default.nix +++ /dev/null @@ -1,71 +0,0 @@ -# NOTE: Dual booted with windows 11. Disable fast-boot in power plan and bios and turn off hibernate to get wifi and bluetooth working. This only works once but on reboot is borked again. So using the old school BLT dongle. -# -{ - lib, - pkgs, - vars, - unstable, - ... -}: { - imports = [ - ./hardware-configuration.nix - ../../modules/hardware/nvidia.nix - ../../modules/services/avahi.nix - ../../modules/virtualization/docker.nix - ../../modules/virtualization/qemu.nix - ../../modules/programs/games.nix - ../../modules/secrets/gnome-keyring.nix - ../../modules/secrets/gpg.nix - # ../../modules/services/easyeffects.nix - ]; - - boot = { - # Boot Options - loader = { - systemd-boot = { - enable = true; - configurationLimit = 3; - }; - efi = { - canTouchEfiVariables = true; - }; - timeout = 5; - }; - kernelPackages = unstable.linuxPackages_latest; - }; - - hardware = { - sane = { - # Scanning - enable = true; - extraBackends = [unstable.utsushi]; - }; - }; - services.udev.packages = [unstable.utsushi]; - - # Desktops - hyprland.enable = false; - kde.enable = false; - awesome.enable = true; - - programs.kdeconnect.enable = true; - environment = { - systemPackages = with pkgs; - [ - # System-Wide Packages - discord # Messaging - obs-studio # Live Streaming - simple-scan # Scanning - firefox - heroic - nextcloud-client - anki - easyeffects - qpwgraph - calibre - ] - ++ (with unstable; [ - libsForQt5.kdeconnect-kde - ]); - }; -} diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix deleted file mode 100644 index ab97b97..0000000 --- a/hosts/desktop/hardware-configuration.nix +++ /dev/null @@ -1,43 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ - config, - lib, - pkgs, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/f9ba57fb-0b82-47e0-8189-7bbebc530e2b"; - fsType = "ext4"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/BCF2-51D4"; - fsType = "vfat"; - }; - - swapDevices = [ - {device = "/dev/disk/by-uuid/4834fbc3-3feb-4b93-b11f-8b9bd054c5c1";} - ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/modules/coding/android-studio.nix b/modules/coding/android-studio.nix deleted file mode 100644 index e3e9227..0000000 --- a/modules/coding/android-studio.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - config, - lib, - pkgs, - unstable, - vars, - ... -}: let -in { - home-manager.users.${vars.user} = { - }; - - programs.adb.enable = true; - users.users.${vars.user}.extraGroups = ["adbusers"]; - - environment.systemPackages = with unstable; [ - android-studio - ]; -} diff --git a/modules/coding/default.nix b/modules/coding/default.nix deleted file mode 100644 index e68a1d3..0000000 --- a/modules/coding/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -[ - ./nvim.nix - ./vscode.nix - ./intellij.nix - ./android-studio.nix -] diff --git a/modules/coding/intellij.nix b/modules/coding/intellij.nix deleted file mode 100644 index eff3cec..0000000 --- a/modules/coding/intellij.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - config, - lib, - pkgs, - unstable, - vars, - ... -}: let -in { - home-manager.users.${vars.user} = { - }; - - environment.systemPackages = with unstable; [ - (jetbrains.plugins.addPlugins jetbrains.idea-ultimate ["ideavim"]) - ]; -} diff --git a/modules/coding/nvim.nix b/modules/coding/nvim.nix deleted file mode 100644 index 657abdc..0000000 --- a/modules/coding/nvim.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - config, - lib, - pkgs, - vars, - ... -}: let -in { - home-manager.users.${vars.user} = { - home.file.".config/nvim/lua/custom/" = { - source = ../../rsc/config/nvim; - recursive = true; - }; - }; - - environment.systemPackages = with pkgs; [ - gcc - black - python310Packages.debugpy # is this working? - mypy - ruff - nodePackages.pyright - clang-tools_16 - rnix-lsp - rust-analyzer - nodePackages.eslint_d - nodePackages.jsonlint - alejandra - ]; -} diff --git a/modules/coding/vscode.nix b/modules/coding/vscode.nix deleted file mode 100644 index 8a33c9d..0000000 --- a/modules/coding/vscode.nix +++ /dev/null @@ -1,87 +0,0 @@ -{ - config, - lib, - pkgs, - vars, - ... -}: let -in { - home-manager.users.${vars.user} = { - programs.vscode = { - enable = true; - package = pkgs.vscodium; - enableUpdateCheck = false; - extensions = with pkgs.vscode-extensions; - [ - catppuccin.catppuccin-vsc - pkief.material-icon-theme - vscodevim.vim - bbenoist.nix - ms-python.python - ms-toolsai.jupyter - ms-toolsai.jupyter-renderers - ms-toolsai.jupyter-keymap - ] - ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ - { - name = "remote-ssh-edit"; - publisher = "ms-vscode-remote"; - version = "0.47.2"; - sha256 = "1hp6gjh4xp2m1xlm1jsdzxw9d8frkiidhph6nvl24d0h8z34w49g"; - } - { - name = "cpptools"; - publisher = "ms-vscode"; - version = "1.19.1"; - sha256 = "sha256-yUZTLnN4nomFp5I0VgRz7rRMkeMU9QzY+dzEdUUASek="; - } - { - name = "camkes-syntax-highlighting"; - publisher = "hensoldt-cyber-gmbh"; - version = "1.1.3"; - sha256 = "sha256-dRhsFGSjR/Vp5aJgMDwCZQtwmmfNXbM85ViTIq5ORwY="; - } - ]; - userSettings = { - #Theming - "workbench.colorTheme" = "Catppuccin Mocha"; - "catppuccin.accentColor" = "teal"; - "workbench.iconTheme" = "material-icon-theme"; - "window.menuBarVisibility" = "toggle"; - "editor.minimap.autohide" = false; - #Extensions - General - "extensions.autoCheckUpdates" = false; - "extensions.autoUpdate" = false; - # Startup - "workbench.startupEditor" = "none"; - # Vim - "editor.lineNumbers" = "relative"; - }; - keybindings = [ - # Navigating Autosuggest and Quick Open entries - { - "key" = "ctrl+j"; - "command" = "selectNextSuggestion"; - "when" = "suggestWidgetVisible"; - } - { - "key" = "ctrl+k"; - "command" = "selectPrevSuggestion"; - "when" = "suggestWidgetVisible"; - } - { - "key" = "ctrl+j"; - "command" = "workbench.action.quickOpenSelectNext"; - "when" = "inQuickOpen"; - } - { - "key" = "ctrl+k"; - "command" = "workbench.action.quickOpenSelectPrevious"; - "when" = "inQuickOpen"; - } - ]; - }; - }; - - # programs.vscode.package = pkgs.vscodium.fhsWithPackages (ps: with ps; [rustup zlib]); -} diff --git a/modules/desktops/awesome.nix b/modules/desktops/awesome.nix deleted file mode 100644 index 655c474..0000000 --- a/modules/desktops/awesome.nix +++ /dev/null @@ -1,82 +0,0 @@ -# -# AwesomeWM Configuration -# Enable with "awesome.enable = true;" -# -{ - config, - lib, - pkgs, - vars, - ... -}: -with lib; { - options = { - awesome = { - enable = mkOption { - type = types.bool; - default = false; - }; - }; - }; - - config = mkIf (config.awesome.enable) { - services = { - xserver = { - enable = true; - layout = "de"; - # dpi = 180; - libinput.enable = true; - modules = [pkgs.xf86_input_wacom]; - wacom.enable = true; - windowManager.awesome.enable = true; - }; - }; - - home-manager.users.${vars.user} = { - home.file.".wallpapers" = { - source = ../../rsc/wallpaper; - recursive = true; - }; - home.file.".config/awesome/" = { - source = ../../rsc/config/awesome; - recursive = true; - }; - home.file.".config/picom/" = { - source = ../../rsc/config/picom; - recursive = true; - }; - home.file.".config/rofi" = { - source = ../../rsc/config/rofi; - recursive = true; - }; - home.file.".config/flameshot" = { - source = ../../rsc/config/flameshot; - recursive = true; - }; - home.file.".config/zathura" = { - source = ../../rsc/config/zathura; - recursive = true; - }; - }; - environment = { - systemPackages = with pkgs; - [ - picom - rofi - redshift - xbindkeys - clipmenu - flameshot - xclip - brightnessctl - ] - ++ (with unstable; []); - }; - # Flatpak - xdg.portal.enable = true; - xdg.portal.extraPortals = with pkgs; [xdg-desktop-portal-kde]; - - # Networking - networking.networkmanager.enable = true; - }; -} diff --git a/modules/desktops/default.nix b/modules/desktops/default.nix deleted file mode 100644 index 7b2a303..0000000 --- a/modules/desktops/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -[ - ./hyprland.nix - ./kde.nix - ./gnome.nix - ./awesome.nix -] diff --git a/modules/desktops/gnome.nix b/modules/desktops/gnome.nix deleted file mode 100644 index 8395c6d..0000000 --- a/modules/desktops/gnome.nix +++ /dev/null @@ -1,66 +0,0 @@ -# -# Gnome Configuration -# Enable with "gnome.enable = true;" -# -{ - config, - lib, - pkgs, - vars, - ... -}: -with lib; { - options = { - gnome = { - enable = mkOption { - type = types.bool; - default = false; - }; - }; - }; - - config = mkIf (config.gnome.enable) { - hardware.pulseaudio.enable = false; - services = { - xserver = { - enable = true; - - layout = "de"; - libinput.enable = true; - modules = [pkgs.xf86_input_wacom]; - wacom.enable = true; - - desktopManager.gnome.enable = true; # Desktop Environment - }; - udev.packages = with pkgs; [ - gnome.gnome-settings-daemon - ]; - }; - - environment = { - systemPackages = with pkgs; [ - # System-Wide Packages - gnome.adwaita-icon-theme - gnome.dconf-editor - gnome.gnome-tweaks - ]; - gnome.excludePackages = - (with pkgs; [ - # Ignored Packages - gnome-tour - ]) - ++ (with pkgs.gnome; [ - atomix - epiphany - geary - gedit - gnome-characters - gnome-contacts - gnome-initial-setup - hitori - iagno - tali - ]); - }; - }; -} diff --git a/modules/desktops/hyprland.nix b/modules/desktops/hyprland.nix deleted file mode 100644 index 87358eb..0000000 --- a/modules/desktops/hyprland.nix +++ /dev/null @@ -1,289 +0,0 @@ -# -# Hyprland Configuration -# Enable with "hyprland.enable = true;" -# -{ - config, - lib, - system, - pkgs, - unstable, - hyprland, - vars, - host, - split-monitor-workspaces, - ... -}: let - hyprlandconf = '' - monitor = DP-1,1920x1080@75,auto,auto - monitor = DP-3,2560x1440@144,auto,auto - monitor = ,preferred,auto,auto - - source = ~/.config/hypr/mocha.conf - - exec-once = waybar - exec-once = dunst - exec-once = swww init && swww img ~/.wallpapers/robot.jpg - exec-once = signal-desktop --start-in-tray - exec-once = webcord --start-minimized - - env = XCURSOR_SIZE,24 - env = LIBVA_DRIVER_NAME,nvidia - env = XDG_SESSION_TYPE,wayland - env = GBM_BACKEND,nvidia-drm - env = __GLX_VENDOR_LIBRARY_NAME,nvidia - env = WLR_NO_HARDWARE_CURSORS,1 - env = NIXOS_OZONE_WL,1 # for any ozone-based browser & electron apps to run on wayland - env = MOZ_ENABLE_WAYLAND,1 # for firefox to run on wayland - env = MOZ_WEBRENDER,1 - - plugin { - split-monitor-workspaces { - count = 9 - } - } - - input { - kb_layout = de - kb_variant = - kb_model = - kb_options = - kb_rules = - - follow_mouse = 1 - - touchpad { - natural_scroll = no - } - - sensitivity = 0 # -1.0 - 1.0, 0 means no modification. - } - - general { - gaps_in = 5 - gaps_out = 5 - border_size = 2 - col.active_border = $teal - col.inactive_border = $tealAlpha - - layout = dwindle - } - - misc { - disable_hyprland_logo = true - vrr = true - vfr = true - } - - decoration { - screen_shader = ~/.config/hypr/shaders/nightlight.frag - - rounding = 10 - - blur { - enabled = true - size = 3 - passes = 1 - } - - drop_shadow = yes - shadow_range = 4 - shadow_render_power = 3 - col.shadow = rgba(1a1a1aee) - } - - animations { - enabled = yes - - bezier = myBezier, 0.05, 0.9, 0.1, 1.05 - - animation = windows, 1, 7, myBezier - animation = windowsOut, 1, 7, default, popin 80% - animation = border, 1, 10, default - animation = borderangle, 1, 8, default - animation = fade, 1, 7, default - animation = workspaces, 1, 6, default - } - - dwindle { - pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below - preserve_split = yes # you probably want this - } - - master { - new_is_master = true - } - - gestures { - workspace_swipe = off - } - - $mainMod = SUPER - - bind = $mainMod, RETURN, exec, alacritty - bind = $mainMod, SPACE, exec, rofi -i -show drun -modi drun -show-icons - bind = SUPER_SHIFT, C, killactive, - bind = SUPER_SHIFT, Q, exit, - bind = $mainMod, V, togglefloating, - bind = $mainMod, P, pseudo, # dwindle - bind = $mainMod, J, togglesplit, # dwindle - bind = $mainMod, O, split-changemonitorsilent,next - # Move focus with mainMod + arrow keys - bind = $mainMod, left, movefocus, l - bind = $mainMod, right, movefocus, r - bind = $mainMod, up, movefocus, u - bind = $mainMod, down, movefocus, d - - # Switch workspaces with mainMod + [0-9] - bind = $mainMod, 1, split-workspace, 1 - bind = $mainMod, 2, split-workspace, 2 - bind = $mainMod, 3, split-workspace, 3 - bind = $mainMod, 4, split-workspace, 4 - bind = $mainMod, 5, split-workspace, 5 - bind = $mainMod, 6, split-workspace, 6 - bind = $mainMod, 7, split-workspace, 7 - bind = $mainMod, 8, split-workspace, 8 - bind = $mainMod, 9, split-workspace, 9 - bind = $mainMod, 0, split-workspace, 10 - - # Move active window to a workspace with mainMod + SHIFT + [0-9] - bind = $mainMod SHIFT, 1, split-movetoworkspace, 1 - bind = $mainMod SHIFT, 2, split-movetoworkspace, 2 - bind = $mainMod SHIFT, 3, split-movetoworkspace, 3 - bind = $mainMod SHIFT, 4, split-movetoworkspace, 4 - bind = $mainMod SHIFT, 5, split-movetoworkspace, 5 - bind = $mainMod SHIFT, 6, split-movetoworkspace, 6 - bind = $mainMod SHIFT, 7, split-movetoworkspace, 7 - bind = $mainMod SHIFT, 8, split-movetoworkspace, 8 - bind = $mainMod SHIFT, 9, split-movetoworkspace, 9 - bind = $mainMod SHIFT, 0, split-movetoworkspace, 10 - - # Move/resize windows with mainMod + LMB/RMB and dragging - bindm = $mainMod, mouse:272, movewindow - bindm = $mainMod, mouse:273, resizewindow - - bind = SUPERSHIFT, V, exec, cliphist list | rofi -dmenu | cliphist decode | wl-copy - bind = $mainMod, L, exec, librewolf - bind = $mainMod SHIFT, L, exec, librewolf --private-window - ''; -in - with lib; - with host; { - options = { - hyprland = { - enable = mkOption { - type = types.bool; - default = false; - }; - }; - }; - - config = mkIf (config.hyprland.enable) { - environment = { - systemPackages = with pkgs; - [ - grim # Grab Images - slurp # Region Selector - wl-clipboard # Clipboard - wlr-randr # Monitor Settings - dunst - cliphist - rofi-wayland - swww - ] - ++ (with unstable; [waybar]); - # sessionVariables = { - # "NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland - # "MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland - # "MOZ_WEBRENDER" = "1"; - # - # # for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/ - # "LIBVA_DRIVER_NAME" = "nvidia"; - # "XDG_SESSION_TYPE" = "wayland"; - # "GBM_BACKEND" = "nvidia-drm"; - # "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; - # "WLR_NO_HARDWARE_CURSORS" = "1"; - # "WLR_EGL_NO_MODIFIRES" = "1"; - # }; - }; - - programs = { - hyprland = { - # Window Manager - enable = true; - xwayland.enable = true; - enableNvidiaPatches = - if hostName == "desktop" - then true - else false; - }; - }; - - hardware = { - opengl = { - enable = true; - }; - }; - - xdg.portal = { - enable = true; - extraPortals = with pkgs; [xdg-desktop-portal-gtk]; - }; - - home-manager.users.${vars.user} = { - imports = [hyprland.homeManagerModules.default]; - - home.file.".config/hypr/" = { - source = ../../rsc/config/hypr; - recursive = true; - }; - - home.file.".config/waybar" = { - source = ../../rsc/config/waybar; - recursive = true; - }; - - home.file.".config/dunst" = { - source = ../../rsc/config/dunst; - recursive = true; - }; - - home.file.".config/rofi" = { - source = ../../rsc/config/rofi; - recursive = true; - }; - - home.file.".wallpapers" = { - source = ../../rsc/wallpaper; - recursive = true; - }; - - programs.waybar.package = pkgs.waybar.overrideAttrs (oa: { - mesonFlags = (oa.mesonFlags or []) ++ ["-Dexperimental=true"]; - patches = - (oa.patches or []) - ++ [ - (pkgs.fetchpatch { - name = "fix waybar hyprctl"; - url = "https://aur.archlinux.org/cgit/aur.git/plain/hyprctl.patch?h=waybar-hyprland-git"; - sha256 = "sha256-pY3+9Dhi61Jo2cPnBdmn3NUTSA8bAbtgsk2ooj4y7aQ="; - }) - ]; - }); - - wayland.windowManager.hyprland = { - enable = true; - systemdIntegration = true; - extraConfig = hyprlandconf; - plugins = [ - split-monitor-workspaces.packages.${pkgs.system}.split-monitor-workspaces - ]; - }; - }; - - nix.settings = { - substituters = ["https://hyprland.cachix.org"]; - trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; - }; # Cache - }; - } diff --git a/modules/desktops/kde.nix b/modules/desktops/kde.nix deleted file mode 100644 index c16e955..0000000 --- a/modules/desktops/kde.nix +++ /dev/null @@ -1,52 +0,0 @@ -# -# KDE Plasma 5 Configuration -# Enable with "kde.enable = true;" -# -{ - config, - lib, - pkgs, - vars, - ... -}: -with lib; { - options = { - kde = { - enable = mkOption { - type = types.bool; - default = false; - }; - }; - }; - - config = mkIf (config.kde.enable) { - services = { - xserver = { - enable = true; - - layout = "de"; - libinput.enable = true; - modules = [pkgs.xf86_input_wacom]; - wacom.enable = true; - - #displayManager.defaultSession = "plasmawayland"; - - desktopManager.plasma5 = { - enable = true; # Desktop Environment - }; - }; - }; - - environment = { - systemPackages = with pkgs.libsForQt5; [ - # System-Wide Packages - ]; - plasma5.excludePackages = with pkgs.libsForQt5; [ - elisa - khelpcenter - konsole - oxygen - ]; - }; - }; -} diff --git a/modules/hardware/nvidia.nix b/modules/hardware/nvidia.nix deleted file mode 100644 index 3e13867..0000000 --- a/modules/hardware/nvidia.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - config, - pkgs, - ... -}: { - services.xserver.videoDrivers = ["nvidia"]; - hardware = { - opengl.enable = true; - nvidia = { - package = config.boot.kernelPackages.nvidiaPackages.stable; - modesetting.enable = true; - powerManagement.enable = false; - open = true; - nvidiaSettings = true; - }; - }; -} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix new file mode 100644 index 0000000..45aae31 --- /dev/null +++ b/modules/home-manager/default.nix @@ -0,0 +1,6 @@ +# Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module). +# These should be stuff you would like to share with others, not your personal configurations. +{ + # List your module files here + # my-module = import ./my-module.nix; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..8605069 --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1,6 @@ +# Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module). +# These should be stuff you would like to share with others, not your personal configurations. +{ + # List your module files here + # my-module = import ./my-module.nix; +} diff --git a/modules/programs/alacritty.nix b/modules/programs/alacritty.nix deleted file mode 100644 index fc3dce3..0000000 --- a/modules/programs/alacritty.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - config, - lib, - pkgs, - vars, - ... -}: { - home-manager.users.${vars.user} = { - home.file.".config/alacritty" = { - source = ../../rsc/config/alacritty; - recursive = true; - }; - }; -} diff --git a/modules/programs/games.nix b/modules/programs/games.nix deleted file mode 100644 index 8854d12..0000000 --- a/modules/programs/games.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - config, - pkgs, - nur, - lib, - unstable, - ... -}: { - environment.systemPackages = [ - unstable.heroic # Game Launcher - unstable.lutris # Game Launcher - unstable.steam # Game Launcher - ]; - - programs = { - 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 - }; -} diff --git a/modules/programs/librewolf.nix b/modules/programs/librewolf.nix deleted file mode 100644 index f89161d..0000000 --- a/modules/programs/librewolf.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - config, - lib, - pkgs, - vars, - ... -}: { - nixpkgs.config.librewolf.enablePlasmaBrowserIntegration = true; - - home-manager.users.${vars.user} = { - programs.librewolf = { - enable = true; - settings = { - "identity.fxaccounts.enabled" = true; - "browser.sessionstore.enabled" = false; - "browser.startup.page" = 1; - "browser.sessionstore.resume_session_once" = true; - "browser.sessionstore.resume_from_crash" = false; - "middlemouse.paste" = false; - "general.autoScroll" = true; - "security.OCSP.require" = false; - }; - }; - }; -} diff --git a/modules/secrets/gnome-keyring.nix b/modules/secrets/gnome-keyring.nix deleted file mode 100644 index 701b31f..0000000 --- a/modules/secrets/gnome-keyring.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - config, - lib, - pkgs, - vars, - ... -}: { - security.pam.services.${vars.user}.enableGnomeKeyring = true; - services.gnome.gnome-keyring.enable = true; - programs.seahorse.enable = true; -} diff --git a/modules/secrets/gpg.nix b/modules/secrets/gpg.nix deleted file mode 100644 index 4bf05a4..0000000 --- a/modules/secrets/gpg.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - config, - lib, - pkgs, - vars, - ... -}: { - home-manager.users.${vars.user} = { - programs.gpg = { - enable = true; - }; - services.gpg-agent = { - enable = true; - enableSshSupport = true; - enableFishIntegration = true; - enableZshIntegration = true; - pinentryFlavor = "gnome3"; - }; - - # Prevent clobbering SSH_AUTH_SOCK - home.sessionVariables.GSM_SKIP_SSH_AGENT_WORKAROUND = "1"; - - # Disable gnome-keyring ssh-agent - xdg.configFile."autostart/gnome-keyring-ssh.desktop".text = '' - ${lib.fileContents "${pkgs.gnome3.gnome-keyring}/etc/xdg/autostart/gnome-keyring-ssh.desktop"} - Hidden=true - ''; - }; - -} diff --git a/modules/services/avahi.nix b/modules/services/avahi.nix deleted file mode 100644 index 57f7f3a..0000000 --- a/modules/services/avahi.nix +++ /dev/null @@ -1,16 +0,0 @@ -# -# Network Discoverability (for printers, scanners and such) -# -{ - services = { - avahi = { - enable = true; - nssmdns = true; - publish = { - enable = true; - addresses = true; - userServices = true; - }; - }; - }; -} diff --git a/modules/services/default.nix b/modules/services/default.nix deleted file mode 100644 index 79210c6..0000000 --- a/modules/services/default.nix +++ /dev/null @@ -1 +0,0 @@ -[./avahi.nix] diff --git a/modules/services/easyeffects.nix b/modules/services/easyeffects.nix deleted file mode 100644 index 8d0149b..0000000 --- a/modules/services/easyeffects.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - config, - lib, - pkgs, - vars, - ... -}: { - home-manager.users.${vars.user} = { - services.easyeffects.enable = true; - - home.file.".config/easyeffects/output/Beyerdynamic_DT990_Oratory.json" = { - source = ../../rsc/config/easyeffects/Beyerdynamic_DT990_Oratory.json; - }; - }; -} diff --git a/modules/shell/default.nix b/modules/shell/default.nix deleted file mode 100644 index 717f050..0000000 --- a/modules/shell/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -[ - ./git.nix - ./fish.nix - ./zsh.nix -] diff --git a/modules/shell/fish.nix b/modules/shell/fish.nix deleted file mode 100644 index 39cb56f..0000000 --- a/modules/shell/fish.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - config, - lib, - pkgs, - vars, - ... -}: { - home-manager.users.${vars.user} = { - programs.fish = { - enable = true; - interactiveShellInit = '' - nix-your-shell fish | source - set fish_greeting - ''; - shellAliases = { - lzg = "lazygit"; - lzd = "lazydocker"; - batt = ''upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -e "percentage" -e "state"''; - hx = "~/Documents/heliox-cli/target/debug/heliox-cli --mode"; - slp = "systemctl suspend"; - sdn = "shutdown 0"; - }; - shellAbbrs = { - build = "bash sdk/scripts/open_trentos_build_env.sh sdk/build-system.sh sdk/demos/demo_hello_world rpi3 build-rpi3-Debug-demo_hello_world -DCMAKE_BUILD_TYPE=Debug"; - simbuild = "bash sdk/scripts/open_trentos_build_env.sh sdk/build-system.sh sdk/demos/demo_hello_world zynq7000 build-zynq7000-Debug-demo_hello_world -DCMAKE_BUILD_TYPE=Debug"; - sim = "sudo bash ../sdk/scripts/open_trentos_test_env.sh ./simulate"; - }; - }; - }; -} diff --git a/modules/shell/git.nix b/modules/shell/git.nix deleted file mode 100644 index 4d19487..0000000 --- a/modules/shell/git.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - config, - lib, - pkgs, - vars, - ... -}: { - home-manager.users.${vars.user} = { - #Prefer IPv4 for ssh - home.file.".ssh/config".text = "AddressFamily inet"; - - programs.git = { - enable = true; - userName = "GHOSCHT"; - userEmail = "31184695+GHOSCHT@users.noreply.github.com"; - - extraConfig = { - commit.gpgsign = true; - user.signingkey = "0x2C2C1C62A5388E82"; - init.defaultBranch = "main"; - }; - }; - }; -} diff --git a/modules/shell/zsh.nix b/modules/shell/zsh.nix deleted file mode 100644 index 1cb175b..0000000 --- a/modules/shell/zsh.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ - lib, - pkgs, - vars, - ... -}: { - home-manager.users.${vars.user} = { - home.file."~/.config/zsh/.p10k.zsh" = { - source = ../../rsc/config/zsh/.p10k.zsh; - }; - - programs.zsh = { - enable = true; - autocd = true; - dotDir = ".config/zsh"; - enableAutosuggestions = true; - enableCompletion = true; - shellAliases = { - sl = "eza"; - ls = "eza"; - l = "eza -l"; - la = "eza -la"; - ip = "ip --color=auto"; - }; - - initExtra = '' - [[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh - nix-your-shell zsh | source /dev/stdin - ''; - - zplug = { - enable = true; - plugins = [ - { - name = "romkatv/powerlevel10k"; - tags = ["as:theme" "depth:1"]; - } - ]; - }; - - plugins = [ - { - name = "zsh-nix-shell"; - file = "nix-shell.plugin.zsh"; - src = pkgs.fetchFromGitHub { - owner = "chisui"; - repo = "zsh-nix-shell"; - rev = "v0.7.0"; - sha256 = "149zh2rm59blr2q458a5irkfh82y3dwdich60s9670kl3cl5h2m1"; - }; - } - ]; - }; - programs.fzf = { - enable = true; - enableZshIntegration = true; - }; - }; -} diff --git a/modules/theming/cursor.nix b/modules/theming/cursor.nix deleted file mode 100644 index 45753b9..0000000 --- a/modules/theming/cursor.nix +++ /dev/null @@ -1,44 +0,0 @@ -# Module to set a default cursor theme -{ - config, - pkgs, - lib, - ... -}: -with lib; let - cfg = config.environment.defaultCursor; - - indexThemeText = theme: generators.toINI {} {"icon theme" = {Inherits = "${theme}";};}; - - mkDefaultCursorFile = theme: - pkgs.writeTextDir - "share/icons/default/index.theme" - "${indexThemeText theme}"; - - defaultCursorPkg = mkDefaultCursorFile cfg.theme; -in { - options = { - environment.defaultCursor = { - enable = mkOption { - type = types.bool; - default = false; - description = '' - Whether to set a default cursor theme for graphical environments. - ''; - }; - - theme = mkOption { - type = types.str; - default = ""; - example = "Adwaita"; - description = "The name of the defualt cursor theme."; - }; - }; - }; - - config = mkIf cfg.enable { - environment.systemPackages = [ - defaultCursorPkg - ]; - }; -} diff --git a/modules/theming/default.nix b/modules/theming/default.nix deleted file mode 100644 index 4d9a7d0..0000000 --- a/modules/theming/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -[ - # ./gtk.nix - # ./qt.nix - ./cursor.nix -] diff --git a/modules/theming/gtk.nix b/modules/theming/gtk.nix deleted file mode 100644 index 5c1af22..0000000 --- a/modules/theming/gtk.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - config, - lib, - pkgs, - vars, - ... -}: { - home-manager.users.${vars.user} = { - gtk.enable = true; - - # gtk.cursorTheme.package = pkgs.bibata-cursors; - # gtk.cursorTheme.name = "Bibata-Modern-Ice"; - - gtk.theme.package = pkgs.adw-gtk3; - gtk.theme.name = "adw-gtk3"; - - # gtk.iconTheme.package = gruvboxPlus; - # gtk.iconTheme.name = "GruvboxPlus"; - }; -} diff --git a/modules/theming/qt.nix b/modules/theming/qt.nix deleted file mode 100644 index 96e1510..0000000 --- a/modules/theming/qt.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - config, - lib, - pkgs, - vars, - ... -}: { - environment.systemPackages = with pkgs; [ - libsForQt5.qtstyleplugins - libsForQt5.qtstyleplugin-kvantum - #other stuff - ]; - home-manager.users.${vars.user} = { - qt.enable = true; - - # platform theme "gtk" or "gnome" - qt.platformTheme = "gtk"; - - # name of the qt theme - qt.style.name = "adwaita"; - - # detected automatically: - # adwaita, adwaita-dark, adwaita-highcontrast, - # adwaita-highcontrastinverse, breeze, - # bb10bright, bb10dark, cde, cleanlooks, - # gtk2, motif, plastique - - # package to use - qt.style.package = pkgs.adwaita-qt; - }; -} diff --git a/modules/virtualization/docker.nix b/modules/virtualization/docker.nix deleted file mode 100644 index 3e010c4..0000000 --- a/modules/virtualization/docker.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - config, - pkgs, - vars, - ... -}: { - virtualisation = { - docker.enable = true; - }; - - users.groups.docker.members = ["${vars.user}"]; - - environment.systemPackages = with pkgs; [ - docker # Containers - docker-compose # Multi-Container - lazydocker - ]; -} diff --git a/modules/virtualization/qemu.nix b/modules/virtualization/qemu.nix deleted file mode 100644 index 9ec2e53..0000000 --- a/modules/virtualization/qemu.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ - config, - pkgs, - vars, - ... -}: { - boot.extraModprobeConfig = '' - options kvm_intel nested=1 - ''; - - users.groups.libvirtd.members = ["root" "${vars.user}"]; - - virtualisation = { - libvirtd = { - enable = true; - qemu = { - verbatimConfig = '' - nvram = [ "${pkgs.OVMF}/FV/OVMF.fd:${pkgs.OVMF}/FV/OVMF_VARS.fd" ] - ''; - swtpm.enable = true; - }; - }; - spiceUSBRedirection.enable = true; - }; - - environment = { - systemPackages = with pkgs; [ - virt-manager # VM Interface - virt-viewer # Remote VM - qemu # Virtualizer - OVMF # UEFI Firmware - gvfs # Shared Directory - swtpm # TPM - virglrenderer # Virtual OpenGL - ]; - }; - - services = { - # File Sharing - gvfs.enable = true; - }; -} diff --git a/nix/home.nix b/nix/home.nix deleted file mode 100644 index 3f49236..0000000 --- a/nix/home.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - lib, - inputs, - nixpkgs, - home-manager, - hyprland, - split-monitor-workspaces, - vars, - ... -}: let - system = "x86_64-linux"; # System Architecture - pkgs = nixpkgs.legacyPackages.${system}; -in { - pacman = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - extraSpecialArgs = {inherit inputs vars hyprland;}; - modules = [ - # Modules Used - { - home = { - username = "${vars.user}"; - homeDirectory = "/home/${vars.user}"; - packages = [pkgs.home-manager]; - stateVersion = "23.05"; - }; - } - ]; - }; -} diff --git a/nixos/configuration.nix b/nixos/configuration.nix new file mode 100644 index 0000000..c8b7600 --- /dev/null +++ b/nixos/configuration.nix @@ -0,0 +1,113 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # You can import other NixOS modules here + imports = [ + # If you want to use modules your own flake exports (from modules/nixos): + # outputs.nixosModules.example + + # Or modules from other flakes (such as nixos-hardware): + # inputs.hardware.nixosModules.common-cpu-amd + # inputs.hardware.nixosModules.common-ssd + + # You can also split up your configuration and import pieces of it here: + # ./users.nix + + # Import your generated (nixos-generate-config) hardware configuration + ./hardware-configuration.nix + ]; + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nix.nixPath = ["/etc/nix/path"]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; + + nix.settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; + }; + + # FIXME: Add the rest of your current configuration + + # TODO: Set your hostname + networking.hostName = "your-hostname"; + + # TODO: This is just an example, be sure to use whatever bootloader you prefer + boot.loader.systemd-boot.enable = true; + + # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. + users.users = { + # FIXME: Replace with your username + your-username = { + # TODO: You can set an initial password for your user. + # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install. + # Be sure to change it (using passwd) after rebooting! + initialPassword = "correcthorsebatterystaple"; + isNormalUser = true; + openssh.authorizedKeys.keys = [ + # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect + ]; + # TODO: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc) + extraGroups = ["wheel"]; + }; + }; + + # This setups a SSH server. Very important if you're setting up a headless system. + # Feel free to remove if you don't need it. + services.openssh = { + enable = true; + settings = { + # Forbid root login through SSH. + PermitRootLogin = "no"; + # Use keys only. Remove if you want to SSH using password (not recommended) + PasswordAuthentication = false; + }; + }; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "23.05"; +} diff --git a/nixos/hardware-configuration.nix b/nixos/hardware-configuration.nix new file mode 100644 index 0000000..dd00939 --- /dev/null +++ b/nixos/hardware-configuration.nix @@ -0,0 +1,10 @@ +# This is just an example, you should generate yours with nixos-generate-config and put it in here. +{ + fileSystems."/" = { + device = "/dev/sda1"; + fsType = "ext4"; + }; + + # Set your system kind (needed for flakes) + nixpkgs.hostPlatform = "x86_64-linux"; +} diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..a13ea3c --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,23 @@ +# This file defines overlays +{inputs, ...}: { + # This one brings our custom packages from the 'pkgs' directory + additions = final: _prev: import ../pkgs {pkgs = final;}; + + # This one contains whatever you want to overlay + # You can change versions, add patches, set compilation flags, anything really. + # https://nixos.wiki/wiki/Overlays + modifications = final: prev: { + # example = prev.example.overrideAttrs (oldAttrs: rec { + # ... + # }); + }; + + # When applied, the unstable nixpkgs set (declared in the flake inputs) will + # be accessible through 'pkgs.unstable' + unstable-packages = final: _prev: { + unstable = import inputs.nixpkgs-unstable { + system = final.system; + config.allowUnfree = true; + }; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..3d9e23c --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,5 @@ +# Custom packages, that can be defined similarly to ones from nixpkgs +# You can build them using 'nix build .#example' +pkgs: { + # example = pkgs.callPackage ./example { }; +} -- 2.45.2 From 6ef0dca25fed75a5cfc3f82f6e199128722c6c94 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Sat, 23 Dec 2023 22:05:10 +0100 Subject: [PATCH 02/44] Add multihost support --- flake.lock | 22 +++++----- flake.nix | 16 +++---- .../ghoscht/global/default.nix | 21 ++++++--- .../adalbert/default.nix | 9 ++-- hosts/adalbert/hardware-configuration.nix | 43 +++++++++++++++++++ nixos/hardware-configuration.nix | 10 ----- 6 files changed, 79 insertions(+), 42 deletions(-) rename home-manager/home.nix => home/ghoscht/global/default.nix (79%) rename nixos/configuration.nix => hosts/adalbert/default.nix (95%) create mode 100644 hosts/adalbert/hardware-configuration.nix delete mode 100644 nixos/hardware-configuration.nix diff --git a/flake.lock b/flake.lock index 05ed3b7..a7f5119 100644 --- a/flake.lock +++ b/flake.lock @@ -7,43 +7,43 @@ ] }, "locked": { - "lastModified": 1685599623, - "narHash": "sha256-Tob4CMOVHue0D3RzguDBCtUmX5ji2PsdbQDbIOIKvsc=", + "lastModified": 1703113038, + "narHash": "sha256-oxkyzjpD+mNT7arzU/zHrkNHLuY9tKwmnD2MNaZiSDw=", "owner": "nix-community", "repo": "home-manager", - "rev": "93db05480c0c0f30382d3e80779e8386dcb4f9dd", + "rev": "0c2353d5d930c3d93724df6858aef064a31b3c00", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.05", + "ref": "release-23.11", "repo": "home-manager", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1686431482, - "narHash": "sha256-oPVQ/0YP7yC2ztNsxvWLrV+f0NQ2QAwxbrZ+bgGydEM=", + "lastModified": 1703068421, + "narHash": "sha256-WSw5Faqlw75McIflnl5v7qVD/B3S2sLh+968bpOGrWA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d3bb401dcfc5a46ce51cdfb5762e70cc75d082d2", + "rev": "d65bceaee0fb1e64363f7871bc43dc1c6ecad99f", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.05", + "ref": "nixos-23.11", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-unstable": { "locked": { - "lastModified": 1686501370, - "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", + "lastModified": 1697059129, + "narHash": "sha256-9NJcFF9CEYPvHJ5ckE8kvINvI84SZZ87PvqMbH6pro0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", + "rev": "5e4c2ada4fcd54b99d56d7bd62f384511a7e2593", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 61960d1..c3054b2 100644 --- a/flake.nix +++ b/flake.nix @@ -3,14 +3,14 @@ inputs = { # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; # You can access packages and modules from different nixpkgs revs # at the same time. Here's an working example: nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. # Home manager - home-manager.url = "github:nix-community/home-manager/release-23.05"; + home-manager.url = "github:nix-community/home-manager/release-23.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; # TODO: Add any other flake you might need @@ -59,12 +59,10 @@ # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { - # FIXME replace with your hostname - your-hostname = nixpkgs.lib.nixosSystem { + adalbert = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs outputs;}; modules = [ - # > Our main nixos configuration file < - ./nixos/configuration.nix + ./hosts/adalbert ]; }; }; @@ -72,13 +70,11 @@ # Standalone home-manager configuration entrypoint # Available through 'home-manager --flake .#your-username@your-hostname' homeConfigurations = { - # FIXME replace with your username@hostname - "your-username@your-hostname" = home-manager.lib.homeManagerConfiguration { + "ghoscht@adalbert" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance extraSpecialArgs = {inherit inputs outputs;}; modules = [ - # > Our main home-manager configuration file < - ./home-manager/home.nix + ./home/ghoscht/adalbert.nix ]; }; }; diff --git a/home-manager/home.nix b/home/ghoscht/global/default.nix similarity index 79% rename from home-manager/home.nix rename to home/ghoscht/global/default.nix index eedacc2..40b5907 100644 --- a/home-manager/home.nix +++ b/home/ghoscht/global/default.nix @@ -42,15 +42,27 @@ config = { # Disable if you don't want unfree packages allowUnfree = true; + permittedInsecurePackages = [ + "electron-24.8.6" #fixes Feishin & Webcord + ]; # Workaround for https://github.com/nix-community/home-manager/issues/2942 allowUnfreePredicate = _: true; }; }; - # TODO: Set your username + nix = { + package = lib.mkDefault pkgs.nix; + settings = { + experimental-features = ["nix-command" "flakes" "repl-flake"]; + warn-dirty = false; + }; + }; + home = { - username = "your-username"; - homeDirectory = "/home/your-username"; + username = lib.mkDefault "ghoscht"; + homeDirectory = lib.mkDefault "/home/${config.home.username}"; + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + stateVersion = "23.11"; }; # Add stuff for your user as you see fit: @@ -63,7 +75,4 @@ # Nicely reload system units when changing configs systemd.user.startServices = "sd-switch"; - - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - home.stateVersion = "23.05"; } diff --git a/nixos/configuration.nix b/hosts/adalbert/default.nix similarity index 95% rename from nixos/configuration.nix rename to hosts/adalbert/default.nix index c8b7600..7381192 100644 --- a/nixos/configuration.nix +++ b/hosts/adalbert/default.nix @@ -73,8 +73,7 @@ # FIXME: Add the rest of your current configuration - # TODO: Set your hostname - networking.hostName = "your-hostname"; + networking.hostName = "adalbert"; # TODO: This is just an example, be sure to use whatever bootloader you prefer boot.loader.systemd-boot.enable = true; @@ -82,11 +81,11 @@ # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. users.users = { # FIXME: Replace with your username - your-username = { + ghoscht = { # TODO: You can set an initial password for your user. # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install. # Be sure to change it (using passwd) after rebooting! - initialPassword = "correcthorsebatterystaple"; + initialPassword = "yoi"; isNormalUser = true; openssh.authorizedKeys.keys = [ # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect @@ -109,5 +108,5 @@ }; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - system.stateVersion = "23.05"; + system.stateVersion = "23.11"; } diff --git a/hosts/adalbert/hardware-configuration.nix b/hosts/adalbert/hardware-configuration.nix new file mode 100644 index 0000000..ab97b97 --- /dev/null +++ b/hosts/adalbert/hardware-configuration.nix @@ -0,0 +1,43 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/f9ba57fb-0b82-47e0-8189-7bbebc530e2b"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/BCF2-51D4"; + fsType = "vfat"; + }; + + swapDevices = [ + {device = "/dev/disk/by-uuid/4834fbc3-3feb-4b93-b11f-8b9bd054c5c1";} + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nixos/hardware-configuration.nix b/nixos/hardware-configuration.nix deleted file mode 100644 index dd00939..0000000 --- a/nixos/hardware-configuration.nix +++ /dev/null @@ -1,10 +0,0 @@ -# This is just an example, you should generate yours with nixos-generate-config and put it in here. -{ - fileSystems."/" = { - device = "/dev/sda1"; - fsType = "ext4"; - }; - - # Set your system kind (needed for flakes) - nixpkgs.hostPlatform = "x86_64-linux"; -} -- 2.45.2 From 68e72081779ca23455aed029678eff4458cb2694 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Sun, 24 Dec 2023 11:16:59 +0100 Subject: [PATCH 03/44] Add baseline configuration --- flake.lock | 16 +++++ flake.nix | 3 +- home/ghoscht/adalbert.nix | 41 ++++++++++++ hosts/adalbert/default.nix | 74 ++++++--------------- hosts/common/global/default.nix | 31 +++++++++ hosts/common/global/fish.nix | 17 +++++ hosts/common/global/locale.nix | 19 ++++++ hosts/common/global/nix.nix | 28 ++++++++ hosts/common/global/podman.nix | 10 +++ hosts/common/global/power-button.nix | 10 +++ hosts/common/global/tailscale.nix | 10 +++ hosts/common/optional/desktop/awesome.nix | 15 +++++ hosts/common/optional/desktop/flatpak.nix | 12 ++++ hosts/common/optional/desktop/global.nix | 18 +++++ hosts/common/optional/desktop/gnome.nix | 16 +++++ hosts/common/optional/desktop/pipewire.nix | 11 +++ hosts/common/optional/desktop/wayland.nix | 15 +++++ hosts/common/optional/desktop/x11.nix | 28 ++++++++ hosts/common/optional/desktop/xdg.nix | 14 ++++ hosts/common/optional/docker.nix | 5 ++ hosts/common/optional/encrypted-root.nix | 7 ++ hosts/common/optional/gamemode.nix | 3 + hosts/common/optional/kde-connect.nix | 22 ++++++ hosts/common/optional/printing.nix | 24 +++++++ hosts/common/optional/quietboot.nix | 33 +++++++++ hosts/common/optional/rgb.nix | 12 ++++ hosts/common/optional/systemd-boot.nix | 9 +++ hosts/common/optional/systemd-exit-node.nix | 6 ++ hosts/common/optional/wireshark.nix | 5 ++ hosts/common/optional/x11-no-suspend.nix | 7 ++ hosts/common/users/ghoscht/default.nix | 44 ++++++++++++ 31 files changed, 510 insertions(+), 55 deletions(-) create mode 100644 home/ghoscht/adalbert.nix create mode 100644 hosts/common/global/default.nix create mode 100644 hosts/common/global/fish.nix create mode 100644 hosts/common/global/locale.nix create mode 100644 hosts/common/global/nix.nix create mode 100644 hosts/common/global/podman.nix create mode 100644 hosts/common/global/power-button.nix create mode 100644 hosts/common/global/tailscale.nix create mode 100644 hosts/common/optional/desktop/awesome.nix create mode 100644 hosts/common/optional/desktop/flatpak.nix create mode 100644 hosts/common/optional/desktop/global.nix create mode 100644 hosts/common/optional/desktop/gnome.nix create mode 100644 hosts/common/optional/desktop/pipewire.nix create mode 100644 hosts/common/optional/desktop/wayland.nix create mode 100644 hosts/common/optional/desktop/x11.nix create mode 100644 hosts/common/optional/desktop/xdg.nix create mode 100644 hosts/common/optional/docker.nix create mode 100644 hosts/common/optional/encrypted-root.nix create mode 100644 hosts/common/optional/gamemode.nix create mode 100644 hosts/common/optional/kde-connect.nix create mode 100644 hosts/common/optional/printing.nix create mode 100644 hosts/common/optional/quietboot.nix create mode 100644 hosts/common/optional/rgb.nix create mode 100644 hosts/common/optional/systemd-boot.nix create mode 100644 hosts/common/optional/systemd-exit-node.nix create mode 100644 hosts/common/optional/wireshark.nix create mode 100644 hosts/common/optional/x11-no-suspend.nix create mode 100644 hosts/common/users/ghoscht/default.nix diff --git a/flake.lock b/flake.lock index a7f5119..7f00ae0 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "hardware": { + "locked": { + "lastModified": 1702453208, + "narHash": "sha256-0wRi9SposfE2wHqjuKt8WO2izKB/ASDOV91URunIqgo=", + "owner": "nixos", + "repo": "nixos-hardware", + "rev": "7763c6fd1f299cb9361ff2abf755ed9619ef01d6", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixos-hardware", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -55,6 +70,7 @@ }, "root": { "inputs": { + "hardware": "hardware", "home-manager": "home-manager", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" diff --git a/flake.nix b/flake.nix index c3054b2..81dec07 100644 --- a/flake.nix +++ b/flake.nix @@ -13,8 +13,7 @@ home-manager.url = "github:nix-community/home-manager/release-23.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; - # TODO: Add any other flake you might need - # hardware.url = "github:nixos/nixos-hardware"; + hardware.url = "github:nixos/nixos-hardware"; # Shameless plug: looking for a way to nixify your themes and make # everything match nicely? Try nix-colors! diff --git a/home/ghoscht/adalbert.nix b/home/ghoscht/adalbert.nix new file mode 100644 index 0000000..47e35e9 --- /dev/null +++ b/home/ghoscht/adalbert.nix @@ -0,0 +1,41 @@ +{ + inputs, + outputs, + ... +}: { + imports = [ + ./global + ]; + + # colorscheme = inputs.nix-colors.colorschemes.paraiso; + # wallpaper = outputs.wallpapers.cyberpunk-city-red; + # + # # ------ ----- ------ + # # | DP-3 | | DP-1| | DP-2 | + # # ------ ----- ------ + # monitors = [ + # { + # name = "DP-3"; + # width = 1920; + # height = 1080; + # x = 0; + # workspace = "3"; + # enabled = false; + # } + # { + # name = "DP-1"; + # width = 2560; + # height = 1080; + # x = 1920; + # workspace = "1"; + # primary = true; + # } + # { + # name = "DP-2"; + # width = 1920; + # height = 1080; + # x = 4480; + # workspace = "2"; + # } + # ]; +} diff --git a/hosts/adalbert/default.nix b/hosts/adalbert/default.nix index 7381192..e0d16f0 100644 --- a/hosts/adalbert/default.nix +++ b/hosts/adalbert/default.nix @@ -14,14 +14,24 @@ # outputs.nixosModules.example # Or modules from other flakes (such as nixos-hardware): - # inputs.hardware.nixosModules.common-cpu-amd - # inputs.hardware.nixosModules.common-ssd + inputs.hardware.nixosModules.common-cpu-amd + inputs.hardware.nixosModules.common-gpu-nvidia + inputs.hardware.nixosModules.common-pc-ssd # You can also split up your configuration and import pieces of it here: # ./users.nix # Import your generated (nixos-generate-config) hardware configuration ./hardware-configuration.nix + + ../common/global + ../common/users/ghoscht + ../common/optional/desktop/awesome.nix + + ../common/optional/systemd-boot.nix + ../common/optional/wireshark.nix + ../common/optional/gamemode.nix + ../common/optional/kde-connect.nix ]; nixpkgs = { @@ -49,62 +59,20 @@ }; }; - # This will add each flake input as a registry - # To make nix3 commands consistent with your flake - nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); - - # This will additionally add your inputs to the system's legacy channels - # Making legacy nix commands consistent as well, awesome! - nix.nixPath = ["/etc/nix/path"]; - environment.etc = - lib.mapAttrs' - (name: value: { - name = "nix/path/${name}"; - value.source = value.flake; - }) - config.nix.registry; - - nix.settings = { - # Enable flakes and new 'nix' command - experimental-features = "nix-command flakes"; - # Deduplicate and optimize nix store - auto-optimise-store = true; - }; - - # FIXME: Add the rest of your current configuration - networking.hostName = "adalbert"; - # TODO: This is just an example, be sure to use whatever bootloader you prefer - boot.loader.systemd-boot.enable = true; + # Force disable Nvidia PRIME, needed by nix-hardware + hardware.nvidia.prime.offload.enable = false; - # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. - users.users = { - # FIXME: Replace with your username - ghoscht = { - # TODO: You can set an initial password for your user. - # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install. - # Be sure to change it (using passwd) after rebooting! - initialPassword = "yoi"; - isNormalUser = true; - openssh.authorizedKeys.keys = [ - # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect - ]; - # TODO: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc) - extraGroups = ["wheel"]; - }; + programs = { + adb.enable = true; + dconf.enable = true; + kdeconnect.enable = true; }; - # This setups a SSH server. Very important if you're setting up a headless system. - # Feel free to remove if you don't need it. - services.openssh = { - enable = true; - settings = { - # Forbid root login through SSH. - PermitRootLogin = "no"; - # Use keys only. Remove if you want to SSH using password (not recommended) - PasswordAuthentication = false; - }; + hardware = { + opengl.enable = true; + opentabletdriver.enable = true; }; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion diff --git a/hosts/common/global/default.nix b/hosts/common/global/default.nix new file mode 100644 index 0000000..7ad5703 --- /dev/null +++ b/hosts/common/global/default.nix @@ -0,0 +1,31 @@ +# This file (and the global directory) holds config that i use on all hosts +{ + inputs, + outputs, + ... +}: { + imports = + [ + inputs.home-manager.nixosModules.home-manager + ./fish.nix + ./locale.nix + ./nix.nix + ./podman.nix + ./power-button.nix + ] + ++ (builtins.attrValues outputs.nixosModules); + + home-manager.extraSpecialArgs = {inherit inputs outputs;}; + + nixpkgs = { + overlays = builtins.attrValues outputs.overlays; + config = { + allowUnfree = true; + }; + }; + + # Fix for qt6 plugins + environment.profileRelativeSessionVariables = { + QT_PLUGIN_PATH = ["/lib/qt-6/plugins"]; + }; +} diff --git a/hosts/common/global/fish.nix b/hosts/common/global/fish.nix new file mode 100644 index 0000000..4bf0acf --- /dev/null +++ b/hosts/common/global/fish.nix @@ -0,0 +1,17 @@ +{ + inputs, + pkgs, + ... +}: { + programs.fish = { + enable = true; + vendor = { + completions.enable = true; + config.enable = true; + functions.enable = true; + }; + useBabelfish = true; + }; + users.defaultUserShell = pkgs.fish; + environment.shells = with pkgs; [fish]; +} diff --git a/hosts/common/global/locale.nix b/hosts/common/global/locale.nix new file mode 100644 index 0000000..4bd5946 --- /dev/null +++ b/hosts/common/global/locale.nix @@ -0,0 +1,19 @@ +{lib, ...}: { + time.timeZone = "Europe/Berlin"; + + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + }; + console.keyMap = "de"; +} diff --git a/hosts/common/global/nix.nix b/hosts/common/global/nix.nix new file mode 100644 index 0000000..08f9cfb --- /dev/null +++ b/hosts/common/global/nix.nix @@ -0,0 +1,28 @@ +{ + inputs, + lib, + ... +}: { + nix = { + settings = { + auto-optimise-store = lib.mkDefault true; + experimental-features = ["nix-command" "flakes" "repl-flake"]; + warn-dirty = false; + system-features = ["kvm" "big-parallel" "nixos-test"]; + }; + gc = { + automatic = true; + dates = "weekly"; + # Keep the last 3 generations + options = "--delete-older-than +3"; + }; + + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + + # Add nixpkgs input to NIX_PATH + # This lets nix2 commands still use + nixPath = ["nixpkgs=${inputs.nixpkgs.outPath}"]; + }; +} diff --git a/hosts/common/global/podman.nix b/hosts/common/global/podman.nix new file mode 100644 index 0000000..8a57d28 --- /dev/null +++ b/hosts/common/global/podman.nix @@ -0,0 +1,10 @@ +{config, ...}: let + dockerEnabled = config.virtualisation.docker.enable; +in { + virtualisation.podman = { + enable = true; + dockerCompat = !dockerEnabled; + dockerSocket.enable = !dockerEnabled; + defaultNetwork.settings.dns_enabled = true; + }; +} diff --git a/hosts/common/global/power-button.nix b/hosts/common/global/power-button.nix new file mode 100644 index 0000000..1b36859 --- /dev/null +++ b/hosts/common/global/power-button.nix @@ -0,0 +1,10 @@ +{ + inputs, + lib, + ... +}: { + services.logind.extraConfig = '' + # don’t shutdown when power button is short-pressed + HandlePowerKey=ignore + ''; +} diff --git a/hosts/common/global/tailscale.nix b/hosts/common/global/tailscale.nix new file mode 100644 index 0000000..139680d --- /dev/null +++ b/hosts/common/global/tailscale.nix @@ -0,0 +1,10 @@ +{lib, ...}: { + services.tailscale = { + enable = true; + useRoutingFeatures = lib.mkDefault "client"; + }; + networking.firewall = { + checkReversePath = "loose"; + allowedUDPPorts = [41641]; # Facilitate firewall punching + }; +} diff --git a/hosts/common/optional/desktop/awesome.nix b/hosts/common/optional/desktop/awesome.nix new file mode 100644 index 0000000..bf428bf --- /dev/null +++ b/hosts/common/optional/desktop/awesome.nix @@ -0,0 +1,15 @@ +{ + config, + lib, + pkgs, + ... +}: { + imports = [./global.nix ./x11.nix]; + + services = { + xserver = { + # dpi = 180; + windowManager.awesome.enable = true; + }; + }; +} diff --git a/hosts/common/optional/desktop/flatpak.nix b/hosts/common/optional/desktop/flatpak.nix new file mode 100644 index 0000000..062dd87 --- /dev/null +++ b/hosts/common/optional/desktop/flatpak.nix @@ -0,0 +1,12 @@ +{ + config, + lib, + pkgs, + ... +}: { + # Enable Flatpak + services.flatpak.enable = true; + + # Create folder where all fonts are linked to /run/current-system/sw/share/X11/fonts + fonts.fontDir.enable = true; +} diff --git a/hosts/common/optional/desktop/global.nix b/hosts/common/optional/desktop/global.nix new file mode 100644 index 0000000..51f9ada --- /dev/null +++ b/hosts/common/optional/desktop/global.nix @@ -0,0 +1,18 @@ +{ + config, + lib, + pkgs, + ... +}: { + imports = [./pipewire.nix ../printing.nix ./flatpak.nix ./xdg.nix]; + + # Enable networking + networking.networkmanager.enable = true; + + # Enable for GTK + programs.dconf.enable = true; + + services.xserver = { + displayManager.sddm.enable = true; + }; +} diff --git a/hosts/common/optional/desktop/gnome.nix b/hosts/common/optional/desktop/gnome.nix new file mode 100644 index 0000000..c57bf1c --- /dev/null +++ b/hosts/common/optional/desktop/gnome.nix @@ -0,0 +1,16 @@ +{ + config, + lib, + pkgs, + ... +}: { + imports = [./global.nix ./x11.nix ./wayland.nix]; + + services = { + xserver = { + desktopManager.gnome = { + enable = true; + }; + }; + }; +} diff --git a/hosts/common/optional/desktop/pipewire.nix b/hosts/common/optional/desktop/pipewire.nix new file mode 100644 index 0000000..e35a788 --- /dev/null +++ b/hosts/common/optional/desktop/pipewire.nix @@ -0,0 +1,11 @@ +{ + security.rtkit.enable = true; + hardware.pulseaudio.enable = false; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; +} diff --git a/hosts/common/optional/desktop/wayland.nix b/hosts/common/optional/desktop/wayland.nix new file mode 100644 index 0000000..e7d1a6c --- /dev/null +++ b/hosts/common/optional/desktop/wayland.nix @@ -0,0 +1,15 @@ +{ + config, + lib, + pkgs, + ... +}: { + # Hint electron apps to use wayland + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + environment.systemPackages = with pkgs; [ + xwaylandvideobridge + libsForQt5.qt5.qtwayland + qt6.qtwayland + ]; +} diff --git a/hosts/common/optional/desktop/x11.nix b/hosts/common/optional/desktop/x11.nix new file mode 100644 index 0000000..57c15e8 --- /dev/null +++ b/hosts/common/optional/desktop/x11.nix @@ -0,0 +1,28 @@ +{ + config, + lib, + pkgs, + ... +}: { + services = { + # Enable the X11 windowing system. + xserver = { + enable = true; + # Enable touchpad support + libinput.enable = true; + # Remove xterm terminal + excludePackages = with pkgs; [xterm]; + modules = [pkgs.xf86_input_wacom]; + wacom.enable = true; + }; + }; + + # Install installation + environment = { + systemPackages = with pkgs; [ + # X11 + xorg.xkbutils + xorg.xkill + ]; + }; +} diff --git a/hosts/common/optional/desktop/xdg.nix b/hosts/common/optional/desktop/xdg.nix new file mode 100644 index 0000000..7e964b7 --- /dev/null +++ b/hosts/common/optional/desktop/xdg.nix @@ -0,0 +1,14 @@ +{ + config, + lib, + pkgs, + ... +}: { + xdg.portal = { + enable = true; + xdgOpenUsePortal = true; + wlr.enable = true; + extraPortals = with pkgs; [xdg-desktop-portal-gtk]; + configPackages = with pkgs; [gnome.gnome-session]; + }; +} diff --git a/hosts/common/optional/docker.nix b/hosts/common/optional/docker.nix new file mode 100644 index 0000000..a0f86ac --- /dev/null +++ b/hosts/common/optional/docker.nix @@ -0,0 +1,5 @@ +{ + virtualisation.docker = { + enable = true; + }; +} diff --git a/hosts/common/optional/encrypted-root.nix b/hosts/common/optional/encrypted-root.nix new file mode 100644 index 0000000..8989ae4 --- /dev/null +++ b/hosts/common/optional/encrypted-root.nix @@ -0,0 +1,7 @@ +{config, ...}: let + hostname = config.networking.hostName; +in { + boot.initrd = { + luks.devices."${hostname}".device = "/dev/disk/by-label/${hostname}_crypt"; + }; +} diff --git a/hosts/common/optional/gamemode.nix b/hosts/common/optional/gamemode.nix new file mode 100644 index 0000000..4280b04 --- /dev/null +++ b/hosts/common/optional/gamemode.nix @@ -0,0 +1,3 @@ +{ + programs.gamemode.enable = true; +} diff --git a/hosts/common/optional/kde-connect.nix b/hosts/common/optional/kde-connect.nix new file mode 100644 index 0000000..3ed1be8 --- /dev/null +++ b/hosts/common/optional/kde-connect.nix @@ -0,0 +1,22 @@ +{ + config, + lib, + pkgs, + ... +}: { + programs.kdeconnect.enable = true; + + # Create system services for KDE connect + systemd.user.services.kdeconnect = { + description = "Adds communication between your desktop and your smartphone"; + after = ["graphical-session-pre.target"]; + partOf = ["graphical-session.target"]; + wantedBy = ["graphical-session.target"]; + + serviceConfig = { + #Environment = "PATH=${config.home.profileDirectory}/bin"; + ExecStart = "${pkgs.plasma5Packages.kdeconnect-kde}/libexec/kdeconnectd"; + Restart = "on-abort"; + }; + }; +} diff --git a/hosts/common/optional/printing.nix b/hosts/common/optional/printing.nix new file mode 100644 index 0000000..b58fb83 --- /dev/null +++ b/hosts/common/optional/printing.nix @@ -0,0 +1,24 @@ +{ + config, + lib, + pkgs, + ... +}: { + services = { + # Printer Setup + printing.enable = true; + avahi = { + enable = true; + nssmdns = true; + # for a WiFi printer + openFirewall = true; + }; + udev.packages = [pkgs.utsushi]; + }; + + # Scanner Setup + hardware.sane = { + enable = true; + extraBackends = [pkgs.utsushi]; + }; +} diff --git a/hosts/common/optional/quietboot.nix b/hosts/common/optional/quietboot.nix new file mode 100644 index 0000000..35786bb --- /dev/null +++ b/hosts/common/optional/quietboot.nix @@ -0,0 +1,33 @@ +{ + pkgs, + config, + ... +}: { + console = { + useXkbConfig = true; + earlySetup = false; + }; + + boot = { + plymouth = { + enable = true; + theme = "spinner-monochrome"; + themePackages = [ + (pkgs.plymouth-spinner-monochrome.override { + inherit (config.boot.plymouth) logo; + }) + ]; + }; + loader.timeout = 0; + kernelParams = [ + "quiet" + "loglevel=3" + "systemd.show_status=auto" + "udev.log_level=3" + "rd.udev.log_level=3" + "vt.global_cursor_default=0" + ]; + consoleLogLevel = 0; + initrd.verbose = false; + }; +} diff --git a/hosts/common/optional/rgb.nix b/hosts/common/optional/rgb.nix new file mode 100644 index 0000000..8bb5d2f --- /dev/null +++ b/hosts/common/optional/rgb.nix @@ -0,0 +1,12 @@ +{ + config, + lib, + pkgs, + ... +}: { + services.hardware.openrgb = { + enable = true; + package = pkgs.openrgb-with-all-plugins; + motherboard = lib.mkDefault config.variables.machine.motherboard; + }; +} diff --git a/hosts/common/optional/systemd-boot.nix b/hosts/common/optional/systemd-boot.nix new file mode 100644 index 0000000..40d04b2 --- /dev/null +++ b/hosts/common/optional/systemd-boot.nix @@ -0,0 +1,9 @@ +{ + boot.loader = { + systemd-boot = { + enable = true; + consoleMode = "max"; + }; + efi.canTouchEfiVariables = true; + }; +} diff --git a/hosts/common/optional/systemd-exit-node.nix b/hosts/common/optional/systemd-exit-node.nix new file mode 100644 index 0000000..e984366 --- /dev/null +++ b/hosts/common/optional/systemd-exit-node.nix @@ -0,0 +1,6 @@ +{ + imports = [../global/tailscale.nix]; + services.tailscale = { + useRoutingFeatures = "both"; + }; +} diff --git a/hosts/common/optional/wireshark.nix b/hosts/common/optional/wireshark.nix new file mode 100644 index 0000000..44223ce --- /dev/null +++ b/hosts/common/optional/wireshark.nix @@ -0,0 +1,5 @@ +{ + programs.wireshark = { + enable = true; + }; +} diff --git a/hosts/common/optional/x11-no-suspend.nix b/hosts/common/optional/x11-no-suspend.nix new file mode 100644 index 0000000..0005eed --- /dev/null +++ b/hosts/common/optional/x11-no-suspend.nix @@ -0,0 +1,7 @@ +{ + services.xserver.serverFlagsSection = '' + Option "StandbyTime" "0" + Option "SuspendTime" "0" + Option "OffTime" "0" + ''; +} diff --git a/hosts/common/users/ghoscht/default.nix b/hosts/common/users/ghoscht/default.nix new file mode 100644 index 0000000..c5f4043 --- /dev/null +++ b/hosts/common/users/ghoscht/default.nix @@ -0,0 +1,44 @@ +{ + pkgs, + config, + ... +}: let + ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; +in { + users.users.ghoscht = { + isNormalUser = true; + shell = pkgs.fish; + extraGroups = + [ + "wheel" + "video" + "audio" + "camera" + ] + ++ ifTheyExist [ + "minecraft" + "network" + "networkmanager" + "wireshark" + "i2c" + "mysql" + "docker" + "podman" + "git" + "libvirtd" + "deluge" + "lp" + "scanner" + "kvm" + "libvirtd" + "tty" + "dialout" + ]; + + packages = [pkgs.home-manager]; + }; + + home-manager.users.ghoscht = import ../../../../home/ghoscht/${config.networking.hostName}.nix; + + security.pam.services = {}; +} -- 2.45.2 From 85caea0cb3363395cfe1ca4441ff7cb16e789c1e Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Sun, 24 Dec 2023 11:17:07 +0100 Subject: [PATCH 04/44] Add ALVR packaging --- pkgs/alvr/default.nix | 36 ++++++++++++++++++++++++++++++++++++ pkgs/default.nix | 1 + 2 files changed, 37 insertions(+) create mode 100644 pkgs/alvr/default.nix diff --git a/pkgs/alvr/default.nix b/pkgs/alvr/default.nix new file mode 100644 index 0000000..bcb25c0 --- /dev/null +++ b/pkgs/alvr/default.nix @@ -0,0 +1,36 @@ +{ + lib, + appimageTools, + fetchurl, +}: let + pname = "alvr"; + version = "20.5.0"; + src = fetchurl { + url = "https://github.com/alvr-org/ALVR/releases/download/v${version}/ALVR-x86_64.AppImage"; + hash = "sha256-shA93fK/F+PNRv+DCTfvN+tm0w/sj/yPEYc5ms2vHRk="; + }; + + appimageContents = appimageTools.extractType2 {inherit pname version src;}; +in + appimageTools.wrapType2 { + inherit pname version src; + + extraInstallCommands = '' + mv $out/bin/${pname}-${version} $out/bin/${pname} + + install -Dm444 ${appimageContents}/alvr.desktop -t $out/share/applications + substituteInPlace $out/share/applications/alvr.desktop \ + --replace 'Exec=alvr_dashboard' 'Exec=${pname}' + cp -r ${appimageContents}/usr/share/icons $out/share + ''; + + meta = with lib; { + description = "Stream VR games from your PC to your headset via Wi-Fi"; + homepage = "https://github.com/alvr-org/ALVR/"; + changelog = "https://github.com/alvr-org/ALVR/releases/tag/v${version}"; + license = licenses.mit; + mainProgram = "alvr"; + maintainers = with maintainers; [passivelemon]; + platforms = ["x86_64-linux"]; + }; + } diff --git a/pkgs/default.nix b/pkgs/default.nix index 3d9e23c..dd93bb4 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -2,4 +2,5 @@ # You can build them using 'nix build .#example' pkgs: { # example = pkgs.callPackage ./example { }; + alvr = pkgs.callPackage ./alvr {}; } -- 2.45.2 From fd997858555f5761fb3fba893d6c048bcd32b16d Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Sun, 24 Dec 2023 11:37:26 +0100 Subject: [PATCH 05/44] Add xserver layout SDDM would choose us layout otherwise --- hosts/common/global/locale.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts/common/global/locale.nix b/hosts/common/global/locale.nix index 4bd5946..624eaa7 100644 --- a/hosts/common/global/locale.nix +++ b/hosts/common/global/locale.nix @@ -16,4 +16,5 @@ }; }; console.keyMap = "de"; + services.xserver.layout = "de"; } -- 2.45.2 From f054c33ce0e7f621fa8290439040baa86021994b Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Mon, 25 Dec 2023 21:29:45 +0100 Subject: [PATCH 06/44] Move tailscale to optional features --- hosts/common/{global => optional}/tailscale.nix | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename hosts/common/{global => optional}/tailscale.nix (100%) diff --git a/hosts/common/global/tailscale.nix b/hosts/common/optional/tailscale.nix similarity index 100% rename from hosts/common/global/tailscale.nix rename to hosts/common/optional/tailscale.nix -- 2.45.2 From 37833f942ac3162dab60e87479fdf37a297f00be Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Mon, 25 Dec 2023 21:30:20 +0100 Subject: [PATCH 07/44] Remove unused pam services from user was there from the template --- hosts/common/users/ghoscht/default.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/hosts/common/users/ghoscht/default.nix b/hosts/common/users/ghoscht/default.nix index c5f4043..05e1241 100644 --- a/hosts/common/users/ghoscht/default.nix +++ b/hosts/common/users/ghoscht/default.nix @@ -39,6 +39,4 @@ in { }; home-manager.users.ghoscht = import ../../../../home/ghoscht/${config.networking.hostName}.nix; - - security.pam.services = {}; } -- 2.45.2 From e9540a58804ed575f9b4a31a125cbc383c664f0f Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Mon, 25 Dec 2023 21:38:40 +0100 Subject: [PATCH 08/44] Remove ambiguous unicode character --- hosts/common/global/power-button.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hosts/common/global/power-button.nix b/hosts/common/global/power-button.nix index 1b36859..5f7577e 100644 --- a/hosts/common/global/power-button.nix +++ b/hosts/common/global/power-button.nix @@ -4,7 +4,7 @@ ... }: { services.logind.extraConfig = '' - # don’t shutdown when power button is short-pressed - HandlePowerKey=ignore + # don't shutdown when power button is short-pressed + HandlePowerKey=ignore ''; } -- 2.45.2 From d446d04ad70ab7943da6d5c3bdd3c1e1bf9a235c Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Mon, 25 Dec 2023 23:11:54 +0100 Subject: [PATCH 09/44] Switch to single-user design --- flake.nix | 5 +++-- hosts/adalbert/default.nix | 1 - hosts/common/global/default.nix | 2 ++ .../common/{users/ghoscht/default.nix => global/user.nix} | 8 ++++++-- vars.nix | 7 +++++++ 5 files changed, 18 insertions(+), 5 deletions(-) rename hosts/common/{users/ghoscht/default.nix => global/user.nix} (72%) create mode 100644 vars.nix diff --git a/flake.nix b/flake.nix index 81dec07..2f57185 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,7 @@ # This is a function that generates an attribute by calling a function you # pass to it, with each system as an argument forAllSystems = nixpkgs.lib.genAttrs systems; + vars = import ./vars.nix; in { # Your custom packages # Accessible through 'nix build', 'nix shell', etc @@ -59,7 +60,7 @@ # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { adalbert = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; + specialArgs = {inherit inputs outputs vars;}; modules = [ ./hosts/adalbert ]; @@ -71,7 +72,7 @@ homeConfigurations = { "ghoscht@adalbert" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = {inherit inputs outputs;}; + extraSpecialArgs = {inherit inputs outputs vars;}; modules = [ ./home/ghoscht/adalbert.nix ]; diff --git a/hosts/adalbert/default.nix b/hosts/adalbert/default.nix index e0d16f0..a211395 100644 --- a/hosts/adalbert/default.nix +++ b/hosts/adalbert/default.nix @@ -25,7 +25,6 @@ ./hardware-configuration.nix ../common/global - ../common/users/ghoscht ../common/optional/desktop/awesome.nix ../common/optional/systemd-boot.nix diff --git a/hosts/common/global/default.nix b/hosts/common/global/default.nix index 7ad5703..6f66581 100644 --- a/hosts/common/global/default.nix +++ b/hosts/common/global/default.nix @@ -2,11 +2,13 @@ { inputs, outputs, + config, ... }: { imports = [ inputs.home-manager.nixosModules.home-manager + ./user.nix ./fish.nix ./locale.nix ./nix.nix diff --git a/hosts/common/users/ghoscht/default.nix b/hosts/common/global/user.nix similarity index 72% rename from hosts/common/users/ghoscht/default.nix rename to hosts/common/global/user.nix index 05e1241..7b6a690 100644 --- a/hosts/common/users/ghoscht/default.nix +++ b/hosts/common/global/user.nix @@ -1,11 +1,15 @@ { + inputs, + outputs, pkgs, config, + vars, ... }: let ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; in { - users.users.ghoscht = { + imports = builtins.attrValues outputs.nixosModules; #propagates imports downwards + users.users.${vars.user} = { isNormalUser = true; shell = pkgs.fish; extraGroups = @@ -38,5 +42,5 @@ in { packages = [pkgs.home-manager]; }; - home-manager.users.ghoscht = import ../../../../home/ghoscht/${config.networking.hostName}.nix; + home-manager.users.${vars.user} = import ../../../home/${vars.user}/${config.networking.hostName}.nix; } diff --git a/vars.nix b/vars.nix new file mode 100644 index 0000000..2b5c5da --- /dev/null +++ b/vars.nix @@ -0,0 +1,7 @@ +{ + # Global variables used in NixOS and HomeManager which will probably never change + user = "ghoscht"; + location = "$HOME/.setup"; + terminal = "alacritty"; + editor = "nvim"; +} -- 2.45.2 From bff5e9072134fab260d48b68bb98ca1673faf9fc Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Mon, 25 Dec 2023 23:12:37 +0100 Subject: [PATCH 10/44] Add gnome-keyring --- hosts/adalbert/default.nix | 1 + hosts/common/optional/gnome-keyring.nix | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 hosts/common/optional/gnome-keyring.nix diff --git a/hosts/adalbert/default.nix b/hosts/adalbert/default.nix index a211395..212ab2b 100644 --- a/hosts/adalbert/default.nix +++ b/hosts/adalbert/default.nix @@ -31,6 +31,7 @@ ../common/optional/wireshark.nix ../common/optional/gamemode.nix ../common/optional/kde-connect.nix + ../common/optional/gnome-keyring.nix ]; nixpkgs = { diff --git a/hosts/common/optional/gnome-keyring.nix b/hosts/common/optional/gnome-keyring.nix new file mode 100644 index 0000000..9931b33 --- /dev/null +++ b/hosts/common/optional/gnome-keyring.nix @@ -0,0 +1,12 @@ +{ + config, + lib, + pkgs, + vars, + ... +}: let +in { + security.pam.services.${vars.user}.enableGnomeKeyring = true; + services.gnome.gnome-keyring.enable = true; + programs.seahorse.enable = true; +} -- 2.45.2 From bacd50086ead3bf6fcc151b307b89f353382a515 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Mon, 25 Dec 2023 23:20:28 +0100 Subject: [PATCH 11/44] Remove unnecessary global vars --- vars.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/vars.nix b/vars.nix index 2b5c5da..e9bf3b5 100644 --- a/vars.nix +++ b/vars.nix @@ -2,6 +2,4 @@ # Global variables used in NixOS and HomeManager which will probably never change user = "ghoscht"; location = "$HOME/.setup"; - terminal = "alacritty"; - editor = "nvim"; } -- 2.45.2 From 9b851c37b88201558a7a8cf6871c12312bcf0acc Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Tue, 26 Dec 2023 11:49:58 +0100 Subject: [PATCH 12/44] Switch home-manager to single-user --- flake.nix | 2 +- home/{ghoscht => }/adalbert.nix | 0 home/{ghoscht => }/global/default.nix | 0 hosts/common/global/user.nix | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename home/{ghoscht => }/adalbert.nix (100%) rename home/{ghoscht => }/global/default.nix (100%) diff --git a/flake.nix b/flake.nix index 2f57185..177dee1 100644 --- a/flake.nix +++ b/flake.nix @@ -74,7 +74,7 @@ pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance extraSpecialArgs = {inherit inputs outputs vars;}; modules = [ - ./home/ghoscht/adalbert.nix + ./home/adalbert.nix ]; }; }; diff --git a/home/ghoscht/adalbert.nix b/home/adalbert.nix similarity index 100% rename from home/ghoscht/adalbert.nix rename to home/adalbert.nix diff --git a/home/ghoscht/global/default.nix b/home/global/default.nix similarity index 100% rename from home/ghoscht/global/default.nix rename to home/global/default.nix diff --git a/hosts/common/global/user.nix b/hosts/common/global/user.nix index 7b6a690..9e7da41 100644 --- a/hosts/common/global/user.nix +++ b/hosts/common/global/user.nix @@ -42,5 +42,5 @@ in { packages = [pkgs.home-manager]; }; - home-manager.users.${vars.user} = import ../../../home/${vars.user}/${config.networking.hostName}.nix; + home-manager.users.${vars.user} = import ../../../home/${config.networking.hostName}.nix; } -- 2.45.2 From 37d462c75f5028da9a4c7d0604b3b47b9b2ddbc0 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Tue, 26 Dec 2023 13:59:30 +0100 Subject: [PATCH 13/44] Add home-manager baseline --- flake.lock | 72 +++++++++++++++++++++++++ flake.nix | 9 ++-- home/adalbert.nix | 2 + home/features/cli/bat.nix | 6 +++ home/features/cli/btop.nix | 9 ++++ home/features/cli/default.nix | 31 +++++++++++ home/features/cli/direnv.nix | 6 +++ home/features/cli/fish.nix | 88 +++++++++++++++++++++++++++++++ home/features/cli/git.nix | 21 ++++++++ home/features/cli/gpg.nix | 25 +++++++++ home/features/cli/lazygit.nix | 5 ++ home/features/cli/nix-index.nix | 33 ++++++++++++ home/features/cli/pfetch.nix | 6 +++ home/features/coding/default.nix | 7 +++ home/features/coding/intellij.nix | 5 ++ home/features/coding/nvim.nix | 30 +++++++++++ home/features/coding/vscode.nix | 83 +++++++++++++++++++++++++++++ home/features/games/default.nix | 5 ++ home/features/games/steam.nix | 30 +++++++++++ home/global/default.nix | 51 ++++++++++-------- overlays/default.nix | 21 ++++++++ 21 files changed, 518 insertions(+), 27 deletions(-) create mode 100644 home/features/cli/bat.nix create mode 100644 home/features/cli/btop.nix create mode 100644 home/features/cli/default.nix create mode 100644 home/features/cli/direnv.nix create mode 100644 home/features/cli/fish.nix create mode 100644 home/features/cli/git.nix create mode 100644 home/features/cli/gpg.nix create mode 100644 home/features/cli/lazygit.nix create mode 100644 home/features/cli/nix-index.nix create mode 100644 home/features/cli/pfetch.nix create mode 100644 home/features/coding/default.nix create mode 100644 home/features/coding/intellij.nix create mode 100644 home/features/coding/nvim.nix create mode 100644 home/features/coding/vscode.nix create mode 100644 home/features/games/default.nix create mode 100644 home/features/games/steam.nix diff --git a/flake.lock b/flake.lock index 7f00ae0..bc90177 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "base16-schemes": { + "flake": false, + "locked": { + "lastModified": 1689473676, + "narHash": "sha256-L0RhUr9+W5EPWBpLcmkKpUeCEWRs/kLzVMF3Vao2ZU0=", + "owner": "tinted-theming", + "repo": "base16-schemes", + "rev": "d95123ca6377cd849cfdce92c0a24406b0c6a789", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-schemes", + "type": "github" + } + }, "hardware": { "locked": { "lastModified": 1702453208, @@ -36,6 +52,45 @@ "type": "github" } }, + "nh": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703024852, + "narHash": "sha256-mVJ/99zkqpqDDs68jYIVYyQH6NBgciKnUg8AfWyXSAM=", + "owner": "viperml", + "repo": "nh", + "rev": "37b0d469a328a5b5969eacdf137f1e6b86c75a1d", + "type": "github" + }, + "original": { + "owner": "viperml", + "repo": "nh", + "type": "github" + } + }, + "nix-colors": { + "inputs": { + "base16-schemes": "base16-schemes", + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1695388192, + "narHash": "sha256-2jelpE7xK+4M7jZNyWL7QYOYegQLYBDQS5bvdo8XRUQ=", + "owner": "misterio77", + "repo": "nix-colors", + "rev": "37227f274b34a3b51649166deb94ce7fec2c6a4c", + "type": "github" + }, + "original": { + "owner": "misterio77", + "repo": "nix-colors", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1703068421, @@ -52,6 +107,21 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1694911725, + "narHash": "sha256-8YqI+YU1DGclEjHsnrrGfqsQg3Wyga1DfTbJrN3Ud0c=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "819180647f428a3826bfc917a54449da1e532ce0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1697059129, @@ -72,6 +142,8 @@ "inputs": { "hardware": "hardware", "home-manager": "home-manager", + "nh": "nh", + "nix-colors": "nix-colors", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" } diff --git a/flake.nix b/flake.nix index 177dee1..ae45dad 100644 --- a/flake.nix +++ b/flake.nix @@ -14,10 +14,11 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; hardware.url = "github:nixos/nixos-hardware"; - - # Shameless plug: looking for a way to nixify your themes and make - # everything match nicely? Try nix-colors! - # nix-colors.url = "github:misterio77/nix-colors"; + nh = { + url = "github:viperml/nh"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-colors.url = "github:misterio77/nix-colors"; }; outputs = { diff --git a/home/adalbert.nix b/home/adalbert.nix index 47e35e9..d2ac644 100644 --- a/home/adalbert.nix +++ b/home/adalbert.nix @@ -5,6 +5,8 @@ }: { imports = [ ./global + ./features/games + ./features/coding ]; # colorscheme = inputs.nix-colors.colorschemes.paraiso; diff --git a/home/features/cli/bat.nix b/home/features/cli/bat.nix new file mode 100644 index 0000000..145895e --- /dev/null +++ b/home/features/cli/bat.nix @@ -0,0 +1,6 @@ +{ + programs.bat = { + enable = true; + config.theme = "base16"; + }; +} diff --git a/home/features/cli/btop.nix b/home/features/cli/btop.nix new file mode 100644 index 0000000..c1a556f --- /dev/null +++ b/home/features/cli/btop.nix @@ -0,0 +1,9 @@ +{ + programs.btop = { + enable = true; + settings = { + color_theme = "Default"; + theme_background = false; + }; + }; +} diff --git a/home/features/cli/default.nix b/home/features/cli/default.nix new file mode 100644 index 0000000..e08d647 --- /dev/null +++ b/home/features/cli/default.nix @@ -0,0 +1,31 @@ +{pkgs, ...}: { + imports = [ + ./bat.nix + ./direnv.nix + ./fish.nix + ./git.nix + ./gpg.nix + ./pfetch.nix + ./btop.nix + ./nix-index.nix + ./lazygit.nix + ]; + home.packages = with pkgs; [ + comma # Install and run programs by sticking a , before them + distrobox # Nice escape hatch, integrates docker images with my environment + + bc # Calculator + eza # Better ls + ripgrep # Better grep + fd # Better find + httpie # Better curl + diffsitter # Better diff + jq # JSON pretty printer and manipulator + timer # To help with my ADHD paralysis + lazydocker # Docker TUI + + nvd # Differ + nix-output-monitor + nh # Nice wrapper for NixOS and HM + ]; +} diff --git a/home/features/cli/direnv.nix b/home/features/cli/direnv.nix new file mode 100644 index 0000000..2b51c9d --- /dev/null +++ b/home/features/cli/direnv.nix @@ -0,0 +1,6 @@ +{ + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; +} diff --git a/home/features/cli/fish.nix b/home/features/cli/fish.nix new file mode 100644 index 0000000..874f9f0 --- /dev/null +++ b/home/features/cli/fish.nix @@ -0,0 +1,88 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib) mkIf; + hasPackage = pname: lib.any (p: p ? pname && p.pname == pname) config.home.packages; + hasRipgrep = hasPackage "ripgrep"; + hasExa = hasPackage "eza"; + hasNeovim = config.programs.neovim.enable; + hasLazygit = config.programs.lazygit.enable; + hasLazydocker = hasPackage "lazydocker"; + hasNixYourShell = hasPackage "nix-your-shell"; + hasShellColor = config.programs.shellcolor.enable; + shellcolor = "${pkgs.shellcolord}/bin/shellcolor"; +in { + programs.fish = { + enable = true; + interactiveShellInit = '' + ${ + if hasNixYourShell + then "nix-your-shell fish | source" + else "" + } + ''; + plugins = [ + { + name = "grc"; + src = pkgs.fishPlugins.grc.src; + } + { + name = "fzf"; + src = pkgs.fishPlugins.fzf.src; + } + { + name = "tide"; + src = pkgs.fishPlugins.tide.src; + } + { + name = "sponge"; + src = pkgs.fishPlugins.sponge.src; + } + { + name = "autopair"; + src = pkgs.fishPlugins.autopair.src; + } + ]; + shellAliases = { + lzg = mkIf hasLazygit "lazygit"; + lzd = mkIf hasLazydocker "lazydocker"; + batt = ''upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -e "percentage" -e "state"''; + hx = "~/Documents/heliox-cli/target/debug/heliox-cli --mode"; + slp = "systemctl suspend"; + sdn = "shutdown 0"; + }; + shellAbbrs = rec { + jqless = "jq -C | less -r"; + + n = "nix"; + nd = "nix develop -c $SHELL"; + ns = "nix shell"; + nsn = "nix shell nixpkgs#"; + nb = "nix build"; + nbn = "nix build nixpkgs#"; + nf = "nix flake"; + + nr = "nixos-rebuild --flake ."; + nrs = "nixos-rebuild --flake . switch"; + snr = "sudo nixos-rebuild --flake ."; + snrs = "sudo nixos-rebuild --flake . switch"; + hm = "home-manager --flake ."; + hms = "home-manager --flake . switch"; + + ls = mkIf hasExa "eza"; + exa = mkIf hasExa "eza"; + + vim = mkIf hasNeovim "nvim"; + vi = vim; + v = vim; + }; + functions = { + # Disable greeting + fish_greeting = ""; + }; + }; + home.packages = with pkgs; [grc fzf nix-your-shell]; +} diff --git a/home/features/cli/git.nix b/home/features/cli/git.nix new file mode 100644 index 0000000..ec86a20 --- /dev/null +++ b/home/features/cli/git.nix @@ -0,0 +1,21 @@ +{pkgs, ...}: { + #Prefer IPv4 for ssh + home.file.".ssh/config".text = "AddressFamily inet"; + + programs.git = { + enable = true; + userName = "GHOSCHT"; + userEmail = "31184695+GHOSCHT@users.noreply.github.com"; + package = pkgs.gitAndTools.gitFull; + + extraConfig = { + commit.gpgsign = true; + user.signingkey = "0x2C2C1C62A5388E82"; + init.defaultBranch = "main"; + }; + lfs.enable = true; + aliases = { + graph = "log --decorate --oneline --graph"; + }; + }; +} diff --git a/home/features/cli/gpg.nix b/home/features/cli/gpg.nix new file mode 100644 index 0000000..f87e9ab --- /dev/null +++ b/home/features/cli/gpg.nix @@ -0,0 +1,25 @@ +{ + lib, + pkgs, + ... +}: { + programs.gpg = { + enable = true; + }; + services.gpg-agent = { + enable = true; + enableSshSupport = true; + enableFishIntegration = true; + enableZshIntegration = true; + pinentryFlavor = "gnome3"; + }; + + # Prevent clobbering SSH_AUTH_SOCK + home.sessionVariables.GSM_SKIP_SSH_AGENT_WORKAROUND = "1"; + + # Disable gnome-keyring ssh-agent + xdg.configFile."autostart/gnome-keyring-ssh.desktop".text = '' + ${lib.fileContents "${pkgs.gnome3.gnome-keyring}/etc/xdg/autostart/gnome-keyring-ssh.desktop"} + Hidden=true + ''; +} diff --git a/home/features/cli/lazygit.nix b/home/features/cli/lazygit.nix new file mode 100644 index 0000000..0d58dae --- /dev/null +++ b/home/features/cli/lazygit.nix @@ -0,0 +1,5 @@ +{ + programs.lazygit = { + enable = true; + }; +} diff --git a/home/features/cli/nix-index.nix b/home/features/cli/nix-index.nix new file mode 100644 index 0000000..a5053c8 --- /dev/null +++ b/home/features/cli/nix-index.nix @@ -0,0 +1,33 @@ +{pkgs, ...}: let + update-script = pkgs.writeShellApplication { + name = "fetch-nix-index-database"; + runtimeInputs = with pkgs; [wget coreutils]; + text = '' + filename="index-x86_64-linux" + mkdir -p ~/.cache/nix-index + cd ~/.cache/nix-index + wget -N "https://github.com/Mic92/nix-index-database/releases/latest/download/$filename" + ln -f "$filename" files + ''; + }; +in { + programs.nix-index.enable = true; + + systemd.user.services.nix-index-database-sync = { + Unit = {Description = "fetch mic92/nix-index-database";}; + Service = { + Type = "oneshot"; + ExecStart = "${update-script}/bin/fetch-nix-index-database"; + Restart = "on-failure"; + RestartSec = "5m"; + }; + }; + systemd.user.timers.nix-index-database-sync = { + Unit = {Description = "Automatic github:mic92/nix-index-database fetching";}; + Timer = { + OnBootSec = "10m"; + OnUnitActiveSec = "24h"; + }; + Install = {WantedBy = ["timers.target"];}; + }; +} diff --git a/home/features/cli/pfetch.nix b/home/features/cli/pfetch.nix new file mode 100644 index 0000000..391de39 --- /dev/null +++ b/home/features/cli/pfetch.nix @@ -0,0 +1,6 @@ +{pkgs, ...}: { + home = { + packages = with pkgs; [pfetch]; + sessionVariables.PF_INFO = "ascii title os kernel uptime shell term desktop scheme palette"; + }; +} diff --git a/home/features/coding/default.nix b/home/features/coding/default.nix new file mode 100644 index 0000000..f3f814b --- /dev/null +++ b/home/features/coding/default.nix @@ -0,0 +1,7 @@ +{pkgs, ...}: { + imports = [ + ./nvim.nix + ./vscode.nix + ./intellij.nix + ]; +} diff --git a/home/features/coding/intellij.nix b/home/features/coding/intellij.nix new file mode 100644 index 0000000..d4eba04 --- /dev/null +++ b/home/features/coding/intellij.nix @@ -0,0 +1,5 @@ +{pkgs, ...}: { + home.packages = with pkgs.unstable; [ + (jetbrains.plugins.addPlugins jetbrains.idea-ultimate ["ideavim"]) + ]; +} diff --git a/home/features/coding/nvim.nix b/home/features/coding/nvim.nix new file mode 100644 index 0000000..2a007f5 --- /dev/null +++ b/home/features/coding/nvim.nix @@ -0,0 +1,30 @@ +{ + config, + lib, + pkgs, + vars, + ... +}: let +in { + home = { + file.".config/nvim/lua/custom/" = { + source = ../../../rsc/config/nvim; + recursive = true; + }; + + packages = with pkgs; [ + gcc + black + python310Packages.debugpy # is this working? + mypy + ruff + nodePackages.pyright + clang-tools_16 + rnix-lsp + rust-analyzer + nodePackages.eslint_d + nodePackages.jsonlint + alejandra + ]; + }; +} diff --git a/home/features/coding/vscode.nix b/home/features/coding/vscode.nix new file mode 100644 index 0000000..67fea5d --- /dev/null +++ b/home/features/coding/vscode.nix @@ -0,0 +1,83 @@ +{ + config, + lib, + pkgs, + vars, + ... +}: let +in { + programs.vscode = { + enable = true; + package = pkgs.vscodium; + enableUpdateCheck = false; + extensions = with pkgs.vscode-extensions; + [ + catppuccin.catppuccin-vsc + pkief.material-icon-theme + vscodevim.vim + bbenoist.nix + ms-python.python + ms-toolsai.jupyter + ms-toolsai.jupyter-renderers + ms-toolsai.jupyter-keymap + ] + ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + { + name = "remote-ssh-edit"; + publisher = "ms-vscode-remote"; + version = "0.47.2"; + sha256 = "1hp6gjh4xp2m1xlm1jsdzxw9d8frkiidhph6nvl24d0h8z34w49g"; + } + { + name = "cpptools"; + publisher = "ms-vscode"; + version = "1.19.1"; + sha256 = "sha256-yUZTLnN4nomFp5I0VgRz7rRMkeMU9QzY+dzEdUUASek="; + } + { + name = "camkes-syntax-highlighting"; + publisher = "hensoldt-cyber-gmbh"; + version = "1.1.3"; + sha256 = "sha256-dRhsFGSjR/Vp5aJgMDwCZQtwmmfNXbM85ViTIq5ORwY="; + } + ]; + userSettings = { + #Theming + "workbench.colorTheme" = "Catppuccin Mocha"; + "catppuccin.accentColor" = "teal"; + "workbench.iconTheme" = "material-icon-theme"; + "window.menuBarVisibility" = "toggle"; + "editor.minimap.autohide" = false; + #Extensions - General + "extensions.autoCheckUpdates" = false; + "extensions.autoUpdate" = false; + # Startup + "workbench.startupEditor" = "none"; + # Vim + "editor.lineNumbers" = "relative"; + }; + keybindings = [ + # Navigating Autosuggest and Quick Open entries + { + "key" = "ctrl+j"; + "command" = "selectNextSuggestion"; + "when" = "suggestWidgetVisible"; + } + { + "key" = "ctrl+k"; + "command" = "selectPrevSuggestion"; + "when" = "suggestWidgetVisible"; + } + { + "key" = "ctrl+j"; + "command" = "workbench.action.quickOpenSelectNext"; + "when" = "inQuickOpen"; + } + { + "key" = "ctrl+k"; + "command" = "workbench.action.quickOpenSelectPrevious"; + "when" = "inQuickOpen"; + } + ]; + }; +} diff --git a/home/features/games/default.nix b/home/features/games/default.nix new file mode 100644 index 0000000..7e45005 --- /dev/null +++ b/home/features/games/default.nix @@ -0,0 +1,5 @@ +{pkgs, ...}: { + imports = [ + ./steam.nix + ]; +} diff --git a/home/features/games/steam.nix b/home/features/games/steam.nix new file mode 100644 index 0000000..8824ea1 --- /dev/null +++ b/home/features/games/steam.nix @@ -0,0 +1,30 @@ +{ + pkgs, + lib, + config, + ... +}: let + steam-with-pkgs = pkgs.steam.override { + extraPkgs = pkgs: + with pkgs; [ + xorg.libXcursor + xorg.libXi + xorg.libXinerama + xorg.libXScrnSaver + libpng + libpulseaudio + libvorbis + stdenv.cc.cc.lib + libkrb5 + keyutils + gamescope + mangohud + ]; + }; +in { + home.packages = with pkgs; [ + gamescope + mangohud + protontricks + ]; +} diff --git a/home/global/default.nix b/home/global/default.nix index 40b5907..d3ebc4f 100644 --- a/home/global/default.nix +++ b/home/global/default.nix @@ -6,38 +6,43 @@ lib, config, pkgs, + vars, ... }: { # You can import other home-manager modules here - imports = [ - # If you want to use modules your own flake exports (from modules/home-manager): - # outputs.homeManagerModules.example + imports = + [ + # If you want to use modules your own flake exports (from modules/home-manager): + # outputs.homeManagerModules.example - # Or modules exported from other flakes (such as nix-colors): - # inputs.nix-colors.homeManagerModules.default + # Or modules exported from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModules - # You can also split up your configuration and import pieces of it here: - # ./nvim.nix - ]; + # You can also split up your configuration and import pieces of it here: + ../features/cli + ] + ++ (builtins.attrValues outputs.homeManagerModules); nixpkgs = { # You can add overlays here - overlays = [ - # Add overlays your own flake exports (from overlays and pkgs dir): - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.unstable-packages + overlays = + [ + # Add overlays your own flake exports (from overlays and pkgs dir): + # outputs.overlays.additions + # outputs.overlays.modifications + # outputs.overlays.unstable-packages - # You can also add overlays exported from other flakes: - # neovim-nightly-overlay.overlays.default + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default - # Or define it inline, for example: - # (final: prev: { - # hi = final.hello.overrideAttrs (oldAttrs: { - # patches = [ ./change-hello-to-hi.patch ]; - # }); - # }) - ]; + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ] + ++ (builtins.attrValues outputs.overlays); # Configure your nixpkgs instance config = { # Disable if you don't want unfree packages @@ -59,7 +64,7 @@ }; home = { - username = lib.mkDefault "ghoscht"; + username = lib.mkDefault vars.user; homeDirectory = lib.mkDefault "/home/${config.home.username}"; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion stateVersion = "23.11"; diff --git a/overlays/default.nix b/overlays/default.nix index a13ea3c..d2098e4 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -3,6 +3,27 @@ # This one brings our custom packages from the 'pkgs' directory additions = final: _prev: import ../pkgs {pkgs = final;}; + # Third party overlays + nh = inputs.nh.overlays.default; + + # For every flake input, aliases 'pkgs.inputs.${flake}' to + # 'inputs.${flake}.packages.${pkgs.system}' or + # 'inputs.${flake}.legacyPackages.${pkgs.system}' + flake-inputs = final: _: { + inputs = + builtins.mapAttrs + ( + _: flake: let + legacyPackages = (flake.legacyPackages or {}).${final.system} or {}; + packages = (flake.packages or {}).${final.system} or {}; + in + if legacyPackages != {} + then legacyPackages + else packages + ) + inputs; + }; + # This one contains whatever you want to overlay # You can change versions, add patches, set compilation flags, anything really. # https://nixos.wiki/wiki/Overlays -- 2.45.2 From 279d309c73ae71b42f9f48dee6f91c2b2b9bff54 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Tue, 26 Dec 2023 13:59:40 +0100 Subject: [PATCH 14/44] Add adb integration --- hosts/adalbert/default.nix | 1 + hosts/common/optional/adb.nix | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 hosts/common/optional/adb.nix diff --git a/hosts/adalbert/default.nix b/hosts/adalbert/default.nix index 212ab2b..f7422fa 100644 --- a/hosts/adalbert/default.nix +++ b/hosts/adalbert/default.nix @@ -32,6 +32,7 @@ ../common/optional/gamemode.nix ../common/optional/kde-connect.nix ../common/optional/gnome-keyring.nix + ../common/optional/adb.nix ]; nixpkgs = { diff --git a/hosts/common/optional/adb.nix b/hosts/common/optional/adb.nix new file mode 100644 index 0000000..c110bb7 --- /dev/null +++ b/hosts/common/optional/adb.nix @@ -0,0 +1,5 @@ +{vars, ...}: let +in { + programs.adb.enable = true; + users.users.${vars.user}.extraGroups = ["adbusers"]; +} -- 2.45.2 From 6d78f64de152b34f0c19525849a16daf98ced8f6 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Tue, 26 Dec 2023 22:07:13 +0100 Subject: [PATCH 15/44] Fix double declaration issue when importing custom packages --- hosts/common/global/user.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/hosts/common/global/user.nix b/hosts/common/global/user.nix index 9e7da41..c050b6f 100644 --- a/hosts/common/global/user.nix +++ b/hosts/common/global/user.nix @@ -8,7 +8,6 @@ }: let ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; in { - imports = builtins.attrValues outputs.nixosModules; #propagates imports downwards users.users.${vars.user} = { isNormalUser = true; shell = pkgs.fish; -- 2.45.2 From de70c6a16b482dc4017ececc924bade385dd51d8 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Tue, 26 Dec 2023 22:07:47 +0100 Subject: [PATCH 16/44] Fix "attribute 'callPackage' missing" error --- pkgs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/default.nix b/pkgs/default.nix index dd93bb4..9e7df08 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,6 +1,6 @@ # Custom packages, that can be defined similarly to ones from nixpkgs # You can build them using 'nix build .#example' -pkgs: { +{pkgs, ...}: { # example = pkgs.callPackage ./example { }; alvr = pkgs.callPackage ./alvr {}; } -- 2.45.2 From 3213902bb699f81ff5a10ffe8dcd07cd9ef35098 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Tue, 26 Dec 2023 22:08:57 +0100 Subject: [PATCH 17/44] Add alvr nixos module --- modules/nixos/alvr.nix | 34 ++++++++++++++++++++++++++++++++++ modules/nixos/default.nix | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 modules/nixos/alvr.nix diff --git a/modules/nixos/alvr.nix b/modules/nixos/alvr.nix new file mode 100644 index 0000000..334fce8 --- /dev/null +++ b/modules/nixos/alvr.nix @@ -0,0 +1,34 @@ +{ + config, + pkgs, + lib, + ... +}: +with lib; let + cfg = config.programs.alvr; +in { + options = { + programs.alvr = { + enable = mkEnableOption (lib.mdDoc "ALVR"); + + package = mkPackageOption pkgs "alvr" {}; + + openFirewall = mkOption { + type = types.bool; + default = false; + description = lib.mdDoc '' + Open the default ports in the firewall for the ALVR server. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [cfg.package]; + + networking.firewall = mkIf cfg.openFirewall { + allowedTCPPorts = [9943 9944]; + allowedUDPPorts = [9943 9944]; + }; + }; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 8605069..402d229 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -2,5 +2,5 @@ # These should be stuff you would like to share with others, not your personal configurations. { # List your module files here - # my-module = import ./my-module.nix; + alvr = import ./alvr.nix; } -- 2.45.2 From de179d73323c3083685d124737fbd388f8e795ba Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Tue, 26 Dec 2023 22:15:20 +0100 Subject: [PATCH 18/44] Enable VR streaming with ALVR --- hosts/adalbert/default.nix | 3 ++- hosts/common/optional/{ => gaming}/gamemode.nix | 0 hosts/common/optional/gaming/vr.nix | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) rename hosts/common/optional/{ => gaming}/gamemode.nix (100%) create mode 100644 hosts/common/optional/gaming/vr.nix diff --git a/hosts/adalbert/default.nix b/hosts/adalbert/default.nix index f7422fa..1305d96 100644 --- a/hosts/adalbert/default.nix +++ b/hosts/adalbert/default.nix @@ -29,10 +29,11 @@ ../common/optional/systemd-boot.nix ../common/optional/wireshark.nix - ../common/optional/gamemode.nix ../common/optional/kde-connect.nix ../common/optional/gnome-keyring.nix ../common/optional/adb.nix + ../common/optional/gaming/gamemode.nix + ../common/optional/gaming/vr.nix ]; nixpkgs = { diff --git a/hosts/common/optional/gamemode.nix b/hosts/common/optional/gaming/gamemode.nix similarity index 100% rename from hosts/common/optional/gamemode.nix rename to hosts/common/optional/gaming/gamemode.nix diff --git a/hosts/common/optional/gaming/vr.nix b/hosts/common/optional/gaming/vr.nix new file mode 100644 index 0000000..1ece2ca --- /dev/null +++ b/hosts/common/optional/gaming/vr.nix @@ -0,0 +1,6 @@ +{ + programs.alvr = { + enable = true; + openFirewall = true; + }; +} -- 2.45.2 From 01f497e64cf7071311836ae4c659379630bd647b Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Tue, 26 Dec 2023 22:32:45 +0100 Subject: [PATCH 19/44] Add awesomewm configuration --- home/adalbert.nix | 1 + home/features/desktop/awesome/default.nix | 31 +++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 home/features/desktop/awesome/default.nix diff --git a/home/adalbert.nix b/home/adalbert.nix index d2ac644..a437239 100644 --- a/home/adalbert.nix +++ b/home/adalbert.nix @@ -5,6 +5,7 @@ }: { imports = [ ./global + ./features/desktop/awesome ./features/games ./features/coding ]; diff --git a/home/features/desktop/awesome/default.nix b/home/features/desktop/awesome/default.nix new file mode 100644 index 0000000..0ce2499 --- /dev/null +++ b/home/features/desktop/awesome/default.nix @@ -0,0 +1,31 @@ +{pkgs, ...}: { + home = { + file.".wallpapers" = { + source = ../../../../rsc/wallpaper; + recursive = true; + }; + file.".config/awesome/" = { + source = ../../../../rsc/config/awesome; + recursive = true; + }; + file.".config/picom/" = { + source = ../../../../rsc/config/picom; + recursive = true; + }; + file.".config/rofi" = { + source = ../../../../rsc/config/rofi; + recursive = true; + }; + + packages = with pkgs; [ + picom + rofi + redshift + xbindkeys + clipmenu + flameshot + xclip + brightnessctl + ]; + }; +} -- 2.45.2 From 0c1666d911cffa4f853a51192dc066a61ad4a0bd Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Tue, 26 Dec 2023 23:25:22 +0100 Subject: [PATCH 20/44] Add firefox & arkenfox --- flake.lock | 251 +++++++++++++++++++++- flake.nix | 9 + home/features/desktop/awesome/default.nix | 4 + home/features/desktop/common/default.nix | 3 + home/features/desktop/common/firefox.nix | 27 +++ hosts/adalbert/default.nix | 1 + 6 files changed, 288 insertions(+), 7 deletions(-) create mode 100644 home/features/desktop/common/default.nix create mode 100644 home/features/desktop/common/firefox.nix diff --git a/flake.lock b/flake.lock index bc90177..a5b8b70 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,28 @@ { "nodes": { + "arkenfox": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit": "pre-commit" + }, + "locked": { + "lastModified": 1701036929, + "narHash": "sha256-5TkAr5a3EoY9/oeO53SU+FRNfOUTpChj7mEW/Ax3T1w=", + "owner": "dwarfmaster", + "repo": "arkenfox-nixos", + "rev": "1c9d061a4ef7bf3ce8a5260eaee4acdb3ee097f9", + "type": "github" + }, + "original": { + "owner": "dwarfmaster", + "repo": "arkenfox-nixos", + "type": "github" + } + }, "base16-schemes": { "flake": false, "locked": { @@ -16,6 +39,134 @@ "type": "github" } }, + "firefox-addons": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "dir": "pkgs/firefox-addons", + "lastModified": 1703515744, + "narHash": "sha256-x/Oz43zeFewMyDglI4AGfyv7xgJZCL75/RL+kGwahto=", + "owner": "rycee", + "repo": "nur-expressions", + "rev": "3776272394cb8b1caf3db29bc6dc853f11208b46", + "type": "gitlab" + }, + "original": { + "dir": "pkgs/firefox-addons", + "owner": "rycee", + "repo": "nur-expressions", + "type": "gitlab" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "locked": { + "lastModified": 1629284811, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c5d161cc0af116a2e17f54316f0bf43f0819785c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "arkenfox", + "pre-commit", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "hardware": { "locked": { "lastModified": 1702453208, @@ -93,16 +244,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1703068421, - "narHash": "sha256-WSw5Faqlw75McIflnl5v7qVD/B3S2sLh+968bpOGrWA=", - "owner": "nixos", + "lastModified": 1689261696, + "narHash": "sha256-LzfUtFs9MQRvIoQ3MfgSuipBVMXslMPH/vZ+nM40LkA=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "d65bceaee0fb1e64363f7871bc43dc1c6ecad99f", + "rev": "df1eee2aa65052a18121ed4971081576b25d6b5c", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-23.11", + "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } @@ -122,6 +273,22 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1697059129, @@ -138,15 +305,85 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1703068421, + "narHash": "sha256-WSw5Faqlw75McIflnl5v7qVD/B3S2sLh+968bpOGrWA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d65bceaee0fb1e64363f7871bc43dc1c6ecad99f", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_2", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1700922917, + "narHash": "sha256-ej2fch/T584b5K9sk1UhmZF7W6wEfDHuoUYpFN8dtvM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "e5ee5c5f3844550c01d2131096c7271cec5e9b78", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { + "arkenfox": "arkenfox", + "firefox-addons": "firefox-addons", "hardware": "hardware", "home-manager": "home-manager", "nh": "nh", "nix-colors": "nix-colors", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index ae45dad..053cdbb 100644 --- a/flake.nix +++ b/flake.nix @@ -19,12 +19,21 @@ inputs.nixpkgs.follows = "nixpkgs"; }; nix-colors.url = "github:misterio77/nix-colors"; + firefox-addons = { + url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + arkenfox = { + url = "github:dwarfmaster/arkenfox-nixos"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, nixpkgs, home-manager, + arkenfox, ... } @ inputs: let inherit (self) outputs; diff --git a/home/features/desktop/awesome/default.nix b/home/features/desktop/awesome/default.nix index 0ce2499..08785e3 100644 --- a/home/features/desktop/awesome/default.nix +++ b/home/features/desktop/awesome/default.nix @@ -1,4 +1,8 @@ {pkgs, ...}: { + imports = [ + ../common + ]; + home = { file.".wallpapers" = { source = ../../../../rsc/wallpaper; diff --git a/home/features/desktop/common/default.nix b/home/features/desktop/common/default.nix new file mode 100644 index 0000000..dad3d2f --- /dev/null +++ b/home/features/desktop/common/default.nix @@ -0,0 +1,3 @@ +{ + imports = [./firefox.nix]; +} diff --git a/home/features/desktop/common/firefox.nix b/home/features/desktop/common/firefox.nix new file mode 100644 index 0000000..70993b7 --- /dev/null +++ b/home/features/desktop/common/firefox.nix @@ -0,0 +1,27 @@ +{ + inputs, + pkgs, + vars, + ... +}: { + imports = [inputs.arkenfox.hmModules.default]; + programs.firefox = { + enable = true; + arkenfox = { + enable = true; + version = "119.0"; + }; + + profiles.Default.arkenfox = { + enable = true; + "0000".enable = true; + }; + }; + + xdg.mimeApps.defaultApplications = { + "text/html" = ["firefox.desktop"]; + "text/xml" = ["firefox.desktop"]; + "x-scheme-handler/http" = ["firefox.desktop"]; + "x-scheme-handler/https" = ["firefox.desktop"]; + }; +} diff --git a/hosts/adalbert/default.nix b/hosts/adalbert/default.nix index 1305d96..fb5594d 100644 --- a/hosts/adalbert/default.nix +++ b/hosts/adalbert/default.nix @@ -58,6 +58,7 @@ config = { # Disable if you don't want unfree packages allowUnfree = true; + firefox.enablePlasmaBrowserIntegration = true; }; }; -- 2.45.2 From e8dfc420fe4eadcf21dffa108ef164fbf1fc6ce3 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 10:31:23 +0100 Subject: [PATCH 21/44] Add nix-colors --- home/adalbert.nix | 6 ++-- home/features/desktop/common/alacritty.nix | 39 ++++++++++++++++++++++ home/features/desktop/common/default.nix | 5 ++- 3 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 home/features/desktop/common/alacritty.nix diff --git a/home/adalbert.nix b/home/adalbert.nix index a437239..78f2915 100644 --- a/home/adalbert.nix +++ b/home/adalbert.nix @@ -2,15 +2,17 @@ inputs, outputs, ... -}: { +}: let +in { imports = [ ./global ./features/desktop/awesome ./features/games ./features/coding + inputs.nix-colors.homeManagerModules.default ]; - # colorscheme = inputs.nix-colors.colorschemes.paraiso; + colorScheme = inputs.nix-colors.colorSchemes.catppuccin-mocha; # wallpaper = outputs.wallpapers.cyberpunk-city-red; # # # ------ ----- ------ diff --git a/home/features/desktop/common/alacritty.nix b/home/features/desktop/common/alacritty.nix new file mode 100644 index 0000000..c90d8f3 --- /dev/null +++ b/home/features/desktop/common/alacritty.nix @@ -0,0 +1,39 @@ +{ + pkgs, + config, + ... +}: { + programs.alacritty.enable = true; + programs.alacritty.settings = { + colors = with config.colorScheme.colors; { + bright = { + black = "0x${base00}"; + blue = "0x${base0D}"; + cyan = "0x${base0C}"; + green = "0x${base0B}"; + magenta = "0x${base0E}"; + red = "0x${base08}"; + white = "0x${base06}"; + yellow = "0x${base09}"; + }; + cursor = { + cursor = "0x${base06}"; + text = "0x${base06}"; + }; + normal = { + black = "0x${base00}"; + blue = "0x${base0D}"; + cyan = "0x${base0C}"; + green = "0x${base0B}"; + magenta = "0x${base0E}"; + red = "0x${base08}"; + white = "0x${base06}"; + yellow = "0x${base0A}"; + }; + primary = { + background = "0x${base00}"; + foreground = "0x${base06}"; + }; + }; + }; +} diff --git a/home/features/desktop/common/default.nix b/home/features/desktop/common/default.nix index dad3d2f..bbd17ca 100644 --- a/home/features/desktop/common/default.nix +++ b/home/features/desktop/common/default.nix @@ -1,3 +1,6 @@ { - imports = [./firefox.nix]; + imports = [ + ./firefox.nix + ./alacritty.nix + ]; } -- 2.45.2 From 72006c4716164dc6dc7727313fdc9da27c38aadb Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 10:57:55 +0100 Subject: [PATCH 22/44] Add centralized key reymapping --- flake.lock | 332 ++++++++++++++++++++++- flake.nix | 1 + hosts/common/optional/desktop/global.nix | 2 +- hosts/common/optional/desktop/xremap.nix | 25 ++ 4 files changed, 358 insertions(+), 2 deletions(-) create mode 100644 hosts/common/optional/desktop/xremap.nix diff --git a/flake.lock b/flake.lock index a5b8b70..56106cb 100644 --- a/flake.lock +++ b/flake.lock @@ -39,6 +39,46 @@ "type": "github" } }, + "crane": { + "inputs": { + "nixpkgs": [ + "xremap", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701386725, + "narHash": "sha256-w4aBlMYh9Y8co1V80m5LzEKMijUJ7CBTq209WbqVwUU=", + "owner": "ipetkov", + "repo": "crane", + "rev": "8b9bad9b30bd7a9ed08782e64846b7485f9d0a38", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "devshell": { + "inputs": { + "nixpkgs": "nixpkgs_3", + "systems": "systems_3" + }, + "locked": { + "lastModified": 1700815693, + "narHash": "sha256-JtKZEQUzosrCwDsLgm+g6aqbP1aseUl1334OShEAS3s=", + "owner": "numtide", + "repo": "devshell", + "rev": "7ad1c417c87e98e56dcef7ecd0e0a2f2e5669d51", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "firefox-addons": { "inputs": { "flake-utils": "flake-utils_3", @@ -94,6 +134,24 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1698882062, + "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -203,6 +261,73 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1701071203, + "narHash": "sha256-lQywA7QU/vzTdZ1apI0PfgCWNyQobXUYghVrR5zuIeM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "db1878f013b52ba5e4034db7c1b63e8d04173a86", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": "nixpkgs_5", + "systems": "systems_4", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1701370414, + "narHash": "sha256-Q7A8BWWS1YndiNaAKM0IP73SGKJiQDfOdZAIdTLGNj8=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "b394c1695c05cf3b2133a473aa459d4cd750911b", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "xremap", + "hyprland", + "nixpkgs" + ], + "systems": [ + "xremap", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, "nh": { "inputs": { "nixpkgs": [ @@ -273,6 +398,24 @@ "type": "github" } }, + "nixpkgs-lib_2": { + "locked": { + "dir": "lib", + "lastModified": 1698611440, + "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1685801374, @@ -321,6 +464,70 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1677383253, + "narHash": "sha256-UfpzWfSxkfXHnb4boXZNaKsAcUrZT9Hw+tao1oZxd08=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9952d6bc395f5841262b006fbace8dd7e143b634", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1700794826, + "narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5a09cb4b393d58f9ed0d9ca1555016a8543c2ac8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1700612854, + "narHash": "sha256-yrQ8osMD+vDLGFX7pcwsY/Qr5PUd6OmDMYJZzZi0+zc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "19cbff58383a4ae384dea4d1d0c823d72b49d614", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1701336116, + "narHash": "sha256-kEmpezCR/FpITc6yMbAh4WrOCiT2zg5pSjnKrq51h5Y=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f5c27c6136db4d76c30e533c20517df6864c46ee", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "pre-commit": { "inputs": { "flake-compat": "flake-compat_2", @@ -352,7 +559,8 @@ "nh": "nh", "nix-colors": "nix-colors", "nixpkgs": "nixpkgs_2", - "nixpkgs-unstable": "nixpkgs-unstable" + "nixpkgs-unstable": "nixpkgs-unstable", + "xremap": "xremap" } }, "systems": { @@ -384,6 +592,128 @@ "repo": "default", "type": "github" } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1701368958, + "narHash": "sha256-7kvyoA91etzVEl9mkA/EJfB6z/PltxX7Xc4gcr7/xlo=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "5d639394f3e83b01596dcd166a44a9a1a2583350", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "5d639394f3e83b01596dcd166a44a9a1a2583350", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "xremap", + "hyprland", + "hyprland-protocols" + ], + "nixpkgs": [ + "xremap", + "hyprland", + "nixpkgs" + ], + "systems": [ + "xremap", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1700508250, + "narHash": "sha256-X4o/mifI7Nhu0UKYlxx53wIC+gYDo3pVM9L2u3PE2bE=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "eb120ff25265ecacd0fc13d7dab12131b60d0f47", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } + }, + "xremap": { + "inputs": { + "crane": "crane", + "devshell": "devshell", + "flake-parts": "flake-parts", + "home-manager": "home-manager_2", + "hyprland": "hyprland", + "nixpkgs": "nixpkgs_6", + "xremap": "xremap_2" + }, + "locked": { + "lastModified": 1701816620, + "narHash": "sha256-axgWrKpoV1T7KVbbT+3H/Q6mcBdUKylIz6ClFCMRxlA=", + "owner": "xremap", + "repo": "nix-flake", + "rev": "5b264392686e6caee50c9b12cb290b7d0f23cf93", + "type": "github" + }, + "original": { + "owner": "xremap", + "repo": "nix-flake", + "type": "github" + } + }, + "xremap_2": { + "flake": false, + "locked": { + "lastModified": 1701234505, + "narHash": "sha256-7k6GsKDUBvhKL9JU/QkWO+IHvhaty1udOYP8fXKr9QY=", + "owner": "k0kubun", + "repo": "xremap", + "rev": "97268d1d92d94609daddff1230c4ca77d54a84dd", + "type": "github" + }, + "original": { + "owner": "k0kubun", + "ref": "v0.8.12", + "repo": "xremap", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 053cdbb..7b3d513 100644 --- a/flake.nix +++ b/flake.nix @@ -27,6 +27,7 @@ url = "github:dwarfmaster/arkenfox-nixos"; inputs.nixpkgs.follows = "nixpkgs"; }; + xremap.url = "github:xremap/nix-flake"; }; outputs = { diff --git a/hosts/common/optional/desktop/global.nix b/hosts/common/optional/desktop/global.nix index 51f9ada..d991eb5 100644 --- a/hosts/common/optional/desktop/global.nix +++ b/hosts/common/optional/desktop/global.nix @@ -4,7 +4,7 @@ pkgs, ... }: { - imports = [./pipewire.nix ../printing.nix ./flatpak.nix ./xdg.nix]; + imports = [./pipewire.nix ../printing.nix ./flatpak.nix ./xdg.nix ./xremap.nix]; # Enable networking networking.networkmanager.enable = true; diff --git a/hosts/common/optional/desktop/xremap.nix b/hosts/common/optional/desktop/xremap.nix new file mode 100644 index 0000000..489898f --- /dev/null +++ b/hosts/common/optional/desktop/xremap.nix @@ -0,0 +1,25 @@ +{ + pkgs, + inputs, + ... +}: { + imports = [ + inputs.xremap.nixosModules.default + ]; + + services.xremap = { + withX11 = true; + config = { + keymap = [ + { + name = "main remaps"; + remap = { + super-e = { + launch = ["firefox"]; + }; + }; + } + ]; + }; + }; +} -- 2.45.2 From 671373b34c1e866a2b117495dae4de0b65c0d277 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 18:01:48 +0100 Subject: [PATCH 23/44] Fix: install steam overlay --- home/features/games/steam.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/features/games/steam.nix b/home/features/games/steam.nix index 8824ea1..c550f86 100644 --- a/home/features/games/steam.nix +++ b/home/features/games/steam.nix @@ -23,6 +23,7 @@ }; in { home.packages = with pkgs; [ + steam-with-pkgs gamescope mangohud protontricks -- 2.45.2 From 1ac89233a129a8494629228ea8629f5f15e89dfb Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 20:03:03 +0100 Subject: [PATCH 24/44] Add btop nix-colors theme --- home/features/cli/btop.nix | 92 +++++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 2 deletions(-) diff --git a/home/features/cli/btop.nix b/home/features/cli/btop.nix index c1a556f..0af1ab6 100644 --- a/home/features/cli/btop.nix +++ b/home/features/cli/btop.nix @@ -1,9 +1,97 @@ -{ +{config, ...}: { programs.btop = { enable = true; settings = { - color_theme = "Default"; + color_theme = "nix-colors"; theme_background = false; + truecolor = true; + vim_keys = true; + rounded_corners = true; }; }; + xdg.configFile."btop/themes/nix-colors".text = '' + # Main background, empty for terminal default, need to be empty if you want transparent background + theme[main_bg]="#${config.colorScheme.colors.base00}" + + # Main text color + theme[main_fg]="#${config.colorScheme.colors.base05}" + + # Title color for boxes + theme[title]="#${config.colorScheme.colors.base05}" + + # Highlight color for keyboard shortcuts + theme[hi_fg]="#${config.colorScheme.colors.base0D}" + + # Background color of selected item in processes box + theme[selected_bg]="#${config.colorScheme.colors.base03}" + + # Foreground color of selected item in processes box + theme[selected_fg]="#${config.colorScheme.colors.base0D}" + + # Color of inactive/disabled text + theme[inactive_fg]="#${config.colorScheme.colors.base02}" + + # Color of text appearing on top of graphs, i.e uptime and current network graph scaling + theme[graph_text]="#${config.colorScheme.colors.base06}" + + # Background color of the percentage meters + theme[meter_bg]="#${config.colorScheme.colors.base03}" + + # Misc colors for processes box including mini cpu graphs, details memory graph and details status text + theme[proc_misc]="#${config.colorScheme.colors.base06}" + + # CPU, Memory, Network, Proc box outline colors + theme[cpu_box]="#${config.colorScheme.colors.base0E}" #Mauve + theme[mem_box]="#${config.colorScheme.colors.base0B}" #Green + theme[net_box]="#${config.colorScheme.colors.base08}" #Maroon + theme[proc_box]="#${config.colorScheme.colors.base0D}" #Blue + + # Box divider line and small boxes line color + theme[div_line]="#${config.colorScheme.colors.base04}" + + # Temperature graph color (Green -> Yellow -> Red) + theme[temp_start]="#${config.colorScheme.colors.base0B}" + theme[temp_mid]="#${config.colorScheme.colors.base0A}" + theme[temp_end]="#${config.colorScheme.colors.base08}" + + # CPU graph colors (Teal -> Lavender) + theme[cpu_start]="#${config.colorScheme.colors.base0C}" + theme[cpu_mid]="#${config.colorScheme.colors.base0D}" + theme[cpu_end]="#${config.colorScheme.colors.base07}" + + # Mem/Disk free meter (Mauve -> Lavender -> Blue) + theme[free_start]="#${config.colorScheme.colors.base0E}" + theme[free_mid]="#${config.colorScheme.colors.base07}" + theme[free_end]="#${config.colorScheme.colors.base0D}" + + # Mem/Disk cached meter (Sapphire -> Lavender) + theme[cached_start]="#${config.colorScheme.colors.base0D}" + theme[cached_mid]="#${config.colorScheme.colors.base0D}" + theme[cached_end]="#${config.colorScheme.colors.base07}" + + # Mem/Disk available meter (Peach -> Red) + theme[available_start]="#${config.colorScheme.colors.base0F}" + theme[available_mid]="#${config.colorScheme.colors.base09}" + theme[available_end]="#${config.colorScheme.colors.base08}" + + # Mem/Disk used meter (Green -> Sky) + theme[used_start]="#${config.colorScheme.colors.base0B}" + theme[used_mid]="#${config.colorScheme.colors.base0C}" + theme[used_end]="#${config.colorScheme.colors.base0D}" + + # Download graph colors (Peach -> Red) + theme[download_start]="#${config.colorScheme.colors.base0F}" + theme[download_mid]="#${config.colorScheme.colors.base09}" + theme[download_end]="#${config.colorScheme.colors.base08}" + + # Upload graph colors (Green -> Sky) + theme[upload_start]="#${config.colorScheme.colors.base0B}" + theme[upload_mid]="#${config.colorScheme.colors.base0C}" + theme[upload_end]="#${config.colorScheme.colors.base0D}" + + # Process box color gradient for threads, mem and cpu usage (Sapphire -> Mauve) + theme[process_start]="#${config.colorScheme.colors.base0D}" + theme[process_mid]="#${config.colorScheme.colors.base0C}" + theme[process_end]="#${config.colorScheme.colors.base0E}" + ''; } -- 2.45.2 From 6aee8be1244a68f8bac7dbcb7bb1f35d3de888f8 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:43:37 +0100 Subject: [PATCH 25/44] Add search engines & plugins to firefox --- home/features/desktop/common/firefox.nix | 62 ++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/home/features/desktop/common/firefox.nix b/home/features/desktop/common/firefox.nix index 70993b7..78f5147 100644 --- a/home/features/desktop/common/firefox.nix +++ b/home/features/desktop/common/firefox.nix @@ -7,14 +7,70 @@ imports = [inputs.arkenfox.hmModules.default]; programs.firefox = { enable = true; + arkenfox = { enable = true; version = "119.0"; }; - profiles.Default.arkenfox = { - enable = true; - "0000".enable = true; + profiles.Default = { + extensions = with inputs.firefox-addons.packages."x86_64-linux"; [ + bitwarden + ublock-origin + darkreader + ]; + + search.engines = { + "Nix Packages" = { + urls = [ + { + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@np"]; + }; + + "Searx" = { + urls = [ + { + template = "https://paulgo.io/search"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + ]; + } + ]; + + iconUpdateURL = "https://paulgo.io/favicon.ico"; + definedAliases = ["@sx"]; + }; + }; + search.force = true; + search.default = "Searx"; + + settings = { + "dom.security.https_only_mode" = true; + "browser.download.panel.shown" = true; + "signon.rememberSignons" = false; + }; + arkenfox = { + enable = true; + "0000".enable = true; + }; }; }; -- 2.45.2 From c2a910524c26ca3d3467eaa504f6321e7e938e18 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:47:58 +0100 Subject: [PATCH 26/44] Add playerctl service --- home/features/desktop/common/default.nix | 1 + home/features/desktop/common/playerctl.nix | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 home/features/desktop/common/playerctl.nix diff --git a/home/features/desktop/common/default.nix b/home/features/desktop/common/default.nix index bbd17ca..df9100d 100644 --- a/home/features/desktop/common/default.nix +++ b/home/features/desktop/common/default.nix @@ -2,5 +2,6 @@ imports = [ ./firefox.nix ./alacritty.nix + ./playerctl.nix ]; } diff --git a/home/features/desktop/common/playerctl.nix b/home/features/desktop/common/playerctl.nix new file mode 100644 index 0000000..97cd5e1 --- /dev/null +++ b/home/features/desktop/common/playerctl.nix @@ -0,0 +1,6 @@ +{pkgs, ...}: { + home.packages = with pkgs; [playerctl]; + services.playerctld = { + enable = true; + }; +} -- 2.45.2 From 744c486e83221ed0d32de3f0f0b415cb94648fb6 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:48:37 +0100 Subject: [PATCH 27/44] Remove btop base16 background color btop wouldnt be transparent otherwise --- home/features/cli/btop.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/home/features/cli/btop.nix b/home/features/cli/btop.nix index 0af1ab6..92f6167 100644 --- a/home/features/cli/btop.nix +++ b/home/features/cli/btop.nix @@ -7,11 +7,12 @@ truecolor = true; vim_keys = true; rounded_corners = true; + proc_gradient = false; }; }; xdg.configFile."btop/themes/nix-colors".text = '' # Main background, empty for terminal default, need to be empty if you want transparent background - theme[main_bg]="#${config.colorScheme.colors.base00}" + # theme[main_bg]="#${config.colorScheme.colors.base00}" # Main text color theme[main_fg]="#${config.colorScheme.colors.base05}" -- 2.45.2 From e27ad55ae9fd86d6765dd2657e3397978b068879 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:49:37 +0100 Subject: [PATCH 28/44] Switch from home-manager steam to system steam couldn't connect to server or sth. like that otherwise --- home/features/games/default.nix | 2 +- hosts/common/optional/gaming/steam.nix | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 hosts/common/optional/gaming/steam.nix diff --git a/home/features/games/default.nix b/home/features/games/default.nix index 7e45005..b4688b5 100644 --- a/home/features/games/default.nix +++ b/home/features/games/default.nix @@ -1,5 +1,5 @@ {pkgs, ...}: { imports = [ - ./steam.nix + # ./steam.nix ]; } diff --git a/hosts/common/optional/gaming/steam.nix b/hosts/common/optional/gaming/steam.nix new file mode 100644 index 0000000..2920e76 --- /dev/null +++ b/hosts/common/optional/gaming/steam.nix @@ -0,0 +1,18 @@ +{pkgs, ...}: { + environment.systemPackages = with pkgs.unstable; [ + heroic # Game Launcher + lutris # Game Launcher + steam # Game Launcher + ]; + + programs = { + steam = { + enable = true; + remotePlay.openFirewall = true; + gamescopeSession.enable = false; + }; + # 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 + }; +} -- 2.45.2 From f5044e4d8daabf8002a393c6d8718b5de4bf7436 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:49:54 +0100 Subject: [PATCH 29/44] Add customization home-manager modules --- modules/home-manager/default.nix | 4 +- modules/home-manager/fonts.nix | 32 +++++++++++++++ modules/home-manager/monitors.nix | 62 ++++++++++++++++++++++++++++++ modules/home-manager/wallpaper.nix | 11 ++++++ 4 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 modules/home-manager/fonts.nix create mode 100644 modules/home-manager/monitors.nix create mode 100644 modules/home-manager/wallpaper.nix diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 45aae31..2c04a15 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -2,5 +2,7 @@ # These should be stuff you would like to share with others, not your personal configurations. { # List your module files here - # my-module = import ./my-module.nix; + fonts = import ./fonts.nix; + monitors = import ./monitors.nix; + wallpaper = import ./wallpaper.nix; } diff --git a/modules/home-manager/fonts.nix b/modules/home-manager/fonts.nix new file mode 100644 index 0000000..db9e088 --- /dev/null +++ b/modules/home-manager/fonts.nix @@ -0,0 +1,32 @@ +{ + lib, + config, + ... +}: let + mkFontOption = kind: { + family = lib.mkOption { + type = lib.types.str; + default = null; + description = "Family name for ${kind} font profile"; + example = "Fira Code"; + }; + package = lib.mkOption { + type = lib.types.package; + default = null; + description = "Package for ${kind} font profile"; + example = "pkgs.fira-code"; + }; + }; + cfg = config.fontProfiles; +in { + options.fontProfiles = { + enable = lib.mkEnableOption "Whether to enable font profiles"; + monospace = mkFontOption "monospace"; + regular = mkFontOption "regular"; + }; + + config = lib.mkIf cfg.enable { + fonts.fontconfig.enable = true; + home.packages = [cfg.monospace.package cfg.regular.package]; + }; +} diff --git a/modules/home-manager/monitors.nix b/modules/home-manager/monitors.nix new file mode 100644 index 0000000..96c1c85 --- /dev/null +++ b/modules/home-manager/monitors.nix @@ -0,0 +1,62 @@ +{ + lib, + config, + ... +}: let + inherit (lib) mkOption types; + cfg = config.monitors; +in { + options.monitors = mkOption { + type = types.listOf (types.submodule { + options = { + name = mkOption { + type = types.str; + example = "DP-1"; + }; + primary = mkOption { + type = types.bool; + default = false; + }; + width = mkOption { + type = types.int; + example = 1920; + }; + height = mkOption { + type = types.int; + example = 1080; + }; + refreshRate = mkOption { + type = types.int; + default = 60; + }; + x = mkOption { + type = types.int; + default = 0; + }; + y = mkOption { + type = types.int; + default = 0; + }; + enabled = mkOption { + type = types.bool; + default = true; + }; + workspace = mkOption { + type = types.nullOr types.str; + default = null; + }; + }; + }); + default = []; + }; + config = { + assertions = [ + { + assertion = + ((lib.length config.monitors) != 0) + -> ((lib.length (lib.filter (m: m.primary) config.monitors)) == 1); + message = "Exactly one monitor must be set to primary."; + } + ]; + }; +} diff --git a/modules/home-manager/wallpaper.nix b/modules/home-manager/wallpaper.nix new file mode 100644 index 0000000..6ca48e0 --- /dev/null +++ b/modules/home-manager/wallpaper.nix @@ -0,0 +1,11 @@ +{lib, ...}: let + inherit (lib) types mkOption; +in { + options.wallpaper = mkOption { + type = types.path; + default = ""; + description = '' + Wallpaper path + ''; + }; +} -- 2.45.2 From b47394fcb68ee09e17a5caf180d77d54a9bcf33d Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:50:11 +0100 Subject: [PATCH 30/44] Add steam system installation --- hosts/adalbert/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts/adalbert/default.nix b/hosts/adalbert/default.nix index fb5594d..327b010 100644 --- a/hosts/adalbert/default.nix +++ b/hosts/adalbert/default.nix @@ -33,6 +33,7 @@ ../common/optional/gnome-keyring.nix ../common/optional/adb.nix ../common/optional/gaming/gamemode.nix + ../common/optional/gaming/steam.nix ../common/optional/gaming/vr.nix ]; -- 2.45.2 From b0d8723793f80b5f91f63b005ad843d544d4dd35 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:51:17 +0100 Subject: [PATCH 31/44] Fix alacritty window config opacity wasn't registeres, because it wasn't inside the window object. added y padding to push prompt a bit downwards --- home/features/desktop/common/alacritty.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/home/features/desktop/common/alacritty.nix b/home/features/desktop/common/alacritty.nix index c90d8f3..5e09cf0 100644 --- a/home/features/desktop/common/alacritty.nix +++ b/home/features/desktop/common/alacritty.nix @@ -5,6 +5,13 @@ }: { programs.alacritty.enable = true; programs.alacritty.settings = { + window = { + opacity = 0.83; + padding = { + x = 0; + y = 5; + }; + }; colors = with config.colorScheme.colors; { bright = { black = "0x${base00}"; -- 2.45.2 From a9f33961aae574cec291eaa61cf28dec6b90d2ef Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 22:51:29 +0100 Subject: [PATCH 32/44] Add neovim installation --- home/features/coding/nvim.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/home/features/coding/nvim.nix b/home/features/coding/nvim.nix index 2a007f5..241bd75 100644 --- a/home/features/coding/nvim.nix +++ b/home/features/coding/nvim.nix @@ -6,6 +6,10 @@ ... }: let in { + programs.neovim = { + enable = true; + }; + home = { file.".config/nvim/lua/custom/" = { source = ../../../rsc/config/nvim; -- 2.45.2 From a6abfb56390ca3c5433b19da7a231f1ee6046a14 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 23:10:10 +0100 Subject: [PATCH 33/44] Remove unused vscode extensions --- home/features/coding/vscode.nix | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/home/features/coding/vscode.nix b/home/features/coding/vscode.nix index 67fea5d..b36582e 100644 --- a/home/features/coding/vscode.nix +++ b/home/features/coding/vscode.nix @@ -28,18 +28,6 @@ in { version = "0.47.2"; sha256 = "1hp6gjh4xp2m1xlm1jsdzxw9d8frkiidhph6nvl24d0h8z34w49g"; } - { - name = "cpptools"; - publisher = "ms-vscode"; - version = "1.19.1"; - sha256 = "sha256-yUZTLnN4nomFp5I0VgRz7rRMkeMU9QzY+dzEdUUASek="; - } - { - name = "camkes-syntax-highlighting"; - publisher = "hensoldt-cyber-gmbh"; - version = "1.1.3"; - sha256 = "sha256-dRhsFGSjR/Vp5aJgMDwCZQtwmmfNXbM85ViTIq5ORwY="; - } ]; userSettings = { #Theming -- 2.45.2 From ec5801ab3677952b273c5006142437394008debd Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 23:10:26 +0100 Subject: [PATCH 34/44] Change vscode catppuccin accentcolor to green --- home/features/coding/vscode.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/features/coding/vscode.nix b/home/features/coding/vscode.nix index b36582e..d705877 100644 --- a/home/features/coding/vscode.nix +++ b/home/features/coding/vscode.nix @@ -32,7 +32,7 @@ in { userSettings = { #Theming "workbench.colorTheme" = "Catppuccin Mocha"; - "catppuccin.accentColor" = "teal"; + "catppuccin.accentColor" = "green"; "workbench.iconTheme" = "material-icon-theme"; "window.menuBarVisibility" = "toggle"; "editor.minimap.autohide" = false; -- 2.45.2 From af735eecad96a2d8bdf329ab40dbbfe8b2636d39 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Wed, 27 Dec 2023 23:25:17 +0100 Subject: [PATCH 35/44] Add more default firefox search engines --- home/features/desktop/common/firefox.nix | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/home/features/desktop/common/firefox.nix b/home/features/desktop/common/firefox.nix index 78f5147..ee1bd36 100644 --- a/home/features/desktop/common/firefox.nix +++ b/home/features/desktop/common/firefox.nix @@ -42,6 +42,23 @@ definedAliases = ["@np"]; }; + "Home Manager" = { + urls = [ + { + template = "https://mipmip.github.io/home-manager-option-search"; + params = [ + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@hm"]; + }; + "Searx" = { urls = [ { @@ -58,6 +75,40 @@ iconUpdateURL = "https://paulgo.io/favicon.ico"; definedAliases = ["@sx"]; }; + + "Amazon" = { + urls = [ + { + template = "https://www.amazon.de/s"; + params = [ + { + name = "k"; + value = "{searchTerms}"; + } + ]; + } + ]; + + iconUpdateURL = "https://amazon.de/favicon.ico"; + definedAliases = ["@a"]; + }; + + "YouTube" = { + urls = [ + { + template = "https://efy.piped.pages.dev/results"; + params = [ + { + name = "search_query"; + value = "{searchTerms}"; + } + ]; + } + ]; + + iconUpdateURL = "https://piped.video/favicon.ico"; + definedAliases = ["yt"]; + }; }; search.force = true; search.default = "Searx"; -- 2.45.2 From 108c7a3378fda381ab0b31982bdc28c60e9260f2 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Thu, 28 Dec 2023 01:20:28 +0100 Subject: [PATCH 36/44] Add lazygit nix-colors integration --- home/features/cli/lazygit.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/home/features/cli/lazygit.nix b/home/features/cli/lazygit.nix index 0d58dae..197631e 100644 --- a/home/features/cli/lazygit.nix +++ b/home/features/cli/lazygit.nix @@ -1,5 +1,21 @@ -{ +{config, ...}: { programs.lazygit = { enable = true; + settings = with config.colorScheme.colors; { + gui = { + theme = { + activeBorderColor = ["#${base0D}" "bold"]; + inactiveBorderColor = ["#${base05}"]; + optionsTextColor = ["#${base0D}"]; + selectedLineBgColor = ["${base02}"]; + selectedRangeBgColor = ["${base02}"]; + cherryPickedCommitBgColor = ["#${base03}"]; + cherryPickedCommitFgColor = ["#${base0D}"]; + unstagedChangesColor = ["#${base08}"]; + defaultFgColor = ["#${base05}"]; + searchingActiveBorderColor = ["#${base0A}"]; + }; + }; + }; }; } -- 2.45.2 From eb9fcf9fea592709edc0a4ffa0e93a5ff0a94958 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Thu, 28 Dec 2023 01:20:56 +0100 Subject: [PATCH 37/44] Add tide activation config & tide nix-colors integration --- home/features/cli/fish.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/home/features/cli/fish.nix b/home/features/cli/fish.nix index 874f9f0..4a627ba 100644 --- a/home/features/cli/fish.nix +++ b/home/features/cli/fish.nix @@ -82,7 +82,31 @@ in { functions = { # Disable greeting fish_greeting = ""; + fish_init_custom = '' + #Variable names: https://github.com/IlanCosman/tide/blob/main/functions/tide/configure/configs/rainbow.fish + #Tide base + tide configure --auto --style=Rainbow --prompt_colors='True color' --show_time=No --rainbow_prompt_separators=Vertical --powerline_prompt_heads=Slanted --powerline_prompt_tails=Flat --powerline_prompt_style='Two lines, frame' --prompt_connection=Solid --powerline_right_prompt_frame=No --prompt_connection_andor_frame_color=Darkest --prompt_spacing=Compact --icons='Many icons' --transient=Yes + + #OS module + set tide_os_bg_color ${config.colorScheme.colors.base07} + + #PWD module + set tide_pwd_bg_color ${config.colorScheme.colors.base0D} + set tide_pwd_color_dirs ${config.colorScheme.colors.base02} + set tide_pwd_color_truncated_dirs ${config.colorScheme.colors.base04} + set tide_pwd_color_anchors ${config.colorScheme.colors.base02} + + #Git module + set tide_git_bg_color ${config.colorScheme.colors.base0B} + set tide_git_bg_color_unstable ${config.colorScheme.colors.base0A} + set tide_git_bg_color_urgent ${config.colorScheme.colors.base08} + ''; }; }; home.packages = with pkgs; [grc fzf nix-your-shell]; + + # Applies tide configure on rebuild + home.activation.configureTide = lib.hm.dag.entryAfter ["writeBoundary"] '' + ${pkgs.fish}/bin/fish -c "fish_init_custom" + ''; } -- 2.45.2 From 1259f0a0325bd29d3320159eb58d3bf11cbc062a Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Thu, 28 Dec 2023 18:15:39 +0100 Subject: [PATCH 38/44] Add custom nvim configuration --- home/features/coding/default.nix | 2 +- home/features/coding/nvim.nix | 34 ---- home/features/coding/nvim/default.nix | 154 ++++++++++++++++++ home/features/coding/nvim/options.lua | 18 ++ home/features/coding/nvim/plugin/alpha.lua | 32 ++++ home/features/coding/nvim/plugin/cmp.lua | 46 ++++++ home/features/coding/nvim/plugin/lsp.lua | 45 +++++ home/features/coding/nvim/plugin/lualine.lua | 10 ++ home/features/coding/nvim/plugin/none-ls.lua | 37 +++++ home/features/coding/nvim/plugin/other.lua | 1 + .../features/coding/nvim/plugin/telescope.lua | 20 +++ home/features/coding/nvim/plugin/todo.lua | 55 +++++++ .../coding/nvim/plugin/treesitter.lua | 9 + 13 files changed, 428 insertions(+), 35 deletions(-) delete mode 100644 home/features/coding/nvim.nix create mode 100644 home/features/coding/nvim/default.nix create mode 100644 home/features/coding/nvim/options.lua create mode 100644 home/features/coding/nvim/plugin/alpha.lua create mode 100644 home/features/coding/nvim/plugin/cmp.lua create mode 100644 home/features/coding/nvim/plugin/lsp.lua create mode 100644 home/features/coding/nvim/plugin/lualine.lua create mode 100644 home/features/coding/nvim/plugin/none-ls.lua create mode 100644 home/features/coding/nvim/plugin/other.lua create mode 100644 home/features/coding/nvim/plugin/telescope.lua create mode 100644 home/features/coding/nvim/plugin/todo.lua create mode 100644 home/features/coding/nvim/plugin/treesitter.lua diff --git a/home/features/coding/default.nix b/home/features/coding/default.nix index f3f814b..83835d9 100644 --- a/home/features/coding/default.nix +++ b/home/features/coding/default.nix @@ -1,6 +1,6 @@ {pkgs, ...}: { imports = [ - ./nvim.nix + ./nvim ./vscode.nix ./intellij.nix ]; diff --git a/home/features/coding/nvim.nix b/home/features/coding/nvim.nix deleted file mode 100644 index 241bd75..0000000 --- a/home/features/coding/nvim.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ - config, - lib, - pkgs, - vars, - ... -}: let -in { - programs.neovim = { - enable = true; - }; - - home = { - file.".config/nvim/lua/custom/" = { - source = ../../../rsc/config/nvim; - recursive = true; - }; - - packages = with pkgs; [ - gcc - black - python310Packages.debugpy # is this working? - mypy - ruff - nodePackages.pyright - clang-tools_16 - rnix-lsp - rust-analyzer - nodePackages.eslint_d - nodePackages.jsonlint - alejandra - ]; - }; -} diff --git a/home/features/coding/nvim/default.nix b/home/features/coding/nvim/default.nix new file mode 100644 index 0000000..6f089d4 --- /dev/null +++ b/home/features/coding/nvim/default.nix @@ -0,0 +1,154 @@ +{ + config, + lib, + pkgs, + # vars, + ... +}: let + vars = import ../../../../vars.nix; + colors = config.colorScheme.colors; +in { + programs.neovim = { + enable = true; + + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + + extraPackages = with pkgs; [ + # LSP + lua-language-server + lua + rnix-lsp # nix + + # Formatters + stylua # lua + black # pyton + alejandra # nix + clang-tools_16 # c/c++ + + # Linters + ruff # python + nodePackages.jsonlint # json + nodePackages.eslint_d # javascript + + # Tools + xclip + wl-clipboard + fzf + gcc + ]; + + plugins = with pkgs.vimPlugins; [ + { + plugin = neodev-nvim; + type = "lua"; + config = '' + require("neodev").setup({ + override = function(root_dir, library) + if root_dir:find("/home/${vars.user + "/" + vars.dir_name}", 1, true) == 1 then + library.enabled = true + library.plugins = true + end + end, + }) + ''; + } + + { + plugin = nvim-lspconfig; + config = builtins.readFile ./plugin/lsp.lua; + type = "lua"; + } + + { + plugin = comment-nvim; + config = "require('Comment').setup()"; + type = "lua"; + } + + nvim-cmp + { + plugin = nvim-cmp; + config = builtins.readFile ./plugin/cmp.lua; + type = "lua"; + } + + { + plugin = telescope-nvim; + config = builtins.readFile ./plugin/telescope.lua; + type = "lua"; + } + + telescope-fzf-native-nvim + telescope-ui-select-nvim + + cmp_luasnip + cmp-nvim-lsp + + luasnip + friendly-snippets + + { + plugin = nvim-treesitter.withAllGrammars; + config = builtins.readFile ./plugin/treesitter.lua; + type = "lua"; + } + + vim-nix + + { + plugin = nvim-base16; + config = '' + require('base16-colorscheme').setup({ + base00 = '#${colors.base00}', base01 = '#${colors.base01}', base02 = '#${colors.base02}', base03 = '#${colors.base03}', + base04 = '#${colors.base04}', base05 = '#${colors.base05}', base06 = '#${colors.base06}', base07 = '#${colors.base07}', + base08 = '#${colors.base08}', base09 = '#${colors.base09}', base0A = '#${colors.base0A}', base0B = '#${colors.base0B}', + base0C = '#${colors.base0C}', base0D = '#${colors.base0D}', base0E = '#${colors.base0E}', base0F = '#${colors.base0F}', + })''; + type = "lua"; + } + + { + plugin = lualine-nvim; + config = builtins.readFile ./plugin/lualine.lua; + type = "lua"; + } + + nvim-web-devicons + plenary-nvim + nui-nvim + { + plugin = neo-tree-nvim; + type = "lua"; + } + + { + plugin = gitsigns-nvim; + config = "require('gitsigns').setup()"; + type = "lua"; + } + + diffview-nvim + lazygit-nvim + + { + plugin = todo-comments-nvim; + config = builtins.readFile ./plugin/todo.lua; + type = "lua"; + } + + { + plugin = alpha-nvim; + config = builtins.readFile ./plugin/alpha.lua; + type = "lua"; + } + + { + plugin = none-ls-nvim; + config = builtins.readFile ./plugin/none-ls.lua; + type = "lua"; + } + ]; + }; +} diff --git a/home/features/coding/nvim/options.lua b/home/features/coding/nvim/options.lua new file mode 100644 index 0000000..eebabfa --- /dev/null +++ b/home/features/coding/nvim/options.lua @@ -0,0 +1,18 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +vim.o.clipboard = "unnamedplus" + +vim.o.number = true +vim.o.relativenumber = true + +vim.o.signcolumn = "yes" + +vim.o.tabstop = 4 +vim.o.shiftwidth = 4 + +vim.o.updatetime = 300 + +vim.o.termguicolors = true + +vim.o.mouse = "a" diff --git a/home/features/coding/nvim/plugin/alpha.lua b/home/features/coding/nvim/plugin/alpha.lua new file mode 100644 index 0000000..2c1b43d --- /dev/null +++ b/home/features/coding/nvim/plugin/alpha.lua @@ -0,0 +1,32 @@ +local dashboard = require("alpha.themes.dashboard") +local function button(sc, txt, keybind, keybind_opts) + local b = dashboard.button(sc, txt, keybind, keybind_opts) + b.opts.hl = "Identifier" + b.opts.hl_shortcut = "Identifier" + return b +end + +dashboard.section.buttons.val = { + button("r", " > Recent files", ":Telescope oldfiles"), + button("n", " > New file", ":ene startinsert "), + button("f", " > Find files", ":Telescope find_files hidden=true"), + button("u", " > Update plugins", ":PackerSync"), + button("q", " > Quit Neovim", ":qa"), +} +dashboard.section.footer.val = require("alpha.fortune") +dashboard.section.header.val = { + [[ ███▄ █ ▓█████ ▒█████ ██▒ █▓ ██▓ ███▄ ▄███▓]], + [[ ██ ▀█ █ ▓█ ▀ ▒██▒ ██▒▓██░ █▒▓██▒▓██▒▀█▀ ██▒]], + [[▓██ ▀█ ██▒▒███ ▒██░ ██▒ ▓██ █▒░▒██▒▓██ ▓██░]], + [[▓██▒ ▐▌██▒▒▓█ ▄ ▒██ ██░ ▒██ █░░░██░▒██ ▒██ ]], + [[▒██░ ▓██░░▒████▒░ ████▓▒░ ▒▀█░ ░██░▒██▒ ░██▒]], + [[░ ▒░ ▒ ▒ ░░ ▒░ ░░ ▒░▒░▒░ ░ ▐░ ░▓ ░ ▒░ ░ ░]], + [[░ ░░ ░ ▒░ ░ ░ ░ ░ ▒ ▒░ ░ ░░ ▒ ░░ ░ ░]], + [[ ░ ░ ░ ░ ░ ░ ░ ▒ ░░ ▒ ░░ ░ ]], + [[ ░ ░ ░ ░ ░ ░ ░ ░ ]], + [[ ░ ]], +} + +dashboard.section.header.opts.hl = "Function" +dashboard.section.footer.opts.hl = "Function" +require("alpha").setup(require("alpha.themes.dashboard").opts) diff --git a/home/features/coding/nvim/plugin/cmp.lua b/home/features/coding/nvim/plugin/cmp.lua new file mode 100644 index 0000000..8a009cc --- /dev/null +++ b/home/features/coding/nvim/plugin/cmp.lua @@ -0,0 +1,46 @@ +local cmp = require("cmp") +local luasnip = require("luasnip") + +require("luasnip.loaders.from_vscode").lazy_load() +luasnip.config.setup({}) + +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete({}), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + }, +}) diff --git a/home/features/coding/nvim/plugin/lsp.lua b/home/features/coding/nvim/plugin/lsp.lua new file mode 100644 index 0000000..9fe3f1a --- /dev/null +++ b/home/features/coding/nvim/plugin/lsp.lua @@ -0,0 +1,45 @@ +local on_attach = function(_, bufnr) + local bufmap = function(keys, func) + vim.keymap.set("n", keys, func, { buffer = bufnr }) + end + + bufmap("r", vim.lsp.buf.rename) + bufmap("a", vim.lsp.buf.code_action) + + bufmap("gd", vim.lsp.buf.definition) + bufmap("gD", vim.lsp.buf.declaration) + bufmap("gI", vim.lsp.buf.implementation) + bufmap("D", vim.lsp.buf.type_definition) + + bufmap("gr", require("telescope.builtin").lsp_references) + bufmap("s", require("telescope.builtin").lsp_document_symbols) + bufmap("S", require("telescope.builtin").lsp_dynamic_workspace_symbols) + + bufmap("K", vim.lsp.buf.hover) + + vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_) + vim.lsp.buf.format() + end, {}) +end + +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) + +require("lspconfig").lua_ls.setup({ + on_attach = on_attach, + capabilities = capabilities, + root_dir = function() + return vim.loop.cwd() + end, + settings = { + Lua = { + workspace = { checkThirdParty = false }, + telemetry = { enable = false }, + }, + }, +}) + +require("lspconfig").rnix.setup({ + on_attach = on_attach, + capabilities = capabilities, +}) diff --git a/home/features/coding/nvim/plugin/lualine.lua b/home/features/coding/nvim/plugin/lualine.lua new file mode 100644 index 0000000..8116074 --- /dev/null +++ b/home/features/coding/nvim/plugin/lualine.lua @@ -0,0 +1,10 @@ +local lualine = require("lualine") + +local config = { + options = { + theme = "base16", + globalstatus = true, + }, +} + +lualine.setup(config) diff --git a/home/features/coding/nvim/plugin/none-ls.lua b/home/features/coding/nvim/plugin/none-ls.lua new file mode 100644 index 0000000..6ae5eb0 --- /dev/null +++ b/home/features/coding/nvim/plugin/none-ls.lua @@ -0,0 +1,37 @@ +local null_ls = require("null-ls") +local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + +local opts = { + sources = { + -- Lua + null_ls.builtins.formatting.stylua, + -- Python + null_ls.builtins.formatting.black, + null_ls.builtins.diagnostics.ruff, + -- Javascript + null_ls.builtins.diagnostics.eslint_d, + null_ls.builtins.diagnostics.jsonlint, + -- C/C++ + null_ls.builtins.formatting.clang_format, + -- Nix + null_ls.builtins.formatting.alejandra, + }, + on_attach = function(client, bufnr) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ + group = augroup, + buffer = bufnr, + }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ bufnr = bufnr }) + end, + }) + end + end, +} + +null_ls.setup(opts) +vim.keymap.set("n", "gf", vim.lsp.buf.format, {}) diff --git a/home/features/coding/nvim/plugin/other.lua b/home/features/coding/nvim/plugin/other.lua new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/home/features/coding/nvim/plugin/other.lua @@ -0,0 +1 @@ + diff --git a/home/features/coding/nvim/plugin/telescope.lua b/home/features/coding/nvim/plugin/telescope.lua new file mode 100644 index 0000000..88d3eba --- /dev/null +++ b/home/features/coding/nvim/plugin/telescope.lua @@ -0,0 +1,20 @@ +require("telescope").setup({ + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + ["ui-select"] = { + require("telescope.themes").get_dropdown({}), + }, + }, + }, +}) + +require("telescope").load_extension("fzf") +require("telescope").load_extension("ui-select") +local builtin = require("telescope.builtin") +vim.keymap.set("n", "", builtin.find_files, {}) +vim.keymap.set("n", "fg", builtin.live_grep, {}) diff --git a/home/features/coding/nvim/plugin/todo.lua b/home/features/coding/nvim/plugin/todo.lua new file mode 100644 index 0000000..bd6863f --- /dev/null +++ b/home/features/coding/nvim/plugin/todo.lua @@ -0,0 +1,55 @@ +require("todo-comments").setup({ + signs = true, + sign_priority = 8, + keywords = { + FIX = { + icon = " ", -- icon used for the sign, and in search results + color = "error", -- can be a hex color, or a named color (see below) + alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords + -- signs = false, -- configure signs for some keywords individually + }, + TODO = { icon = " ", color = "info" }, + HACK = { icon = " ", color = "warning" }, + WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, + PERF = { icon = "󰑮 ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, + NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, + TEST = { icon = "󰤑 ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, + }, + gui_style = { + fg = "NONE", -- The gui style to use for the fg highlight group. + bg = "BOLD", -- The gui style to use for the bg highlight group. + }, + merge_keywords = true, -- when true, custom keywords will be merged with the defaults + highlight = { + multiline = true, -- enable multine todo comments + multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword + multiline_context = 10, -- extra lines that will be re-evaluated when changing a line + before = "", -- "fg" or "bg" or empty + keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg) + after = "fg", -- "fg" or "bg" or empty + pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex) + comments_only = true, -- uses treesitter to match keywords in comments only + max_line_len = 400, -- ignore lines longer than this + exclude = {}, -- list of file types to exclude highlighting + }, + colors = { + error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, + warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, + info = { "DiagnosticInfo", "#2563EB" }, + hint = { "DiagnosticHint", "#10B981" }, + default = { "Identifier", "#7C3AED" }, + test = { "Identifier", "#FF00FF" }, + }, + search = { + command = "rg", + args = { + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + }, + -- pattern = [[\b(KEYWORDS):]], -- ripgrep regex + pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. + }, +}) diff --git a/home/features/coding/nvim/plugin/treesitter.lua b/home/features/coding/nvim/plugin/treesitter.lua new file mode 100644 index 0000000..1a873cf --- /dev/null +++ b/home/features/coding/nvim/plugin/treesitter.lua @@ -0,0 +1,9 @@ +require("nvim-treesitter.configs").setup({ + ensure_installed = {}, + + auto_install = false, + + highlight = { enable = true }, + + indent = { enable = true }, +}) -- 2.45.2 From 48735554596cdef0e752e9e7522427df35f2229e Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Thu, 28 Dec 2023 18:21:32 +0100 Subject: [PATCH 39/44] CLI tool tweaks exchange pfetch with neofetch add tldr command --- home/features/cli/default.nix | 3 ++- home/features/cli/pfetch.nix | 6 ------ 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 home/features/cli/pfetch.nix diff --git a/home/features/cli/default.nix b/home/features/cli/default.nix index e08d647..01eaa05 100644 --- a/home/features/cli/default.nix +++ b/home/features/cli/default.nix @@ -5,7 +5,6 @@ ./fish.nix ./git.nix ./gpg.nix - ./pfetch.nix ./btop.nix ./nix-index.nix ./lazygit.nix @@ -23,6 +22,8 @@ jq # JSON pretty printer and manipulator timer # To help with my ADHD paralysis lazydocker # Docker TUI + neofetch + tldr # nice & short manual snippets nvd # Differ nix-output-monitor diff --git a/home/features/cli/pfetch.nix b/home/features/cli/pfetch.nix deleted file mode 100644 index 391de39..0000000 --- a/home/features/cli/pfetch.nix +++ /dev/null @@ -1,6 +0,0 @@ -{pkgs, ...}: { - home = { - packages = with pkgs; [pfetch]; - sessionVariables.PF_INFO = "ascii title os kernel uptime shell term desktop scheme palette"; - }; -} -- 2.45.2 From 03d2ee28368af88756244d5cbdadbeb3ea22d03c Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Thu, 28 Dec 2023 18:22:05 +0100 Subject: [PATCH 40/44] Add nvim system defaults nvim is now default editor --- home/features/coding/nvim/default.nix | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/home/features/coding/nvim/default.nix b/home/features/coding/nvim/default.nix index 6f089d4..7fb907a 100644 --- a/home/features/coding/nvim/default.nix +++ b/home/features/coding/nvim/default.nix @@ -8,6 +8,8 @@ vars = import ../../../../vars.nix; colors = config.colorScheme.colors; in { + home.sessionVariables.EDITOR = "nvim"; + programs.neovim = { enable = true; @@ -151,4 +153,34 @@ in { } ]; }; + + xdg.desktopEntries = { + nvim = { + name = "Neovim"; + genericName = "Text Editor"; + comment = "Edit text files"; + exec = "nvim %F"; + icon = "nvim"; + mimeType = [ + "text/english" + "text/plain" + "text/x-makefile" + "text/x-c++hdr" + "text/x-c++src" + "text/x-chdr" + "text/x-csrc" + "text/x-java" + "text/x-moc" + "text/x-pascal" + "text/x-tcl" + "text/x-tex" + "application/x-shellscript" + "text/x-c" + "text/x-c++" + ]; + terminal = true; + type = "Application"; + categories = ["Utility" "TextEditor"]; + }; + }; } -- 2.45.2 From 56af3a2118afb681b4f9a173cc8edd91794e9a6a Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Thu, 28 Dec 2023 18:23:28 +0100 Subject: [PATCH 41/44] Clean up fish config add nh alias "nrs" for easy system rebuild remove custom tide prompt colors (they looked ugly) remove vim abbreviations --- home/features/cli/fish.nix | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/home/features/cli/fish.nix b/home/features/cli/fish.nix index 4a627ba..3dacd79 100644 --- a/home/features/cli/fish.nix +++ b/home/features/cli/fish.nix @@ -8,7 +8,6 @@ hasPackage = pname: lib.any (p: p ? pname && p.pname == pname) config.home.packages; hasRipgrep = hasPackage "ripgrep"; hasExa = hasPackage "eza"; - hasNeovim = config.programs.neovim.enable; hasLazygit = config.programs.lazygit.enable; hasLazydocker = hasPackage "lazydocker"; hasNixYourShell = hasPackage "nix-your-shell"; @@ -53,6 +52,7 @@ in { hx = "~/Documents/heliox-cli/target/debug/heliox-cli --mode"; slp = "systemctl suspend"; sdn = "shutdown 0"; + nrs = "nh os switch ~/.setup"; }; shellAbbrs = rec { jqless = "jq -C | less -r"; @@ -65,41 +65,14 @@ in { nbn = "nix build nixpkgs#"; nf = "nix flake"; - nr = "nixos-rebuild --flake ."; - nrs = "nixos-rebuild --flake . switch"; - snr = "sudo nixos-rebuild --flake ."; - snrs = "sudo nixos-rebuild --flake . switch"; - hm = "home-manager --flake ."; - hms = "home-manager --flake . switch"; - ls = mkIf hasExa "eza"; exa = mkIf hasExa "eza"; - - vim = mkIf hasNeovim "nvim"; - vi = vim; - v = vim; }; functions = { # Disable greeting fish_greeting = ""; fish_init_custom = '' - #Variable names: https://github.com/IlanCosman/tide/blob/main/functions/tide/configure/configs/rainbow.fish - #Tide base tide configure --auto --style=Rainbow --prompt_colors='True color' --show_time=No --rainbow_prompt_separators=Vertical --powerline_prompt_heads=Slanted --powerline_prompt_tails=Flat --powerline_prompt_style='Two lines, frame' --prompt_connection=Solid --powerline_right_prompt_frame=No --prompt_connection_andor_frame_color=Darkest --prompt_spacing=Compact --icons='Many icons' --transient=Yes - - #OS module - set tide_os_bg_color ${config.colorScheme.colors.base07} - - #PWD module - set tide_pwd_bg_color ${config.colorScheme.colors.base0D} - set tide_pwd_color_dirs ${config.colorScheme.colors.base02} - set tide_pwd_color_truncated_dirs ${config.colorScheme.colors.base04} - set tide_pwd_color_anchors ${config.colorScheme.colors.base02} - - #Git module - set tide_git_bg_color ${config.colorScheme.colors.base0B} - set tide_git_bg_color_unstable ${config.colorScheme.colors.base0A} - set tide_git_bg_color_urgent ${config.colorScheme.colors.base08} ''; }; }; -- 2.45.2 From cdc88dd4ee8775fbbde00821a20fe14d40b00f91 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Thu, 28 Dec 2023 18:23:56 +0100 Subject: [PATCH 42/44] Set default font --- home/features/desktop/common/alacritty.nix | 14 ++++++++++++++ home/features/desktop/common/default.nix | 1 + home/features/desktop/common/font.nix | 13 +++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 home/features/desktop/common/font.nix diff --git a/home/features/desktop/common/alacritty.nix b/home/features/desktop/common/alacritty.nix index 5e09cf0..6b1566f 100644 --- a/home/features/desktop/common/alacritty.nix +++ b/home/features/desktop/common/alacritty.nix @@ -12,6 +12,20 @@ y = 5; }; }; + font = { + normal = { + family = "${config.fontProfiles.monospace.family}"; + style = "Medium"; + }; + bold = { + family = "${config.fontProfiles.monospace.family}"; + style = "Bold"; + }; + italic = { + family = "${config.fontProfiles.monospace.family}"; + style = "MediumItalic"; + }; + }; colors = with config.colorScheme.colors; { bright = { black = "0x${base00}"; diff --git a/home/features/desktop/common/default.nix b/home/features/desktop/common/default.nix index df9100d..ac725e3 100644 --- a/home/features/desktop/common/default.nix +++ b/home/features/desktop/common/default.nix @@ -2,6 +2,7 @@ imports = [ ./firefox.nix ./alacritty.nix + ./font.nix ./playerctl.nix ]; } diff --git a/home/features/desktop/common/font.nix b/home/features/desktop/common/font.nix new file mode 100644 index 0000000..89d0f87 --- /dev/null +++ b/home/features/desktop/common/font.nix @@ -0,0 +1,13 @@ +{pkgs, ...}: { + fontProfiles = { + enable = true; + monospace = { + family = "JetBrains Mono Nerd Font"; + package = pkgs.nerdfonts.override {fonts = ["JetBrainsMono"];}; + }; + regular = { + family = "Fira Sans"; + package = pkgs.fira; + }; + }; +} -- 2.45.2 From 0b7e8328f513b007dc13b9dc08eb90e1fc85e175 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Thu, 28 Dec 2023 18:24:23 +0100 Subject: [PATCH 43/44] Add new global variable --- vars.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/vars.nix b/vars.nix index e9bf3b5..82bb689 100644 --- a/vars.nix +++ b/vars.nix @@ -1,5 +1,6 @@ { # Global variables used in NixOS and HomeManager which will probably never change user = "ghoscht"; + dir_name = ".setup"; location = "$HOME/.setup"; } -- 2.45.2 From bbe8d280c176c703da8cc18b9d7691989579033d Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Thu, 28 Dec 2023 18:24:36 +0100 Subject: [PATCH 44/44] Tweak some firefox settings --- home/features/desktop/common/firefox.nix | 50 +++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/home/features/desktop/common/firefox.nix b/home/features/desktop/common/firefox.nix index ee1bd36..0b7a146 100644 --- a/home/features/desktop/common/firefox.nix +++ b/home/features/desktop/common/firefox.nix @@ -18,6 +18,8 @@ bitwarden ublock-origin darkreader + tabliss + consent-o-matic ]; search.engines = { @@ -117,10 +119,56 @@ "dom.security.https_only_mode" = true; "browser.download.panel.shown" = true; "signon.rememberSignons" = false; + "browser.formfill.enable" = false; + "signon. prefillForms" = false; + "browser.shell.checkDefaultBrowser" = false; + "browser.newtabpage.activity-stream.showSponsoredTopSites" = false; + "browser.uiCustomization.state" = ''{"placements":{"widget-overflow-fixed-list":[],"unified-extensions-area":["addon_darkreader_org-browser-action","plasma-browser-integration_kde_org-browser-action","_506e023c-7f2b-40a3-8066-bc5deb40aebe_-browser-action","_testpilot-containers-browser-action","7esoorv3_alefvanoon_anonaddy_me-browser-action","_a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7_-browser-action","gdpr_cavi_au_dk-browser-action","firefoxcolor_mozilla_com-browser-action","firefox-translations-addon_mozilla_org-browser-action"],"nav-bar":["back-button","forward-button","stop-reload-button","urlbar-container","downloads-button","unified-extensions-button","ublock0_raymondhill_net-browser-action","_446900e4-71c2-419f-a6a7-df9c091e268b_-browser-action"],"toolbar-menubar":["menubar-items"],"TabsToolbar":["tabbrowser-tabs","new-tab-button","alltabs-button"],"PersonalToolbar":["personal-bookmarks"]},"seen":["save-to-pocket-button","developer-button","_446900e4-71c2-419f-a6a7-df9c091e268b_-browser-action","addon_darkreader_org-browser-action","ublock0_raymondhill_net-browser-action","plasma-browser-integration_kde_org-browser-action","_506e023c-7f2b-40a3-8066-bc5deb40aebe_-browser-action","_testpilot-containers-browser-action","7esoorv3_alefvanoon_anonaddy_me-browser-action","_a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7_-browser-action","gdpr_cavi_au_dk-browser-action","firefoxcolor_mozilla_com-browser-action","firefox-translations-addon_mozilla_org-browser-action"],"dirtyAreaCache":["nav-bar","PersonalToolbar","toolbar-menubar","TabsToolbar","unified-extensions-area"],"currentVersion":20,"newElementCount":4}''; }; arkenfox = { enable = true; - "0000".enable = true; + "0000".enable = true; + "0100" = { + enable = true; + # Allow setting homepage + "0102"."browser.startup.page".value = 1; + }; + "0200" = { + enable = true; + }; + "0300".enable = true; + # We keep safebrowsing + "0400".enable = false; + "0600" = { + enable = true; + "0610"."browser.send_pings".enable = true; + }; + "0700" = { + enable = true; + # Disable DNS over HTTPS + "0710"."network.trr.mode".value = 5; + }; + # "0800" = { + # enable = true; + # # Keep using url bar as search bar + # "0801"."keyword.enabled".value = true; + # }; + "0900".enable = true; + "1000" = { + enable = true; + # Enable disk cache for performance reasons + "1001"."browser.cache.disk.enable".enable = true; + "1001"."browser.cache.disk.enable".value = true; + }; + "1200".enable = true; + # I don't use container tabs + "1700".enable = false; + "2600" = { + enable = true; + # The recent documents feature is useful + "2653".enable = false; + }; + "2700".enable = true; }; }; }; -- 2.45.2