diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..a75d2dc --- /dev/null +++ b/configuration.nix @@ -0,0 +1,165 @@ +# 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, talhelper, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + programs.fish.enable = true; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + networking.hostName = "durincore"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "America/Chicago"; + + # 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; + + # Enable the GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + + services.gnome.gnome-keyring.enable = true; + security.pam.services.jahanson.enableGnomeKeyring = true; + programs.seahorse.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; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.jahanson = { + isNormalUser = true; + description = "Joseph Hanson"; + extraGroups = [ "networkmanager" "wheel" ]; + shell = pkgs.fish; + packages = with pkgs; [ + firefox + thunderbird + git + vscode + vivaldi + vivaldi-ffmpeg-codecs + termius + ]; + }; + environment.variables.EDITOR = "vim"; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + talhelper.packages."${pkgs.system}".default + wget + curl + vim + lazygit + fira-code-nerdfont + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # 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? + + systemd.user.services.ssh_agent = { + enable = true; + description = "OpenSSH key agent"; + documentation = ["man:ssh-agent(1)" "man:ssh-add(1)" "man:ssh(1)"]; + unitConfig = { + ConditionEnvironment = "!SSH_AGENT_PID"; + }; + serviceConfig = { + ExecStart = "/run/current-system/sw/bin/ssh-agent -D -a $SSH_AUTH_SOCK"; + Environment = "SSH_AUTH_SOCK=%t/ssh-agent.socket"; + PassEnvironment = "SSH_AGENT_PID"; + SuccessExitStatus = "2"; + Type = "simple"; + }; + wantedBy = [ "default.target" ]; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0c0a017 --- /dev/null +++ b/flake.lock @@ -0,0 +1,121 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1698882062, + "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703527373, + "narHash": "sha256-AjypRssRtS6F3xkf7rE3/bXkIF2WJOZLbTIspjcE1zM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "80679ea5074ab7190c4cce478c600057cfb5edae", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1703255338, + "narHash": "sha256-Z6wfYJQKmDN9xciTwU3cOiOk+NElxdZwy/FiHctCzjU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6df37dc6a77654682fe9f071c62b4242b5342e04", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1698611440, + "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1701068326, + "narHash": "sha256-vmMceA+q6hG1yrjb+MP8T0YFDQIrW3bl45e7z24IEts=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "8cfef6986adfb599ba379ae53c9f5631ecd2fd9c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "talhelper": "talhelper" + } + }, + "talhelper": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1703307959, + "narHash": "sha256-cBtbOMPP6uZMsoWZifDPZIudQDJgblQBkkMB9KCSDBI=", + "owner": "budimanjojo", + "repo": "talhelper", + "rev": "6396cd7b1c55416356d3c7209ebe6989cad9375c", + "type": "github" + }, + "original": { + "owner": "budimanjojo", + "ref": "v1.16.4", + "repo": "talhelper", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a8375a0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,43 @@ +{ + description = "jahanson's NixOS Flake"; + + # This is the standard format for flake.nix. + # `inputs` are the dependencies of the flake, + # and `outputs` function will return all the build results of the flake. + # Each item in `inputs` will be passed as a parameter to + # the `outputs` function after being pulled and built. + inputs = { + # There are many ways to reference flake inputs. + # The most widely used is `github:owner/name/reference`, + # which represents the GitHub repository URL + branch/commit-id/tag. + + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + talhelper.url = "github:budimanjojo/talhelper/v1.16.4"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + # The `@` syntax here is used to alias the attribute set of the + # inputs's parameter, making it convenient to use inside the function. + outputs = { self, nixpkgs, home-manager, ... }@inputs: { + nixosConfigurations = { + "durincore" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = inputs; + modules = [ + # Import the configuration.nix here, so that the + # old configuration file can still take effect. + # Note: configuration.nix itself is also a Nixpkgs Module, + ./configuration.nix + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.jahanson = import ./home.nix; + } + ]; + }; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..94d5c1e --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,40 @@ +# 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" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/e3e1b7a8-bf44-4b8c-a697-2aa994efe209"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-63960cf7-ce95-4e7d-8177-30bac148f890".device = "/dev/disk/by-uuid/63960cf7-ce95-4e7d-8177-30bac148f890"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/42C0-BA66"; + 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.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.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..4e969e8 --- /dev/null +++ b/home.nix @@ -0,0 +1,153 @@ +{ config, pkgs, ... }: + +{ + # TODO please change the username & home direcotry to your own + home.username = "jahanson"; + home.homeDirectory = "/home/jahanson"; + + # set cursor size and dpi for 4k monitor + xresources.properties = { + "Xcursor.size" = 16; + "Xft.dpi" = 172; + }; + + # basic configuration of git, please change to your own + programs.git = { + enable = true; + userName = "Joseph Hanson"; + userEmail = "joe@veri.dev"; + }; + + # exa replacement, ls replacement. + programs.lsd.enable = true; + programs.fish = { + enable = true; + shellAliases = { + # lsd + ls = "lsd"; + ll = "lsd -l"; + la = "lsd -a"; + lt = "lsd --tree"; + lla = "lsd -la"; + + # other + df = "df -h"; + du = "du -h"; + }; + functions = { + fish_greeting = { + description = "Set the fish greeting"; + body = "neofetch"; + }; + }; + }; + + # Packages that should be installed to the user profile. + home.packages = with pkgs; [ + # here is some command line tools I use frequently + # feel free to add your own or remove some of them + + neofetch + nnn # terminal file manager + ranger + + # archives + zip + xz + unzip + p7zip + + # utils + ripgrep # recursively searches directories for a regex pattern + jq # A lightweight and flexible command-line JSON processor + yq-go # yaml processer https://github.com/mikefarah/yq + fzf # A command-line fuzzy finder + + # networking tools + mtr # A network diagnostic tool + iperf3 + dnsutils # `dig` + `nslookup` + ldns # replacement of `dig`, it provide the command `drill` + aria2 # A lightweight multi-protocol & multi-source command-line download utility + socat # replacement of openbsd-netcat + nmap # A utility for network discovery and security auditing + ipcalc # it is a calculator for the IPv4/v6 addresses + + # misc + cowsay + file + which + tree + gnused + gnutar + gawk + zstd + gnupg + + # nix related + # + # it provides the command `nom` works just like `nix` + # with more details log output + nix-output-monitor + + # productivity + hugo # static site generator + glow # markdown previewer in terminal + + btop # replacement of htop/nmon + iotop # io monitoring + iftop # network monitoring + + # system call monitoring + strace # system call monitoring + ltrace # library call monitoring + lsof # list open files + + # system tools + sysstat + lm_sensors # for `sensors` command + ethtool + pciutils # lspci + usbutils # lsusb + ]; + + # starship - an customizable prompt for any shell + programs.starship = { + enable = true; + # custom settings + settings = { + add_newline = false; + aws.disabled = true; + gcloud.disabled = true; + line_break.disabled = true; + }; + }; + + # alacritty - a cross-platform, GPU-accelerated terminal emulator + programs.alacritty = { + enable = true; + # custom settings + settings = { + env.TERM = "xterm-256color"; + font = { + size = 12; + draw_bold_text_with_bright_colors = true; + }; + scrolling.multiplier = 5; + selection.save_to_clipboard = true; + }; + }; + + # 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 = "23.11"; + + # Let home Manager install and manage itself. + programs.home-manager.enable = true; +}