diff options
| author | Petri Hienonen <petri.hienonen@gmail.com> | 2024-05-23 09:44:38 +0300 |
|---|---|---|
| committer | Petri Hienonen <petri.hienonen@gmail.com> | 2024-05-23 09:44:38 +0300 |
| commit | 75c2af4aedd2ac5c2cfc74b346625fa4b265541d (patch) | |
| tree | f0a58a6c699dc305ae8f506a806761ad7e57029c | |
| download | nixos-75c2af4aedd2ac5c2cfc74b346625fa4b265541d.tar.zst | |
Nixos
| -rw-r--r-- | flake.lock | 81 | ||||
| -rw-r--r-- | flake.nix | 40 | ||||
| -rw-r--r-- | home/alacritty/default.nix | 12 | ||||
| -rw-r--r-- | home/default.nix | 71 | ||||
| -rw-r--r-- | home/dunst/default.nix | 75 | ||||
| -rw-r--r-- | home/fish/default.nix | 14 | ||||
| -rw-r--r-- | home/git/default.nix | 11 | ||||
| -rw-r--r-- | home/helix/default.nix | 35 | ||||
| -rw-r--r-- | home/hyprland/default.nix | 66 | ||||
| -rw-r--r-- | home/hyprland/hyprpaper.conf | 2 | ||||
| -rw-r--r-- | home/lock/default.nix | 62 | ||||
| -rw-r--r-- | home/waybar/config | 160 | ||||
| -rw-r--r-- | home/waybar/default.nix | 6 | ||||
| -rw-r--r-- | home/waybar/style.css | 258 | ||||
| -rw-r--r-- | hosts/saarni/default.nix | 250 | ||||
| -rw-r--r-- | hosts/saarni/hardware-configuration.nix | 37 |
16 files changed, 1180 insertions, 0 deletions
diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..088625d --- /dev/null +++ b/flake.lock @@ -0,0 +1,81 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1715381426, + "narHash": "sha256-wPuqrAQGdv3ISs74nJfGb+Yprm23U/rFpcHFFNWgM94=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "ab5542e9dbd13d0100f8baae2bc2d68af901f4b4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.11", + "repo": "home-manager", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1716173274, + "narHash": "sha256-FC21Bn4m6ctajMjiUof30awPBH/7WjD0M5yqrWepZbY=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "d9e0b26202fd500cf3e79f73653cce7f7d541191", + "type": "github" + }, + "original": { + "id": "nixos-hardware", + "type": "indirect" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1716218643, + "narHash": "sha256-i/E7gzQybvcGAYDRGDl39WL6yVk30Je/NXypBz6/nmM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a8695cbd09a7ecf3376bd62c798b9864d20f86ee", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1716137900, + "narHash": "sha256-sowPU+tLQv8GlqtVtsXioTKeaQvlMz/pefcdwg8MvfM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6c0b7a92c30122196a761b440ac0d46d3d9954f1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..44581ae --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +{ + description = "Petri's system"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-23.11"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager/release-23.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, home-manager, nixos-hardware, ... }: + let + inherit (self) outputs; + vars = { + user = "petri"; + name = "Petri Hienonen"; + email= "petri.hienonen@gmail.com"; + location = "$HOME/.nix"; + terminal = "alacritty"; + editor = "helix"; + shell = "fish"; + }; + in { + nixosConfigurations = { + saarni = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = {inherit inputs outputs vars nixpkgs-unstable; }; + modules = [ + ./hosts/saarni + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + } + ]; + }; + }; + }; +} + diff --git a/home/alacritty/default.nix b/home/alacritty/default.nix new file mode 100644 index 0000000..5bed57a --- /dev/null +++ b/home/alacritty/default.nix @@ -0,0 +1,12 @@ +{ vars, pkgs, ... }: + +{ + programs.alacritty = { + enable = true; + settings = { + selection = { + save_to_clipboard = true; + }; + }; + }; +} diff --git a/home/default.nix b/home/default.nix new file mode 100644 index 0000000..15054ab --- /dev/null +++ b/home/default.nix @@ -0,0 +1,71 @@ +{ inputs, lib, config, vars, pkgs, ... }: + +{ + imports = [ + ./hyprland + ./waybar + ./dunst + ./lock + ./git + ./helix + ./fish + ./alacritty + ]; + + home = { + username = "${vars.user}"; + sessionVariables = { + EDITOR = "${pkgs.helix}/bin/hx"; + PAGER = "${pkgs.moar}/bin/moar"; + DEFAULT_BROWSER = "${pkgs.firefox}/bin/firefox"; + NIXOS_OZONE_WL = "1"; + MOZ_USE_XINPUT2 = "1"; + MOZ_ENABLE_WAYLAND = "1"; + GDK_SCALE = "1"; + CURSOR_SIZE = "16"; + }; + pointerCursor = { + package = pkgs.bibata-cursors; + gtk.enable = true; + name = "Bibata-Modern-Ice"; + size = 22; + }; + homeDirectory = "/home/${vars.user}"; + packages = with pkgs; [ + clang + gnumake + biome + go + mpv + brightnessctl + bluez + element-desktop-wayland + yamlfmt + dprint + nodePackages.jsdoc + nodePackages.typescript-language-server + alacritty + pavucontrol + moar + zathura + grim + slurp + fd + wl-clipboard + hyprpaper + waybar + wofi + dunst + ]; + }; + + xdg.mimeApps = { + enable = true; + defaultApplications = { + "application/pdf" = "zathura.desktop"; + }; + }; + programs.home-manager.enable = true; + systemd.user.startServices = "sd-switch"; + home.stateVersion = "23.11"; +} diff --git a/home/dunst/default.nix b/home/dunst/default.nix new file mode 100644 index 0000000..8a5f4ad --- /dev/null +++ b/home/dunst/default.nix @@ -0,0 +1,75 @@ +{ config, pkgs, ... }: { + services.dunst = { + enable = true; + settings = { + global = { + alignment = "center"; + allow_markup = true; + browser = + "${config.programs.firefox.package}/bin/firefox -new-tab"; + bounce_freq = 0; + corner_radius = 5; + dmenu = "${pkgs.rofi}/bin/rofi -dmenu"; + follow = "mouse"; + font = "Fira Code 10"; + format = '' + <b>%s</b> + %b + %p''; + frame_color = "#555555"; + frame_width = 2; + geometry = "400-30+30"; + horizontal_padding = 15; + icon_position = "off"; + idle_threshold = 120; + ignore_newline = false; + indicate_hidden = true; + line_height = 0; + markup = "full"; + max_icon_size = 130; + padding = 15; + separator_color = "frame"; + separator_height = 2; + show_age_threshold = 60; + shrink = true; + sort = true; + startup_notification = false; + sticky_history = true; + transparency = 0; + word_wrap = true; + }; + + frame = { + width = 2; + color = "#83a598"; + }; + + urgency_low = { + frame_color = "#fabd2f"; + background = "#282828"; + foreground = "#ebdbb2"; + timeout = 5; + }; + + urgency_normal = { + background = "#282828"; + foreground = "#ebdbb2"; + timeout = 15; + }; + + urgency_critical = { + background = "#282828"; + foreground = "#ebdbb2"; + frame_color = "#CC241D"; + timeout = 0; + }; + + shortcuts = { + close = "ctrl+space"; + close_all = "ctrl+shift+space"; + history = "ctrl+grave"; + context = "ctrl+shift+period"; + }; + }; + }; +} diff --git a/home/fish/default.nix b/home/fish/default.nix new file mode 100644 index 0000000..af2a377 --- /dev/null +++ b/home/fish/default.nix @@ -0,0 +1,14 @@ +{ vars, pkgs, ... }: + +{ + programs.fish = { + enable = true; + interactiveShellInit = '' + function fish_greeting + if status is-interactive + fastfetch + end + end + ''; + }; +} diff --git a/home/git/default.nix b/home/git/default.nix new file mode 100644 index 0000000..d3c605e --- /dev/null +++ b/home/git/default.nix @@ -0,0 +1,11 @@ +{pkgs, ...}:{ + programs.git = { + enable = true; + userName = "Petri Hienonen"; + userEmail = "petri.hienonen@gmail.com"; + extraConfig = { + init.defaultBranch = "master"; + credential.helper = "store"; + }; + }; +} diff --git a/home/helix/default.nix b/home/helix/default.nix new file mode 100644 index 0000000..2438703 --- /dev/null +++ b/home/helix/default.nix @@ -0,0 +1,35 @@ +{ + inputs, + pkgs, + ... +}: { + programs.helix = { + enable = true; + settings = { + theme = "catppuccin_mocha"; + editor = { + color-modes = true; + cursorline = true; + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + indent-guides.render = true; + lsp.display-inlay-hints = true; + statusline.center = ["position-percentage"]; + true-color = true; + whitespace.characters = { + newline = "↴"; + tab = "⇥"; + }; + }; + + keys.normal.space.u = { + f = ":format"; # format using LSP formatter + w = ":set whitespace.render all"; + W = ":set whitespace.render none"; + }; + }; + }; +} diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix new file mode 100644 index 0000000..e00e794 --- /dev/null +++ b/home/hyprland/default.nix @@ -0,0 +1,66 @@ +{ + + wayland.windowManager.hyprland = { + enable = true; + systemd.enable = true; + settings = { + "exec-once" = "waybar & hyprpaper"; + "monitor" = ",preferred,auto,1"; + input = { + kb_layout = "fi"; + repeat_delay = 280; + repeat_rate = 100; + }; + + "$mainMod" = "SUPER"; + bind = [ + "$mainMod, Return, exec, alacritty" + "$mainMod, d, exec, wofi --show drun" + "$mainMod, B, exec, firefox" + "$mainMod, F, fullscreen" + "$mainMod, C, killactive," + + # Move focus with mainMod + arrow keys + "$mainMod, left, movefocus, l" + "$mainMod, right, movefocus, r" + "$mainMod, up, movefocus, u" + "$mainMod, down, movefocus, d" + "$mainMod, H, movefocus, l" + "$mainMod, L, movefocus, r" + "$mainMod, K, movefocus, u" + "$mainMod, J, movefocus, d" + + # Switch workspaces with mainMod + [0-9] + "$mainMod, 1, workspace, 1" + "$mainMod, 2, workspace, 2" + "$mainMod, 3, workspace, 3" + "$mainMod, 4, workspace, 4" + "$mainMod, 5, workspace, 5" + "$mainMod, 6, workspace, 6" + "$mainMod, 7, workspace, 7" + "$mainMod, 8, workspace, 8" + "$mainMod, 9, workspace, 9" + "$mainMod, 0, workspace, 10" + + # Move active window to a workspace with mainMod + SHIFT + [0-9] + "$mainMod SHIFT, 1, movetoworkspace, 1" + "$mainMod SHIFT, 2, movetoworkspace, 2" + "$mainMod SHIFT, 3, movetoworkspace, 3" + "$mainMod SHIFT, 4, movetoworkspace, 4" + "$mainMod SHIFT, 5, movetoworkspace, 5" + "$mainMod SHIFT, 6, movetoworkspace, 6" + "$mainMod SHIFT, 7, movetoworkspace, 7" + "$mainMod SHIFT, 8, movetoworkspace, 8" + "$mainMod SHIFT, 9, movetoworkspace, 9" + "$mainMod SHIFT, 0, movetoworkspace, 10" + ]; + bindm = [ + # Move/resize windows with mainMod + LMB/RMB and dragging + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + }; + }; + + home.file.".config/hypr/hyprpaper.conf".source = ./hyprpaper.conf; +} diff --git a/home/hyprland/hyprpaper.conf b/home/hyprland/hyprpaper.conf new file mode 100644 index 0000000..67a04ed --- /dev/null +++ b/home/hyprland/hyprpaper.conf @@ -0,0 +1,2 @@ +preload = ~/wallpapers/metsapalo.jpg +wallpaper = eDP-1,~/wallpapers/metsapalo.jpg diff --git a/home/lock/default.nix b/home/lock/default.nix new file mode 100644 index 0000000..188d4b7 --- /dev/null +++ b/home/lock/default.nix @@ -0,0 +1,62 @@ +{ pkgs, ... }: + +{ + programs.swaylock = { + enable = true; + + package = pkgs.swaylock-effects; + settings = { + ignore-empty-password = true; + disable-caps-lock-text = true; + # font = "MonaspiceAr Nerd Font"; + grace = 3; + + clock = true; + timestr = "%R"; + datestr = "%a, %e of %B"; + + fade-in = "0.2"; + + effect-blur = "10x2"; + effect-scale = "0.1"; + + indicator = true; + indicator-radius = 240; + indicator-thickness = 20; + indicator-caps-lock = true; + + key-hl-color = "#8aadf4"; + bs-hl-color = "#ed8796"; + caps-lock-key-hl-color = "#f5a97f"; + caps-lock-bs-hl-color = "#ed8796"; + + separator-color = "#181926"; + + inside-color = "#24273a"; + inside-clear-color = "#24273a"; + inside-caps-lock-color = "#24273a"; + inside-ver-color = "#24273a"; + inside-wrong-color = "#24273a"; + + ring-color = "#1e2030"; + ring-clear-color = "#8aadf4"; + ring-caps-lock-color = "231f20D9"; + ring-ver-color = "#1e2030"; + ring-wrong-color = "#ed8796"; + + line-color = "#8aadf4"; + line-clear-color = "#8aadf4"; + line-caps-lock-color = "#f5a97f"; + line-ver-color = "#181926"; + line-wrong-color = "#ed8796"; + + text-color = "#8aadf4"; + text-clear-color = "#24273a"; + text-caps-lock-color = "#f5a97f"; + text-ver-color = "#24273a"; + text-wrong-color = "#24273a"; + + debug = true; + }; + }; +} diff --git a/home/waybar/config b/home/waybar/config new file mode 100644 index 0000000..779a9a1 --- /dev/null +++ b/home/waybar/config @@ -0,0 +1,160 @@ +{ + // ------------------------------------------------------------------------- + // Global configuration + // ------------------------------------------------------------------------- + "ipc": true, + "position": "bottom", + "layer": "top", + "height": 30, + "mode": "dock", + "modules-left": [ + "hyprland/hide", + "hyprland/mode", + "hyprland/workspaces", + "disk", + "memory", + "cpu", + "temperature", + "custom/spotify" + ], + "modules-center": [ + "hyprland/window" + ], + "modules-right": [ + "pulseaudio", + "battery", + "backlight", + "clock#date", + "clock#time", + "network", + "tray" + ], + // ------------------------------------------------------------------------- + // Modules + // ------------------------------------------------------------------------- + "hyprland/hide": { + "hide-on-startup": true + }, + "battery": { + "interval": 1, + "states": { + "low": 30, + "warning": 15, + "critical": 5 + }, + "format": "{icon} {capacity}%", + "format-discharging": "{icon} {capacity}%", + "format-charging": " {capacity}%", + "tooltip-format": "{time} left", + "format-icons": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + ], + "tooltip": true, + "full-at": 95 + }, + "clock#time": { + "interval": 10, + "format": "{:%H:%M}", + "tooltip": false + }, + "clock#date": { + "interval": 60, + "format": "{:%A, %e %b %Y}", + "tooltip": true + }, + "cpu": { + "interval": 2, + "tooltip": true, + "format": " {usage}%", + "states": { + "low": 0, + "normal": 20, + "warning": 70, + "critical": 90 + } + }, + "memory": { + "interval": 5, + "format": " {used:0.1f}G", + "tooltip-format": "{used:0.1f}G / {total:0.1f}G", + "states": { + "warning": 70, + "critical": 90 + } + }, + "network": { + "interval": 1, + "format-wifi": "{icon}", + "format-disconnected": "", + "format-icons": [ + "", + "", + "", + "", + "" + ], + "tooltip-format": "{essid} ({signalStrength}%) - {ifname} - {ipaddr} - {bandwidthDownBits} {bandwidthUpBits}", + "tooltip": true, + }, + "hyprland/mode": { + "format": "<span style=\"italic\"> {}</span>", + "tooltip": false + }, + "hyprland/window": { + "format": "{}", + "max-length": 60, + "tooltip": true + }, + "hyprland/workspaces": { + "all-outputs": true, + "format": "{icon}" + }, + "pulseaudio": { + "scroll-step": 1, + "format": "{icon} {volume}%", + "format-muted": "", + "format-bluetooth": " {icon} {volume}%", + "format-bluetooth-muted": "", + "on-click": "pulseaudio-control togmute", + "on-click-middle": "pulseaudio-control --sink-blacklist 'alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_3__sink,alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_4__sink,alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_5__sink' next-sink" + }, + "temperature": { + "critical-threshold": 90, + "interval": 5, + "format": "{icon} {temperatureC}°C", + "format-icons": [ + "", + "", + "", + "", + "" + ], + "tooltip": true + }, + "disk": { + "interval": 10, + "format": "{free}" + }, + "backlight": { + "device": "intel_backlight", + "format": "{icon} {percent}", + "format-icons": [ + "" + ], + "on-scroll-up": "brightnessctl set +1% -e 6 -n 1", + "on-scroll-down": "brightnessctl set 1%- -e 6 -n 1" + }, + "tray": { + "icon-size": 24, + "spacing": 10 + } +} diff --git a/home/waybar/default.nix b/home/waybar/default.nix new file mode 100644 index 0000000..bfe3c39 --- /dev/null +++ b/home/waybar/default.nix @@ -0,0 +1,6 @@ +{ + programs.waybar = { enable = true; }; + + home.file."./config/waybar/config".source = ./config; + home.file."./config/waybar/style.css".source = ./style.css; +} diff --git a/home/waybar/style.css b/home/waybar/style.css new file mode 100644 index 0000000..8fe60c7 --- /dev/null +++ b/home/waybar/style.css @@ -0,0 +1,258 @@ +@keyframes blink-low { + 70% { + color: @foreground; + } + + to { + color: @foreground; + background-color: #744E0D; + } +} + +@keyframes blink-warning { + 70% { + color: @foreground; + } + + to { + color: @foreground; + background-color: @warning; + } +} + +@keyframes blink-critical { + 70% { + color: @foreground; + } + + to { + color: @foreground; + background-color: @critical; + } +} + + +/* ----------------------------------------------------------------------------- + * Styles + * -------------------------------------------------------------------------- */ + +/* Nord */ +/* Gruvbox */ +@define-color foreground #D4BE98; +@define-color background #202020; +@define-color backgroundlight #2A2A2A; +@define-color mode #a89984; +@define-color workspaces #458588; +@define-color workspacesfocused #83a598; +@define-color sound #E78A4E; +@define-color network #A9B665; +@define-color memory #7DAEA3; +@define-color cpu #8EC07C; +@define-color layout #689d6a; +@define-color battery #A9B665; +@define-color date #282828; +@define-color time #ebdbb2; +@define-color warning #DE655E; +@define-color critical #FB4934; +@define-color temp #A9B665; + +/* Reset all styles */ +* { + border: none; + border-radius: 0; + min-height: 0; + margin: 0; + padding: 0; +} + +/* The whole bar */ +#waybar { + background: @background; + color: @foreground; + font-family: Sarasa Term K, JetBrainsMono Nerd Font, Material Design Icons, unifont, Fira Code, Terminus, Siji; + font-size: 12pt; + font-weight: bold; +} + +/* Each module */ +#battery, +#clock, +#cpu, +#memory, +#custom-clockify, +#custom-spotify, +#backlight, +#mode, +#network, +#disk, +#pulseaudio, +#workspaces, +#temperature { + padding: 0 10px; + margin: 5px 5px; + border-radius: 10em; + background-color: @backgroundlight; + color: @foreground; +} + +/* Each module that should blink */ +#mode, +#memory, +#temperature, +#battery { + animation-timing-function: ease-out; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +/* Each critical module */ +#memory.critical, +#cpu.critical, +#temperature.critical, +#battery.critical { + color: @critical; +} + +/* Each critical that should blink */ +#mode, +#memory.critical, +#temperature.critical, +#battery.critical.discharging { + animation-name: blink-critical; + animation-duration: 2s; +} + +/* Each warning */ +#network.disconnected, +#memory.warning, +#cpu.warning, +#temperature.warning, +#battery.warning { + color: @warning; +} + +#cpu.low { + color: @memory; +} + +/* Each warning that should blink */ +#battery.warning.discharging { + animation-name: blink-warning; + animation-duration: 3s; +} + +#battery.low.discharging { + animation-name: blink-low; + animation-duration: 5s; +} + +/* And now modules themselves in their respective order */ + +#mode { /* Shown current Sway mode (resize etc.) */ + color: @foreground; + background: @mode; +} + +/* Workspaces stuff */ +#workspaces { + background: #2A2A2A; +} + +#workspaces button { + padding: 0; + color: #D4BE98; + font-size: 16pt; +} + +#workspaces button.persistent { + color: #3E3E3E; +} + +#workspaces button.visible { + color: #FE8019; +} + +#network { + color: @network; +} + +#disk { + color: #FABD2F; + border-radius: 10em 0 0 10em; + margin-right: 0; +} + +#memory { + color: @memory; + margin-right: 0; + margin-left: 0; + border-radius: 0; +} + +#cpu { + color: @cpu; + margin-right: 0; + margin-left: 0; + border-radius: 0; +} + +#temperature { + color: @temp; + border-radius: 0 10em 10em 0; + margin-left: 0; +} + +#pulseaudio { + color: @sound; + margin-right: 0; + border-radius: 10em 0 0 10em; +} + +#pulseaudio.muted { + color: #3E3E3E; +} + +#battery { + color: @battery; + margin-right: 0; + margin-left: 0; + border-radius: 0; +} + +#backlight { + color: #D3869B; + margin-left: 0; + border-radius: 0 10em 10em 0; +} + +#clock.date { + background: @date; + color: @foreground; + margin-right: 0; + border-radius: 10em 0 0 10em; +} + +#clock.time { + background: @time; + color: @background; + margin-left: 0; + border-radius: 0 10em 10em 0; +} + +#tray { + margin: 0 5px; +} + +tooltip { + color: @foreground; + background-color: @background; + font-weight: 400; + font-family: Fira Code; + margin: 0 10px; + border-radius: 1em; +} + +tooltip label { + color: @foreground; + padding: 0 5px; +} diff --git a/hosts/saarni/default.nix b/hosts/saarni/default.nix new file mode 100644 index 0000000..010a8eb --- /dev/null +++ b/hosts/saarni/default.nix @@ -0,0 +1,250 @@ +# 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’). + +{ inputs, outputs, lib, config, pkgs, vars, ... }: + +{ + imports = [ + ./hardware-configuration.nix + inputs.home-manager.nixosModules.home-manager + ]; + + nix = { + nixPath = [ "/etc/nix/path" ]; + gc = { + automatic = true; + }; + settings = { + auto-optimise-store = true; + experimental-features = "nix-command flakes"; + }; + registry = (lib.mapAttrs (_: flake: { inherit flake; })) + ((lib.filterAttrs (_: lib.isType "flake")) inputs); + }; + nixpkgs.config.allowUnfree = true; + security.rtkit.enable = true; + + home-manager = { + extraSpecialArgs = { inherit inputs outputs vars; }; + users = { ${vars.user} = import ../../home; }; + }; + + powerManagement = { + enable = true; + powertop.enable = true; + }; + + # Bootloader. + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + kernelPackages = pkgs.linuxPackages_latest; + plymouth.enable = true; + kernelParams = [ "quiet" "splash" ]; + }; + + networking = { + nameservers = [ "1.1.1.1#one.one.one.one" "1.0.0.1#one.one.one.one" ]; + hostName = "saarni"; + useNetworkd = true; + wireless.iwd.enable = true; + }; + + systemd = { + watchdog = { + device = "/dev/watchdog"; + runtimeTime = "30s"; + }; + sleep.extraConfig = "HibernateDelaysSec=90m"; + network = { + enable = true; + wait-online.enable = false; + networks = { + "10-lan" = { + matchConfig.Name = "enp0s20f0u9"; + networkConfig.DHCP = "yes"; + }; + "11-lan" = { + matchConfig.Name = "wlan0"; + networkConfig.DHCP = "yes"; + }; + }; + }; + }; + + system.autoUpgrade = { + enable = true; + }; + + sound.enable = true; + + hardware = { + opengl = { + enable = true; + driSupport = true; + extraPackages = with pkgs; [ + intel-media-driver + libvdpau-va-gl + ]; + }; + bluetooth = { + enable = true; + powerOnBoot = true; + }; + }; + + # Set your time zone. + time.timeZone = "Europe/Helsinki"; + + # Select internationalisation properties. + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "fi_FI.UTF-8"; + LC_IDENTIFICATION = "fi_FI.UTF-8"; + LC_MEASUREMENT = "fi_FI.UTF-8"; + LC_MONETARY = "fi_FI.UTF-8"; + LC_NAME = "fi_FI.UTF-8"; + LC_NUMERIC = "fi_FI.UTF-8"; + LC_PAPER = "fi_FI.UTF-8"; + LC_TELEPHONE = "fi_FI.UTF-8"; + LC_TIME = "fi_FI.UTF-8"; + }; + }; + + console.keyMap = "fi"; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.${vars.user} = { + isNormalUser = true; + description = "${vars.name}"; + extraGroups = [ "input" "network" "wheel" ]; + packages = with pkgs; [ ]; + ignoreShellProgramCheck = true; + shell = pkgs.${vars.shell}; + }; + + programs = { + firefox.enable = true; + hyprland.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + mtr.enable = true; + }; + + environment = { + sessionVariables = { + LIBVA_DRIVER_NAME = "iHD"; + }; + systemPackages = with pkgs; [ + fastfetch + vulkan-tools + libva-utils + wget + curl + git + gzip + btop + glxinfo + sqlite + openssh + gnupg + helix + nixfmt + ]; + etc = lib.mapAttrs' (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) config.nix.registry; + }; + + fonts = { + enableDefaultPackages = true; + packages = with pkgs; [ noto-fonts fira-code fira-code-symbols ]; + fontconfig = { + defaultFonts = { + serif = [ "Noto Serif" ]; + sansSerif = [ "Noto Sans" ]; + monospace = [ "Fira Code" ]; + }; + }; + }; + + # List services that you want to enable: + services = { + getty.autologinUser = "petri"; + resolved = { + enable = true; + dnsovertls = "true"; + }; + xserver = { + layout = "fi"; + xkbVariant = "normal"; + }; + pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + }; + openssh.enable = true; + printing.enable = true; + kmscon = { + enable = true; + hwRender = true; + extraOptions = "--xkb-layout=fi"; + }; + blueman.enable = true; + upower.enable = true; + upower.criticalPowerAction = "Hibernate"; + fstrim.enable = false; + thermald.enable = true; + auto-cpufreq.enable = true; + greetd = { + enable = true; + settings = rec { + initial_session = { + command = "${pkgs.hyprland}/bin/Hyprland"; + user = "petri"; + }; + default_session = initial_session; + }; + }; + }; + + xdg.portal = { + enable = true; + xdgOpenUsePortal = true; + extraPortals = [ + pkgs.xdg-desktop-portal-hyprland + pkgs.xdg-desktop-portal-gtk + ]; + wlr = { + enable = true; + settings = { + screencast = { + chooser_type = "simple"; + chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -ro"; + }; + }; + }; + }; + + # 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 = "23.11"; # Did you read the comment? +} diff --git a/hosts/saarni/hardware-configuration.nix b/hosts/saarni/hardware-configuration.nix new file mode 100644 index 0000000..6aef572 --- /dev/null +++ b/hosts/saarni/hardware-configuration.nix @@ -0,0 +1,37 @@ +# 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 = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/3968a07a-5e37-4bdb-9e3a-6c74950fd03d"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/9B7E-3D1B"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [ ]; + + # 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.<interface>.useDHCP`. + # networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} |
