From 743cbd2336c3eab3e86c4f3ddc13b65365f224be Mon Sep 17 00:00:00 2001 From: itsscb Date: Mon, 13 May 2024 23:58:09 +0200 Subject: [PATCH] ch/restores configuration --- configuration.nix | 344 +++++++++++++++++++++++++++++++++++++ hardware-configuration.nix | 42 +++++ home.nix | 309 +++++++++++++++++++++++++++++++++ 3 files changed, 695 insertions(+) create mode 100644 configuration.nix create mode 100644 hardware-configuration.nix create mode 100644 home.nix diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..eb40cbc --- /dev/null +++ b/configuration.nix @@ -0,0 +1,344 @@ +# 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, + inputs, + ... +}: let + sops = builtins.fetchTarball { + url = "https://github.com/Mic92/sops-nix/archive/master.tar.gz"; + sha256 = "1wzm5hs3cda6l7q9ls5nw16bifb00v5kan1xcab57bb5fg6qqnyb"; + }; +in { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + # inputs.home-manager.nixosModules.default + # (import "${home-manager}/nixos") + + (import "${sops}/modules/sops") + # Secrets Manager + # inputs.sops-nix.nixosModules.sops + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + boot.initrd.luks.devices."luks-368f684f-d514-405f-a909-fb4488d19183".device = "/dev/disk/by-uuid/368f684f-d514-405f-a909-fb4488d19183"; + networking.hostName = "scbnb"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + nix.settings.experimental-features = ["nix-command" "flakes"]; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + + + services.displayManager.sddm = { + enable = true; + }; + services.xserver = { + enable = true; + desktopManager.gnome = { + enable = true; + }; + + xkb = { + layout = "us"; + variant = ""; + }; +excludePackages = + (with pkgs; [ + nano + xterm + ]) + ++ (with pkgs.gnome; [ + cheese + gnome-music + epiphany + geary + totem + tali + iagno + hitori + atomix + ]); + + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + + users.groups.fsc = { + gid = 1010; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.itsscb = { + isNormalUser = true; + uid = 1000; + description = "itsscb"; + extraGroups = ["networkmanager" "wheel" "fsc"]; + packages = with pkgs; [ + ]; + }; + users.users."k.sc" = { + isNormalUser = true; + uid = 1001; + description = "k.sc"; + extraGroups = ["networkmanager" "fsc"]; + packages = with pkgs; [ + ]; + }; + + fonts.packages = with pkgs; [ + nerdfonts + ]; + + programs = { + steam = { + enable = true; + }; + + hyprland = { + enable = true; + xwayland.enable = true; + }; + + chromium = { + enable = true; + homepageLocation = "https://start.duckduckgo.com"; + extraOpts = { + syncDisabled = true; + BrowserSignin = 0; + PasswordManagerEnabled = false; + SpellcheckEnabled = false; + }; + defaultSearchProviderEnabled = true; + defaultSearchProviderSearchURL = "https://start.duckduckgo.com/?q={searchTerms}"; + }; + }; + + environment = { + sessionVariables = { + WLR_NO_HARDWARE_CURSORS = "1"; + NIXOS_OZONE_WL = "1"; + }; + + variables = { + EDITOR = "hx"; + }; + }; + + hardware = { + opengl.enable = true; + nvidia.modesetting.enable = true; + }; + + home-manager = { + # extraSpecialArgs = {inherit inputs;}; + backupFileExtension = "backup"; + users = { + "itsscb" = (import ./home.nix); + "root" = { + home.stateVersion = "23.11"; + home.file.".config/helix".source = ./dotfiles/helix; + programs.bash = { + enable = true; + shellAliases = { + ls = "eza -la --git"; + grep = "rg"; + cat = "bat"; + }; + }; + }; + }; + }; + + nixpkgs.config.allowUnfree = true; + + xdg.portal.enable = true; + + environment.systemPackages = with pkgs; [ + # nix specific + ## Secrets Manager + sops + + ## nix formatter + alejandra + + # Encryption + age + + # Hyprland / Window Manager + xdg-desktop-portal-gtk + xdg-desktop-portal-hyprland + + ## App Starter + rofi-wayland + + ## Network Settings + networkmanagerapplet + + # Audio Settings + pavucontrol + + ## Bluetooth Settings + blueman + + ## Lockscreen + hyprlock + + ## Top Bar + waybar + ( + waybar.overrideAttrs (oldAttrs: { + mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"]; + }) + ) + + ## ??? + dunst + + ## Notification Daemone (?) + libnotify + + ## File Manager + # dolphin + cinnamon.nemo + breeze-icons + + ## ??? + swww + + # Clipboard Manager + xclip + + # Image Manipulation + inkscape + gimp + + # Video + ffmpeg + vlc + + # Music + spotify + + # Terminal + alacritty + + ## 'ls' replacement + eza + + ## 'cat' replacement + bat + + ## 'grep' replacement + ripgrep + + ## 'find' replacement + fd + + ## Default Tools + curl + gitFull # git + broot # file manager + yazi # file manager + jq # json tool + poppler # ??? + fzf # ??? + + # Editor + helix + + # Mail Client + thunderbird + ]; + + sops.validateSopsFiles = false; + sops.defaultSopsFile = "/etc/nixos/secrets/secrets.yaml"; + sops.defaultSopsFormat = "yaml"; + sops.age.keyFile = "/home/itsscb/.config/sops/age/keys.txt"; + + sops.secrets."nas" = { + owner = config.users.users.itsscb.name; + }; + sops.secrets."git" = { + owner = config.users.users.itsscb.name; + path = "${config.users.users.itsscb.home}/.config/git/credentials"; + }; + + fileSystems = { + "/mnt/home" = { + device = "//192.168.128.2/Cloud_Privat"; + fsType = "cifs"; + label = "HOME"; + options = let + automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user"; + in ["${automount_opts},credentials=${config.sops.secrets."nas".path},uid=1000,gid=1010"]; + }; + "/mnt/music" = { + device = "//192.168.128.2/music"; + fsType = "cifs"; + label = "HOME"; + options = let + automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user"; + in ["${automount_opts},credentials=${config.sops.secrets."nas".path},uid=1000,gid=1010"]; + }; + "/mnt/scan" = { + device = "//192.168.128.2/scan"; + fsType = "cifs"; + options = let + automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user"; + in ["${automount_opts},credentials=${config.sops.secrets."nas".path},uid=1000,gid=1010"]; + }; + "/mnt/shared" = { + device = "//192.168.128.2/shared"; + fsType = "cifs"; + options = let + automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user"; + in ["${automount_opts},credentials=${config.sops.secrets."nas".path},uid=1000,gid=1010"]; + }; + }; + + programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ + # Add any missing dynamic libraries for unpackaged + # programs here, NOT in environment.systemPackages + ]; + + system.stateVersion = "23.11"; # Did you read the comment? +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..fc6ba7a --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,42 @@ +# 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" "ahci" "nvme" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/0ae6401b-0d05-468e-acff-76e7a5493d5e"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-df78403b-c8cf-406a-be4c-0b3af8697930".device = "/dev/disk/by-uuid/df78403b-c8cf-406a-be4c-0b3af8697930"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/D6DD-9639"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/c5d6dba0-2418-4ba2-b7f0-af63e39e4a80"; } + ]; + + # 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.wlp59s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..1822154 --- /dev/null +++ b/home.nix @@ -0,0 +1,309 @@ +{ + config, + pkgs, + inputs, + ... +}: +{ + home.username = "itsscb"; + home.homeDirectory = "/home/itsscb"; + + home.stateVersion = "23.11"; # Please read the comment before changing. + + gtk = { + enable = true; + theme = { + package = pkgs.flat-remix-gtk; + name = "Flat-Remix-GTK-Grey-Darkest"; + }; + + iconTheme = { + package = pkgs.gnome.adwaita-icon-theme; + name = "Adwaita"; + }; + + font = { + name = "FiraCode"; + size = 10; + }; + }; + + programs = { + helix = { + enable = true; + defaultEditor = true; + settings = { + theme = "onedark"; + editor = { + line-number = "relative"; + bufferline = "multiple"; + auto-completion = true; + auto-save = true; + auto-format = true; + cursorline = true; + gutters = [ + "diff" + "diagnostics" + "line-numbers" + "spacer" + ]; + text-width = 80; + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + + statusline = { + left = [ + "mode" + "spinner" + "file-modification-indicator" + "read-only-indicator" + ]; + + center = ["file-name"]; + + right = [ + "diagnostics" + "register" + "selections" + "position" + "file-encoding" + "file-line-ending" + "file-type" + ]; + + separator = "|"; + }; + + lsp = { + enable = true; + auto-signature-help = true; + display-messages = true; + display-inlay-hints = true; + }; + + indent-guides = { + render = true; + character = "┊"; + skip-levels = 1; + }; + }; + keys.insert.j.k = "normal_mode"; + keys.insert."C-c" = "normal_mode"; + + keys.normal.g.a = "code_action"; + keys.normal.backspace = { + r = ":run-shell-command cargo run"; + t = ":run-shell-command cargo test"; + b = ":run-shell-command cargo build"; + c = ":run-shell-command cargo check"; + }; + }; + }; + + bash = { + enable = true; + shellAliases = { + ls = "eza -la --git"; + grep = "rg"; + cat = "bat"; + }; + }; + + git = { + enable = true; + userName = "itsscb"; + userEmail = "dev@itsscb.de"; + extraConfig = { + credential.helper = "store"; + }; + }; + + vim = { + enable = true; + }; + + chromium = { + enable = true; + commandLineArgs = [ + "--disable-default-apps" + "--homepage https://start.duckduckgo.com" + "--start-maximized" + "--enable-features=WebContentsForceDark" + "--force-dark-mode" + ]; + }; + }; + + dconf = { + enable = true; + settings."org/gnome/desktop/interface".color-scheme = "prefer-dark"; + settings."org/gnome/desktop/screensaver" = { + picture-uri = "file:///etc/nixos/dotfiles/hypr/rust.png"; + picture-uri-dark = "file:///etc/nixos/dotfiles/hypr/rust.png"; + }; + settings."org/gnome/desktop/peripherals/touchpad".tap-to-click = true; + settings."org/gnome/desktop/background".picture-uri-dark = "file:///run/current-system/sw/share/backgrounds/gnome/keys-d.jpg"; + settings."org/gnome/desktop/background".picture-uri = "file:///run/current-system/sw/share/backgrounds/gnome/keys-l.jpg"; + settings."org/gnome/desktop/background".primary-color = "#aaaaaa"; + settings."org/gnome/desktop/background".secondary-color = "#000000"; + settings."org/gnome/desktop/interface".show-battery-percentage = true; + settings."org/gnome/settings-daemon/plugins/media-keys".home = ["e"]; + settings."org/gnome/settings-daemon/plugins/media-keys".control-center = ["i"]; + settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0".binding = "t"; + settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0".command = "gnome-terminal"; + settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0".name = "gt1"; + + settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1".binding = "t"; + settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1".command = "gnome-terminal"; + settings."org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1".name = "gt2"; + settings."org/gnome/settings-daemon/plugins/media-keys".custom-keybindings = ["/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"]; + }; + home.packages = [ + ]; + wayland.windowManager.hyprland.enable = true; + + # wayland.windowManager.hyprland.plugins = [ + # inputs.hyprland-plugins.${pkgs.system}.hyprlock + # ]; + wayland.windowManager.hyprland.settings = { + exec-once = [ + "swww-daemon" + "swww img /etc/nixos/dotfiles/hypr/rust.png" + "nm-applet --indicator" + "blueman-applet" + "waybar" + "dunst" + ]; + + "$terminal" = "alacritty"; + "$fileManager" = "nemo"; + # "$fileManager" = "dolphin"; + "$menu" = "rofi -show drun"; + + "$mod" = "SUPER"; + + monitor = ",preferred,auto,1"; + + general = { + layout = "master"; + gaps_in = 5; + gaps_out = 20; + border_size = 2; + "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; + "col.inactive_border" = "rgba(595959aa)"; + + allow_tearing = false; + }; + + decoration = { + rounding = 10; + + blur = { + enabled = true; + size = 3; + passes = 1; + }; + + drop_shadow = "yes"; + shadow_range = 4; + shadow_render_power = 3; + "col.shadow" = "rgba(1a1a1aee)"; + }; + + animations = { + enabled = "yes"; + + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + gestures = { + workspace_swipe = "off"; + }; + + misc = { + force_default_wallpaper = 0; + }; + + windowrulev2 = "suppressevent maximize, class:.*"; + + input = { + follow_mouse = 2; + + touchpad = { + natural_scroll = "yes"; + }; + }; + + master = { + new_is_master = false; + }; + + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + + bind = + [ + "$mod, T, exec, $terminal" + "$mod, L, exec, hyprlock" + "$mod, Q, exec, $terminal" + "$mod SHIFT, L, exit" + "$mod, C, killactive" + "$mod, E, exec, $fileManager" + "$mod, V, exec, togglefloating" + "$mod, R, exec, $menu" + "$mod, P, pseudo," + "$mod, O, togglesplit," + "$mod, U, fullscreen," + "$mod, P, focuscurrentorlast," + "$mod, P, movewindow,l" + # "$mod, H, movefocus, l" + # "$mod, K, movefocus, u" + "$mod, J, movefocus, d" + "$mod, S, togglespecialworkspace, magic" + "$mod SHIFT, S, movetoworkspace, special:magic" + "$mod, mouse_down, workspace, e+1" + "$mod, mouse_up, workspace, e-1" + ] + ++ ( + # workspaces + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} + builtins.concatLists (builtins.genList ( + x: let + ws = let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in [ + "$mod, ${ws}, workspace, ${toString (x + 1)}" + "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" + ] + ) + 10) + ); + }; + + home.file = { + ".config/hypr/hyprlock.conf".source = ./dotfiles/hypr/hyprlock.conf; + ".config/waybar".source = ./dotfiles/waybar; + }; + + home.sessionVariables = { + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +}