commit 53dc0a539d7038b4e8a87cae1c6363e6c6038033 Author: cswimr Date: Sat Nov 16 13:38:09 2024 -0500 initial commit diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..d2fb86b --- /dev/null +++ b/flake.lock @@ -0,0 +1,182 @@ +{ + "nodes": { + "catppuccin": { + "locked": { + "lastModified": 1731232837, + "narHash": "sha256-0aIwr/RC/oe7rYkfJb47xjdEQDSNcqpFGsEa+EPlDEs=", + "owner": "catppuccin", + "repo": "nix", + "rev": "32359bf226fe874d3b7a0a5753d291a4da9616fe", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "nix", + "type": "github" + } + }, + "compose2nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "onchg": "onchg" + }, + "locked": { + "lastModified": 1728874779, + "narHash": "sha256-498cQTDaU7bU3CbWPCQgSGkV25T8sZQmMwhU58WkIXE=", + "owner": "aksiksi", + "repo": "compose2nix", + "rev": "07cad037b8887ba94cd7236ffd1a8ee47002a9fe", + "type": "github" + }, + "original": { + "owner": "aksiksi", + "repo": "compose2nix", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1652776076, + "narHash": "sha256-gzTw/v1vj4dOVbpBSJX4J0DwUR6LIyXo7/SuuTJp1kM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "04c1b180862888302ddfb2e3ad9eaa63afc60cf8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1731604581, + "narHash": "sha256-Qq2YZZaDTB3FZLWU/Hgh1uuWlUBl3cMLGB99bm7rFUM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "1d0862ee2d7c6f6cd720d6f32213fa425004be10", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "home-manager", + "type": "github" + } + }, + "nix-pre-commit": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "compose2nix", + "onchg", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1653259102, + "narHash": "sha256-XfCEu4zur/N2Dk4v8wFiQAgJ7bgNqPqwWp1vBXkeczM=", + "owner": "jmgilman", + "repo": "nix-pre-commit", + "rev": "6a99b2711c7eac9960939d8eb91e84322b22d50c", + "type": "github" + }, + "original": { + "owner": "jmgilman", + "repo": "nix-pre-commit", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1731319897, + "narHash": "sha256-PbABj4tnbWFMfBp6OcUK5iGy1QY+/Z96ZcLpooIbuEI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dc460ec76cbff0e66e269457d7b728432263166c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1727348695, + "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "onchg": { + "inputs": { + "nix-pre-commit": "nix-pre-commit", + "nixpkgs": [ + "compose2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720368454, + "narHash": "sha256-NUSw3G2gsQX8/G64/pDBb1oitM+x13m7nFRvpiI4a+s=", + "owner": "aksiksi", + "repo": "onchg-rs", + "rev": "c42b693d10920874b3644ef1502e33318409d69c", + "type": "github" + }, + "original": { + "owner": "aksiksi", + "repo": "onchg-rs", + "type": "github" + } + }, + "root": { + "inputs": { + "catppuccin": "catppuccin", + "compose2nix": "compose2nix", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "zen-browser": "zen-browser" + } + }, + "zen-browser": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1727721329, + "narHash": "sha256-QYlWZwUSwrM7BuO+dXclZIwoPvBIuJr6GpFKv9XKFPI=", + "owner": "MarceColl", + "repo": "zen-browser-flake", + "rev": "e6ab73f405e9a2896cce5956c549a9cc359e5fcc", + "type": "github" + }, + "original": { + "owner": "MarceColl", + "repo": "zen-browser-flake", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..1805789 --- /dev/null +++ b/flake.nix @@ -0,0 +1,75 @@ +{ + description = "System Configuration @ cswimr 2024"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + catppuccin.url = "github:catppuccin/nix"; + compose2nix = { + url = "github:aksiksi/compose2nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + zen-browser.url = "github:MarceColl/zen-browser-flake"; + }; + outputs = { nixpkgs, home-manager, catppuccin, ... }@inputs: + let system = "x86_64-linux"; + in { + nixosConfigurations = { + eclipse = nixpkgs.lib.nixosSystem { + system = system; + modules = [ + # imports + ./nixos/configuration.nix + ./nixos/eclipse-hw-configuration.nix + ./nixos/environment.nix + ./nixos/git.nix + ./nixos/nvidia.nix + ./nixos/nvim.nix + ./nixos/pkg.nix + ./nixos/sudo.nix + ./nixos/tailscale.nix + ./nixos/zsh.nix + + # flake packages + { + environment.systemPackages = with inputs; + [ + compose2nix.packages.${system}.default + zen-browser.packages.${system}.specific + ]; + } + + # Catppuccin theme + catppuccin.nixosModules.catppuccin + { + catppuccin.enable = true; + catppuccin.flavor = "mocha"; + catppuccin.accent = "blue"; + boot.loader.grub.catppuccin.enable = true; + services.displayManager.sddm.catppuccin.enable = false; + } + + # Home Manager + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.cswimr = { + imports = [ + ./home-manager/home.nix + catppuccin.homeManagerModules.catppuccin + { + catppuccin.enable = true; + catppuccin.flavor = "mocha"; + catppuccin.accent = "blue"; + } + ]; + }; + } + ]; + }; + }; + }; +} diff --git a/home-manager/home.nix b/home-manager/home.nix new file mode 100755 index 0000000..b7a67c1 --- /dev/null +++ b/home-manager/home.nix @@ -0,0 +1,67 @@ +{ pkgs, ... }: { + home.username = "cswimr"; + home.homeDirectory = "/home/cswimr"; + + # link the configuration file in current directory to the specified location in home directory + # home.file.".config/i3/wallpaper.jpg".source = ./wallpaper.jpg; + + # link all files in `./scripts` to `~/.config/i3/scripts` + # home.file.".config/i3/scripts" = { + # source = ./scripts; + # recursive = true; # link recursively + # executable = true; # make all files executable + # }; + + # encode the file content in nix configuration file directly + # home.file.".xxx".text = '' + # xxx + # ''; + + # set cursor size and dpi for 4k monitor + xresources.properties = { + "Xcursor.size" = 16; + "Xft.dpi" = 172; + }; + + # Packages that should be installed to the user profile. + home.packages = with pkgs; [ vesktop vscode ]; + + # basic configuration of git, please change to your own + programs.git = { + enable = true; + userName = "cswimr"; + userEmail = "seaswimmerthefsh@gmail.com"; + extraConfig = { + signing = { signByDefault = true; }; + init = { defaultBranch = "master"; }; + safe = { directory = "/etc/nixos"; }; + url = { + "https://www.coastalcommits.com/" = { + insteadOf = [ + "cc:" + "coastalcommits:" + ]; + }; + "https://github.com/" = { + insteadOf = [ + "gh:" + "github:" + ]; + }; + }; + }; + }; + + # 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 = "24.05"; + + # Let home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix new file mode 100755 index 0000000..5b8e1c3 --- /dev/null +++ b/nixos/configuration.nix @@ -0,0 +1,118 @@ +# 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’). +{ + nix = { + settings.experimental-features = [ "nix-command" "flakes" ]; + }; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "eclipse"; # 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/New_York"; + + # 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. + # You can disable this if you're only using the Wayland session. + services.xserver.enable = true; + + # Enable the KDE Plasma Desktop Environment. + services.displayManager.sddm.enable = true; + services.desktopManager.plasma6.enable = true; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + 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.cswimr = { + isNormalUser = true; + description = "Seaswimmer"; + extraGroups = [ "networkmanager" "wheel" ]; + # packages = with pkgs; []; use home-manager instead! + }; + + # Install firefox. + programs.firefox.enable = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # 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 = "24.05"; # Did you read the comment? + +} diff --git a/nixos/eclipse-hw-configuration.nix b/nixos/eclipse-hw-configuration.nix new file mode 100755 index 0000000..f3cb1e9 --- /dev/null +++ b/nixos/eclipse-hw-configuration.nix @@ -0,0 +1,48 @@ +# 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, modulesPath, ... }: + +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + "sr_mod" + "rtsx_usb_sdmmc" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/f65ec459-c974-4032-8224-fa78c57527c2"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/484E-279A"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [{ device = "/dev/disk/by-uuid/4eab8c8f-85c5-4a04-a03c-e111ada06ec0"; }]; + + # 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.wlp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nixos/environment.nix b/nixos/environment.nix new file mode 100644 index 0000000..30ffb65 --- /dev/null +++ b/nixos/environment.nix @@ -0,0 +1,9 @@ +{ lib, ... }: { + environment.variables = { + EDITOR = lib.mkDefault (if builtins.hasAttr "SSH_CONNECTION" + builtins.currentSystemEnvironment then + "nvim" + else + "code"); + }; +} diff --git a/nixos/git.nix b/nixos/git.nix new file mode 100755 index 0000000..9a730be --- /dev/null +++ b/nixos/git.nix @@ -0,0 +1,22 @@ +{ + programs.git = { + config = { + init = { defaultBranch = "master"; }; + safe = { directory = "/etc/nixos"; }; + url = { + "https://www.coastalcommits.com/" = { + insteadOf = [ + "cc:" + "coastalcommits:" + ]; + }; + "https://github.com/" = { + insteadOf = [ + "gh:" + "github:" + ]; + }; + }; + }; + }; +} diff --git a/nixos/nvidia.nix b/nixos/nvidia.nix new file mode 100755 index 0000000..2afa881 --- /dev/null +++ b/nixos/nvidia.nix @@ -0,0 +1,37 @@ +{ config, ... }: { + # Enable OpenGL + hardware.graphics = { enable = true; }; + + # Load nvidia driver for Xorg / Wayland + services.xserver.videoDrivers = [ "nvidia" ]; + + hardware.nvidia = { + + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have grapihcal corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = true; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + open = true; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.beta; + }; +} diff --git a/nixos/nvim.nix b/nixos/nvim.nix new file mode 100755 index 0000000..b694d2f --- /dev/null +++ b/nixos/nvim.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: { + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ neovim ]; + + programs.neovim = { + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + }; +} diff --git a/nixos/pkg.nix b/nixos/pkg.nix new file mode 100755 index 0000000..93420b5 --- /dev/null +++ b/nixos/pkg.nix @@ -0,0 +1,66 @@ +{ pkgs, ... }: { + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + wget + curl + git + (nnn.override { withNerdIcons = true; }) + fzf + ripgrep + fastfetch + zip + xz + unzip + jq + yq-go + eza + dnsutils + nmap + which + tree + gnupg + nix-output-monitor + glow + btop + strace + ltrace + lsof + sysstat + lm_sensors + ethtool + pciutils + usbutils + nil + lazygit + lazydocker + bat + nixfmt + + # python stuff 🐍 + uv + python313 + python312 + python311 + + # javascript stuff 🤮 + nodejs + corepack + + # catppuccin + (catppuccin-kde.override { + flavour = [ "mocha" "macchiato" "frappe" "latte" ]; + accents = [ "blue" ]; + winDecStyles = [ "classic" ]; + }) + ]; + + fonts.packages = with pkgs; + [ (nerdfonts.override { fonts = [ "FiraCode" ]; }) ]; + + # install docker + virtualisation.docker = { enable = true; }; + + # remove nano + programs.nano.enable = false; +} diff --git a/nixos/sudo.nix b/nixos/sudo.nix new file mode 100755 index 0000000..5ee4631 --- /dev/null +++ b/nixos/sudo.nix @@ -0,0 +1,9 @@ +{ + security.sudo.extraRules = [{ + users = [ "cswimr" ]; + commands = [{ + command = "ALL"; + options = [ "SETENV" "NOPASSWD" ]; + }]; + }]; +} diff --git a/nixos/tailscale.nix b/nixos/tailscale.nix new file mode 100755 index 0000000..17a324c --- /dev/null +++ b/nixos/tailscale.nix @@ -0,0 +1,7 @@ +{ + services.tailscale = { + enable = true; + authKeyFile = "/run/secrets/tailscale_key"; + extraUpFlags = [ "--ssh" ]; + }; +} diff --git a/nixos/zsh.nix b/nixos/zsh.nix new file mode 100755 index 0000000..afc3a77 --- /dev/null +++ b/nixos/zsh.nix @@ -0,0 +1,49 @@ +{ pkgs, ... }: { + # starship - an customizable prompt for any shell + #programs.starship = { + #enable = true; + # custom settings + #settings = { + #format = "$all$nix_shell$python$nodejs$lua$golang$rust$php$git_branch$git_commit$git_state$git_status\n$username$hostname$directory"; + #add_newline = true; + #aws.disabled = true; + #gcloud.disabled = true; + #line_break.disabled = true; + #}; + #}; + users.defaultUserShell = pkgs.zsh; + programs.zsh = { + enable = true; + enableCompletion = true; + enableBashCompletion = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + shellInit = '' + export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin" + ''; + + histSize = 10000; + histFile = "$HOME/.zsh_history"; + + ohMyZsh = { + enable = true; + theme = "agnoster"; + }; + + shellAliases = { + ff = "fastfetch"; + neofetch = "fastfetch"; + nf = "fastfetch"; + + ls = "eza --icons"; + l = "eza -lhg --icons"; + + upd = "sudo nixos-rebuild switch"; + + c = "clear"; + # alias sudo to itself so user aliases can be sudoed + sudo = "sudo "; + s = "sudo "; + }; + }; +}