From a6786f8eb1934ed5aa490b77512ee50012d34a2b Mon Sep 17 00:00:00 2001 From: Liam Malone Date: Thu, 14 Mar 2024 21:45:05 +0000 Subject: [PATCH] initial commit --- flake.lock | 270 +++++++++++++++++++ flake.nix | 36 +++ hosts/default/configuration.nix | 138 ++++++++++ hosts/default/hardware-configuration.nix | 43 +++ hosts/default/home.nix | 136 ++++++++++ hosts/gaming/configuration.nix | 139 ++++++++++ hosts/gaming/hardware-configuration.nix | 43 +++ hosts/gaming/home.nix | 142 ++++++++++ hosts/gaming/main-user.nix | 27 ++ modules/home-manager/hyprland.nix | 187 +++++++++++++ modules/home-manager/terminals/alacritty.nix | 0 modules/home-manager/terminals/default.nix | 0 modules/home-manager/terminals/kitty.nix | 0 modules/nvidia.nix | 0 14 files changed, 1161 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hosts/default/configuration.nix create mode 100644 hosts/default/hardware-configuration.nix create mode 100644 hosts/default/home.nix create mode 100644 hosts/gaming/configuration.nix create mode 100644 hosts/gaming/hardware-configuration.nix create mode 100644 hosts/gaming/home.nix create mode 100644 hosts/gaming/main-user.nix create mode 100644 modules/home-manager/hyprland.nix create mode 100644 modules/home-manager/terminals/alacritty.nix create mode 100644 modules/home-manager/terminals/default.nix create mode 100644 modules/home-manager/terminals/kitty.nix create mode 100644 modules/nvidia.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ead0217 --- /dev/null +++ b/flake.lock @@ -0,0 +1,270 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1710336510, + "narHash": "sha256-mT/Z1AseVhhiFooCu2J7wudx+FivkRrlRBW0iBC2V/o=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "383296ffa45b539c28bf79ec2a272f652838ddd1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "hyprcursor": { + "inputs": { + "hyprlang": "hyprlang", + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1710091028, + "narHash": "sha256-yFk2kc8J2kVh0RWlwT+PQf0bpfUNcROOcRYcyQJbpk4=", + "owner": "hyprwm", + "repo": "hyprcursor", + "rev": "05db7dfd7fc261e0195e54f8a6d655d4f370e70f", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprcursor": "hyprcursor", + "hyprland-protocols": "hyprland-protocols", + "hyprlang": "hyprlang_2", + "nixpkgs": "nixpkgs", + "systems": "systems_2", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1710344304, + "narHash": "sha256-jE+/UGqRYkKBBpLTTV5ayCtVmD9N1WsSKpufszUPzcA=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "3e67ee0f5f66c74c0a0bd4f797361fd100c2e2d2", + "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" + } + }, + "hyprlang": { + "inputs": { + "nixpkgs": [ + "hyprland", + "hyprcursor", + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1709914708, + "narHash": "sha256-bR4o3mynoTa1Wi4ZTjbnsZ6iqVcPGriXp56bZh5UFTk=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "a685493fdbeec01ca8ccdf1f3655c044a8ce2fe2", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprlang_2": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1709914708, + "narHash": "sha256-bR4o3mynoTa1Wi4ZTjbnsZ6iqVcPGriXp56bZh5UFTk=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "a685493fdbeec01ca8ccdf1f3655c044a8ce2fe2", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1709961763, + "narHash": "sha256-6H95HGJHhEZtyYA3rIQpvamMKAGoa8Yh2rFV29QnuGw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3030f185ba6a4bf4f18b87f345f104e6a6961f34", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1710272261, + "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "hyprland": "hyprland", + "nixpkgs": "nixpkgs_2" + } + }, + "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" + } + }, + "systems_2": { + "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": 1709983277, + "narHash": "sha256-wXWIJLd4F2JZeMaihWVDW/yYXCLEC8OpeNJZg9a9ly8=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "50eae512d9cecbf0b3b1898bb1f0b40fa05fe19b", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "50eae512d9cecbf0b3b1898bb1f0b40fa05fe19b", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1709299639, + "narHash": "sha256-jYqJM5khksLIbqSxCLUUcqEgI+O2LdlSlcMEBs39CAU=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "2d2fb547178ec025da643db57d40a971507b82fe", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..9106b10 --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + description = "Nixos config flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + hyprland.url = "github:hyprwm/Hyprland"; + }; + + outputs = { self, nixpkgs, ... }@inputs: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in + { + nixosConfigurations = { + default = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + ./hosts/default/configuration.nix + ]; + }; + gamemachine = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + ./hosts/gamemachine/configuration.nix + ./modules/nvidia.nix + ]; + }; + }; + }; +} diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix new file mode 100644 index 0000000..dd5a975 --- /dev/null +++ b/hosts/default/configuration.nix @@ -0,0 +1,138 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ config, lib, pkgs, inputs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # networking.hostName = "nixos"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + # Set your time zone. + time.timeZone = "Europe/Dublin"; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkb.options in tty. + # }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + services.xserver.displayManager.sddm.enable = true; + services.xserver.windowManager.i3.enable = true; + + # services.xserver.xkb.options = "eurosign:e,caps:escape"; + services.xserver = { + xkb = { + layout = "us"; + variant = ""; + }; + }; + hardware.bluetooth.enable = true; + + # Configure keymap in X11 + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + # users.users.alice = { + # isNormalUser = true; + # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + # packages = with pkgs; [ + # firefox + # tree + # ]; + # }; + nix.settings.trusted-users = [ "root" "@wheel" ]; + + users.users.liamm = { + isNormalUser = true; + description = "liamm"; + extraGroups = [ "networkmanager" "wheel" ]; # Enable ‘sudo’ for the user. + }; + + home-manager = { + extraSpecialArgs = { inherit inputs; }; + users = { + "liamm" = import ./home.nix; + }; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + alacritty + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + networking.firewall.enable = false; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; + + # This option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "23.11"; # Did you read the comment? + +} diff --git a/hosts/default/hardware-configuration.nix b/hosts/default/hardware-configuration.nix new file mode 100644 index 0000000..fddc4d1 --- /dev/null +++ b/hosts/default/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 + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/5c0b32f9-9711-4483-9717-842706d4f901"; + fsType = "ext4"; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/3a477a6e-f720-414b-ac19-16dadfb01d93"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/FE97-DFFD"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/cf76c3c2-7f63-4bd9-9480-4e935f60cf24"; } + ]; + + # 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.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/hosts/default/home.nix b/hosts/default/home.nix new file mode 100644 index 0000000..a6ff816 --- /dev/null +++ b/hosts/default/home.nix @@ -0,0 +1,136 @@ +{ config, pkgs, ... }: + +{ + home.username = "liamm"; + home.homeDirectory = "/home/liamm"; + + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "23.11"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = [ + pkgs.htop + pkgs.firefox + pkgs.thunderbird + pkgs.neofetch + pkgs.tree + pkgs.cmake + pkgs.gcc + pkgs.libtool + (pkgs.nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; }) + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + }; + + home.sessionVariables = { + EDITOR = "emacs"; + GIT_EDITOR = "nvim"; + NIX_SHELL_PRESERVE_PROMPT = 1; + }; + + nix.settings.extra-trusted-substituters = [ + "https://ghostty.cachix.org" + ]; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + # ENV/APPEARANCE SETTINGS + + fonts.fontconfig = { + enable = true; + }; + + # BEGIN PROGRAMS + + programs.bash = { + enable = true; + enableCompletion = true; + enableVteIntegration = true; + initExtra ='' + export PS1='\[\e[1;m\e[1;33m\e[1;m\] \W\[\e[m\e[m\] 🐧 \[\e[1;32m\]~> \[\e[m\e[m\]' + set -o vi + ''; + shellAliases = { + ls = "ls --color=auto"; + ll = "ls -l"; + la = "ls -lA"; + ping = "ping -c 5"; + kpx = "keepassxc-cli open"; + nixbuild = "sudo nixos-rebuild switch --flake"; + nixtest = "sudo nixos-rebuild test --flake"; + vi = "\vim"; + emacsd = "emacs --daemon"; + emacsc = "emacsclient -c -a 'emacs'"; + new = "source $HOME/.bashrc"; + newbar = "pkill waybar; waybar &disown"; + ".." = "cd .."; + set-github-var = "export GITHUB=$(sed -n 2p ~/documents/.git_keys)"; + set-gitlab-var = "export GITLAB=$(sed -n 4p ~/documents/.git_keys)"; + }; + }; + programs.emacs = { + enable = true; + # extraPackages = epkgs: [ + # epkgs.nix-mode + # epkgs.magit + # ]; + }; + programs.git = { + enable = true; + diff-so-fancy.enable = true; + userEmail = "maloneliam@proton.me"; + userName = "Liam Malone"; + }; + programs.neovim = { + enable = true; + package = pkgs.neovim-unwrapped; + vimAlias = true; + vimdiffAlias = true; + }; + + + # BEGIN SERVICES + + services.emacs = { + enable = true; + client = { + enable = true; + arguments = [ + "-c" + "-a emacs" + ]; + }; + startWithUserSession = true; + }; + + services.flameshot = { + enable = true; + settings = { + General = { + disabledTrayIcon = true; + showStartupLaunchMessage = false; + }; + }; + }; + + services.gpg-agent = { + enable = true; + defaultCacheTtl = 1800; + enableSshSupport = true; + }; + + #services.nexcloud-client.enable = true; +} diff --git a/hosts/gaming/configuration.nix b/hosts/gaming/configuration.nix new file mode 100644 index 0000000..24d34d7 --- /dev/null +++ b/hosts/gaming/configuration.nix @@ -0,0 +1,139 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ config, lib, pkgs, inputs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # networking.hostName = "nixos"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + # Set your time zone. + time.timeZone = "Europe/Dublin"; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkb.options in tty. + # }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + services.xserver.displayManager.sddm.enable = true; + services.xserver.windowManager.i3.enable = true; + + # services.xserver.xkb.options = "eurosign:e,caps:escape"; + services.xserver = { + xkb = { + layout = "us"; + variant = ""; + }; + }; + hardware.bluetooth.enable = true; + + # Configure keymap in X11 + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + # users.users.alice = { + # isNormalUser = true; + # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + # packages = with pkgs; [ + # firefox + # tree + # ]; + # }; + users.users.liamm = { + isNormalUser = true; + description = "liamm"; + extraGroups = [ "networkmanager" "wheel" ]; # Enable ‘sudo’ for the user. + }; + + home-manager = { + extraSpecialArgs = { inherit inputs; }; + users = { + "liamm" = import ./home.nix; + }; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + alacritty + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + networking.firewall.enable = false; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; + + # This option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "23.11"; # Did you read the comment? + +} + diff --git a/hosts/gaming/hardware-configuration.nix b/hosts/gaming/hardware-configuration.nix new file mode 100644 index 0000000..fddc4d1 --- /dev/null +++ b/hosts/gaming/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 + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/5c0b32f9-9711-4483-9717-842706d4f901"; + fsType = "ext4"; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/3a477a6e-f720-414b-ac19-16dadfb01d93"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/FE97-DFFD"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/cf76c3c2-7f63-4bd9-9480-4e935f60cf24"; } + ]; + + # 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.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/hosts/gaming/home.nix b/hosts/gaming/home.nix new file mode 100644 index 0000000..78d39a4 --- /dev/null +++ b/hosts/gaming/home.nix @@ -0,0 +1,142 @@ +{ config, pkgs, ... }: + +{ + home.username = "liamm"; + home.homeDirectory = "/home/liamm"; + + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "23.11"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = [ + pkgs.htop + pkgs.firefox + pkgs.git + pkgs.thunderbird + pkgs.neofetch + pkgs.tree + pkgs.cmake + pkgs.gnumake + pkgs.clang + pkgs.libtool + (pkgs.nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; }) + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + }; + + home.sessionVariables = { + EDITOR = "emacs"; + GIT_EDITOR = "nvim"; + NIX_SHELL_PRESERVE_PROMPT = 1; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + # ENV/APPEARANCE SETTINGS + + fonts.fontconfig = { + enable = true; + }; + + # BEGIN PROGRAMS + + programs.bash = { + enable = true; + enableCompletion = true; + enableVteIntegration = true; + initExtra ='' + export PS1='\[\e[1;m\e[1;33m\e[1;m\] \W\[\e[m\e[m\] 🐧 \[\e[1;32m\]~> \[\e[m\e[m\]' + set -o vi + ''; + shellAliases = { + ls = "ls --color=auto"; + ll = "ls -l"; + la = "ls -lA"; + ping = "ping -c 5"; + kpx = "keepassxc-cli open"; + nixbuild = "sudo nixos-rebuild switch --flake"; + nixtest = "sudo nixos-rebuild test --flake"; + vi = "\vim"; + emacsd = "emacs --daemon"; + emacsc = "emacsclient -c -a 'emacs'"; + neofetch = "neofetch --ascii_distro nixos_small"; + new = "source $HOME/.bashrc"; + newbar = "pkill waybar; waybar &disown"; + ".." = "cd .."; + set-github-var = "export GITHUB=$(sed -n 2p ~/documents/.git_keys)"; + set-gitlab-var = "export GITLAB=$(sed -n 4p ~/documents/.git_keys)"; + }; + }; + programs.emacs = { + enable = true; + # extraPackages = epkgs: [ + # epkgs.nix-mode + # epkgs.magit + # ]; + }; + programs.neovim = { + enable = true; + package = pkgs.neovim-unwrapped; + vimAlias = true; + vimdiffAlias = true; + }; + + + # BEGIN SERVICES + + services.emacs = { + enable = true; + client = { + enable = true; + arguments = [ + "-c" + "-a emacs" + ]; + }; + startWithUserSession = true; + }; + + services.flameshot = { + enable = true; + settings = { + General = { + disabledTrayIcon = true; + showStartupLaunchMessage = false; + }; + }; + }; + + services.gpg-agent = { + enable = true; + defaultCacheTtl = 1800; + enableSshSupport = true; + }; + + #services.nexcloud-client.enable = true; + +} diff --git a/hosts/gaming/main-user.nix b/hosts/gaming/main-user.nix new file mode 100644 index 0000000..254949c --- /dev/null +++ b/hosts/gaming/main-user.nix @@ -0,0 +1,27 @@ +# main-user.nix +{ lib, config, pkgs, ... }: + +let + cfg = config.main-user; +in +{ + options.main-user = { + enable + = lib.mkEnableOption "enable user module"; + userName = lib.mkOption { + default = "mainuser"; + description = '' + username + ''; + }; + }; + + config = lib.mkIf cfg.enable { + users.users.${config.main-user.userName} = { + isNormalUser = true; + initialPasswork = "p4ss"; + description = "main user"; + shell = pkgs.bash; + }; + }; +} diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix new file mode 100644 index 0000000..c36a4e8 --- /dev/null +++ b/modules/home-manager/hyprland.nix @@ -0,0 +1,187 @@ +{ + config, + lib, + pkgs, + osConfig, + ... +}: +{ + home.packages = with pkgs; [ hyprpicker ]; + wayland.windowManager.hyprland = { + enable = true; + # plugins = []; + systemd = { + enable = true; + # extraCommands = []; + # variables = ["-all"]; + }; + settings = { + monitor = [ + (lib.mkIf (osConfig.networking.hostName == "nixlaptop") "eDP-1,1920x1080@60,0x0,1") + (lib.mkIf (osConfig.networking.hostName == "nixgamer") "DP-1,2560x1440@144,1920x0,1") + ",preferred,auto,1" + ]; + # Trays and similar are systemd service bound to graphical-session.target + exec-once = [ "hyprctl setcursor ${config.gtk.cursorTheme.name} 24" ]; + env = [ "XCURSOR_SIZE,24" ]; + input = { + kb_layout = "ie"; + kb_variant = ""; + kb_model = "pc104"; + kb_options = ""; + kb_rules = ""; + + follow_mouse = 1; + + touchpad = { + natural_scroll = true; + }; + + sensitivity = 0; # -1.0 - 1.0, 0 means no modification. + }; + general = { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + gaps_in = config.variables.gaps.inner.int; + gaps_out = config.variables.gaps.outer.int; + border_size = config.variables.border.width.wide.int; + "col.active_border" = "rgb(${config.colorScheme.palette.base09})"; + # "col.active_border" = "rgb(${config.colorScheme.palette.base09}) rgb(${config.colorScheme.palette.base06}) 45deg"; + "col.inactive_border" = "rgb(${config.colorScheme.palette.base00})"; + layout = "dwindle"; + }; + + misc = { + # Get rid of anime girl jumpscare + disable_hyprland_logo = true; + disable_splash_rendering = true; + mouse_move_enables_dpms = true; + key_press_enables_dpms = true; + }; + + decoration = { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + rounding = config.variables.border.radius.int; + blur = { + enabled = true; + size = 3; + passes = 1; + }; + + drop_shadow = true; + shadow_range = 4; + shadow_render_power = 3; + "col.shadow" = "rgb(${config.colorScheme.palette.base00})"; + }; + + animations = { + enabled = true; + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + master = { + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + new_is_master = true; + }; + + gestures = { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = true; + }; + + # Example windowrule v1 + # windowrule = float, ^(kitty)$ + # Example windowrule v2 + # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ + # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more + + # See https://wiki.hyprland.org/Configuring/Keywords/ for more + "$mainMod" = "SUPER"; + + bind = + let + scriptDir = ./scripts; + in + [ + ",XF86MonBrightnessUp , exec, ${scriptDir}/brightness.sh increase" + ",XF86MonBrightnessDown, exec, ${scriptDir}/brightness.sh decrease" + ",XF86AudioRaiseVolume , exec, ${scriptDir}/volume.sh increase" + ",XF86AudioLowerVolume , exec, ${scriptDir}/volume.sh decrease" + ",XF86AudioMute , exec, ${scriptDir}/volume.sh toggle" + ",XF86AudioMicMute , exec, ${scriptDir}/mic.sh toggle" + ",Caps_Lock , exec, ${scriptDir}/capsLock.sh" + + "$mainMod, t, exec, wezterm" + "$mainMod, Space, exec, anyrun" + "$mainMod, p, exec, ${scriptDir}/screencap.sh" + "$mainMod, w, exec, ${scriptDir}/win-vm.sh" + "$mainMod, i, exec, ${scriptDir}/sleep-toggle.sh" + "$mainMod, r, exec, ${pkgs.ironbar}/bin/ironbar reload" + "$mainMod, b, exec, flatpak run org.mozilla.firefox" + "$mainMod, e, exec, flatpak run org.mozilla.Thunderbird" + "$mainMod, l, exec, swaylock" + "$mainMod, c, killactive," + "$mainMod, m, exit," + "$mainMod, v, togglefloating," + "$mainMod, f, fullscreen, # fullscreen" + "$mainMod, s, togglesplit, # dwindle" + + "$mainMod, left, movefocus, l" + "$mainMod, right, movefocus, r" + "$mainMod, up, movefocus, u" + "$mainMod, down, movefocus, d" + + "$mainMod, h, movefocus, l" + "$mainMod, l, movefocus, r" + "$mainMod, k, movefocus, u" + "$mainMod, j, movefocus, d" + + "$mainMod, 1, workspace, 1" + "$mainMod, 2, workspace, 2" + "$mainMod, 3, workspace, 3" + "$mainMod, 4, workspace, 4" + "$mainMod, 5, workspace, 5" + "$mainMod, 6, workspace, 6" + "$mainMod, 7, workspace, 7" + "$mainMod, 8, workspace, 8" + "$mainMod, 9, workspace, 9" + "$mainMod, 0, workspace, 10" + + "$mainMod SHIFT, 1, movetoworkspace, 1" + "$mainMod SHIFT, 2, movetoworkspace, 2" + "$mainMod SHIFT, 3, movetoworkspace, 3" + "$mainMod SHIFT, 4, movetoworkspace, 4" + "$mainMod SHIFT, 5, movetoworkspace, 5" + "$mainMod SHIFT, 6, movetoworkspace, 6" + "$mainMod SHIFT, 7, movetoworkspace, 7" + "$mainMod SHIFT, 8, movetoworkspace, 8" + "$mainMod SHIFT, 9, movetoworkspace, 9" + + # Scroll through existing workspaces with mainMod + scroll + "$mainMod, mouse_down, workspace, e+1" + "$mainMod, mouse_up, workspace, e-1" + ]; + + # Move/resize windows with mainMod + LMB/RMB and dragging + bindm = [ + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + + # Helps ensure that workspace 1 is always on main monitor for each pc + }; + xwayland.enable = true; + }; +} diff --git a/modules/home-manager/terminals/alacritty.nix b/modules/home-manager/terminals/alacritty.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/home-manager/terminals/default.nix b/modules/home-manager/terminals/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/home-manager/terminals/kitty.nix b/modules/home-manager/terminals/kitty.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/nvidia.nix b/modules/nvidia.nix new file mode 100644 index 0000000..e69de29