From 646b0b4ce54ce2ca1c81e73d50869ebd4787116e Mon Sep 17 00:00:00 2001 From: Alexander Szczepanski Date: Wed, 9 Jun 2021 20:52:21 +0200 Subject: [PATCH] initial commit with desktop --- configs/gui.nix | 28 ++++ configs/virtualisation.nix | 12 ++ configs/vscode.nix | 27 ++++ machine/desktop/configuration.nix | 228 ++++++++++++++++++++++++++++++ rsync.sh | 4 + 5 files changed, 299 insertions(+) create mode 100644 configs/gui.nix create mode 100644 configs/virtualisation.nix create mode 100644 configs/vscode.nix create mode 100644 machine/desktop/configuration.nix create mode 100644 rsync.sh diff --git a/configs/gui.nix b/configs/gui.nix new file mode 100644 index 0000000..17f9848 --- /dev/null +++ b/configs/gui.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + kitty + chromium + gparted + keepassxc + meld + twemoji-color-font + mpv + brave + firefox + alacritty + baobab + lutris + insomnia + jellyfin-web + kdenlive + nextcloud-client + barrier + solaar + spotify + vulkan-tools + gnome.eog + virtmanager + ]; +} diff --git a/configs/virtualisation.nix b/configs/virtualisation.nix new file mode 100644 index 0000000..5caeabf --- /dev/null +++ b/configs/virtualisation.nix @@ -0,0 +1,12 @@ +{ config, pkgs, lib, ... }: + +{ + # container virtualization + virtualisation.docker.enable = true; + + # hypervisor virtualization + virtualisation.libvirtd = { + enable = true; + qemuPackage = pkgs.qemu_kvm; + }; +} diff --git a/configs/vscode.nix b/configs/vscode.nix new file mode 100644 index 0000000..9b541c7 --- /dev/null +++ b/configs/vscode.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: + +let + extensions = (with pkgs.vscode-extensions; [ + bbenoist.Nix + ms-python.python + ms-azuretools.vscode-docker + ms-vscode-remote.remote-ssh + ]) ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [{ + name = "remote-ssh-edit"; + publisher = "ms-vscode-remote"; + version = "0.47.2"; + sha256 = "1hp6gjh4xp2m1xlm1jsdzxw9d8frkiidhph6nvl24d0h8z34w49g"; + } { + name = "rafaelmaiolla.remote-vscode"; + publisher = "rafaelmaiolla"; + }]; + vscode-with-extensions = pkgs.vscode-with-extensions.override { + vscodeExtensions = extensions; + }; +in { + config = { + environment.systemPackages = [ + vscode-with-extensions + ]; + }; +} diff --git a/machine/desktop/configuration.nix b/machine/desktop/configuration.nix new file mode 100644 index 0000000..d9bd7c0 --- /dev/null +++ b/machine/desktop/configuration.nix @@ -0,0 +1,228 @@ +{ config, pkgs, lib, ... }: + +let + unstable = import { config.allowUnfree = true; }; +in +{ + imports = + [ # Include the results of the hardware scan. + /etc/nixos/hardware-configuration.nix +# ./vscode.nix + ../../configs/gui.nix + ../../configs/virtualisation.nix + ]; + + # Use the systemd-boot EFI boot loader. + fileSystems."/".options = [ "noatime" "discard" ]; + fileSystems."/boot".options = [ "noatime" "discard" ]; + fileSystems."/mnt/second" = { + device = "/dev/disk/by-uuid/49c04c91-752d-4dff-b4d9-40a0b9a7bf7c"; + fsType = "ext4"; + options = [ "noatime" "discard" ]; + }; + + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.device = "nodev"; + boot.loader.grub.efiSupport = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.grub.gfxmodeEfi = "1024x768"; + boot.initrd.kernelModules = [ "amdgpu" ]; + boot.plymouth.enable = true; + boot.extraModulePackages = with pkgs.linuxPackages; [ it87 ]; + boot.kernelModules = [ "it87" ]; + boot.tmpOnTmpfs = true; + + networking.hostName = "desktop"; # Define your hostname. + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # 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.enp8s0.useDHCP = true; + networking.interfaces.wlp6s0.useDHCP = true; + + console = { + font = "latarcyrheb-sun32"; + keyMap = "us"; + }; + + hardware.fancontrol.enable = true; + hardware.fancontrol.config = '' + INTERVAL=10 + DEVPATH=hwmon2=devices/platform/it87.656 + DEVNAME=hwmon2=it8665 + FCTEMPS=hwmon2/pwm3=hwmon2/temp1_input hwmon2/pwm2=hwmon2/temp1_input hwmon2/pwm1=hwmon2/temp1_input + FCFANS=hwmon2/pwm3=hwmon2/fan2_input hwmon2/pwm2=hwmon2/fan1_input hwmon2/pwm1= + MINTEMP=hwmon2/pwm3=60 hwmon2/pwm2=60 hwmon2/pwm1=60 + MAXTEMP=hwmon2/pwm3=75 hwmon2/pwm2=75 hwmon2/pwm1=75 + MINSTART=hwmon2/pwm3=51 hwmon2/pwm2=51 hwmon2/pwm1=51 + MINSTOP=hwmon2/pwm3=51 hwmon2/pwm2=51 hwmon2/pwm1=51 + MINPWM=hwmon2/pwm1=51 hwmon2/pwm2=51 hwmon2/pwm3=51 + MAXPWM=hwmon2/pwm3=127 hwmon2/pwm2=204 + ''; + + + hardware.cpu.amd.updateMicrocode = true; + hardware.opengl.extraPackages = with pkgs; [ + rocm-opencl-icd + rocm-opencl-runtime + amdvlk + ]; + + hardware.opengl = { + driSupport = true; + driSupport32Bit = true; + }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + services.xserver.desktopManager.pantheon.enable = true; + services.xserver.desktopManager.pantheon.extraWingpanelIndicators = [ pkgs.pantheon.wingpanel-indicator-nightlight ]; + services.xserver.videoDrivers = [ "amdgpu" ]; + + fonts.fonts = with pkgs; [ + open-sans + roboto-mono + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + liberation_ttf + fira-code + fira-code-symbols + mplus-outline-fonts + dina-font + proggyfonts + ]; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + hardware.pulseaudio.support32Bit = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users = { + defaultUserShell = pkgs.zsh; + + users.alex = { + isNormalUser = true; + extraGroups = [ "wheel" "docker" "networkmanager" "libvirtd" ]; + }; + }; + + nixpkgs.config.chromium.commandLineArgs = "--enable-features=WebUIDarkMode,NativeNotifications,VaapiVideoDecoder --ignore-gpu-blocklist --use-gl=desktop --force-dark-mode --disk-cache-dir=/tmp/cache"; + programs.chromium = { + enable = true; + extensions = [ + "cbnipbdpgcncaghphljjicfgmkonflee" # Axel Springer Blocker + "cjpalhdlnbpafiamejdnhcphjbkeiagm" # uBlock Origin + "mnjggcdmjocbbbhaepdhchncahnbgone" # SponsorBlock for YouTube + "hjdoplcnndgiblooccencgcggcoihigg" # Terms of Service; Didn’t Read + "gcbommkclmclpchllfjekcdonpmejbdp" # HTTPS Everywhere + "oboonakemofpalcgghocfoadofidjkkk" # KeePassXC-Browser + "fploionmjgeclbkemipmkogoaohcdbig" # Page load time + "egnjhciaieeiiohknchakcodbpgjnchh" # Tab Wrangler + "fnaicdffflnofjppbagibeoednhnbjhg" # Floccus bookmarks + ]; + extraOpts = { + "BrowserSignin" = 0; + "SyncDisabled" = true; + "PasswordManagerEnabled" = false; + "AutofillAddressEnabled" = true; + "AutofillCreditCardEnabled" = false; + "BuiltInDnsClientEnabled" = false; + "MetricsReportingEnabled" = true; + "SearchSuggestEnabled" = false; + "AlternateErrorPagesEnabled" = false; + "UrlKeyedAnonymizedDataCollectionEnabled" = false; + "SpellcheckEnabled" = true; + "SpellcheckLanguage" = [ + "de" + "en-US" + ]; + "CloudPrintSubmitEnabled" = false; + }; + }; + + programs.zsh = { + enable = true; + + enableCompletion = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + + ohMyZsh = { + enable = true; + theme = "agnoster"; + plugins = [ + "cp" + "common-aliases" + "docker " + "systemd" + "wd" + "kubectl" + "git" + ]; + }; + }; + + nixpkgs.config.allowUnfree = true; + + environment.systemPackages = with pkgs; [ + ack + dfc + git + glances +# home-manager + htop + ncdu + zsh + ruby + pstree + pciutils + borgbackup + bpytop + broot + bwm_ng + nodejs + sshfs + tealdeer + tree + lm_sensors + ]; + + # 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; + + # 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 = "21.05"; # Did you read the comment? + +} + diff --git a/rsync.sh b/rsync.sh new file mode 100644 index 0000000..b26ef8b --- /dev/null +++ b/rsync.sh @@ -0,0 +1,4 @@ +sudo rsync -ah --delete --progress /home/alex/Workspace/nixos-config/ /root/nixos/ +sudo rm /etc/nixos/configuration.nix +sudo ln -s /root/nixos/machine/`hostname`/configuration.nix /etc/nixos/configuration.nix +sudo nixos-rebuild switch \ No newline at end of file