diff --git a/nix/flake.nix b/nix/flake.nix index 9e12260..6118f9a 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -14,14 +14,14 @@ defaultModules = [ home-manager.nixosModules.home-manager ./modules/g810-led.nix - # ./main/fonts.nix + ./main/fonts.nix + ./main/kernel.nix + ./main/packages.nix + ./main/printing.nix # ./main/general.nix # ./main/hardware.nix - # ./main/kernel.nix # ./main/misc.nix # ./main/networking.nix - # ./main/packages.nix - # ./main/printing.nix # ./main/services.nix # ./main/terminal.nix @@ -38,7 +38,7 @@ nixpkgs-unstable.flake = nixpkgs-unstable; }; - nixpkgs.overlays = [ (import ./overlays) ]; + # nixpkgs.overlays = [ (import ./overlays) ]; home-manager = { useGlobalPkgs = true; diff --git a/nix/home/default.nix b/nix/home/default.nix index 935ccf0..c7f368f 100644 --- a/nix/home/default.nix +++ b/nix/home/default.nix @@ -1,12 +1,9 @@ { pkgs, ... }: { - nixpkgs.overlays = import ../overlays { inherit pkgs; }; - nixpkgs.config.allowUnfree = true; home = { sessionVariables = { EDITOR = "vim"; }; - packages = import ./packages.nix { inherit pkgs; }; }; services = { diff --git a/nix/home/packages.nix b/nix/home/packages.nix deleted file mode 100644 index 0aebb8a..0000000 --- a/nix/home/packages.nix +++ /dev/null @@ -1,154 +0,0 @@ -{ pkgs }: - -with pkgs; [ - - # utils - bat - bind - binutils-unwrapped - colordiff - curl - direnv - exa - fd - fzf - git - gnumake - jq - ripgrep - tree - unzip - zip - - # education - anki - - # monitoring - htop - - # password - gopass - - # social media - rtv - - # imaging - gifsicle - gimp - - # editors - libreoffice - vscodium - - # audio - audio-recorder - spotify - - # video - youtube-dl - vlc - - # network - bandwhich - deluge - nmap - openvpn - postman - - # terraform - terraform-ls - terraform_0_14 - tflint - tfsec - - # gcp - google-cloud-sdk - - # jvm - jdk8 - gradle - groovy - maven - - # encryption - cryptsetup - - # browser - brave - firefox - - # docker - docker - docker-compose - - # k8s - kubectl - kubernetes-helm - - # nix - nix-index - nixfmt - nixpkgs-fmt - nixpkgs-review - rnix-lsp - - # games - steam - minecraft - yuzu - - # communication - discord - element-desktop - signal-desktop - slack - zoom-us - - ## aws - awscli2 - ssm-session-manager-plugin - - # python - black - python38 - python38Packages.ipython - python38Packages.pip - python38Packages.poetry - python38Packages.setuptools - python38Packages.virtualenv - - # fonts - dejavu_fonts - fira-code - fira-code-symbols - fira-mono - font-awesome - google-fonts - noto-fonts - noto-fonts-cjk - noto-fonts-emoji - noto-fonts-extra - - # misc - asciinema - github-cli - glibcLocales - go-jira - hadolint - nodejs-12_x - imagemagick - pfetch - pinentry-curses - shellcheck - shfmt - starship - xclip - xdg_utils - zathura - - # overlays - lpass - rfd - vpngate - -] diff --git a/nix/lib/default.nix b/nix/lib/default.nix new file mode 100644 index 0000000..7dbe838 --- /dev/null +++ b/nix/lib/default.nix @@ -0,0 +1,12 @@ +{ config, lib, ... }: + +with lib; rec { + + pkgsImport = pkgs: + import pkgs { + config = config.nixpkgs.config; + overlays = config.nixpkgs.overlays; + system = config.nixpkgs.system; + }; + +} diff --git a/nix/machines/hephaestus/configuration.nix b/nix/machines/hephaestus/configuration.nix index 9234edd..fb1435d 100644 --- a/nix/machines/hephaestus/configuration.nix +++ b/nix/machines/hephaestus/configuration.nix @@ -15,7 +15,6 @@ # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - boot.kernelPackages = pkgs.linuxPackages_latest; networking.hostName = "hephaestus"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. diff --git a/nix/main/fonts.nix b/nix/main/fonts.nix new file mode 100644 index 0000000..9cbf8b1 --- /dev/null +++ b/nix/main/fonts.nix @@ -0,0 +1,39 @@ + +{ pkgs, ... }: + +{ + # Set system-wide fonts. + fonts.fonts = with pkgs; [ + dejavu_fonts + fira-code + fira-code-symbols + fira-mono + font-awesome + google-fonts + liberation_ttf # Free replacement for MS Fonts. + noto-fonts + noto-fonts + noto-fonts-cjk + noto-fonts-cjk + noto-fonts-emoji + noto-fonts-emoji + noto-fonts-extra + ]; + + # Set default fonts. + fonts.fontconfig.defaultFonts = { + sansSerif = [ + "Noto Sans" + ]; + serif = [ + "Noto Serif" + ]; + monospace = [ + "MesloLGS Nerd Font" + "Noto Sans Mono" + ]; + emoji = [ + "Noto Color Emoji" + ]; + }; +} diff --git a/nix/main/kernel.nix b/nix/main/kernel.nix new file mode 100644 index 0000000..fd3c92f --- /dev/null +++ b/nix/main/kernel.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: + +{ + # Use the latest stable kernel + boot.kernelPackages = pkgs.linuxPackages_latest; + + # Enable support for additional filesystems + boot.supportedFilesystems = [ "ntfs" ]; +} diff --git a/nix/main/packages.nix b/nix/main/packages.nix new file mode 100644 index 0000000..2508d9f --- /dev/null +++ b/nix/main/packages.nix @@ -0,0 +1,168 @@ +{ config, lib, pkgs, unstable, ... }: + +{ + # System-wide packages to install. + environment.systemPackages = with unstable; + let + common = [ + # utils + bat + bind + binutils-unwrapped + colordiff + curl + direnv + exa + fd + fzf + git + gnumake + jq + ripgrep + tree + unzip + zip + + # education + anki + + # monitoring + htop + + # password + gopass + + # social media + rtv + + # imaging + gifsicle + gimp + + # editors + libreoffice + vscodium + + # audio + audio-recorder + spotify + + # video + youtube-dl + vlc + + # network + bandwhich + deluge + nmap + openvpn + postman + + # terraform + terraform-ls + terraform_0_14 + tflint + tfsec + + # gcp + google-cloud-sdk + + # jvm + jdk8 + gradle + groovy + maven + + # encryption + cryptsetup + + # browser + brave + firefox + + # docker + docker + docker-compose + + # k8s + kubectl + kubernetes-helm + + # nix + nix-index + nixfmt + nixpkgs-fmt + nixpkgs-review + rnix-lsp + + # games + steam + minecraft + yuzu + + # communication + discord + element-desktop + signal-desktop + slack + zoom-us + + ## aws + awscli2 + ssm-session-manager-plugin + + # python + black + python38 + python38Packages.ipython + python38Packages.pip + python38Packages.poetry + python38Packages.setuptools + python38Packages.virtualenv + + # fonts + dejavu_fonts + fira-code + fira-code-symbols + fira-mono + font-awesome + google-fonts + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + noto-fonts-extra + + # misc + asciinema + github-cli + glibcLocales + go-jira + hadolint + nodejs-12_x + imagemagick + pfetch + pinentry-curses + shellcheck + shfmt + starship + xclip + xdg_utils + zathura + + # overlays + # lpass + # rfd + # vpngate + + ]; + in common; + + # Don't install optional default packages. + environment.defaultPackages = [ ]; + + # Install ADB and fastboot. + programs.adb.enable = true; + + # Install GnuPG agent. + programs.gnupg.agent.enable = true; +} diff --git a/nix/main/printing.nix b/nix/main/printing.nix new file mode 100644 index 0000000..d92f3c7 --- /dev/null +++ b/nix/main/printing.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: + +{ + # Setup CUPS for printing documents. + services.printing.enable = true; +} diff --git a/nix/modules/g810-led.nix b/nix/modules/g810-led.nix new file mode 100644 index 0000000..1525d94 --- /dev/null +++ b/nix/modules/g810-led.nix @@ -0,0 +1,60 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.hardware.g810-led; +in +{ + options.hardware.g810-led = { + enable = mkOption { + type = types.bool; + default = false; + description = '' + Whether to apply a g810-led profile when a compatible keyboard + is connected. + ''; + }; + + profile = mkOption { + type = types.path; + description = '' + The profile file to be applied, samples can be found at: + https://github.com/MatMoul/g810-led/tree/master/sample_profiles + ''; + }; + + enableFlashingWorkaround = mkOption { + type = types.bool; + default = false; + description = '' + Whether to turn off all LEDs on shutdown and reboot. + Enable this if your keyboard flashes 3 times on boot. + ''; + }; + }; + + config = mkIf cfg.enable { + + services.udev.packages = [ + (pkgs.g810-led.override { profile = cfg.profile; }) + ]; + + # Workaround mentioned here: + # https://github.com/MatMoul/g810-led/blob/14e331ad2ab7c5ffb546e0c14dd6164b517ff9ca/PROFILES.md + systemd.services.g810-led-workaround = mkIf cfg.enableFlashingWorkaround { + description = "Turn off all g810-led keys"; + script = "${pkgs.g810-led}/bin/g810-led -a 000000"; + + serviceConfig.Type = "oneshot"; + unitConfig.DefaultDependencies = false; + + wantedBy = [ "shutdown.target" ]; + before = [ "shutdown.target" "reboot.target" "halt.target" ]; + }; + }; + + meta.maintainers = [ maintainers.davegallant ]; + +} + diff --git a/nix/nixos-rebuild b/nix/nixos-rebuild index 79b57a2..5bd5def 100755 --- a/nix/nixos-rebuild +++ b/nix/nixos-rebuild @@ -1,3 +1,3 @@ #!/usr/bin/env bash cd "$(dirname "$0")" -exec nixos-rebuild -I nixos-config=machines/$(hostname)/configuration.nix "$@" +exec nixos-rebuild -I nixos-config=machines/$(hostname)/configuration.nix "$@" --flake '.#'