From 0eecc461c9454d1e3c46a0e7caf404d889fec680 Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Sat, 30 May 2020 14:07:02 +0200 Subject: [PATCH] Initial commit --- configuration.nix | 17 ++ hardware-configuration-current.nix | 1 + hardware/hardware-configuration-desktop.nix | 32 ++++ .../hardware-configuration-desktop.nix.bak | 32 ++++ role-current.nix | 1 + roles/subroles/dev.nix | 30 +++ roles/subroles/entertainment.nix | 20 ++ roles/subroles/internet.nix | 12 ++ roles/workstation.nix | 174 ++++++++++++++++++ 9 files changed, 319 insertions(+) create mode 100644 configuration.nix create mode 120000 hardware-configuration-current.nix create mode 100644 hardware/hardware-configuration-desktop.nix create mode 100644 hardware/hardware-configuration-desktop.nix.bak create mode 120000 role-current.nix create mode 100644 roles/subroles/dev.nix create mode 100644 roles/subroles/entertainment.nix create mode 100644 roles/subroles/internet.nix create mode 100644 roles/workstation.nix diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..2f9062e --- /dev/null +++ b/configuration.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration-current.nix + ./role-current.nix + ]; + + # 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/hardware-configuration-current.nix b/hardware-configuration-current.nix new file mode 120000 index 0000000..e348ca9 --- /dev/null +++ b/hardware-configuration-current.nix @@ -0,0 +1 @@ +hardware/hardware-configuration-desktop.nix \ No newline at end of file diff --git a/hardware/hardware-configuration-desktop.nix b/hardware/hardware-configuration-desktop.nix new file mode 100644 index 0000000..028a41e --- /dev/null +++ b/hardware/hardware-configuration-desktop.nix @@ -0,0 +1,32 @@ +# 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" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/878539a9-eab3-4b29-86ba-dc703ac93de6"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/6456-8B97"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/5292c090-e162-441d-95f2-c43f4afec853"; } + ]; + + nix.maxJobs = lib.mkDefault 8; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +} diff --git a/hardware/hardware-configuration-desktop.nix.bak b/hardware/hardware-configuration-desktop.nix.bak new file mode 100644 index 0000000..20d6aac --- /dev/null +++ b/hardware/hardware-configuration-desktop.nix.bak @@ -0,0 +1,32 @@ +# 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" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/ad7ff130-6171-4c9e-85c9-3db3f4bf5ae9"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/8939-9AFF"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/ecb19fb8-4335-40d4-89ff-2b11947e0e0e"; } + ]; + + nix.maxJobs = lib.mkDefault 8; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +} diff --git a/role-current.nix b/role-current.nix new file mode 120000 index 0000000..362aada --- /dev/null +++ b/role-current.nix @@ -0,0 +1 @@ +roles/workstation.nix \ No newline at end of file diff --git a/roles/subroles/dev.nix b/roles/subroles/dev.nix new file mode 100644 index 0000000..a5acf4a --- /dev/null +++ b/roles/subroles/dev.nix @@ -0,0 +1,30 @@ +{ config, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + neovim + vim + vscodium + + docker-compose + + binutils + curl + htop + nixfmt + ripgrep + shellcheck + tmux + unzip + wget + + git + + rustup + + direnv + ]; + + services.lorri.enable = true; + + programs.adb.enable = true; +} diff --git a/roles/subroles/entertainment.nix b/roles/subroles/entertainment.nix new file mode 100644 index 0000000..1ea13b5 --- /dev/null +++ b/roles/subroles/entertainment.nix @@ -0,0 +1,20 @@ +{ config, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + steam + steam-run + #lutris + #multimc + #(wine.override { wineBuild = "wineWow"; }) + + mplayer + spotify + vlc + + teamspeak_client + ]; + + # needed for steam + hardware.opengl.driSupport32Bit = true; + hardware.pulseaudio.support32Bit = true; +} diff --git a/roles/subroles/internet.nix b/roles/subroles/internet.nix new file mode 100644 index 0000000..90ac68e --- /dev/null +++ b/roles/subroles/internet.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + firefox + chromium + + thunderbird + + riot-desktop + tdesktop + ]; +} diff --git a/roles/workstation.nix b/roles/workstation.nix new file mode 100644 index 0000000..a4c5c6f --- /dev/null +++ b/roles/workstation.nix @@ -0,0 +1,174 @@ +{ config, pkgs, builtins, ... }: + +{ + nixpkgs.config.allowUnfree = true; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + # mount tmp as tmpfs + boot.tmpOnTmpfs = true; + + boot.initrd.luks.devices = { + root = { + device = "/dev/sda2"; + preLVM = true; + }; + }; + + networking.hostName = "w1n5t0n"; # 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.eno1.useDHCP = true; + + networking.networkmanager.enable = 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 = "eu"; + # }; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + glibcLocales + keepassxc + lxappearance + networkmanagerapplet + nextcloud-client + pavucontrol + termite + vim + which + ]; + + # required for nextcloud + services.gnome3.gnome-keyring.enable = true; + + virtualisation.docker.enable = true; + # virtualisation.lxd.enable = true; + # virtualisation.virtualbox.host.enable = true; + # virtualisation.virtualbox.host.enableExtensionPack = true; + + # 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 sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + + # set keyboard layout + environment.sessionVariables = { + XKB_DEFAULT_OPTIONS = "caps:escape"; + XKB_DEFAULT_LAYOUT = "eu"; + }; + + # Enable the X11 windowing system. + services.xserver = { + enable = true; + + layout = "eu"; + xkbOptions = "caps:escape"; + + displayManager = { + defaultSession = "none+i3"; + lightdm.enable = true; + }; + + windowManager.i3 = { + enable = true; + extraPackages = with pkgs; [ + dmenu + rofi + i3status + i3lock + i3blocks + ]; + }; + }; + + # required for i3 + environment.pathsToLink = [ "/libexec" ]; # links /libexec from derivations to /run/current-system/sw + + # Enable touchpad support. + # services.xserver.libinput.enable = true; + + # Enable the KDE Desktop Environment. + # services.xserver.displayManager.sddm.enable = true; + # services.xserver.desktopManager.plasma5.enable = true; + + # enable zsh globally + programs.zsh.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.me = { + shell = pkgs.zsh; + createHome = true; + isNormalUser = true; + extraGroups = [ + "adbusers" + "audio" + "disk" + "docker" + "networkmanager" + "plugdev" + "vboxusers" + "video" + "wheel" + ]; + }; + + # systemd.services.home-manager-me.preStart = '' + # ${pkgs.nix}/bin/nix-env -i -E + # ''; + + fonts.fonts = with pkgs; [ + font-awesome-ttf + #nerdfonts + noto-fonts-cjk + powerline-fonts + ]; + + # Enable NTFS support + boot.supportedFilesystems = [ "ntfs" ]; + + imports = + [ + ./subroles/dev.nix + ./subroles/entertainment.nix + ./subroles/internet.nix + ]; +}