From 56f2526a4cf17df812bbfb7f122f64286d431172 Mon Sep 17 00:00:00 2001 From: Varris Date: Sun, 7 Aug 2022 17:37:11 +0200 Subject: [PATCH] update --- flake.nix | 8 +- system/configuration.nix | 1 + user/config.nix | 7 + user/configs/beets/beets.nix | 44 +++++ user/configs/firefox/firefox.nix | 7 + user/configs/fish/fish.nix | 41 +++++ user/configs/kakoune/kakoune.nix | 82 +++++++++ user/configs/mpd/mpd.nix | 94 ++++++++++ user/configs/mpv/mpv.nix | 13 ++ user/configs/sway/sway.nix | 244 ++++++++++++++++++++++++++ user/configs/sway/waybar.nix | 141 +++++++++++++++ user/home.nix | 101 +++++++++++ user/nixos/configuration.nix | 163 +++++++++++++++++ user/nixos/hardware-configuration.nix | 62 +++++++ user/overlays.nix | 13 ++ 15 files changed, 1020 insertions(+), 1 deletion(-) create mode 100644 user/config.nix create mode 100644 user/configs/beets/beets.nix create mode 100644 user/configs/firefox/firefox.nix create mode 100644 user/configs/fish/fish.nix create mode 100644 user/configs/kakoune/kakoune.nix create mode 100644 user/configs/mpd/mpd.nix create mode 100644 user/configs/mpv/mpv.nix create mode 100644 user/configs/sway/sway.nix create mode 100644 user/configs/sway/waybar.nix create mode 100644 user/home.nix create mode 100644 user/nixos/configuration.nix create mode 100644 user/nixos/hardware-configuration.nix create mode 100644 user/overlays.nix diff --git a/flake.nix b/flake.nix index 8578dd3..c9e14a0 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { nixpkgs, home-manager, ... }: + outputs = inputs@{ nixpkgs, home-manager, ... }: let system = "x86_64-linux"; @@ -26,6 +26,12 @@ modules = [ ./system/configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.manuel = import ./user/home.nix; + } ]; }; }; diff --git a/system/configuration.nix b/system/configuration.nix index 16b6a4e..d34541c 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -87,6 +87,7 @@ environment.systemPackages = with pkgs; [ # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. # wget + git links2 ripgrep fd diff --git a/user/config.nix b/user/config.nix new file mode 100644 index 0000000..97b4216 --- /dev/null +++ b/user/config.nix @@ -0,0 +1,7 @@ +{ + packageOverrides = pkgs: { + nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { + inherit pkgs; + }; + }; +} diff --git a/user/configs/beets/beets.nix b/user/configs/beets/beets.nix new file mode 100644 index 0000000..f158bdd --- /dev/null +++ b/user/configs/beets/beets.nix @@ -0,0 +1,44 @@ +{ config, pkgs, ... }: { + + programs.beets = { + enable = true; + + settings = { + plugins = "mpdupdate ftintitle fetchart chroma edit"; + + directory = "/mnt/hdd/Music"; + library = "/mnt/hdd/Music/library.db"; + + import = { + "resume" = true; + "group_albums" = true; + "move" = true; + }; + + paths = { + "default" = "%asciify{$albumartist}/$year - %asciify{$album}%aunique{}/$track %asciify{$title}"; + "singleton" = "Non-Album/%asciify{$artist}/%asciify{$title}"; + "comp" = "Compilations/%asciify{$album}%aunique{}/$track %asciify{$title}"; + }; + + ftintitle = { + "auto" = true; + }; + + fetchart = { + "auto" = true; + }; + + chroma = { + auto = true; + }; + + replaygain = { + "backend" = "gstreamer"; + "threads" = 8; + }; + }; + + }; +} + diff --git a/user/configs/firefox/firefox.nix b/user/configs/firefox/firefox.nix new file mode 100644 index 0000000..f2f1384 --- /dev/null +++ b/user/configs/firefox/firefox.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: +{ + programs.firefox = { + enable = true; + }; +} + diff --git a/user/configs/fish/fish.nix b/user/configs/fish/fish.nix new file mode 100644 index 0000000..57d4125 --- /dev/null +++ b/user/configs/fish/fish.nix @@ -0,0 +1,41 @@ +{ config, pkgs, ... }: +{ + programs.exa = { + enable = true; + enableAliases = true; + }; + + programs.fish = { + enable = true; + interactiveShellInit = '' + ${pkgs.any-nix-shell}/bin/any-nix-shell fish --info-right | source + ''; + functions = { + fish_prompt = '' + set_color green + printf (prompt_pwd) + set_color cyan + printf " ► " + set_color normal + ''; + fish_greeting = ""; + + ec = '' + pushd &> /dev/null + cd "${config.home.homeDirectory}" + set "filename" (${pkgs.fd}/bin/fd -t f . ${config.home.homeDirectory}/.config/nixpkgs | \ + ${pkgs.fzf}/bin/fzf -q "$argv[1]" \ + --preview "${pkgs.python3Packages.pygments}/bin/pygmentize -g -O linenos=1 {}") + if test -f "$filename" + $EDITOR $filename + end + popd &> /dev/null + ''; + }; + shellAliases = { + hm = "home-manager"; + nf = "${pkgs.neofetch}/bin/neofetch"; + }; + }; +} + diff --git a/user/configs/kakoune/kakoune.nix b/user/configs/kakoune/kakoune.nix new file mode 100644 index 0000000..9fb36a8 --- /dev/null +++ b/user/configs/kakoune/kakoune.nix @@ -0,0 +1,82 @@ +{ config, pkgs, lib, ... }: +let + smarttab = pkgs.kakouneUtils.buildKakounePlugin { + name = "smarttab-kak"; + src = pkgs.fetchFromGitHub { + owner = "andreyorst"; + repo = "smarttab.kak"; + rev = "86ac6599b13617ff938905ba4cdd8225d7eb6a2e"; + sha256 = "1992xwf2aygzfd26lhg3yiy253g0hl1iagj0kq9yhcqg0i5xjcj9"; + }; + }; + auto-pairs = pkgs.kakouneUtils.buildKakounePlugin { + name = "auto-pairs-kak"; + src = pkgs.fetchFromGitHub { + owner = "alexherbo2"; + repo = "auto-pairs.kak"; + rev = "bfdcb8566076f653ec707f86207f83ea75173ce9"; + sha256 = "0vx9msk8wlj8p9qf6yiv9gzrbanb5w245cidnx5cppgld2w842ij"; + }; + }; + sort-selections = pkgs.kakouneUtils.buildKakounePlugin { + name = "sort-selections-kak"; + src = pkgs.fetchFromGitHub { + owner = "occivink"; + repo = "kakoune-sort-selections"; + rev = "fdc03616b83140d3657f971dbc914269f9c8f1ff"; + sha256 = "P0uyuKQ//QqzOHs920gggXUKyWoMeAWn7XnlOQazHbc="; + }; + }; +in +{ + programs.kakoune = { + enable = true; + plugins = with pkgs.kakounePlugins; [ + smarttab + kakboard + auto-pairs + pkgs.kak-lsp + sort-selections + ]; + config = { + colorScheme = "gruvbox-dark"; + tabStop = 4; + indentWidth = 4; + showMatching = true; + showWhitespace = { + enable = false; + }; + numberLines.enable = true; + + hooks = [ + { name = "WinSetOption"; option = "filetype=nix|sh"; commands = "hook window BufWritePre .* lsp-formatting-sync"; } + + { name = "WinCreate"; option = ".*"; commands = "kakboard-enable"; } + { name = "InsertChar"; option = "\\t"; commands = "exec -draft -itersel h@"; } + ]; + + keyMappings = [ + ]; + + ui = { + assistant = "none"; + setTitle = true; + }; + + }; + extraConfig = '' + set global startup_info_version 99999999 + set-option global auto_pairs ( ) { } [ ] '"' '"' "'" "'" ` ` “ ” ‘ ’ « » ‹ › + + eval %sh{kak-lsp --kakoune -s $kak_session} # Not needed if you load it with plug.kak. + lsp-enable + + map global user l %{: enter-user-mode lsp} -docstring "LSP mode" + + ''; + }; + + home.packages = [ + pkgs.rnix-lsp + ]; +} diff --git a/user/configs/mpd/mpd.nix b/user/configs/mpd/mpd.nix new file mode 100644 index 0000000..c4a9eb8 --- /dev/null +++ b/user/configs/mpd/mpd.nix @@ -0,0 +1,94 @@ +{ config, pkgs, ... }: +{ + services.mpd = { + enable = true; + musicDirectory = "/mnt/hdd/Music"; + extraConfig = '' + auto_update "yes" + restore_paused "yes" + + audio_output { + type "pulse" + name "MPD PipeWire" + replay_gain_handler "none" + } + + audio_output { + type "fifo" + name "my_fifo" + path "/tmp/mpd.fifo" + format "44100:16:2" + } + + audio_output { + type "httpd" + name "FLAC Stream" + encoder "flac" + bitrate "128000" + port "8000" + format "44100:16:2" + always_on "yes" + } + ''; + }; + + services.mpd-discord-rpc = { + enable = true; + settings = { + id = 474605546457137157; + hosts = [ "localhost:6600" ]; + format = { + details = "$title ($album)"; + state = "by $artist"; + timestamp = "elapsed"; + large_image = "mpd_large"; + small_image = ""; + large_text = "Music Player Daemon"; + small_text = ""; + }; + }; + }; + + programs.ncmpcpp = { + enable = true; + package = pkgs.ncmpcpp.override { + visualizerSupport = true; + }; + settings = { + visualizer_data_source = "/tmp/mpd.fifo"; + visualizer_output_name = "my_fifo"; + visualizer_in_stereo = false; + visualizer_type = "spectrum"; + visualizer_look = "+|"; + + mouse_support = false; + + ask_before_clearing_playlists = false; + + user_interface = "alternative"; + alternative_header_first_line_format = "$5{%a}$0"; + alternative_header_second_line_format = "$7{%t}|{%f}$0"; + progressbar_look = "─╼ "; + + song_columns_list_format = "(25)[5]{a:artist} (3f)[5]{n: } (50)[cyan]{t|f:title} (5)[cyan]{lr:duration}"; + playlist_display_mode = "columns"; + browser_display_mode = "columns"; + search_engine_display_mode = "columns"; + playlist_editor_display_mode = "columns"; + + colors_enabled = true; + discard_colors_if_item_is_selected = true; + + main_window_color = "yellow"; + visualizer_color = "default, yellow"; + header_window_color = "yellow"; + + }; + }; + services.mpdris2 = { + enable = true; + notifications = true; + multimediaKeys = false; + }; +} + diff --git a/user/configs/mpv/mpv.nix b/user/configs/mpv/mpv.nix new file mode 100644 index 0000000..0e8e8e8 --- /dev/null +++ b/user/configs/mpv/mpv.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: +{ + programs.mpv = { + enable = true; + config = { + profile = "gpu-hq"; + ytdl-format = "bestvideo+bestaudio"; + hwdec = "vaapi-copy"; + gpu-context = "wayland"; + force-window = "yes"; + }; + }; +} diff --git a/user/configs/sway/sway.nix b/user/configs/sway/sway.nix new file mode 100644 index 0000000..9454eeb --- /dev/null +++ b/user/configs/sway/sway.nix @@ -0,0 +1,244 @@ +{ config, pkgs, lib, ... }: +let + wobsock = "/tmp/wob-swayvol.fifo"; + wallpaper = "/mnt/hdd/Wallpapers/gruv-4.jpg"; + + left_monitor = "HDMI-A-1"; + right_monitor = "DP-1"; + + wob-voldaemon = pkgs.writeShellScriptBin "wob-volumedaemon.sh" + '' + if pgrep "wob"; then + killall wob &> /dev/null + fi + + if [[ -e "${wobsock}" ]]; then + rm "${wobsock}" + fi + + mkfifo "${wobsock}" + tail -f "${wobsock}" | ${pkgs.wob}/bin/wob --border-color "#D65D0EFF" --background-color "#282828FF" --bar-color "#D65D0EFF" -b 2 -H 40 & + echo "wob: started" + ''; + + passmenu = pkgs.writeShellScriptBin "passmenu.sh" + '' + shopt -s nullglob globstar + + prefix=''${PASSWORD_STORE_DIR-~/.password-store} + password_files=( "$prefix"/**/*.gpg ) + password_files=( "''${password_files[@]#"$prefix"/}" ) + password_files=( "''${password_files[@]%.gpg}" ) + + password=$(printf '%s\n' "''${password_files[@]}" | ${pkgs.rofi-wayland}/bin/rofi -dmenu -p "pass" "$@") + + [[ -n $password ]] || exit + + pass show -c "$password" 2>/dev/null + ''; + + xwaylandSetPrimary = pkgs.writeShellScriptBin "xwayland-setprimary.sh" + '' + DSP=$(${pkgs.xorg.xrandr}/bin/xrandr | awk '/2560x1440/ {print $1}' | head -n 1) + + ${pkgs.xorg.xrandr}/bin/xrandr --output "$DSP" --primary + echo "Xwayland: $DSP - Primary monitor set" + ''; + + rofi-theme = pkgs.fetchFromGitHub + { + owner = "bardisty"; + repo = "gruvbox-rofi"; + rev = "0b4cf703087e2150968826b7508cf119437eba7a"; + sha256 = "nAVNtibzVhv1wBcAo36jvHbsN7spFYjjm3IhcAeoM6M="; + } + "/gruvbox-dark.rasi"; + + killprocess = pkgs.writeShellScriptBin "killprocess.sh" + '' + ps -x -o pid=,comm= | column -t -o " " | rofi -dmenu -p "kill process" | awk '{print $1}' | uniq | xargs -r kill -9 + ''; + +in +{ + imports = [ ./waybar.nix ]; + wayland.windowManager.sway = { + enable = true; + config = { + modifier = "Mod4"; + terminal = "${pkgs.foot}/bin/foot"; + gaps = { + inner = 20; + }; + keybindings = + let + modifier = config.wayland.windowManager.sway.config.modifier; + in + lib.mkOptionDefault { + "XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer -i 10 --get-volume > ${wobsock}"; + "XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer -d 10 --get-volume > ${wobsock}"; + "Mod5+F9" = "exec ${pkgs.mpc-cli}/bin/mpc stop"; + "Mod5+F11" = "exec ${pkgs.mpc-cli}/bin/mpc toggle"; + "Mod5+F10" = "exec ${pkgs.mpc-cli}/bin/mpc prev"; + "Mod5+F12" = "exec ${pkgs.mpc-cli}/bin/mpc next"; + "XF86AudioMute" = "exec mpc toggle"; + + "Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify copy screen"; + "${modifier}+Shift+Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify copy area"; + "${modifier}+Print" = "exec ${pkgs.sway-contrib.grimshot}/bin/grimshot --notify copy active"; + + "${modifier}+d" = "exec ${pkgs.rofi-wayland}/bin/rofi -show drun"; + "${modifier}+Shift+p" = "exec ${passmenu}/bin/passmenu.sh"; + "${modifier}+Shift+o" = "exec ${killprocess}/bin/killprocess.sh"; + + "${modifier}+q" = "exec ${pkgs.firefox}/bin/firefox"; + + "Ctrl+Space" = "exec ${pkgs.mako}/bin/makoctl dismiss"; + "Ctrl+grave" = "exec ${pkgs.mako}/bin/makoctl restore"; + }; + input = { + "type:keyboard" = { + xkb_layout = "us"; + xkb_variant = "altgr-intl"; + }; + "type:pointer" = { + accel_profile = "flat"; + }; + "type:touchpad" = { + events = "disabled"; #disable DualSense touchpad. Let Steam Input handle it + }; + }; + output = { + "*" = { + bg = "${wallpaper} stretch"; + }; + "${left_monitor}" = { + position = "0 0"; + }; + "${right_monitor}" = { + position = "1920 0"; + adaptive_sync = "on"; + }; + }; + + workspaceOutputAssign = [ + + { workspace = "1"; output = "${right_monitor}"; } + { workspace = "2"; output = "${right_monitor}"; } + { workspace = "3"; output = "${right_monitor}"; } + + { workspace = "4"; output = "${left_monitor}"; } + { workspace = "5"; output = "${left_monitor}"; } + { workspace = "6"; output = "${left_monitor}"; } + ]; + + startup = [ + { command = "${wob-voldaemon}/bin/wob-volumedaemon.sh"; always = true; } + { command = "${xwaylandSetPrimary}/bin/xwayland-setprimary.sh"; always = true; } + { command = "${pkgs.autotiling}/bin/autotiling"; always = true; } + { command = "${pkgs.openrgb}/bin/openrgb --server --profile autorun.orp"; } + ]; + bars = [{ + command = "${pkgs.waybar}/bin/waybar"; + }]; + colors = { + focused = { + border = "#d65d0e"; + background = "#d65d0e"; + text = "#eeeeec"; + indicator = "#d65d0e"; + childBorder = "#d65d0e"; + }; + unfocused = { + border = "#323232"; + background = "#323232"; + text = "#babdb6"; + indicator = "#323232"; + childBorder = "#323232"; + }; + focusedInactive = { + border = "#323232"; + background = "#323232"; + text = "#babdb6"; + indicator = "#323232"; + childBorder = "#323232"; + }; + urgent = { + border = "#000000"; + background = "#000000"; + text = "#eeeeec"; + indicator = "#323232"; + childBorder = "#323232"; + }; + }; + }; + extraConfig = '' + ''; + extraSessionCommands = '' + export MOZ_ENABLE_WAYLAND=1 + ''; + }; + + programs.mako = { + enable = true; + anchor = "top-right"; + defaultTimeout = 5000; + + width = 320; + height = 130; + + backgroundColor = "#282828"; + borderColor = "#3C3836"; + borderRadius = 10; + borderSize = 2; + + font = "JetBrainsMono Nerd Font Regular 9"; + }; + + programs.rofi = { + enable = true; + package = pkgs.rofi-wayland; + theme = "${rofi-theme}"; + font = "JetBrainsMono Nerd Font Regular 9"; + }; + + programs.foot = { + enable = true; + settings = { + main = { + font = "JetBrainsMono Nerd Font:pixelsize=12"; + box-drawings-uses-font-glyphs = "yes"; + pad = "16x16 center"; + }; + + colors = { + background = "282828"; + foreground = "ebdbb2"; + regular0 = "282828"; + regular1 = "cc241d"; + regular2 = "98971a"; + regular3 = "d79921"; + regular4 = "458588"; + regular5 = "b16286"; + regular6 = "689d6a"; + regular7 = "a89984"; + bright0 = "928374"; + bright1 = "fb4934"; + bright2 = "b8bb26"; + bright3 = "fabd2f"; + bright4 = "83a598"; + bright5 = "d3869b"; + bright6 = "8ec07c"; + bright7 = "ebdbb2"; + + selection-foreground = "000000"; + selection-background = "FFFACD"; + urls = "0087BD"; + }; + }; + }; + + home.packages = [ + pkgs.wl-clipboard + ]; +} + diff --git a/user/configs/sway/waybar.nix b/user/configs/sway/waybar.nix new file mode 100644 index 0000000..2013432 --- /dev/null +++ b/user/configs/sway/waybar.nix @@ -0,0 +1,141 @@ +{ config, pkgs, ... }: +let + + ds-battery = pkgs.writeShellScriptBin "ds-battery.sh" + '' + ds_capacity_file="/sys/class/power_supply/ps-controller-battery-4c:b9:9b:74:ae:31/capacity" + ds_status_file="/sys/class/power_supply/ps-controller-battery-4c:b9:9b:74:ae:31/status" + + while true; do + if [[ -f $ds_capacity_file ]]; then + charge=$(<"$ds_capacity_file") + if [[ $(<"$ds_status_file") == "Charging" ]]; then + echo "{\"class\":\"charging\",\"text\":\" Charging: $charge%\",\"tooltip\":\"Charging:\n$charge%\"}" + else + echo "{\"class\":\"discharging\",\"text\":\" $charge%\",\"tooltip\":\"Battery:\\n$charge%\"}" + fi + else + echo "{\"class\":\"not_connected\",\"text\":\"\"}" + fi + sleep 1 + done + ''; + +in +{ + programs.waybar = { + enable = true; + settings = [{ + layer = "top"; + position = "top"; + height = 32; + + modules-left = [ "custom/blank" "sway/workspaces" "sway/mode" ]; + modules-center = [ "sway/window" ]; + modules-right = [ "custom/ds-battery" "pulseaudio" "mpd" "tray" "custom/blank" "clock" "custom/blank" ]; + + "sway/mode" = { + format = " {}"; + }; + "sway/window" = { + icon = false; + icon-size = 16; + }; + + "clock" = { + format = "{:%a %d. %B %H:%M}"; + }; + + "pulseaudio" = { + scroll-step = 5; + format = "{icon} {volume}%"; + format-icons = [ "" "" "墳" "" ]; + }; + + "tray" = { + icon-size = 16; + spacing = 10; + }; + "mpd" = { + format = "{stateIcon} {artist} - {title} {elapsedTime:%M:%S}/{totalTime:%M:%S}"; + format-stopped = "栗 stopped"; + state-icons = { + playing = ""; + paused = ""; + }; + }; + + "custom/ds-battery" = { + return-type = "json"; + exec = "${ds-battery}/bin/ds-battery.sh"; + escape = "true"; + }; + "custom/blank" = { + format = " "; + }; + + }]; + style = '' + @define-color foreground #EBDBB2; + @define-color background #282828; + @define-color box-bg #3C3836; + + * { + font-family: JetBrainsMono Nerd Font; + font-size: 9pt; + } + + window#waybar { + background: @background; + color: @foreground; + border-bottom: 1px solid @box-bg; + } + + #pulseaudio, #mpd, #custom-waybar-mpris, #custom-ds-battery, #window, #keyboard-state { + background: @box-bg; + padding: 0 10px 0 10px; + margin: 5px 10px 5px 0; + } + + window#waybar.empty #window { + background: @background; + } + + #tray, #clock { + background: @box-bg; + padding: 0 10px 0 10px; + margin: 5px 0 5px 0; + } + + #clock { + margin: 5px 0 5px 0; + } + + #workspaces { + background: @box-bg; + color: @foreground; + margin: 5px 0 5px 0; + } + + #workspaces button { + border-radius: 0; + color: @foreground; + background: @background; + padding: 0 5px; + } + + #workspaces button.focused { + border-radius: 0; + color: @foreground; + background: @box-bg; + font-weight: bold; + } + + #workspaces button.unfocused { + border-radius: 0; + color: @foreground; + background: @background; + } + ''; + }; +} diff --git a/user/home.nix b/user/home.nix new file mode 100644 index 0000000..6d448bc --- /dev/null +++ b/user/home.nix @@ -0,0 +1,101 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./configs/beets/beets.nix + ./configs/kakoune/kakoune.nix + ./configs/sway/sway.nix + ./configs/fish/fish.nix + ./configs/mpd/mpd.nix + ./configs/mpv/mpv.nix + ./configs/firefox/firefox.nix + ]; + + # Home Manager needs a bit of information about you and the + # paths it should manage. + home.username = "manuel"; + home.homeDirectory = "/home/manuel"; + home.packages = [ + pkgs.appimage-run + pkgs.bottles + pkgs.discord + pkgs.firefox + pkgs.nerdfonts + pkgs.noto-fonts-cjk-sans + pkgs.noto-fonts-cjk-serif + pkgs.pass + pkgs.pavucontrol + pkgs.polymc + pkgs.steam + pkgs.thunderbird + pkgs.twemoji-color-font + pkgs.xivlauncher + ]; + + home.sessionVariables = { + EDITOR = "kak"; + GTK_USE_PORTAL = "1"; + }; + + fonts.fontconfig.enable = true; + + services.gpg-agent = { + enable = true; + }; + + services.udiskie.enable = true; + + services.kdeconnect = { + enable = true; + indicator = true; + }; + + services.gammastep = { + enable = true; + provider = "geoclue2"; + }; + + gtk = { + enable = true; + theme = { + package = pkgs.gruvbox-dark-gtk; + name = "gruvbox-dark-gtk"; + }; + font = { + name = "JetBrainsMono Nerd Font"; + size = 9; + }; + iconTheme = { + package = pkgs.gruvbox-dark-icons-gtk; + name = "oomox-gruvbox-dark"; + }; + }; + + programs.git = { + enable = true; + userName = "Varris"; + userEmail = "varris@posteo.net"; + }; + + programs.fzf = { + enable = true; + enableFishIntegration = true; + }; + + services.gnome-keyring.enable = true; + + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + # + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + home.stateVersion = "22.05"; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + nixpkgs.config.allowUnfree = true; +} diff --git a/user/nixos/configuration.nix b/user/nixos/configuration.nix new file mode 100644 index 0000000..d628332 --- /dev/null +++ b/user/nixos/configuration.nix @@ -0,0 +1,163 @@ +# 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 + ]; + + nixpkgs.config.allowUnfree = true; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot = { + enable = true; + configurationLimit = 10; + }; + + boot.loader.efi.canTouchEfiVariables = true; + + boot.initrd.availableKernelModules = [ "amdgpu" ]; + boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelModules = [ "i2c-dev" "i2c-piix4" ]; + + networking.hostName = "terra"; # Define your hostname. + + # Set your time zone. + time.timeZone = "Europe/Vienna"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + #keyMap = "us-intl"; + useXkbConfig = true; # use xkbOptions in tty. + }; + + hardware.opengl = { + enable = true; + extraPackages = [ + pkgs.libvdpau-va-gl + ]; + + driSupport = true; + driSupport32Bit = true; + }; + + hardware.steam-hardware.enable = true; + + hardware.bluetooth.enable = true; + + # Enable sound. + sound.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + security.doas.enable = true; + security.sudo.enable = false; + + security.doas.extraRules = [{ + users = [ "manuel" ]; + keepEnv = true; + persist = true; + }]; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.manuel = { + isNormalUser = true; + extraGroups = [ "wheel" "audio" "video" "games" "input" "geoclue" ]; # Enable ‘sudo’ for the user. + shell = pkgs.fish; + packages = with pkgs; [ + ]; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + links2 + ripgrep + fd + htop + openrgb + ]; + + # 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; + + services.udev.packages = [ pkgs.openrgb ]; + + programs.dconf.enable = true; + + services.geoclue2 = { + enable = true; + appConfig."gammastep".isAllowed = true; + appConfig."gammastep".isSystem = false; + }; + + services.gnome.gnome-keyring.enable = true; + xdg.portal = { + enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-wlr + ]; + }; + + services.openssh = { + enable = true; + }; + + + nixpkgs.config.packageOverrides = pkgs: { + nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { + inherit pkgs; + }; + }; + + nix.gc = { + persistent = true; + automatic = true; + }; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # 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 = "22.05"; # Did you read the comment? + +} + diff --git a/user/nixos/hardware-configuration.nix b/user/nixos/hardware-configuration.nix new file mode 100644 index 0000000..f4f2e08 --- /dev/null +++ b/user/nixos/hardware-configuration.nix @@ -0,0 +1,62 @@ +# 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" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/0981f787-9cb2-495e-95d5-611e0de24d85"; + fsType = "btrfs"; + options = [ "subvol=@nixos-root" "compress-force=zstd" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/1AC9-E1AD"; + fsType = "vfat"; + }; + + fileSystems."/mnt/btrfs" = + { device = "/dev/disk/by-uuid/0981f787-9cb2-495e-95d5-611e0de24d85"; + fsType = "btrfs"; + options = [ "subvol=@nixos-root" ]; + }; + + fileSystems."/mnt/hdd" = + { device = "/dev/disk/by-uuid/beccaf7e-9c7e-4c04-959b-52f1e0375491"; + fsType = "ext4"; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/d94babc9-ef09-43bb-949d-ed477ff4f4c2"; + fsType = "ext4"; + }; + + fileSystems."/opt/games" = + { device = "/dev/disk/by-uuid/0981f787-9cb2-495e-95d5-611e0de24d85"; + fsType = "btrfs"; + options = [ "subvol=@steamgames" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/b7ec8c05-2a36-4b35-99fc-866e97c6330b"; } + ]; + + # 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.enp8s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true; + + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/user/overlays.nix b/user/overlays.nix new file mode 100644 index 0000000..f69fd2c --- /dev/null +++ b/user/overlays.nix @@ -0,0 +1,13 @@ +[ + ( + self: super: + { + nerdfonts = super.nerdfonts.override { + fonts = [ + "JetBrainsMono" + ]; + }; + } + ) +] +