From 44b011a6b44ef99ab90ac57a37c708896d482d02 Mon Sep 17 00:00:00 2001 From: Chris Josten Date: Tue, 12 May 2020 10:53:09 +0200 Subject: [PATCH] Initial configuration --- common/console.nix | 8 ++ common/default.nix | 8 ++ common/devel/default.nix | 5 ++ common/devel/pkgs.nix | 19 +++++ common/gui/default.nix | 30 ++++++++ common/gui/pkgs.nix | 35 +++++++++ common/networking-home/default.nix | 8 ++ common/pkgs/console-core.nix | 11 +++ common/pkgs/gui.nix | 41 ++++++++++ common/pkgs/result | 1 + common/users.nix | 15 ++++ configuration.nix | 89 ++++++++++++++++++++++ specific/laptop/default.nix | 13 ++++ specific/laptop/fs.nix | 15 ++++ specific/laptop/hardware-configuration.nix | 30 ++++++++ 15 files changed, 328 insertions(+) create mode 100644 common/console.nix create mode 100644 common/default.nix create mode 100644 common/devel/default.nix create mode 100644 common/devel/pkgs.nix create mode 100644 common/gui/default.nix create mode 100644 common/gui/pkgs.nix create mode 100644 common/networking-home/default.nix create mode 100644 common/pkgs/console-core.nix create mode 100644 common/pkgs/gui.nix create mode 120000 common/pkgs/result create mode 100644 common/users.nix create mode 100644 configuration.nix create mode 100644 specific/laptop/default.nix create mode 100644 specific/laptop/fs.nix create mode 100644 specific/laptop/hardware-configuration.nix diff --git a/common/console.nix b/common/console.nix new file mode 100644 index 0000000..977e19c --- /dev/null +++ b/common/console.nix @@ -0,0 +1,8 @@ +{ config, ... }: + +{ + imports = [ + ./pkgs/console-core.nix + ]; + nixpkgs.config.allowUnfree = true; +} diff --git a/common/default.nix b/common/default.nix new file mode 100644 index 0000000..4f1b79b --- /dev/null +++ b/common/default.nix @@ -0,0 +1,8 @@ +{config, ...}: + +{ + imports = [ + ./console.nix + ./users.nix + ]; +} diff --git a/common/devel/default.nix b/common/devel/default.nix new file mode 100644 index 0000000..a664057 --- /dev/null +++ b/common/devel/default.nix @@ -0,0 +1,5 @@ +{config, ... }: + +{ + imports = [./pkgs.nix]; +} diff --git a/common/devel/pkgs.nix b/common/devel/pkgs.nix new file mode 100644 index 0000000..af0e362 --- /dev/null +++ b/common/devel/pkgs.nix @@ -0,0 +1,19 @@ +{ pkgs, ...}: + +{ + environment = { + systemPackages = with pkgs; [ + # General + git + # C/C++ + gcc + cmake + qtcreator + + # Java + gradle + jetbrains.idea-ultimate + maven + ]; + }; +} diff --git a/common/gui/default.nix b/common/gui/default.nix new file mode 100644 index 0000000..e81f131 --- /dev/null +++ b/common/gui/default.nix @@ -0,0 +1,30 @@ +# Defines comfig for a "gui" system, in most cases a Desktop or Laptop +{ config, ... }: + +{ + imports = [ ./pkgs.nix ]; + + # Basic X11/display manager config + services.xserver = { + enable = true; + displayManager.sddm.enable = true; + desktopManager.plasma5.enable = true; + }; + + networking.networkmanager.enable = true; + + sound.enable = true; + hardware.pulseaudio.enable = true; + + # Additional services + services.syncthing.enable = true; + services.flatpak.enable = true; + xdg.portal.enable = true; + + # Input config + services.xserver = { + synaptics.tapButtons = false; + libinput.enable = true; + }; + +} diff --git a/common/gui/pkgs.nix b/common/gui/pkgs.nix new file mode 100644 index 0000000..fe61b8b --- /dev/null +++ b/common/gui/pkgs.nix @@ -0,0 +1,35 @@ +{ pkgs, ...}: + +{ + environment = { + systemPackages = with pkgs; [ + # Internet + firefox + keepassxc + riot-desktop + syncthing + qsyncthingtray + + # Wire(less) internet support + dnsmasq + hostapd + iw + plasma-nm + + # KDE plasma and applications + kate + latte-dock # My PC has enough RAM by now + kleopatra + networkmanager + okular + plasma-desktop + plasma-integration + sddm + # To show of your distro + neofetch + + # Communication + tdesktop + ]; + }; +} diff --git a/common/networking-home/default.nix b/common/networking-home/default.nix new file mode 100644 index 0000000..f8a7004 --- /dev/null +++ b/common/networking-home/default.nix @@ -0,0 +1,8 @@ +{config, ...}: + +{ + networking = { + # PiHole + networkmanager.insertNameservers = ["192.168.178.151"]; + }; +} diff --git a/common/pkgs/console-core.nix b/common/pkgs/console-core.nix new file mode 100644 index 0000000..a2c4c23 --- /dev/null +++ b/common/pkgs/console-core.nix @@ -0,0 +1,11 @@ +{ pkgs, ...}: + +{ + environment = { + systemPackages = with pkgs; [ + neovim + tmux + vim + ]; + }; +} diff --git a/common/pkgs/gui.nix b/common/pkgs/gui.nix new file mode 100644 index 0000000..3570c15 --- /dev/null +++ b/common/pkgs/gui.nix @@ -0,0 +1,41 @@ +{ pkgs, ...}: + +{ + environment = { + systemPackages = with pkgs; [ + # Internet + firefox + keepassxc + riot-desktop + syncthing + qsyncthingtray + + # Wire(less) internet support + dnsmasq + hostapd + iw + plasma-nm + + # KDE plasma and applications + kate + latte-dock # My PC has enough RAM by now + kleopatra + networkmanager + okular + plasma-desktop + plasma-integration + sddm + # To show of your distro + neofetch + + # Communication + tdesktop + ]; + }; + + #packageOverrides = pkgs: rec { + #latte-dock = pkgs.latte-dock.override (attrs: { + # src = fetc + #}; + #} +} diff --git a/common/pkgs/result b/common/pkgs/result new file mode 120000 index 0000000..42bb7f6 --- /dev/null +++ b/common/pkgs/result @@ -0,0 +1 @@ +/nix/store/rq2fvc9n4n9qlmqq88maxaw8cr7cy12p-nixos-system-nix-te-vinden-20.03.1754.b0e3df2f843 \ No newline at end of file diff --git a/common/users.nix b/common/users.nix new file mode 100644 index 0000000..6730bea --- /dev/null +++ b/common/users.nix @@ -0,0 +1,15 @@ +{ config, ... }: + +{ + # Define a user account. Don't forget to set a password with ‘passwd’. + # users.users.jane = { + # isNormalUser = true; + # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + # }; + users.users.chris = { + isNormalUser = true; + home = "/home/chris"; + description = "Chris Josten"; + extraGroups = ["wheel" "networkmanager" "power"]; + }; +} diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..6bba2b7 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,89 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./common + ./specific/laptop + ]; + + # Use the grub EFI boot loader. + boot.loader = { + efi = { + canTouchEfiVariables = true; + }; + grub = { + device = "nodev"; + efiSupport = true; + }; + systemd-boot.enable = false; + }; + + + # networking.hostName = "nixos"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # The global useDHCP flag is deprecated, therefore explicitly set to false here. + # Per-interface useDHCP will be mandatory in the future, so this generated config + # replicates the default behaviour. + networking.useDHCP = false; + networking.interfaces.enp0s31f6.useDHCP = true; + networking.interfaces.wlp1s0.useDHCP = true; + + # 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_GB.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # }; + + # Set your time zone. + time.timeZone = "Europe/Amsterdam"; + + # 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; + # pinentryFlavor = "gnome3"; + # }; + + # 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; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + + # Enable the X11 windowing system. + # services.xserver.enable = true; + # services.xserver.layout = "us"; + # services.xserver.xkbOptions = "eurosign:e"; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # 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 = "20.03"; # Did you read the comment? + +} + diff --git a/specific/laptop/default.nix b/specific/laptop/default.nix new file mode 100644 index 0000000..1054357 --- /dev/null +++ b/specific/laptop/default.nix @@ -0,0 +1,13 @@ +{config, ...}: + +{ + imports = [ + ../../common/gui + ../../common/devel + ../../common/networking-home + ./fs.nix + ./hardware-configuration.nix + ]; + + networking.hostName = "nix-te-vinden"; +} diff --git a/specific/laptop/fs.nix b/specific/laptop/fs.nix new file mode 100644 index 0000000..2663728 --- /dev/null +++ b/specific/laptop/fs.nix @@ -0,0 +1,15 @@ +{ ... }: { + fileSystems = { + "/" = { label = "root"; }; + "/boot" = { label = "BOOT"; }; + "/home" = { label = "home"; }; + }; + + boot.initrd.luks.devices = { + luks-system = { + device = "/dev/disk/by-uuid/b51ac469-a88d-4cc8-9b92-d0f0c8479eb2"; + preLVM = true; + allowDiscards = true; + }; + }; +} diff --git a/specific/laptop/hardware-configuration.nix b/specific/laptop/hardware-configuration.nix new file mode 100644 index 0000000..6d7b747 --- /dev/null +++ b/specific/laptop/hardware-configuration.nix @@ -0,0 +1,30 @@ +# 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, ... }: + +{ + imports = + [ + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/8c86ebcd-7bce-4cff-81fc-bd3059b8a1a9"; + fsType = "ext4"; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/227fa1db-887e-4a3f-9b9d-59f425bfe880"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + + nix.maxJobs = lib.mkDefault 8; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +}