From 3f3ec1c47cf85a8d9464614de75ab85bec75d76b Mon Sep 17 00:00:00 2001 From: caem Date: Wed, 24 May 2023 21:35:59 +0200 Subject: [PATCH] Initial commit of new configuration --- .gitignore | 1 + configuration.nix | 43 ++++++++++++++++++++++++ environments/plasma.nix | 11 ++++++ hardware-configuration.nix | 43 ++++++++++++++++++++++++ profile.nix | 2 ++ profiles/workstation.nix | 69 ++++++++++++++++++++++++++++++++++++++ sets/base/common.nix | 11 ++++++ sets/base/devel.nix | 9 +++++ sets/base/plasma.nix | 7 ++++ sets/devel/c.nix | 11 ++++++ sets/devel/git.nix | 7 ++++ sets/drivers/nvidia.nix | 8 +++++ sets/drivers/tablet.nix | 7 ++++ sets/graphics/art.nix | 9 +++++ sets/graphics/video.nix | 8 +++++ username.nix | 2 ++ users/user.nix | 30 +++++++++++++++++ 17 files changed, 278 insertions(+) create mode 100644 .gitignore create mode 100644 configuration.nix create mode 100644 environments/plasma.nix create mode 100644 hardware-configuration.nix create mode 100644 profile.nix create mode 100644 profiles/workstation.nix create mode 100644 sets/base/common.nix create mode 100644 sets/base/devel.nix create mode 100644 sets/base/plasma.nix create mode 100644 sets/devel/c.nix create mode 100644 sets/devel/git.nix create mode 100644 sets/drivers/nvidia.nix create mode 100644 sets/drivers/tablet.nix create mode 100644 sets/graphics/art.nix create mode 100644 sets/graphics/video.nix create mode 100644 username.nix create mode 100644 users/user.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0f4ce10 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +nixos/result diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..2d5071c --- /dev/null +++ b/configuration.nix @@ -0,0 +1,43 @@ +# Master configuration file +{ config, pkgs, ... }: +let + # User configurations are stored under ./user/[username].nix + # Set the corresponding value in ./username.nix + user = import ./username.nix; +in +{ + imports = [ + ./users/${user}.nix + + # Include the results of the hardware scan. + ./hardware-configuration.nix + + # Uncomment the profile you want to use + ./profiles/workstation.nix + ]; + + # General NixOS configuration + nix = { + settings.auto-optimise-store = true; + # Automatically remove generations older than a week + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # Use the unstable channel + system.autoUpgrade = { + enable = true; + channel = "https://nixos.org/channels/nixos-unstable"; + }; + + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "22.05"; +} + diff --git a/environments/plasma.nix b/environments/plasma.nix new file mode 100644 index 0000000..a19848c --- /dev/null +++ b/environments/plasma.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../sets/base/plasma.nix + ]; + + services.xserver.enable = true; + services.xserver.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5.enable = true; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..b7ae331 --- /dev/null +++ b/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 = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/56ec7666-a2ea-4e77-9015-00151b9b7884"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + fileSystems."/boot/efi" = + { device = "/dev/disk/by-uuid/F076-283D"; + fsType = "vfat"; + }; + + fileSystems."/mnt/vault" = { + device = "/dev/disk/by-uuid/048d175b-0e3e-4ec7-955b-3d9a45f9f237"; + fsType = "xfs"; + }; + + swapDevices = [ ]; + + # 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.enp34s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/profile.nix b/profile.nix new file mode 100644 index 0000000..b02be5f --- /dev/null +++ b/profile.nix @@ -0,0 +1,2 @@ +# Select profile from ./profiles/ directory +"workstation" diff --git a/profiles/workstation.nix b/profiles/workstation.nix new file mode 100644 index 0000000..68be2bc --- /dev/null +++ b/profiles/workstation.nix @@ -0,0 +1,69 @@ +{ config, pkgs, ... }: + +{ + imports = [ + # Environments + ../environments/plasma.nix # KDE/Plasma + # ../environments/hyprland.nix # Todo + + # Package sets + ../sets/base/common.nix + ../sets/drivers/nvidia.nix + ../sets/drivers/tablet.nix + ../sets/base/devel.nix + ../sets/graphics/art.nix + ../sets/graphics/video.nix + ]; + + # Bootloader + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + + # Hostname + networking.hostName = "nixos"; + + # Networking + networking.networkmanager.enable = true; + + # Timezone + time.timeZone = "Europe/Berlin"; + + # Locale + i18n.defaultLocale = "en_US.UTF-8"; + console.keyMap = "uk"; + i18n.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"; + }; + + services.xserver = { + layout = "gb"; + xkbVariant = ""; + }; + + # Nvidia + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.opengl.enable = true; + hardware.nvidia.modesetting.enable = true; + + # Enable audio + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; +} + diff --git a/sets/base/common.nix b/sets/base/common.nix new file mode 100644 index 0000000..be9e1d3 --- /dev/null +++ b/sets/base/common.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + neovim + firefox + neofetch + tree + ]; +} + diff --git a/sets/base/devel.nix b/sets/base/devel.nix new file mode 100644 index 0000000..4c8d9cc --- /dev/null +++ b/sets/base/devel.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../devel/git.nix + ../devel/c.nix + ]; +} + diff --git a/sets/base/plasma.nix b/sets/base/plasma.nix new file mode 100644 index 0000000..1dc2601 --- /dev/null +++ b/sets/base/plasma.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + kate + ]; +} diff --git a/sets/devel/c.nix b/sets/devel/c.nix new file mode 100644 index 0000000..1d1398c --- /dev/null +++ b/sets/devel/c.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + gcc + clang + clang-tools + gnumake + ]; +} + diff --git a/sets/devel/git.nix b/sets/devel/git.nix new file mode 100644 index 0000000..197e22e --- /dev/null +++ b/sets/devel/git.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + git + ]; +} diff --git a/sets/drivers/nvidia.nix b/sets/drivers/nvidia.nix new file mode 100644 index 0000000..fdf60e6 --- /dev/null +++ b/sets/drivers/nvidia.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.opengl.enable = true; + hardware.nvidia.modesetting.enable = true; +} + diff --git a/sets/drivers/tablet.nix b/sets/drivers/tablet.nix new file mode 100644 index 0000000..c90699c --- /dev/null +++ b/sets/drivers/tablet.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + hardware.opentabletdriver.enable = true; + hardware.opentabletdriver.daemon.enable = true; +} + diff --git a/sets/graphics/art.nix b/sets/graphics/art.nix new file mode 100644 index 0000000..fa9ceb3 --- /dev/null +++ b/sets/graphics/art.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + krita + gimp + ]; +} + diff --git a/sets/graphics/video.nix b/sets/graphics/video.nix new file mode 100644 index 0000000..b3830f7 --- /dev/null +++ b/sets/graphics/video.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + kdenlive + ]; +} + diff --git a/username.nix b/username.nix new file mode 100644 index 0000000..8cc2f7f --- /dev/null +++ b/username.nix @@ -0,0 +1,2 @@ +# Select user from the ./users/ directory +"user" diff --git a/users/user.nix b/users/user.nix new file mode 100644 index 0000000..32ab12b --- /dev/null +++ b/users/user.nix @@ -0,0 +1,30 @@ +{ config, pkgs, ... }: +{ + imports = [ + ]; + + users.users.user = { + isNormalUser = true; + description = "user"; + extraGroups = [ + "wheel" + "networkmanager" + "audio" + "video" + "docker" + "plugdev" + ]; + }; + + # Set to false to disable sudo password prompt + security = { + sudo.wheelNeedsPassword = true; + }; + +# home-manager.users.user = { +# home.stateVersion = "22.11"; +# }; + + # programs.home-manager.enable = true; +} +