commit caafce59d9b7434d0b33c63f99323a4c047361e8 Author: morganmayday Date: Thu Feb 12 15:00:24 2026 -0800 First commit! diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bbe23ce --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +scripts/depend/cache/* +scripts/cache/* +nixos-switch.log diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..ea9b84a --- /dev/null +++ b/configuration.nix @@ -0,0 +1,49 @@ +{ inputs, outputs, lib, config, pkgs, variables, ... }: +{ + + system.stateVersion = "25.05"; + + imports = [ + # Imports these as if they're in this file + ./modules/index.nix + ]; + + nixpkgs = { + config = { + # Allow proprietary packages + allowUnfree = true; + allowUnfreePredicate = (_: true); + }; + }; + + nix = let + flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; + in { + + settings = { + # Enable the nix commands, which are useful, and flakes, which are useful and necessary for this + experimental-features = "nix-command flakes"; + }; + + gc = { # garbage collection + automatic = true; + dates = "weekly"; + options = "--delete-older-than 14d"; + }; + }; + + boot.kernelPackages = pkgs.linuxPackages_latest; + +# If you set up disk encryption, paste the line that looks like this from your generated config +# boot.initrd.luks.devices."LUKS-ID".device = "/dev/disk/by-uuid/DISK-UUID"; + + + users.users = { + ${variables.username} = { + isNormalUser = true; + extraGroups = [ "networkmanager" "wheel" "wireshark" ]; + shell = pkgs.bash; + description= "${variables.userDescription}"; + }; + }; +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..62b7f68 --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "Barebones version of Morgan Mayday's v1.0b config, for newer users"; + + inputs = { + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + nixpkgs.url = "nixpkgs/nixos-25.11"; + nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; + }; + }; + + outputs = { self, nixpkgs, nixos-hardware, ... }@inputs: + let + variables = { + # Change these to yours! + username = "mayday"; + hostname = "atlas"; + email = "me@morganmay.day"; + gitUsername = "morganmayday"; + userDescription = "Morgan Mayday"; + # If you prefer nano, CHANGE THIS NOW! + editor = "nvim"; + # Find this for your laptop in https://github.com/NixOS/nixos-hardware/tree/master + # If you can't find your machine in the nixos-hardware repo, comment this out. + hardware = "framework-12-13th-gen-intel"; + }; + in + { + nixosConfigurations.${variables.hostname} = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs variables; }; + modules = [ + ./configuration.nix + # If you can't find your machine in the nixos-hardware repo, comment this out. + nixos-hardware.nixosModules.${variables.hardware} + ]; + }; + }; +} diff --git a/modules/boot.nix b/modules/boot.nix new file mode 100644 index 0000000..09a5b37 --- /dev/null +++ b/modules/boot.nix @@ -0,0 +1,10 @@ +## Controls the bootloader +{ inputs, config, pkgs, variables, ... }: +{ + # Enables systemd-boot, I dislike Grub + boot.loader.systemd-boot.enable = true; + # Allows the bootloader to touch things in UEFI and such + boot.loader.efi.canTouchEfiVariables = true; + # Allows the firmware updater to work + services.fwupd.enable = true; +} diff --git a/modules/index.nix b/modules/index.nix new file mode 100644 index 0000000..4ba4c2e --- /dev/null +++ b/modules/index.nix @@ -0,0 +1,14 @@ +## Indexes all the other modules +{ inputs, config, pkgs, ... }: +{ + imports = + [ + ./boot.nix + ./packages.nix + ./services.nix + ./net.nix + ./vars.nix + ./unstable.nix + ./machine.nix + ]; +} diff --git a/modules/machine.nix b/modules/machine.nix new file mode 100644 index 0000000..6f9bfca --- /dev/null +++ b/modules/machine.nix @@ -0,0 +1,14 @@ +## Intended to route hostname and machine-specific settings +{ inputs, config, pkgs, variables, ... }: +{ + imports = + [ + # If you set up a machine-specific .nix file, the line below can route it from this folder + # ./${variables.hostname}.nix + # if map-impure for your hw config doesn't work, copy the below file into this folder, and point the path here + /etc/nixos/hardware-configuration.nix + ]; + + system.nixos.label = "atlas"; + networking.hostName = "atlas"; +} diff --git a/modules/net.nix b/modules/net.nix new file mode 100644 index 0000000..d29de46 --- /dev/null +++ b/modules/net.nix @@ -0,0 +1,42 @@ +## Controls networking +{ inputs, config, pkgs, ... }: +{ + networking = { + networkmanager = { + enable = true; + }; + nameservers = [ "9.9.9.9" ]; # Backup is 1s for Cloudflare + enableIPv6 = false; # IPv6 has been fucky every single time I've tried to use it + nat = { + enable = true; + internalInterfaces = [ "ve-+" ]; + externalInterface = "wlan0"; + }; + firewall = { + enable = true; + # open ports in firewall below + # allowedTCPPorts = [ ... ]; + # allowedUDPPorts = [ ... ]; + }; + }; + services = { + # LAN discovery, necessary for printing + avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + # VPN + mullvad-vpn.enable = true; + # Bluetooth + blueman.enable = false; + # Printing + printing = { + enable = true; + drivers = [ pkgs.gutenprint pkgs.cnijfilter2 pkgs.hplip pkgs.hplipWithPlugin]; + }; + }; + # Bluetooth hardware + hardware.bluetooth.enable = false; + hardware.bluetooth.powerOnBoot = false; +} diff --git a/modules/packages.nix b/modules/packages.nix new file mode 100644 index 0000000..e177ffa --- /dev/null +++ b/modules/packages.nix @@ -0,0 +1,102 @@ +## Most if not all packages +{ inputs, config, pkgs, variables, ... }: +{ + environment.systemPackages = with pkgs; + [ + #### WORKFLOW-CLI #### + neovim + # nano # for if you don't like vim + bash + bc # bash calculator + kitty # terminal + #### WORKFLOW-GUI #### + # Since this version is on Plasma, you're gonna be provided with almost everything + speedcrunch # gui calculator + #### UNCORE UTILS #### + wget + unzip + zip + fastfetch # neofetch replacement + dust # disk storage mapper + fzf # fuzzy finder + jq # json parser + #### COMMS #### + # signal-desktop needs to be on the unstable release + vesktop + #### MEDIA READING #### + vlc # audio/video + zathura # pdfs + firefox # browsing + #### MEDIA MAKING #### + inkscape-with-extensions # visual art + libreoffice # office suite + #### GAMING #### + prismlauncher # Minecraft + wine # a nice cabernet, perhaps? windows compat layer, if Steam fails you. + #### FIRMWARE / BASEWARE #### + linux-firmware + pipewire # audio + pipecontrol # audio + fwupd # firmware updater + dbus # process messager + upower + syspower + brightnessctl + networkmanager + #### THEMING #### + swww # animated wallpaper engine + gtk4 + gtk3 + gtk2 + nwg-look # gtk manager, imperative :/ + #### THEME ELEMENTS #### + # nothing here :) + ]; + fonts.packages = with pkgs; [ + noto-fonts-color-emoji + noto-fonts-monochrome-emoji + libertine + liberation_ttf + fira-code + fira-code-symbols + mplus-outline-fonts.githubRelease + dina-font + clearlyU + proggyfonts + garamond-libre + nerd-fonts.noto + nerd-fonts.shure-tech-mono + nerd-fonts.dejavu-sans-mono + ]; + + environment.plasma6.excludePackages = with pkgs.kdePackages; [ + # any packages you want to exclude from KDE Plasma's default install go here + ]; + + programs = { + # Workflow + git.enable = true; + # again, kill neovim if you prefer nano + neovim = { + enable = true; + vimAlias = true; + configure = { + customRC = '' + require('neo-tree').setup({ + --options go here + }) + ''; + }; + }; + # Steam + steam.enable = true; + # Network diagnostics + mtr.enable = true; + # nix-ld.enable = true; + # nix-ld.libraries = with pkgs; [ + # Add any missing dynamic libraries for unpackaged programs here, + # NOT In environment.systemPackages + # ]; + }; +} + diff --git a/modules/services.nix b/modules/services.nix new file mode 100644 index 0000000..643ecb3 --- /dev/null +++ b/modules/services.nix @@ -0,0 +1,77 @@ +## Controls the bulk of system services other than bootloader and networking + +{ inputs, config, pkgs, variables, ... }: +{ + # Enables graphics + hardware.graphics.enable = true; + services = { + # Enable KDE Plasma and its display manager, SDDM + desktopManager.plasma6.enable = true; + displayManager.sddm.enable = true; + displayManager.sddm.wayland.enable = true; # enables specifically wayland support + # Automatically mount removable media to /media + udisks2.enable = true; + udisks2.mountOnMedia = true; + # Schedulers + cron.enable = true; + atd.enable = true; + # Power stuff + upower.enable = true; + logind.settings.Login = { + HandleLidSwitch = "suspend-then-hibernate"; + HandlePowerKey = "poweroff"; + }; + # VFS stuff + envfs.enable = true; + gvfs.enable = true; + # Audio + pipewire = { + enable = true; + audio.enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + wireplumber.enable = true; + }; + # Location services + locate = { + enable = false; + package = pkgs.plocate; + }; + # Temp management + thermald.enable = true; + # X11--I prefer wayland, but just to be safe + xserver = { + enable = true; + xkb.layout = "us"; + xkb.variant = ""; + }; + }; + # Allows sudo stuff with fuse for mounting shit + programs.fuse.userAllowOther = true; + # Power management + powerManagement.enable = true; + # if you ever need appimages this is magic code that does magic + boot.binfmt.registrations.appimage = { + wrapInterpreterInShell = false; + interpreter = "${pkgs.appimage-run}/bin/appimage-run"; + recognitionType = "magic"; + offset = 0; + mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff''; + magicOrExtension = ''\x7fELF....AI\x02''; + }; + # Security & encryption + security.polkit.enable = true; + security.rtkit.enable = true; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + # Themeing + # qt = { + # enable = true; + # platformTheme = "gtk2"; + # style = "gtk2"; + #}; +} diff --git a/modules/unstable.nix b/modules/unstable.nix new file mode 100644 index 0000000..36fee25 --- /dev/null +++ b/modules/unstable.nix @@ -0,0 +1,8 @@ +## Pulls packages specifically from unstable repo, rather than the default stable. +## Note: this may not work! This *should* work, but I use the opposite setup--unstable, with specific stable packages--so this is a bit more spaghetti. +{ inputs, config, pkgs, ... }: +{ + environment.systemPackages = with inputs.nixpkgs-unstable; [ + signal-desktop + ]; +} diff --git a/modules/vars.nix b/modules/vars.nix new file mode 100644 index 0000000..b46ce48 --- /dev/null +++ b/modules/vars.nix @@ -0,0 +1,32 @@ +## Sets environment variables, locale, and the like. +{ inputs, config, pkgs, variables, ... }: +{ + environment.sessionVariables = { + NIXOS_OZONE_WL = "1"; # fixes some electron stuff + ELECTRON_OZONE_PLATFORM_HINT = "auto"; + DOTFILES_DIR = "/home/${variables.username}/dotfiles"; + SCRIPTS_DIR = "/home/${variables.username}/dotfiles/scripts"; + SCRIPTS_PATH = "/home/${variables.username}/dotfiles/scripts"; + PATH="\${SCRIPTS_PATH}:\${PATH}"; + EDITOR="${variables.editor}"; + }; + programs.git.config = { + user = { + email = "${variables.email}"; + name = "${variables.gitUsername}"; + }; + core = { + pager = "cat"; + editor = "${variables.editor}"; + }; + }; + time.timeZone = "US/Pacific"; + i18n.defaultLocale = "en_CA.UTF-8"; + i18n.extraLocales = "all"; + i18n.extraLocaleSettings = { + LC_TIME = "C.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_ADDRESS = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + }; +} diff --git a/scripts/rebuild b/scripts/rebuild new file mode 100755 index 0000000..76e7bf5 --- /dev/null +++ b/scripts/rebuild @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +cd $DOTFILES_DIR +echo "Rebuilding..." +current=$(nixos-rebuild list-generations | grep True | awk '{print $4,"generation",$1,"kernel version",$5,"at",$3,$2}') +if [[ $* =~ u ]]; then + rm $DOTFILES_DIR/flake.lock + nix-channel --update + nix flake update +fi +git add . && git diff HEAD --minimal && git commit -am "$current rebuilding" +sudo nixos-rebuild switch --impure --flake $DOTFILES_DIR # &> nixos-switch.log || (cat nixos-switch.log | grep --color error && notify-send -e "NixOS Rebuild Failed!" --icon=software-update-available && exit 1) && notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available +if [[ $* =~ p ]]; then + sync-dotfiles +fi +if [[ $* =~ r ]]; then + reboot +fi diff --git a/scripts/sync-dotfiles b/scripts/sync-dotfiles new file mode 100755 index 0000000..f07d966 --- /dev/null +++ b/scripts/sync-dotfiles @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +echo "" +cd $DOTFILES_DIR +current=$(nixos-rebuild list-generations | grep True | awk '{print $4,"generation",$1,"kernel version",$5,"at",$3,$2}') +git add . +git commit -am "Autocommit for $current" +git remote update +statusr=$(git status --ahead-behind | grep -E "Your branch" | awk '{print $4}') + +if [[ $statusr == "up" ]]; then + echo "Local and remote already synced." +elif [[ $statusr == "ahead" ]]; then + echo "Ahead of remote, no diverging changes. Pushing now." + git push -q + echo "Pushed!" +elif [[ $statusr == "behind" ]]; then + echo "Behind remote, no diverging changes. Pulling now." + git pull -q + echo "Pulled!" +elif [[ -n $statusr ]]; then + echo "Divergent changes detected. Manual intervention required." +fi + +echo ""