From f3b5d329420a9b4dbcda02cd8d27653bc9e1738f Mon Sep 17 00:00:00 2001 From: luxzi Date: Wed, 24 Jul 2024 19:51:43 -0400 Subject: [PATCH] base: add existing config --- LICENSE | 19 +++++++++++ README.md | 3 ++ flake.lock | 48 +++++++++++++++++++++++++++ flake.nix | 28 ++++++++++++++++ home-manager/home.nix | 14 ++++++++ home-manager/packages/git.nix | 19 +++++++++++ home-manager/packages/packages.nix | 20 +++++++++++ home-manager/packages/zsh.nix | 26 +++++++++++++++ nixos/configuration.nix | 25 ++++++++++++++ nixos/environments/plasma-wayland.nix | 14 ++++++++ nixos/hardware/audio.nix | 5 +++ nixos/hardware/fstab.nix | 14 ++++++++ nixos/hardware/hardware.nix | 13 ++++++++ nixos/hardware/intel.nix | 6 ++++ nixos/hardware/modules.nix | 13 ++++++++ nixos/hardware/network.nix | 5 +++ nixos/hardware/nvidia.nix | 13 ++++++++ nixos/misc/locale.nix | 5 +++ nixos/misc/misc.nix | 10 ++++++ nixos/misc/nixconfig.nix | 6 ++++ nixos/misc/time.nix | 5 +++ nixos/programs/dconf.nix | 5 +++ nixos/programs/gpg.nix | 8 +++++ nixos/programs/nix-ld.nix | 8 +++++ nixos/programs/programs.nix | 29 ++++++++++++++++ nixos/programs/steam.nix | 5 +++ nixos/services/boot.nix | 9 +++++ nixos/services/cups.nix | 5 +++ nixos/services/firewall.nix | 7 ++++ nixos/services/libinput.nix | 5 +++ nixos/services/networkmanager.nix | 6 ++++ nixos/services/pipewire.nix | 11 ++++++ nixos/services/services.nix | 13 ++++++++ nixos/users/luxzi.nix | 15 +++++++++ 34 files changed, 437 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 home-manager/home.nix create mode 100644 home-manager/packages/git.nix create mode 100644 home-manager/packages/packages.nix create mode 100644 home-manager/packages/zsh.nix create mode 100644 nixos/configuration.nix create mode 100644 nixos/environments/plasma-wayland.nix create mode 100644 nixos/hardware/audio.nix create mode 100644 nixos/hardware/fstab.nix create mode 100644 nixos/hardware/hardware.nix create mode 100644 nixos/hardware/intel.nix create mode 100644 nixos/hardware/modules.nix create mode 100644 nixos/hardware/network.nix create mode 100644 nixos/hardware/nvidia.nix create mode 100644 nixos/misc/locale.nix create mode 100644 nixos/misc/misc.nix create mode 100644 nixos/misc/nixconfig.nix create mode 100644 nixos/misc/time.nix create mode 100644 nixos/programs/dconf.nix create mode 100644 nixos/programs/gpg.nix create mode 100644 nixos/programs/nix-ld.nix create mode 100644 nixos/programs/programs.nix create mode 100644 nixos/programs/steam.nix create mode 100644 nixos/services/boot.nix create mode 100644 nixos/services/cups.nix create mode 100644 nixos/services/firewall.nix create mode 100644 nixos/services/libinput.nix create mode 100644 nixos/services/networkmanager.nix create mode 100644 nixos/services/pipewire.nix create mode 100644 nixos/services/services.nix create mode 100644 nixos/users/luxzi.nix diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..93972a0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2024 Luxzi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3f1492b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# NixOS configuration files + +Configured for KDE Plasma Wayland on Nvidia. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..7deb4a9 --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1721804110, + "narHash": "sha256-i4jINRazBKPqlaS+qhlP+kV/UHEq3vs5itfpblqu4ZM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "af70fc502a15d7e1e4c5a4c4fc8e06c2ec561e0c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1721562059, + "narHash": "sha256-Tybxt65eyOARf285hMHIJ2uul8SULjFZbT9ZaEeUnP8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "68c9ed8bbed9dfce253cc91560bf9043297ef2fe", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c55fea8 --- /dev/null +++ b/flake.nix @@ -0,0 +1,28 @@ +{ + description = "Luxzi's NixOS system configuration"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, nixpkgs, home-manager, ... }: + let + lib = nixpkgs.lib; + pkgs = nixpkgs.legacyPackages."x86_64-linux"; + in { + nixosConfigurations = { + nixos = lib.nixosSystem { + specialArgs = { inherit self; }; + modules = [ ./nixos/configuration.nix ]; + }; + }; + homeConfigurations = { + luxzi = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ ./home-manager/home.nix ]; + }; + }; + }; +} diff --git a/home-manager/home.nix b/home-manager/home.nix new file mode 100644 index 0000000..1499e1c --- /dev/null +++ b/home-manager/home.nix @@ -0,0 +1,14 @@ +{ config, pkgs, ... }: + +{ + imports = + [ + ./packages/packages.nix + ]; + + programs.home-manager.enable = true; + + home.username = "luxzi"; + home.homeDirectory = "/home/luxzi"; + home.stateVersion = "24.05"; +} diff --git a/home-manager/packages/git.nix b/home-manager/packages/git.nix new file mode 100644 index 0000000..8a88dd9 --- /dev/null +++ b/home-manager/packages/git.nix @@ -0,0 +1,19 @@ +{ ... }: + +{ + programs.git = { + enable = true; + userName = "luxzi"; + userEmail = "lesson085@gmail.com"; + aliases = { + pf = "push --force"; + kl = "log --show-signature"; + }; + signing = { + key = "$HOME/.ssh/luxzi"; + }; + extraConfig = { + init.defaultBranch = "main"; + }; + }; +} diff --git a/home-manager/packages/packages.nix b/home-manager/packages/packages.nix new file mode 100644 index 0000000..e44efab --- /dev/null +++ b/home-manager/packages/packages.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: + +{ + imports = + [ + ./zsh.nix + ./git.nix + ]; + + home.packages = with pkgs; [ + rustup + hyfetch + nix-output-monitor + alvr + firefox + tree + vesktop + kitty + ]; +} diff --git a/home-manager/packages/zsh.nix b/home-manager/packages/zsh.nix new file mode 100644 index 0000000..c9455d0 --- /dev/null +++ b/home-manager/packages/zsh.nix @@ -0,0 +1,26 @@ +{ ... }: + +{ + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + oh-my-zsh = { + enable = true; + plugins = [ "git" ]; + theme = "af-magic"; + }; + shellAliases = { + hm-switch = "home-manager switch --flake $HOME/.dotfiles"; + nx-switch = "sudo nixos-rebuild switch --flake $HOME/.dotfiles"; + nx-boot = "sudo nixos-rebuild boot --flake $HOME/.dotfiles"; + nx-clean = "sudo nix-collect-garbage --delete-old && nix-collect-garbage --delete-old"; + hm-clean = "home-manager remove-generations"; + gl-switch = "sudo nixos-rebuild switch --flake $HOME/.dotfiles && home-manager switch --flake $HOME/.dotfiles"; + gl-clean = "sudo nix-collect-garbage --delete-old && nix-collect-garbage --delete-old && home-manager remove-generations"; + snv = "sudo -E nvim"; + sen = "sudo -E"; + }; + }; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix new file mode 100644 index 0000000..21c024e --- /dev/null +++ b/nixos/configuration.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, self, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware/hardware.nix + ./environments/plasma-wayland.nix + ./users/luxzi.nix + ./services/services.nix + ./programs/programs.nix + ./misc/misc.nix + ]; + + # 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 value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how + # to actually do that. + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "24.05"; # Did you read the comment? +} + diff --git a/nixos/environments/plasma-wayland.nix b/nixos/environments/plasma-wayland.nix new file mode 100644 index 0000000..fb77cf1 --- /dev/null +++ b/nixos/environments/plasma-wayland.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: + +{ + services.xserver.videoDrivers = ["nvidia"]; + + services.displayManager.sddm.enable = true; + services.displayManager.sddm.wayland.enable = true; + services.desktopManager.plasma6.enable = true; + + environment.plasma6.excludePackages = with pkgs; [ + plasma-browser-integration + konsole + ]; +} diff --git a/nixos/hardware/audio.nix b/nixos/hardware/audio.nix new file mode 100644 index 0000000..82ca1fa --- /dev/null +++ b/nixos/hardware/audio.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + hardware.pulseaudio.enable = false; +} diff --git a/nixos/hardware/fstab.nix b/nixos/hardware/fstab.nix new file mode 100644 index 0000000..321df02 --- /dev/null +++ b/nixos/hardware/fstab.nix @@ -0,0 +1,14 @@ +{ ... }: + +{ + fileSystems."/" = + { device = "/dev/disk/by-uuid/6f9a4486-8f14-468f-aecb-5e0df8af2309"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/4A4B-5B94"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; +} diff --git a/nixos/hardware/hardware.nix b/nixos/hardware/hardware.nix new file mode 100644 index 0000000..c7cd0a6 --- /dev/null +++ b/nixos/hardware/hardware.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + imports = + [ + ./modules.nix + ./fstab.nix + ./audio.nix + ./network.nix + ./intel.nix + ./nvidia.nix + ]; +} diff --git a/nixos/hardware/intel.nix b/nixos/hardware/intel.nix new file mode 100644 index 0000000..88bf59e --- /dev/null +++ b/nixos/hardware/intel.nix @@ -0,0 +1,6 @@ +{ lib, config, ... }: + +{ + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nixos/hardware/modules.nix b/nixos/hardware/modules.nix new file mode 100644 index 0000000..1593b53 --- /dev/null +++ b/nixos/hardware/modules.nix @@ -0,0 +1,13 @@ +{ 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-intel" ]; + boot.extraModulePackages = [ ]; +} diff --git a/nixos/hardware/network.nix b/nixos/hardware/network.nix new file mode 100644 index 0000000..45bc069 --- /dev/null +++ b/nixos/hardware/network.nix @@ -0,0 +1,5 @@ +{ lib, ... }: + +{ + networking.useDHCP = lib.mkDefault true; +} diff --git a/nixos/hardware/nvidia.nix b/nixos/hardware/nvidia.nix new file mode 100644 index 0000000..eb1abd6 --- /dev/null +++ b/nixos/hardware/nvidia.nix @@ -0,0 +1,13 @@ +{ config, ... }: + +{ + hardware.graphics.enable = true; + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + open = false; + nvidiaSettings = false; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; +} diff --git a/nixos/misc/locale.nix b/nixos/misc/locale.nix new file mode 100644 index 0000000..01de88c --- /dev/null +++ b/nixos/misc/locale.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + i18n.defaultLocale = "en_US.UTF-8"; +} diff --git a/nixos/misc/misc.nix b/nixos/misc/misc.nix new file mode 100644 index 0000000..0ff1eca --- /dev/null +++ b/nixos/misc/misc.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + imports = + [ + ./time.nix + ./locale.nix + ./nixconfig.nix + ]; +} diff --git a/nixos/misc/nixconfig.nix b/nixos/misc/nixconfig.nix new file mode 100644 index 0000000..88d2b4a --- /dev/null +++ b/nixos/misc/nixconfig.nix @@ -0,0 +1,6 @@ +{ ... }: + +{ + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nixpkgs.config.allowUnfree = true; +} diff --git a/nixos/misc/time.nix b/nixos/misc/time.nix new file mode 100644 index 0000000..edf3feb --- /dev/null +++ b/nixos/misc/time.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + time.timeZone = "America/New_York"; +} diff --git a/nixos/programs/dconf.nix b/nixos/programs/dconf.nix new file mode 100644 index 0000000..11c2c3b --- /dev/null +++ b/nixos/programs/dconf.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + programs.dconf.enable = true; +} diff --git a/nixos/programs/gpg.nix b/nixos/programs/gpg.nix new file mode 100644 index 0000000..0ade0fc --- /dev/null +++ b/nixos/programs/gpg.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; +} diff --git a/nixos/programs/nix-ld.nix b/nixos/programs/nix-ld.nix new file mode 100644 index 0000000..d178e51 --- /dev/null +++ b/nixos/programs/nix-ld.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: + +{ + programs.nix-ld = { + enable = true; + libraries = with pkgs; []; + }; +} diff --git a/nixos/programs/programs.nix b/nixos/programs/programs.nix new file mode 100644 index 0000000..65c910f --- /dev/null +++ b/nixos/programs/programs.nix @@ -0,0 +1,29 @@ +{ pkgs, ... }: + +{ + imports = + [ + ./nix-ld.nix + ./dconf.nix + ./gpg.nix + ./steam.nix + ]; + + environment.systemPackages = with pkgs; [ + wget + curl + git + neovim + fira-code-nerdfont + cmake + ninja + libgcc + gnumake + topgrade + unzip + patchelf + wl-clipboard + jdk17 + jre8 + ]; +} diff --git a/nixos/programs/steam.nix b/nixos/programs/steam.nix new file mode 100644 index 0000000..3e50e04 --- /dev/null +++ b/nixos/programs/steam.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + programs.steam.enable = true; +} diff --git a/nixos/services/boot.nix b/nixos/services/boot.nix new file mode 100644 index 0000000..8e3bb56 --- /dev/null +++ b/nixos/services/boot.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + boot.loader.systemd-boot.enable = true; + boot.loader.systemd-boot.configurationLimit = 10; + boot.loader.systemd-boot.editor = false; + boot.loader.efi.efiSysMountPoint = "/boot"; + boot.loader.efi.canTouchEfiVariables = true; +} diff --git a/nixos/services/cups.nix b/nixos/services/cups.nix new file mode 100644 index 0000000..4610bde --- /dev/null +++ b/nixos/services/cups.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + services.printing.enable = true; +} diff --git a/nixos/services/firewall.nix b/nixos/services/firewall.nix new file mode 100644 index 0000000..54168e7 --- /dev/null +++ b/nixos/services/firewall.nix @@ -0,0 +1,7 @@ +{ ... }: + +{ + networking.firewall.enable = false; + networking.firewall.allowedTCPPorts = []; + networking.firewall.allowedUDPPorts = []; +} diff --git a/nixos/services/libinput.nix b/nixos/services/libinput.nix new file mode 100644 index 0000000..4640b6d --- /dev/null +++ b/nixos/services/libinput.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + services.libinput.enable = true; +} diff --git a/nixos/services/networkmanager.nix b/nixos/services/networkmanager.nix new file mode 100644 index 0000000..55ce0e4 --- /dev/null +++ b/nixos/services/networkmanager.nix @@ -0,0 +1,6 @@ +{ ... }: + +{ + networking.hostName = "nixos"; + networking.networkmanager.enable = true; +} diff --git a/nixos/services/pipewire.nix b/nixos/services/pipewire.nix new file mode 100644 index 0000000..dcba83f --- /dev/null +++ b/nixos/services/pipewire.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + services.pipewire = { + enable = true; + audio.enable = true; + pulse.enable = true; + alsa.enable = true; + alsa.support32Bit = true; + }; +} diff --git a/nixos/services/services.nix b/nixos/services/services.nix new file mode 100644 index 0000000..25567fb --- /dev/null +++ b/nixos/services/services.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + imports = + [ + ./boot.nix + ./pipewire.nix + ./cups.nix + ./firewall.nix + ./libinput.nix + ./networkmanager.nix + ]; +} diff --git a/nixos/users/luxzi.nix b/nixos/users/luxzi.nix new file mode 100644 index 0000000..587a5d3 --- /dev/null +++ b/nixos/users/luxzi.nix @@ -0,0 +1,15 @@ +{ self, pkgs, ... }: + +{ + users.users.luxzi = { + isNormalUser = true; + extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + shell = pkgs.zsh; + packages = [ + self.inputs.home-manager.packages.${pkgs.system}.home-manager + ]; + }; + + environment.shells = with pkgs; [ zsh ]; + programs.zsh.enable = true; +}