diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..577b0a0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +hardware-configuration.nix diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..69e2294 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,116 @@ +# 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. + ./hardware-configuration.nix + ./users.nix + ./de.nix + ./discord.nix + ./hosts.nix + ./docker.nix + ./ovpn.nix + ./packages.nix + ]; + + nixpkgs.config.allowUnfree = true; + programs.gnupg.agent.enable = true; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.supportedFilesystems = [ "ntfs" ]; + + # networking.hostName = "nixos"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + networking.wireless.iwd.enable = true; + networking.networkmanager.wifi.backend = "iwd"; + + # Set your time zone. + # time.timeZone = "Europe/Amsterdam"; + + # 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_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkbOptions in tty. + # }; + + # Enable the X11 windowing system. + # services.xserver.enable = true; + + + + + # Configure keymap in X11 + # services.xserver.layout = "us"; + # services.xserver.xkbOptions = "eurosign:e,caps:escape"; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # Enable sound. + # sound.enable = true; + # hardware.pulseaudio.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + # users.users.alice = { + # isNormalUser = true; + # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + # packages = with pkgs; [ + # firefox + # tree + # ]; + # }; + + # 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; + + # Enable NTP daemon + services.ntp.enable = true; + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ 6006 3000 ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # 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 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 = "23.11"; # Did you read the comment? + +} + diff --git a/cura57.nix b/cura57.nix new file mode 100644 index 0000000..76caa99 --- /dev/null +++ b/cura57.nix @@ -0,0 +1,30 @@ +{ + appimageTools, + fetchurl, + writeShellScriptBin, +}: + +let + cura5 = appimageTools.wrapType2 rec { + name = "cura5"; + version = "5.7.1"; + src = fetchurl { + url = "https://github.com/Ultimaker/Cura/releases/download/${version}/UltiMaker-Cura-${version}-linux-X64.AppImage"; + hash = "sha256-LZMD0fo8TSlDEJspvTka724lYq5EgrOlDkwMktXqATw="; + }; + extraPkgs = pkgs: with pkgs; [ ]; + }; +in +writeShellScriptBin "cura" '' + # AppImage version of Cura loses current working directory and treats all paths relateive to $HOME. + # So we convert each of the files passed as argument to an absolute path. + # This fixes use cases like `cd /path/to/my/files; cura mymodel.stl anothermodel.stl`. + args=() + for a in "$@"; do + if [ -e "$a" ]; then + a="$(realpath "$a")" + fi + args+=("$a") + done + exec "${cura5}/bin/cura5" "''${args[@]}" +'' diff --git a/de.nix b/de.nix new file mode 100644 index 0000000..0979764 --- /dev/null +++ b/de.nix @@ -0,0 +1,52 @@ +{ config, pkgs, ... }: + +{ + hardware.nvidia = { + modesetting.enable = true; + open = false; + nvidiaSettings = true; + }; + services.xserver = { + enable = true; + videoDrivers = [ "nvidia" ]; + xrandrHeads = [ + { + output = "DP-0"; + primary = true; + } + { + output = "DP-2"; + monitorConfig = '' + Option "Rotate" "right" + Option "LeftOf" "DP-0" + ''; + } + ]; + displayManager.sddm = { + enable = true; + wayland.enable = true; + settings = { + Theme = { + Current = "breeze"; + ThemeDir = "/sddmt"; + }; + }; + }; + }; + services.xserver.desktopManager.plasma5.enable = true; + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + services.xrdp.enable = true; + services.xrdp.defaultWindowManager = "startplasma-x11"; + services.xrdp.openFirewall = true; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; +} diff --git a/discord.nix b/discord.nix new file mode 100644 index 0000000..59f3b42 --- /dev/null +++ b/discord.nix @@ -0,0 +1,3 @@ +{ + nixpkgs.overlays = [(self: super: { discord = super.discord.overrideAttrs (_: { src = builtins.fetchTarball "https://dl.discordapp.net/apps/linux/0.0.40/discord-0.0.40.tar.gz"; });})]; +} diff --git a/docker.nix b/docker.nix new file mode 100644 index 0000000..b886683 --- /dev/null +++ b/docker.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + virtualisation.docker = { + enable = true; + package = pkgs.docker.override { + buildGoPackage = pkgs.buildGo121Package; + }; + }; +} diff --git a/hosts.nix b/hosts.nix new file mode 100644 index 0000000..9652ab4 --- /dev/null +++ b/hosts.nix @@ -0,0 +1,6 @@ +{ + networking.extraHosts = '' + 127.0.0.1 web-api.shinservice.localdev www.shinservice.localdev ryazan.shinservice.localdev novgorod.shinservice.localdev borisoglebsk.shinservice.localdev kyzyl.shinservice.localdev surgut.shinservice.localdev voronezh.shisnervice.localdev krasnodar.shinservice.localdev cherepovets.shinservice.localdev nakhodka.shinservice.localdev + 10.10.1.21 www.1121313.ru web-api.1121313.ru adm.1121313.ru auth.1121313.ru nomenclature.1121313.ru shopping-cart.1121313.ru feeds.1121313.ru kibana.1121313.ru + ''; +} diff --git a/laptop.nix b/laptop.nix new file mode 100644 index 0000000..a7c8818 --- /dev/null +++ b/laptop.nix @@ -0,0 +1,35 @@ +{ config, pkgs, ... }: + +{ + services.tlp = { + enable = true; + settings = { + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + + CPU_MIN_PERF_ON_AC = 0; + CPU_MAX_PERF_ON_AC = 100; + CPU_MIN_PERF_ON_BAT = 0; + CPU_MAX_PERF_ON_BAT = 50; + + START_CHARGE_THRESH_BAT0 = 40; + STOP_CHARGE_THRESH_BAT0 = 85; + }; + }; + + services.thermald.enable = true; + + hardware.trackpoint = { + enable = true; + emulateWheel = true; + fakeButtons = false; + }; + + + environment.systemPackages = with pkgs; [ + powertop + ] +} diff --git a/ovpn.nix b/ovpn.nix new file mode 100644 index 0000000..f97d1b6 --- /dev/null +++ b/ovpn.nix @@ -0,0 +1,6 @@ +{ + services.openvpn.servers = { + shinservice = { config = '' config /home/deiru/.vpn/shinservice.ovpn ''; autoStart = false; }; + shinservice-new = { config = '' config /home/deiru/.vpn/shinservice-new.ovpn ''; autoStart = false; }; + }; +} diff --git a/packages.nix b/packages.nix new file mode 100644 index 0000000..216bf6d --- /dev/null +++ b/packages.nix @@ -0,0 +1,69 @@ +{ pkgs, ... }: +{ + programs.adb.enable = true; + environment.systemPackages = with pkgs; [ + (callPackage ./cura57.nix { }) + neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + digikam + insomnia + discord + tdesktop + direnv + qutebrowser + screen + floorp + opera + qmk + chromium + kate + okular + kdenlive + spectacle + emacs + nodejs_18 + python3 + jdk17 + yakuake + wget + ripgrep + git + docker-compose + audacity + blender + clipgrab + dmidecode + ffmpeg + freecad + gimp + htop + jpegoptim + killall + libreoffice + libwebp + lmms + mediainfo + mpv + nextcloud-client + obs-studio + openjdk + pass + pinentry + prismlauncher + qbittorrent + qdirstat + rofi + rofi-pass + skypeforlinux + sshpass + syncthing + telegram-desktop + tokodon + usbutils + ventoy + whois + wl-clipboard + xclip + xorg.xinit + xorg.xorgserver + ]; +} diff --git a/shadowsocks.nix b/shadowsocks.nix new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/shadowsocks.nix diff --git a/users.nix b/users.nix new file mode 100644 index 0000000..e9d432e --- /dev/null +++ b/users.nix @@ -0,0 +1,9 @@ +{ + users.users.deiru = { + isNormalUser = true; + home = "/home/deiru"; + description = "Deiru TwoKey"; + extraGroups = [ "wheel" "power" "docker" "adbusers" ]; + uid = 1312; + }; +}