From 493ac02c334789567d412c29f8e035a97afbd811 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Sat, 16 Dec 2023 20:17:41 -0500 Subject: [PATCH] Setup nixnuc, rework home manager files --- .gitignore | 1 + flake.nix | 15 ++-- .../{default.nix => common/all-cli.nix} | 14 +-- .../{darwin.nix => common/all-darwin.nix} | 0 modules/home-manager/common/all-gui.nix | 10 +++ modules/home-manager/common/all-linux.nix | 12 +++ .../linux-apps/tilix.nix} | 18 ++-- .../home-manager/common/linux-apps/waybar.nix | 17 ++++ .../common/linux-apps/xfce4-terminal.nix | 46 ++++++++++ .../hosts/Blue-Rock/gene.liverman.nix | 17 ++++ modules/home-manager/hosts/nixnuc/gene.nix | 8 ++ .../rainbow-planet/gene.nix} | 81 ++--------------- modules/hosts/nixos/nixnuc/default.nix | 88 +++++++++++++++++++ .../nixos/nixnuc/hardware-configuration.nix | 39 ++++++++ .../hosts/nixos/rainbow-planet/default.nix | 1 + .../common/all-darwin.nix} | 0 .../common/all-nixos.nix} | 6 +- .../common/linux}/internationalisation.nix | 0 18 files changed, 273 insertions(+), 100 deletions(-) rename modules/home-manager/{default.nix => common/all-cli.nix} (96%) rename modules/home-manager/{darwin.nix => common/all-darwin.nix} (100%) create mode 100644 modules/home-manager/common/all-gui.nix create mode 100644 modules/home-manager/common/all-linux.nix rename modules/home-manager/{dconf.nix => common/linux-apps/tilix.nix} (59%) create mode 100644 modules/home-manager/common/linux-apps/waybar.nix create mode 100644 modules/home-manager/common/linux-apps/xfce4-terminal.nix create mode 100644 modules/home-manager/hosts/Blue-Rock/gene.liverman.nix create mode 100644 modules/home-manager/hosts/nixnuc/gene.nix rename modules/home-manager/{nixos.nix => hosts/rainbow-planet/gene.nix} (68%) create mode 100644 modules/hosts/nixos/nixnuc/default.nix create mode 100644 modules/hosts/nixos/nixnuc/hardware-configuration.nix rename modules/{common/darwin/all-hosts.nix => system/common/all-darwin.nix} (100%) rename modules/{common/nixos/all-hosts.nix => system/common/all-nixos.nix} (89%) rename modules/{common/nixos => system/common/linux}/internationalisation.nix (100%) diff --git a/.gitignore b/.gitignore index f7e442f..72f8bf7 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /vendor/ .dccache +*.swp # Config files that are not suitable to add to version control: link/nix/config/.mono/ diff --git a/flake.nix b/flake.nix index 545ec6f..5249ca0 100644 --- a/flake.nix +++ b/flake.nix @@ -70,15 +70,14 @@ useGlobalPkgs = true; useUserPackages = true; users.${username}.imports = [ - ./modules/home-manager - ./modules/home-manager/darwin.nix + ./modules/home-manager/hosts/${hostname}/${username}.nix ]; extraSpecialArgs = { inherit genebean-omp-themes; }; }; } - ./modules/common/darwin/all-hosts.nix - ./modules/hosts/darwin/${hostname} # ip address, host specific stuff + ./modules/system/common/all-darwin.nix # system-wide stuff + ./modules/hosts/darwin/${hostname} # host specific stuff ]; # end modules }; # end darwinSystem @@ -101,15 +100,14 @@ useGlobalPkgs = true; useUserPackages = true; users.${username}.imports = [ - ./modules/home-manager - ./modules/home-manager/nixos.nix + ./modules/home-manager/hosts/${hostname}/${username}.nix ]; extraSpecialArgs = { inherit genebean-omp-themes; }; }; } - ./modules/common/nixos/all-hosts.nix - ./modules/hosts/nixos/${hostname} # ip address, host specific stuff + ./modules/system/common/all-nixos.nix # system-wide stuff + ./modules/hosts/nixos/${hostname} # host specific stuff ]; }; # end nixosSystem @@ -119,6 +117,7 @@ }; nixosConfigurations = { + nixnuc = nixosSystem "x86_64-linux" "nixnuc" "gene"; rainbow-planet = nixosSystem "x86_64-linux" "rainbow-planet" "gene"; }; }; diff --git a/modules/home-manager/default.nix b/modules/home-manager/common/all-cli.nix similarity index 96% rename from modules/home-manager/default.nix rename to modules/home-manager/common/all-cli.nix index 7ee8bed..0abd26a 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/common/all-cli.nix @@ -1,11 +1,9 @@ { pkgs, genebean-omp-themes, ... }: { - home.stateVersion = "23.11"; home.packages = with pkgs; [ colordiff dogdns dos2unix du-dust - element-desktop git-filter-repo gotop htop @@ -78,12 +76,7 @@ }; }; }; # end git - go = { - enable = true; - goPath = "go"; - }; jq.enable = true; - k9s.enable = true; neovim.enable = true; oh-my-posh = { enable = true; @@ -157,9 +150,6 @@ let g:airline_powerline_fonts = 1 ''; }; - vscode = { - enable = true; - }; zsh = { enable = true; enableCompletion = true; @@ -218,7 +208,7 @@ }; # end programs home.file = { - ".config/powershell/Microsoft.PowerShell_profile.ps1".source = ./files/Microsoft.PowerShell_profile.ps1; - ".config/powershell/Microsoft.VSCode_profile.ps1".source = ./files/Microsoft.PowerShell_profile.ps1; + ".config/powershell/Microsoft.PowerShell_profile.ps1".source = ../files/Microsoft.PowerShell_profile.ps1; + ".config/powershell/Microsoft.VSCode_profile.ps1".source = ../files/Microsoft.PowerShell_profile.ps1; }; } diff --git a/modules/home-manager/darwin.nix b/modules/home-manager/common/all-darwin.nix similarity index 100% rename from modules/home-manager/darwin.nix rename to modules/home-manager/common/all-darwin.nix diff --git a/modules/home-manager/common/all-gui.nix b/modules/home-manager/common/all-gui.nix new file mode 100644 index 0000000..3c77e03 --- /dev/null +++ b/modules/home-manager/common/all-gui.nix @@ -0,0 +1,10 @@ +{ pkgs, genebean-omp-themes, ... }: { + home.packages = with pkgs; [ + element-desktop + ]; + programs = { + vscode = { + enable = true; + }; + }; +} \ No newline at end of file diff --git a/modules/home-manager/common/all-linux.nix b/modules/home-manager/common/all-linux.nix new file mode 100644 index 0000000..d50f5fd --- /dev/null +++ b/modules/home-manager/common/all-linux.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: { + + programs = { + # Linux-specific aliases + zsh.shellAliases = { + nixup = "sudo nixos-rebuild switch --flake ~/repos/dots"; + uwgconnect = "nmcli dev wifi connect SecureWest password"; + uwgforget = "nmcli connection delete SecureWest"; + ykey = "sudo systemctl restart pcscd && sudo pkill -9 gpg-agent && source ~/.zshrc; ssh-add -L"; + }; + }; +} \ No newline at end of file diff --git a/modules/home-manager/dconf.nix b/modules/home-manager/common/linux-apps/tilix.nix similarity index 59% rename from modules/home-manager/dconf.nix rename to modules/home-manager/common/linux-apps/tilix.nix index 4ee7c33..bd7433c 100644 --- a/modules/home-manager/dconf.nix +++ b/modules/home-manager/common/linux-apps/tilix.nix @@ -1,9 +1,5 @@ -# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix -{ lib, ... }: +{ lib, pkgs, ... }: with lib.hm.gvariant; { -with lib.hm.gvariant; - -{ dconf.settings = { "com/gexperts/Tilix/profiles/2b7c4080-0ddd-46c5-8f23-563fd3ba789d" = { background-color = "#272822"; @@ -21,4 +17,14 @@ with lib.hm.gvariant; }; }; -} + + home.file = { + ".config/tilix/schemes/Beanbag-Mathias.json".source = ../../files/tilix/Beanbag-Mathias.json; + ".config/tilix/schemes/Catppuccin-Frappe.json".source = (pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "tilix"; + rev = "3fd05e03419321f2f2a6aad6da733b28be1765ef"; + hash = "sha256-SI7QxQ+WBHzeuXbTye+s8pi4tDVZOV4Aa33mRYO276k="; + } + "/src/Catppuccin-Frappe.json"); + }; +} \ No newline at end of file diff --git a/modules/home-manager/common/linux-apps/waybar.nix b/modules/home-manager/common/linux-apps/waybar.nix new file mode 100644 index 0000000..3fdd87a --- /dev/null +++ b/modules/home-manager/common/linux-apps/waybar.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: { + home.file = { + ".config/waybar/config".source = ../../files/waybar/config; + ".config/waybar/frappe.css".source = (pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "waybar"; + rev = "f74ab1eecf2dcaf22569b396eed53b2b2fbe8aff"; + hash = "sha256-WLJMA2X20E5PCPg0ZPtSop0bfmu+pLImP9t8A8V4QK8="; + } + "/themes/frappe.css"); + ".config/waybar/style.css".source = ../../files/waybar/style.css; + }; + + programs = { + # Using file in ../../files/waybar/ to configure waybar + waybar.enable = true; + }; +} \ No newline at end of file diff --git a/modules/home-manager/common/linux-apps/xfce4-terminal.nix b/modules/home-manager/common/linux-apps/xfce4-terminal.nix new file mode 100644 index 0000000..e1b596c --- /dev/null +++ b/modules/home-manager/common/linux-apps/xfce4-terminal.nix @@ -0,0 +1,46 @@ +{ pkgs, ... }: { + home.file = { + ".config/xfce4/terminal/accels.scm".source = ../../files/xfce4/terminal/accels.scm; + }; + + xfconf.settings = { + xfce4-terminal = { + "background-mode" = "TERMINAL_BACKGROUND_TRANSPARENT"; + "background-darkness" = "0.90000000000000000"; + "color-foreground" = "#e3e3ea"; + "color-background" = "#08052b"; + "color-cursor" = "#ff7f7f"; + "color-cursor-use-default" = false; + "color-palette" = "#000000;#e52222;#a6e32d;#fc951e;#c48dff;#fa2573;#67d9f0;#f2f2f2;#555555;#ff5555;#55ff55;#ffff55;#5555ff;#ff55ff;#55ffff;#ffffff"; + "font-name" = "Hack Nerd Font Mono 12"; + "misc-always-show-tabs" = false; + "misc-bell" = false; + "misc-bell-urgent" = true; + "misc-borders-default" = true; + "misc-cursor-blinks" = false; + "misc-cursor-shape" = "TERMINAL_CURSOR_SHAPE_BLOCK"; + "misc-default-geometry" = "120x24"; + "misc-inherit-geometry" = false; + "misc-menubar-default" = true; + "misc-mouse-autohide" = false; + "misc-mouse-wheel-zoom" = true; + "misc-toolbar-default" = false; + "misc-confirm-close" = true; + "misc-cycle-tabs" = true; + "misc-tab-close-buttons" = true; + "misc-tab-close-middle-click" = true; + "misc-tab-position" = "GTK_POS_TOP"; + "misc-highlight-urls" = true; + "misc-middle-click-opens-uri" = false; + "misc-copy-on-select" = false; + "misc-show-relaunch-dialog" = true; + "misc-rewrap-on-resize" = true; + "misc-slim-tabs" = true; + "misc-new-tab-adjacent" = false; + "misc-search-dialog-opacity" = "100"; + "misc-show-unsafe-paste-dialog" = true; + "scrolling-unlimited" = true; + "title-initial" = "xfce4-terminal"; + }; + }; +} \ No newline at end of file diff --git a/modules/home-manager/hosts/Blue-Rock/gene.liverman.nix b/modules/home-manager/hosts/Blue-Rock/gene.liverman.nix new file mode 100644 index 0000000..4b58941 --- /dev/null +++ b/modules/home-manager/hosts/Blue-Rock/gene.liverman.nix @@ -0,0 +1,17 @@ +{ pkgs, genebean-omp-themes, ... }: { + home.stateVersion = "23.11"; + imports = [ + ../../common/all-cli.nix + ../../common/all-gui.nix + ../../common/all-darwin.nix + ]; + + programs = { + go = { + enable = true; + goPath = "go"; + }; + k9s.enable = true; + }; + +} diff --git a/modules/home-manager/hosts/nixnuc/gene.nix b/modules/home-manager/hosts/nixnuc/gene.nix new file mode 100644 index 0000000..0c2ef47 --- /dev/null +++ b/modules/home-manager/hosts/nixnuc/gene.nix @@ -0,0 +1,8 @@ +{ pkgs, genebean-omp-themes, ... }: { + home.stateVersion = "23.11"; + imports = [ + ../../common/all-cli.nix + ../../common/all-linux.nix + ]; + +} diff --git a/modules/home-manager/nixos.nix b/modules/home-manager/hosts/rainbow-planet/gene.nix similarity index 68% rename from modules/home-manager/nixos.nix rename to modules/home-manager/hosts/rainbow-planet/gene.nix index 5ce2bf9..ab07b4c 100644 --- a/modules/home-manager/nixos.nix +++ b/modules/home-manager/hosts/rainbow-planet/gene.nix @@ -1,7 +1,14 @@ -{ pkgs, ... }: { +{ pkgs, genebean-omp-themes, ... }: { + home.stateVersion = "23.11"; imports = [ - ./dconf.nix + ../../common/all-cli.nix + ../../common/all-gui.nix + ../../common/all-linux.nix + ../../common/linux-apps/tilix.nix + ../../common/linux-apps/waybar.nix + ../../common/linux-apps/xfce4-terminal.nix ]; + home.file = { ".config/hypr/frappe.conf".source = (pkgs.fetchFromGitHub { owner = "catppuccin"; @@ -9,34 +16,6 @@ rev = "99a88fd21fac270bd999d4a26cf0f4a4222c58be"; hash = "sha256-07B5QmQmsUKYf38oWU3+2C6KO4JvinuTwmW1Pfk8CT8="; } + "/themes/frappe.conf"); - ".config/tilix/schemes/Beanbag-Mathias.json".source = ./files/tilix/Beanbag-Mathias.json; - ".config/tilix/schemes/Catppuccin-Frappe.json".source = (pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "tilix"; - rev = "3fd05e03419321f2f2a6aad6da733b28be1765ef"; - hash = "sha256-SI7QxQ+WBHzeuXbTye+s8pi4tDVZOV4Aa33mRYO276k="; - } + "/src/Catppuccin-Frappe.json"); - ".config/waybar/config".source = ./files/waybar/config; - ".config/waybar/frappe.css".source = (pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "waybar"; - rev = "f74ab1eecf2dcaf22569b396eed53b2b2fbe8aff"; - hash = "sha256-WLJMA2X20E5PCPg0ZPtSop0bfmu+pLImP9t8A8V4QK8="; - } + "/themes/frappe.css"); - ".config/waybar/style.css".source = ./files/waybar/style.css; - ".config/xfce4/terminal/accels.scm".source = ./files/xfce4/terminal/accels.scm; - }; - - programs = { - # Linux-specific aliases - zsh.shellAliases = { - nixup = "sudo nixos-rebuild switch --flake ~/repos/dots"; - uwgconnect = "nmcli dev wifi connect SecureWest password"; - uwgforget = "nmcli connection delete SecureWest"; - ykey = "sudo systemctl restart pcscd && sudo pkill -9 gpg-agent && source ~/.zshrc; ssh-add -L"; - }; - # Using file in ./files/waybar/ to configure waybar - waybar.enable = true; }; services.dunst = { @@ -65,47 +44,6 @@ }; }; - xfconf.settings = { - xfce4-terminal = { - "background-mode" = "TERMINAL_BACKGROUND_TRANSPARENT"; - "background-darkness" = "0.90000000000000000"; - "color-foreground" = "#e3e3ea"; - "color-background" = "#08052b"; - "color-cursor" = "#ff7f7f"; - "color-cursor-use-default" = false; - "color-palette" = "#000000;#e52222;#a6e32d;#fc951e;#c48dff;#fa2573;#67d9f0;#f2f2f2;#555555;#ff5555;#55ff55;#ffff55;#5555ff;#ff55ff;#55ffff;#ffffff"; - "font-name" = "Hack Nerd Font Mono 12"; - "misc-always-show-tabs" = false; - "misc-bell" = false; - "misc-bell-urgent" = true; - "misc-borders-default" = true; - "misc-cursor-blinks" = false; - "misc-cursor-shape" = "TERMINAL_CURSOR_SHAPE_BLOCK"; - "misc-default-geometry" = "120x24"; - "misc-inherit-geometry" = false; - "misc-menubar-default" = true; - "misc-mouse-autohide" = false; - "misc-mouse-wheel-zoom" = true; - "misc-toolbar-default" = false; - "misc-confirm-close" = true; - "misc-cycle-tabs" = true; - "misc-tab-close-buttons" = true; - "misc-tab-close-middle-click" = true; - "misc-tab-position" = "GTK_POS_TOP"; - "misc-highlight-urls" = true; - "misc-middle-click-opens-uri" = false; - "misc-copy-on-select" = false; - "misc-show-relaunch-dialog" = true; - "misc-rewrap-on-resize" = true; - "misc-slim-tabs" = true; - "misc-new-tab-adjacent" = false; - "misc-search-dialog-opacity" = "100"; - "misc-show-unsafe-paste-dialog" = true; - "scrolling-unlimited" = true; - "title-initial" = "xfce4-terminal"; - }; - }; - wayland.windowManager.hyprland = { enable = true; settings = { @@ -286,4 +224,3 @@ }; # end settings }; # end hyprland } - diff --git a/modules/hosts/nixos/nixnuc/default.nix b/modules/hosts/nixos/nixnuc/default.nix new file mode 100644 index 0000000..c2c63d2 --- /dev/null +++ b/modules/hosts/nixos/nixnuc/default.nix @@ -0,0 +1,88 @@ +{ inputs, config, pkgs, username, ... }: { + imports = [ + ./hardware-configuration.nix + ]; + + system.stateVersion = "23.11"; + + # Bootloader. + boot.loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; + }; + + environment.systemPackages = with pkgs; [ + helix + jellyfin + jellyfin-ffmpeg + jellyfin-web + net-snmp + yt-dlp + ]; + + hardware.opengl = { + enable = true; + extraPackages = with pkgs; [ + intel-media-driver + vaapiIntel + vaapiVdpau + libvdpau-va-gl + intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in) + ]; + }; + + networking = { + # Open ports in the firewall. + firewall.allowedTCPPorts = [ 22 ]; + # firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # firewall.enable = false; + + networkmanager.enable = true; + }; + + # Hardware Transcoding for Jellyfin + nixpkgs.overlays = [ + (self: super: { + # "vaapiIntel" is in some docs, but that is an alias + # to intel-vaapi-driver as of 2023-05-31 + intel-vaapi-driver = super.intel-vaapi-driver.override { + enableHybridCodec = 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; + }; + + programs.mtr.enable = true; + + # List services that you want to enable: + services = { + fwupd.enable = true; + jellyfin = { + enable = true; + openFirewall = true; + }; + openssh.enable = true; + }; + + users.users.${username} = { + isNormalUser = true; + description = "Gene Liverman"; + extraGroups = [ "docker" "networkmanager" "wheel" ]; + packages = with pkgs; [ + docker-compose + ]; + }; + + virtualisation.docker.enable = true; +} diff --git a/modules/hosts/nixos/nixnuc/hardware-configuration.nix b/modules/hosts/nixos/nixnuc/hardware-configuration.nix new file mode 100644 index 0000000..9fa404c --- /dev/null +++ b/modules/hosts/nixos/nixnuc/hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/0ee15ee9-37ea-448d-aa3b-23eb25994df0"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/4814-3E47"; + fsType = "vfat"; + }; + + 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.eno1.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s20f0u3u1u4.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/hosts/nixos/rainbow-planet/default.nix b/modules/hosts/nixos/rainbow-planet/default.nix index 962f669..c6f4401 100644 --- a/modules/hosts/nixos/rainbow-planet/default.nix +++ b/modules/hosts/nixos/rainbow-planet/default.nix @@ -25,6 +25,7 @@ wmctrl # common gui apps that really should be in another file + angryipscanner firefox libreoffice meld diff --git a/modules/common/darwin/all-hosts.nix b/modules/system/common/all-darwin.nix similarity index 100% rename from modules/common/darwin/all-hosts.nix rename to modules/system/common/all-darwin.nix diff --git a/modules/common/nixos/all-hosts.nix b/modules/system/common/all-nixos.nix similarity index 89% rename from modules/common/nixos/all-hosts.nix rename to modules/system/common/all-nixos.nix index 8bdc9b8..fd82a32 100644 --- a/modules/common/nixos/all-hosts.nix +++ b/modules/system/common/all-nixos.nix @@ -1,17 +1,18 @@ { config, pkgs, hostname, username, ... }: { imports = [ - ./internationalisation.nix + ./linux/internationalisation.nix ]; environment = { shells = with pkgs; [ bash zsh ]; systemPackages = with pkgs; [ - angryipscanner dconf2nix file neofetch python3 tailscale + unzip + wget ]; }; @@ -34,6 +35,7 @@ "flakes" "nix-command" ]; + trusted-users = [ "${username}" ]; }; programs = { diff --git a/modules/common/nixos/internationalisation.nix b/modules/system/common/linux/internationalisation.nix similarity index 100% rename from modules/common/nixos/internationalisation.nix rename to modules/system/common/linux/internationalisation.nix