From 917bc101b733ebe5823a911f864379eb11842af1 Mon Sep 17 00:00:00 2001 From: Daryl Ronningen Date: Tue, 20 Dec 2022 22:27:41 -0800 Subject: [PATCH] initial --- flake.lock | 156 +++++++++++++++++++++ flake.nix | 36 +++++ hosts/skynet/configuration.nix | 128 ++++++++++++++++++ hosts/skynet/hardware-configuration.nix | 41 ++++++ users/relms/home.nix | 173 ++++++++++++++++++++++++ 5 files changed, 534 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hosts/skynet/configuration.nix create mode 100644 hosts/skynet/hardware-configuration.nix create mode 100644 users/relms/home.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e1c95a7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,156 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1671578428, + "narHash": "sha256-YmbpBcPaGz9KE2bC4xPvSdgCSMk0BmS/L3ePvy9TR/M=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "0f8bf4f92efa3c6168705b49a6788abb3612033a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "neovim-flake": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "dir": "contrib", + "lastModified": 1671505418, + "narHash": "sha256-kWK3A7OkZqjI51Ntad25JwAEdx81a2yCmFVqUd2vOMc=", + "owner": "neovim", + "repo": "neovim", + "rev": "de90a8bfe5ff4b440597e6d3301bdc3bde01990a", + "type": "github" + }, + "original": { + "dir": "contrib", + "owner": "neovim", + "repo": "neovim", + "type": "github" + } + }, + "neovim-nightly-overlay": { + "inputs": { + "flake-compat": "flake-compat", + "neovim-flake": "neovim-flake", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1671524068, + "narHash": "sha256-cn8sDsbMVEqHyc5vuC1bxxaN+ogmG7mu+9uQAiF/kn0=", + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "rev": "c7d0de1fc663052e51ce0ff11983e7b6222bf225", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1671417167, + "narHash": "sha256-JkHam6WQOwZN1t2C2sbp1TqMv3TVRjzrdoejqfefwrM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "bb31220cca6d044baa6dc2715b07497a2a7c4bc7", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1671359686, + "narHash": "sha256-3MpC6yZo+Xn9cPordGz2/ii6IJpP2n8LE8e/ebUXLrs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "04f574a1c0fde90b51bf68198e2297ca4e7cccf4", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "neovim-nightly-overlay": "neovim-nightly-overlay", + "nixpkgs": "nixpkgs_2" + } + }, + "utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..30426de --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + description = "The nix flake for all my systems"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; + + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + outputs = { self, nixpkgs, home-manager, neovim-nightly-overlay, ... }: let + system = "x86_64-linux"; + lib = nixpkgs.lib; + overlays = [ + neovim-nightly-overlay.overlay + ]; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + overlays = overlays; + }; + in { + nixosConfigurations = { + skynet = lib.nixosSystem { + inherit system; + modules = [ ./hosts/skynet/configuration.nix ]; + }; + }; + homeConfigurations = { + relms = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ ./users/relms/home.nix ]; + }; + }; + }; +} diff --git a/hosts/skynet/configuration.nix b/hosts/skynet/configuration.nix new file mode 100644 index 0000000..103e216 --- /dev/null +++ b/hosts/skynet/configuration.nix @@ -0,0 +1,128 @@ +{ config, pkgs, ... }: + +{ + imports = [ ./hardware-configuration.nix ]; + + # Bootloader. + boot.loader.grub.enable = true; + boot.loader.grub.device = "nodev"; + boot.loader.grub.useOSProber = true; + boot.loader.grub.efiSupport = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + boot.kernelPackages = pkgs.linuxPackages_latest; + + # Networking + networking.hostName = "skynet"; + + # Set your time zone. + time.timeZone = "America/Los_Angeles"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + services.xserver.autorun = true; + services.xserver.excludePackages = [ pkgs.xterm ]; + + # Install various graphics drivers + hardware.opengl.extraPackages = with pkgs; [ + intel-compute-runtime + mesa_drivers + vaapiIntel + vaapiVdpau + libvdpau-va-gl + intel-media-driver + ]; + + # Enable the GNOME Desktop Environment. + services.xserver.desktopManager.gnome.enable = true; + services.xserver.displayManager.gdm.enable = true; + services.gnome.core-utilities.enable = false; + services.gnome.gnome-browser-connector.enable = true; + + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = ""; + }; + + # 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; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.relms = { + isNormalUser = true; + description = "Daryl Ronningen"; + extraGroups = [ "networkmanager" "wheel" ]; + shell = pkgs.fish; + }; + + # Install fish + programs.fish.enable = true; + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # Manage CPU speed + services.cpupower-gui.enable = true; + + # Fingerprint + services.fprintd.enable = true; + systemd.services.fprintd = { + wantedBy = [ "multi-user.target" ]; + serviceConfig.Type = "simple"; + }; + + # Thermals + services.thermald.enable = true; + + # Flatpak + services.flatpak.enable = true; + + # Firmware Updater + services.fwupd.enable = true; + services.fwupd.enableTestRemote = true; + services.fwupd.extraRemotes = [ "lvfs-testing" ]; + + # Setup some basic fonts + fonts = { + enableDefaultFonts = true; + enableGhostscriptFonts = true; + fontDir.enable = true; + fonts = [ pkgs.nerdfonts ]; + }; + + # 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.05"; # Did you read the comment? +} diff --git a/hosts/skynet/hardware-configuration.nix b/hosts/skynet/hardware-configuration.nix new file mode 100644 index 0000000..a843f6c --- /dev/null +++ b/hosts/skynet/hardware-configuration.nix @@ -0,0 +1,41 @@ +# 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/d0dfd8f7-355c-4d81-a20b-52b522914b96"; + fsType = "xfs"; + }; + + fileSystems."/boot/efi" = { + device = "/dev/disk/by-uuid/FD80-0AEA"; + fsType = "vfat"; + }; + + fileSystems."/tmp" = { + device = "tmpfs"; + fsType = "tmpfs"; + }; + + 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.wlp166s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/users/relms/home.nix b/users/relms/home.nix new file mode 100644 index 0000000..764548d --- /dev/null +++ b/users/relms/home.nix @@ -0,0 +1,173 @@ +{ lib, config, pkgs, ... }: + +{ + # Home Manager needs a bit of information about you and the + # paths it should manage. + home.username = "relms"; + home.homeDirectory = "/home/relms"; + + # Some user packages + home.packages = with pkgs; [ + gnome.nautilus + gnome.gnome-tweaks + gnome.gnome-software + adw-gtk3 + numix-icon-theme-circle + gcc12 + xsel + wget + rustup + ]; + + # 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.11"; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + programs.htop.enable = true; + + programs.hyfetch.enable = true; + programs.hyfetch.settings = { + preset = "genderfluid"; + mode = "rgb"; + color_align = { + mode = "horizontal"; + }; + }; + + programs.exa.enable = true; + + programs.fish.enable = true; + programs.fish.shellAliases = { + ls = "exa -laFghHUum@ --sort name --group-directories-first --git --icons"; + tree = "exa -laFghHUumRT@ --sort name --group-directories-first --git --icons"; + nixos-rebuild = "sudo nixos-rebuild --flake ~/git/flake#"; + home-manager = "home-manager --flake ~/git/flake#relms"; + }; + + programs.firefox.enable = true; + programs.firefox.package = pkgs.firefox.override { + cfg = { + enableGnomeExtensions = true; + enableTridactylNative = true; + }; + }; + + programs.starship.enable = true; + programs.starship.enableFishIntegration = true; + programs.starship.settings = { + add_newline = true; + format = lib.concatStrings [ "$username@$hostname" " " "$directory" " " "$all$character" ]; + right_format = "$cmd_duration"; + directory = { + format = "[$path]($style)[$read_only]($read_only_style)"; + read_only = " 🔒"; + }; + hostname = { + ssh_only = false; + format = "[$hostname]($style)"; + }; + username = { + show_always = true; + format = "[$user]($style)"; + }; + shell = { + disabled = false; + }; + time = { + disabled = false; + }; + status = { + disabled = false; + }; + }; + + programs.autorandr.enable = true; + programs.autorandr.profiles = { + laptop = { + fingerprint = { + eDP-1 = "00ffffffffffff0009e55f0900000000171d0104a51c137803de50a3544c99260f505400000001010101010101010101010101010101115cd01881e02d50302036001dbe1000001aa749d01881e02d50302036001dbe1000001a000000fe00424f452043510a202020202020000000fe004e4531333546424d2d4e34310a00fb"; + }; + config = { + eDP-1 = { + enable = true; + primary = true; + position = "0x0"; + mode = "2256x1504"; + crtc = 0; + rate = "60.00"; + transform = [[1.500000 0.000000 0.000000] [0.000000 1.500000 0.000000] [0.000000 0.000000 1.000000]]; + }; + }; + }; + }; + + programs.git = { + enable = true; + package = pkgs.gitAndTools.gitFull; + userEmail = "relms@relms.dev"; + userName = "Daryl Ronningen"; + delta = { + enable = true; + options = { + navigate = true; + light = false; + line-numbers = true; + side-by-side = true; + }; + }; + extraConfig = { + init = { + defaultBranch = "main"; + }; + pull = { + rebase = false; + }; + credential = { + helper = "store"; + }; + core = { + editor = "nvim"; + }; + }; + signing = { + signByDefault = true; + key = "3905311D17C0E1E8AD2B3439FD23F0C934A5EC6B"; + }; + }; + + programs.neovim = { + enable = true; + package = pkgs.neovim-nightly; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + withNodeJs = true; + withPython3 = true; + withRuby = true; + }; + + programs.gnome-terminal = { + enable = true; + profile = { + default = { + default = true; + font = "FiraCode Nerd Font Mono"; + visibleName = "Default"; + }; + }; + }; + + programs.gpg.enable = true; + services.gpg-agent.enable = true; + services.gpg-agent.enableSshSupport = true; + services.gpg-agent.pinentryFlavor = "gnome3"; +}