diff --git a/.gitignore b/.gitignore index 5ad4d896c794425bf5abd8fecd4e1e4cffc78ad9..bd001b5071fb0ab58c99f18615df6c177a4480f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ flake.lock .DS_STORE **/.DS_STORE +result +result-* diff --git a/flake.nix b/flake.nix index 07c39d145e3057cc2906036b60940efa7e427eb5..ee9fe4095b8cdc926f580cb3d389a0f47c450b94 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,6 @@ description = "New Modular flake!"; inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; - # nixpkgs.url = "github:NixOS/nixpkgs/master"; nixpkgs-stable.url = "nixpkgs/nixos-23.11"; home-manager.url = "github:nix-community/home-manager/master"; @@ -69,41 +68,51 @@ inputs.nh.overlays.default ]; - # ----- USER SETTINGS ----- # - userSettings = rec { - #enable if you want to use a tiling wm on macos - darwinTiling = true; - - username = "nmarks"; # username - name = "Natalie"; # name/identifier - email = "nmarks413@gmail.com"; # email (used for certain configurations) - dotfilesDir = "~/.dotfiles"; # absolute path of the local repo - theme = "catppuccin-mocha"; #name of theme that stylix will use - browser = "firefox"; # Default browser; must select one from ./user/app/browser/ - term = "ghostty"; # Default terminal command; - font = "iosevka"; # Selected font - editor = "neovim"; # Default editor; - spawnEditor = "exec" + term + " -e " + editor; - timeZone = "America/Los_Angeles"; - sexuality = "bisexual"; - - darwinHost = "laptop"; - nixosHost = "desktop"; - }; - mkSystem = import ./lib/mkSystem.nix { - inherit overlays nixpkgs inputs userSettings; + inherit overlays nixpkgs inputs; }; - in { + in rec { + # "nix run .#darwin-rebuild" + packages.aarch64-darwin.darwin-rebuild = darwin.packages.aarch64-darwin.darwin-rebuild; + # "nix fmt ." + formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; + formatter.aarch64-darwin = nixpkgs.legacyPackages.aarch64-darwin.alejandra; + + # natalie's desktop computer nixosConfigurations.nixos = mkSystem "nixos" { + user = "natalie"; + host = "desktop"; system = "x86_64-linux"; extraModules = [ nixos-cosmic.nixosModules.default ]; }; + # natalie's laptop darwinConfigurations."Natalies-MacBook-Air" = mkSystem "Natalies-MacBook-Air" { + user = "natalie"; + host = "laptop"; system = "aarch64-darwin"; - darwin = true; }; + + # chloe's mac studio "sandwich" + darwinConfigurations.sandwich = mkSystem "sandwich" { + user = "chloe"; + host = "sandwich"; + system = "aarch64-darwin"; + }; + # chloe's macbook air "paperback" + darwinConfigurations.paperback = mkSystem "paperback" { + user = "chloe"; + host = "paperback"; + system = "aarch64-darwin"; + }; + + # generate checks for "nix flake check --all-systems --no-build" + checks.aarch64-darwin = builtins.listToAttrs (builtins.map (name: let + d = darwinConfigurations.${name}.system; + in { + name = "darwinConfiguration-" + d.name; + value = d; + }) (builtins.attrNames darwinConfigurations)); }; } diff --git a/glance.yml b/glance.yml deleted file mode 100644 index 92b4de1c4871cde24a2f8d192f6a74189dbd8986..0000000000000000000000000000000000000000 --- a/glance.yml +++ /dev/null @@ -1,108 +0,0 @@ -pages: - - name: Home - # Optionally, if you only have a single page you can hide the desktop navigation for a cleaner look - # hide-desktop-navigation: true - columns: - - size: small - widgets: - - type: calendar - first-day-of-week: monday - - - type: rss - limit: 10 - collapse-after: 3 - cache: 12h - feeds: - - url: https://selfh.st/rss/ - title: selfh.st - limit: 4 - - url: https://ciechanow.ski/atom.xml - - url: https://www.joshwcomeau.com/rss.xml - title: Josh Comeau - - url: https://samwho.dev/rss.xml - - url: https://ishadeed.com/feed.xml - title: Ahmad Shadeed - - - type: twitch-channels - channels: - - theprimeagen - - j_blow - - piratesoftware - - cohhcarnage - - christitustech - - EJ_SA - - - size: full - widgets: - - type: group - widgets: - - type: hacker-news - - type: lobsters - - - type: videos - channels: - - UCXuqSBlHAE6Xw-yeJA0Tunw # Linus Tech Tips - - UCR-DXc1voovS8nhAvccRZhg # Jeff Geerling - - UCsBjURrPoezykLs9EqgamOA # Fireship - - UCBJycsmduvYEL83R_U4JriQ # Marques Brownlee - - UCHnyfMqiRRG1u-2MsSQLbXA # Veritasium - - - type: group - widgets: - - type: reddit - subreddit: technology - show-thumbnails: true - - type: reddit - subreddit: selfhosted - show-thumbnails: true - - - size: small - widgets: - - type: weather - location: London, United Kingdom - units: metric # alternatively "imperial" - hour-format: 12h # alternatively "24h" - # Optionally hide the location from being displayed in the widget - # hide-location: true - - - type: markets - # The link to go to when clicking on the symbol in the UI, - # {SYMBOL} will be substituded with the symbol for each market - symbol-link-template: https://www.tradingview.com/symbols/{SYMBOL}/news - markets: - - symbol: SPY - name: S&P 500 - - symbol: BTC-USD - name: Bitcoin - - symbol: NVDA - name: NVIDIA - - symbol: AAPL - name: Apple - - symbol: MSFT - name: Microsoft - - - type: releases - cache: 1d - # Without authentication the Github API allows for up to 60 requests per hour. You can create a - # read-only token from your Github account settings and use it here to increase the limit. - # token: ... - repositories: - - glanceapp/glance - - go-gitea/gitea - - immich-app/immich - - syncthing/syncthing - - # Add more pages here: - # - name: Your page name - # columns: - # - size: small - # widgets: - # # Add widgets here - - # - size: full - # widgets: - # # Add widgets here - - # - size: small - # widgets: - # # Add widgets here diff --git a/hosts/.DS_Store b/hosts/.DS_Store deleted file mode 100644 index 35fbfdbfc0e1e2dbaad4d81ec972ed669ba56405..0000000000000000000000000000000000000000 Binary files a/hosts/.DS_Store and /dev/null differ diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix deleted file mode 100644 index dfa4ffb938a9f85b8d8f6c7c6012ea58c250b31c..0000000000000000000000000000000000000000 --- a/hosts/desktop/configuration.nix +++ /dev/null @@ -1,181 +0,0 @@ -{ - pkgs, - userSettings, - systemSettings, - ... -}: { - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - programs = { - gamemode.enable = true; - - _1password.enable = true; - _1password-gui = { - enable = true; - # Certain features, including CLI integration and system authentication support, - # require enabling PolKit integration on some desktop environments (e.g. Plasma). - polkitPolicyOwners = [userSettings.username]; - }; - - noisetorch.enable = true; - - fish.enable = true; - virt-manager.enable = true; - - nh = { - enable = true; - # clean.enable = true; - # clean.extraArgs = "--keep-since 4d --keep 3"; - flake = "/home/nmarks/.dotfiles#nixosConfigurations.nixos"; - }; - - neovim = { - enable = true; - defaultEditor = true; - }; - - steam = { - enable = true; - package = with pkgs; steam.override {extraPkgs = pkgs: [attr];}; - }; - - git = { - enable = true; - lfs.enable = true; - }; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - mtr.enable = true; - gnupg.agent = { - enable = true; - enableSSHSupport = true; - pinentryPackage = pkgs.pinentry-curses; - }; - - kdeconnect.enable = true; - }; - - hardware.bluetooth.enable = true; - - xdg.portal = { - enable = true; - extraPortals = with pkgs; [xdg-desktop-portal-gtk]; - }; - virtualisation = { - containers.enable = true; - podman = { - enable = true; - # dockerCompat = true; - }; - docker.enable = true; - - libvirtd.enable = true; - }; - - nix.settings.trusted-users = ["root" userSettings.username]; - systemd = { - targets = { - sleep.enable = false; - suspend.enable = false; - hibernate.enable = false; - hybrid-sleep.enable = false; - }; - - packages = [pkgs.observatory]; - - services.monitord.wantedBy = ["multi-user.target"]; - }; - - i18n = { - # Select internationalisation properties. - defaultLocale = "en_US.UTF-8"; - - supportedLocales = ["all"]; - - 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"; - }; - - inputMethod = { - type = "fcitx5"; - enable = true; - fcitx5.waylandFrontend = true; - fcitx5.addons = with pkgs; [ - # fcitx5-gtk - # kdePackages.fcitx5-qt - rime-data - fcitx5-rime - fcitx5-rose-pine - ]; - }; - }; - - # Enable sound with pipewire. - security.rtkit.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.defaultUserShell = pkgs.fish; - users.users.${userSettings.username} = { - shell = pkgs.fish; - isNormalUser = true; - description = "Natalie Marks"; - extraGroups = ["networkmanager" "wheel" "docker"]; - # openssh.authorizedKeys.keyFiles = ["~/.ssh/id_ed25519.pub"]; - packages = with pkgs; [ - firefox - vim - steam - - # thunderbird - ]; - }; - environment = { - sessionVariables.COSMIC_DATA_CONTROL_ENABLED = 1; - variables.EDITOR = "nvim"; - - systemPackages = with pkgs; [ - vim - ]; - }; - - networking = { - hostName = systemSettings.host; # Define your hostname. - # wireless.enable = true; # Enables wireless support via wpa_supplicant. - networkmanager.enable = true; - firewall = { - allowedTCPPorts = [22 80 443]; - enable = true; - }; - interfaces.enp11s0.wakeOnLan = { - enable = true; - policy = ["magic"]; - }; - }; - - # Open ports in the firewall. - # 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.05"; # Did you read the comment? -} diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix deleted file mode 100644 index 92f5c10b57826805acb6e32df721b4d4f5379b37..0000000000000000000000000000000000000000 --- a/hosts/desktop/hardware-configuration.nix +++ /dev/null @@ -1,52 +0,0 @@ -# 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 = ["nvme" "ahci" "xhci_pci" "usbhid" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/5838d50d-e6e8-4ad2-a25e-524f4c46da35"; - fsType = "ext4"; - }; - - fileSystems."/boot/efi" = { - device = "/dev/disk/by-uuid/2319-EE79"; - fsType = "vfat"; - options = ["fmask=0022" "dmask=0022"]; - }; - - fileSystems."/home/nmarks/Games/steam" = { - device = "/dev/disk/by-uuid/e7ac46ce-edcb-4763-8717-a7c67de5c7f3"; - fsType = "ext4"; - }; - - swapDevices = [ - {device = "/dev/disk/by-uuid/a4128bb9-239c-4aa9-9777-5067feb77b28";} - ]; - - # 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.docker0.useDHCP = lib.mkDefault true; - # networking.interfaces.enp11s0.useDHCP = lib.mkDefault true; - # networking.interfaces.tailscale0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp10s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix deleted file mode 100644 index af74a4d9ffbc10eb18eb6bba7eed9b8971ddc267..0000000000000000000000000000000000000000 --- a/hosts/desktop/home.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ - inputs, - config, - pkgs, - lib, - userSettings, - systemSettings, - ... -}: let - shared-programs = import ../../modules/shared/homeManagerPrograms.nix {inherit inputs config pkgs lib userSettings systemSettings;}; -in { - imports = [ - inputs.nixvim.homeManagerModules.nixvim - #set up nixvim - # ../../modules/nixvim - ]; - home = { - stateVersion = "23.05"; # Please read the comment before changing. - - packages = with pkgs; let - shared-packages = import ../../modules/shared/packages.nix {inherit pkgs systemSettings;}; - in - shared-packages - ++ [ - #building macos apps hard :( - ghostty - stremio - julia - qbittorrent - - #gaming - bottles - lutris - mangohud - dxvk_2 - steam-run - vulkan-tools - path-of-building - wineWowPackages.stable - winetricks - (prismlauncher.override {gamemodeSupport = true;}) - - #window manager stuff - wofi - xorg.xauth - #linux tools - legcord - pavucontrol - ethtool - grub2 - efibootmgr - distrobox - xdg-desktop-portal-gtk - xclip - kdePackages.dolphin - #broken on macos - calibre - mpv - wireguard-tools - signal-desktop - ] - ++ [ - inputs.zls.packages.x86_64-linux.zls - rust-bin.stable.latest.default - ]; - # programs.mangohud.enable = true; - }; - - programs = shared-programs; - - # xdg.mimeApps.defaultApplications."inode/directory" = "dolphin.desktop"; -} diff --git a/hosts/laptop/.DS_Store b/hosts/laptop/.DS_Store deleted file mode 100644 index 4be084eeb267c00f5520ddb5bd0a88f0f42b9f06..0000000000000000000000000000000000000000 Binary files a/hosts/laptop/.DS_Store and /dev/null differ diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix deleted file mode 100644 index 3208c09b726a49ded4e8b4ac71fea1dc6d9629d5..0000000000000000000000000000000000000000 --- a/hosts/laptop/configuration.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - pkgs, - userSettings, - ... -}: { - environment.systemPackages = with pkgs; [ - neovim - pinentry_mac - signal-desktop-bin - ]; - - # Create /etc/zshrc that loads the nix-darwin environment. - programs = { - gnupg.agent.enable = true; - zsh.enable = true; # default shell on catalina - }; - - # When opening an interactive shell that isnt fish move into fish - programs.zsh = { - interactiveShellInit = '' - if [[ $(${pkgs.procps}/bin/ps -p $PPID -o comm) != "fish" && -z ''${ZSH_EXUCTION_STRING} ]] - then - [[ -o login ]] && LOGIN_OPTION='--login' || LOGIN_OPTION="" - exec ${pkgs.fish}/bin/fish $LOGIN_OPTION - fi - ''; - }; -} diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix deleted file mode 100644 index 1165040d8f892bf457b8f69dffa3284c971b58a0..0000000000000000000000000000000000000000 --- a/hosts/laptop/home.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ - inputs, - config, - pkgs, - lib, - userSettings, - systemSettings, - ... -}: { - imports = - [ - inputs.nixvim.homeManagerModules.nixvim - #set up nixvim - # ../../modules/nixvim - ] - ++ lib.optionals userSettings.darwinTiling [../../modules/macos/tiling/sketchybar-home.nix]; - - programs = import ../../modules/shared/homeManagerPrograms.nix {inherit inputs config pkgs lib userSettings systemSettings;}; - - home = { - inherit (userSettings) username; - # homeDirectory = systemSettings.homeConfig; - # shell = pkgs.fish; - stateVersion = "23.05"; # Please read the comment before changing. - - packages = pkgs.callPackage ../../modules/shared/packages.nix {inherit systemSettings;}; - - # file = { - # ".config/sketchybar" = { - # source = ../../modules/macos/tiling/sketchybar; - # recursive = true; - # onChange = "${pkgs.sketchybar}/bin/sketchybar --reload"; - # }; - # }; - - sessionPath = [ - "$HOME/.emacs.d/bin" - ]; - }; -} diff --git a/lib/mkSystem.nix b/lib/mkSystem.nix index e3da27f198a3ea7abe2f2276f92bdeb36e17e7e2..6cdb4b0d9c13ed566cdb07415f27bdb372d34458 100644 --- a/lib/mkSystem.nix +++ b/lib/mkSystem.nix @@ -4,116 +4,149 @@ nixpkgs, overlays, inputs, - userSettings, }: name: { - system, - darwin ? false, + user, # ./users/{name} + host ? null, # ./users/{name}/{host} (optional) + system, # arch-os extraModules ? [], }: let - nixindex = - if darwin - then inputs.nix-index-database.darwinModules.nix-index - else inputs.nix-index-database.nixosModules.nix-index; + inherit (builtins) pathExists; + darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system; + getInputModule = a: b: + inputs.${ + a + }.${ + if darwin + then "darwinModules" + else "nixosModules" + }.${ + b + }; - stylix = + # NixOS vs nix-darwin functions + systemFunc = if darwin - then inputs.stylix.darwinModules.stylix - else inputs.stylix.nixosModules.stylix; + then inputs.darwin.lib.darwinSystem + else nixpkgs.lib.nixosSystem; - systemModuleDir = - if darwin - then "macos" - else "nixos"; + userDir = ../users + "/${user}"; + userConfig = import (userDir + "/user.nix"); + hostDir = userDir + "/${host}"; + + hostConfigPath = hostDir + "/configuration.nix"; + userConfigPath = userDir + "/configuration.nix"; + hostHomePath = hostDir + "/home.nix"; + userHomePath = userDir + "/home.nix"; + # Arguments passed to all module files + args = { + inherit inputs; + currentSystem = system; + # Details about the host machine + host = { + inherit darwin name; + }; + user = ({ + # This acts as formal documentation for what is allowed in user.nix + username, # unix username + name, # your display name + email, # for identity in programs such as git + dotfilesDir, # location to `../.` + timeZone ? "America/Los_Angeles", + # Stylix/Theming + theme ? null, # theme name for stylix + sexuality ? null, # pride flag for hyfetch + font ? null, # font to use + term, # preferred $TERM + editor, # preferred $EDITOR + browser ? null, # preferred $BROWSER + } @ user: + user) + userConfig; + }; systemSettings = rec { inherit darwin; - host = + homeDir = "/${ if darwin - then userSettings.darwinHost - else userSettings.nixosHost; - - # The config files for this system. - - hostConfig = ../hosts/${host}/configuration.nix; - homeConfig = ../hosts/${host}/home.nix; - - homeDir = - if darwin - then "/Users/" + userSettings.username + "/" - else "/home/" + userSettings.username + "/"; - - # NixOS vs nix-darwin functions - systemFunc = - if darwin - then inputs.darwin.lib.darwinSystem - else nixpkgs.lib.nixosSystem; - - hmModules = - if darwin - then inputs.home-manager.darwinModules - else inputs.home-manager.nixosModules; + then "Users" + else "home" + }/${userConfig.username}"; }; in - with systemSettings; - systemFunc rec { - inherit system; + systemFunc { + inherit system; - #gross and ugly hack do NOT like - specialArgs = { - inherit (userSettings) darwinTiling; - }; + modules = + builtins.filter (f: f != null) + [ + # Apply our overlays. Overlays are keyed by system type so we have + # to go through and apply our system type. We do this first so + # the overlays are available globally. + {nixpkgs.overlays = overlays;} - modules = - [ - # Apply our overlays. Overlays are keyed by system type so we have - # to go through and apply our system type. We do this first so - # the overlays are available globally. - {nixpkgs.overlays = overlays;} + # Modules shared between nix-darwin and NixOS + ../modules/shared + # Modules for the specific OS + ( + if darwin + then ../modules/macos + else ../modules/nixos + ) - # Enable caching for nix-index so we dont have to rebuild it + # The user-wide configuration.nix + ( + if pathExists userConfigPath + then userConfigPath + else null + ) + # The host-wide configuration.nix + ( + if host != null && pathExists hostConfigPath + then hostConfigPath + else null + ) - #shared modules - ../modules/shared + # Set up nix-index and enable comma for easy one-shot command use + # https://github.com/nix-community/comma + (getInputModule "nix-index-database" "nix-index") + {programs.nix-index-database.comma.enable = true;} - #system specific modules - ../modules/${systemModuleDir} + # Themes for all programs + (getInputModule "stylix" "stylix") - # Link to config.nix - hostConfig + # Home manager + (getInputModule "home-manager" "home-manager") + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "hm-backup"; + # Arguments passed to all module files + extraSpecialArgs = + args + // { + mainHomeImports = builtins.filter (f: f != null) [ + ( + if pathExists userHomePath + then userHomePath + else null + ) + ( + if host != null && pathExists hostHomePath + then hostHomePath + else null + ) + ]; + }; + # can't find how to make this an array without the param + users.${userConfig.username} = ../modules/home-manager.nix; + }; + users.users.${userConfig.username}.home = systemSettings.homeDir; + } - #Set up nix-index and enable comma for easy one-shot command use - #https://github.com/nix-community/comma - nixindex - {programs.nix-index-database.comma.enable = true;} - - #style programs - stylix - - hmModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - backupFileExtension = "hm-backup"; - extraSpecialArgs = {inherit inputs userSettings systemSettings;}; - users.${userSettings.username} = homeConfig; - }; - - users.users.${userSettings.username}.home = homeDir; - } - - # We expose some extra arguments so that our modules can parameterize - # better based on these values. - { - config._module.args = { - currentSystem = system; - # currentSystemName = name; - # currentSystemUser = userSettings.username; - - inherit inputs userSettings systemSettings; - }; - } - ] - #Add extra modules depending on system - ++ extraModules; - } + # Arguments passed to all module files + {config._module.args = args;} + ] + # Add extra modules specified from config + ++ extraModules; + } diff --git a/modules/home-manager.nix b/modules/home-manager.nix new file mode 100644 index 0000000000000000000000000000000000000000..ae8767d74d6cb5a2b598f576809f6f230885bb9e --- /dev/null +++ b/modules/home-manager.nix @@ -0,0 +1,82 @@ +# This contains default configurations for set of programs +# and configuration, but does not enable many things on it's own. +{ + pkgs, + lib, + config, + user, + host, + mainHomeImports, + ... +}: let + cfg = config.programs; +in { + imports = mainHomeImports; + programs = { + home-manager.enable = true; + nix-index.enable = true; + + direnv = { + enableZshIntegration = true; + nix-direnv.enable = config.programs.direnv.enable; + }; + + git = { + enable = true; + userName = lib.mkDefault user.name; + userEmail = lib.mkDefault user.email; + ignores = [ + (lib.mkIf host.darwin ".DS_Store") # When using Finder + (lib.mkIf host.darwin "._*") # When using non-APFS drives + # ViM and Neovim + ".*.swp" + ".nvimlog" + ]; + }; + + atuin = { + enableBashIntegration = true; + enableFishIntegration = true; + daemon.enable = cfg.atuin.enable; + }; + bat = { + extraPackages = with pkgs.bat-extras; [batdiff batman batgrep batwatch batpipe prettybat]; + }; + hyfetch = { + settings = { + backend = "fastfetch"; + preset = user.sexuality; + mode = "rgb"; + light_dark = "dark"; + lightness = { + }; + color_align = { + mode = "horizontal"; + }; + }; + }; + fastfetch.enable = cfg.hyfetch.enable; + + fish = { + plugins = [ + { + name = "tide"; + inherit (pkgs.fishPlugins.tide) src; + } + { + name = "!!"; + inherit (pkgs.fishPlugins.bang-bang) src; + } + ]; + shellAliases = + {} + // lib.optionalAttrs (!host.darwin) { + reboot-windows = "sudo efibootmgr --bootnext 0000; sudo reboot -h now"; + }; + shellInit = '' + batman --export-env | source + ''; + ##test -r '/Users/${user.username}/.opam/opam-init/init.fish' && source '/Users/${user.username}/.opam/opam-init/init.fish' > /dev/null 2> /dev/null; or true + }; + }; +} diff --git a/modules/macos/default.nix b/modules/macos/default.nix index 8001529450328295c5b527d5ba93826e04f43924..57d92a7e9f94f6df392d6c62bbf0a85c53f88701 100644 --- a/modules/macos/default.nix +++ b/modules/macos/default.nix @@ -1,13 +1,20 @@ { pkgs, lib, - darwinTiling, ... }: { - imports = - [ - ./homebrew.nix - ./system.nix - ] - ++ lib.optionals darwinTiling [./tiling]; + imports = [ + # sort-lines: start + ./mac-app-store.nix + ./system.nix + ./icons.nix + ./tiling + # sort-lines: end + ]; + # make 'shared.linux' not an error to define. + options.shared.linux = lib.mkOption { + type = lib.types.anything; + default = {}; + description = "no-op on darwin"; + }; } diff --git a/modules/macos/mac-app-store.nix b/modules/macos/mac-app-store.nix new file mode 100644 index 0000000000000000000000000000000000000000..3b0dc41007e7ec116c9aab5902cf220f221630ed --- /dev/null +++ b/modules/macos/mac-app-store.nix @@ -0,0 +1,44 @@ +{ + config, + lib, + pkgs, + ... +}: let + types = lib.types; + + # Mapping of Mac App Store applications. + # Add new entries to this list via the App Store's share button + # https://apps.apple.com/us/app/logic-pro/id634148309?mt=12 + # --------- ID HERE + allMasApps = { + # sort-lines:start + adguard = 1440147259; + final-cut-pro = 424389933; + logic-pro = 634148309; + magnet = 441258766; + motion = 434290957; + wireguard = 1451685025; + # sort-lines:end + }; + + # the resolved configuration from the user + masApps = config.shared.darwin.macAppStoreApps; +in { + options = { + # Installs Mac Applications via name using homebrew. + shared.darwin.macAppStoreApps = lib.mkOption { + type = types.listOf types.str; + default = []; + }; + }; + config = lib.mkIf (builtins.length masApps > 0) { + homebrew.enable = true; + homebrew.masApps = builtins.listToAttrs ( + builtins.map (name: { + inherit name; + value = allMasApps.${name}; + }) + masApps + ); + }; +} diff --git a/modules/macos/system.nix b/modules/macos/system.nix index f0d75afd8c16d797741b80ec31745e8376792d80..578dda9c2efa6c374f662f4cb1a4a42d0899dbd1 100644 --- a/modules/macos/system.nix +++ b/modules/macos/system.nix @@ -1,21 +1,25 @@ { + config, pkgs, - userSettings, + lib, ... -}: { - #Use touchid or watch to activate sudo +}: let + tiling = config.shared.darwin.tiling.enable; +in { + # Use touchid or watch to activate sudo security.pam.services.sudo_local = { enable = true; reattach = true; touchIdAuth = true; }; - # set some OSX preferences that I always end up hunting down and changing. + + # Set some OSX preferences that I always end up hunting down and changing. system = { # Used for backwards compatibility, please read the changelog before changing. # $ darwin-rebuild changelog stateVersion = 6; - defaults = { + defaults = lib.mkDefault { # Turn quarantine off LaunchServices = { LSQuarantine = false; @@ -53,14 +57,14 @@ NSDocumentSaveNewDocumentsToCloud = false; AppleICUForce24HourTime = true; - #Autohide menu bar - _HIHideMenuBar = userSettings.darwinTiling; + # Autohide menu bar for tiling window manager + _HIHideMenuBar = tiling; }; # minimal dock dock = { autohide = true; - #instant hide and show - autohide-time-modifier = 0.0; + autohide-time-modifier = 0.0; # make animation instant + autohide-delay = 0.0; # remove delay when touching bottom of screen show-process-indicators = true; expose-group-apps = true; @@ -80,13 +84,12 @@ AppleShowAllExtensions = true; ShowPathbar = true; FXEnableExtensionChangeWarning = false; + # TODO: default to list view and not saving .DS_Store }; - CustomSystemPreferences = { "com.apple.universalaccess" = { closeViewTrackpadGestureZoomEnabled = 1; }; - "com.apple.symbolichotkeys" = { AppleSymbolicHotKeys = { "64" = { @@ -96,7 +99,6 @@ }; }; }; - # Bind caps to escape for better normal mode stuff keyboard = { enableKeyMapping = true; diff --git a/modules/macos/tiling/aerospace.nix b/modules/macos/tiling/aerospace.nix index 83aace4b614becab39cdf4cf7564d56198b48834..1405b4d72017c7f2f818760265957f9ff665915c 100644 --- a/modules/macos/tiling/aerospace.nix +++ b/modules/macos/tiling/aerospace.nix @@ -1,6 +1,6 @@ -{pkgs, ...}: { +{config,pkgs, ...}: { services.aerospace = { - enable = true; + enable = config.shared.darwin.tiling.enable; settings = { # Normalizations. See: https://nikitabobko.github.io/AeroSpace/guide#normalization enable-normalization-flatten-containers = true; diff --git a/modules/macos/tiling/default.nix b/modules/macos/tiling/default.nix index 0e55ef2ac56e6a7d8edee49b4127a77e79b896d7..2d79dc43996184035214c9de9b569677223f8844 100644 --- a/modules/macos/tiling/default.nix +++ b/modules/macos/tiling/default.nix @@ -1,6 +1,16 @@ -{pkgs, ...}: { +{ lib, ... }: let + inherit (lib) types; +in { imports = [ - ./aerospace.nix ./sketchybar.nix + ./aerospace.nix ]; + options = { + shared.darwin.tiling.enable = lib.mkOption { + type = types.bool; + default = false; + example = true; + description = "Enable tiling window management."; + }; + }; } diff --git a/modules/macos/tiling/sketchybar.nix b/modules/macos/tiling/sketchybar.nix index 97160217a70d9bdabc0a1e475a5582dd9b71c22f..e1121e34063cc5e4d2da909a90ba0b63803cb2be 100644 --- a/modules/macos/tiling/sketchybar.nix +++ b/modules/macos/tiling/sketchybar.nix @@ -1,6 +1,150 @@ -{pkgs, ...}: { +{config,pkgs, ...}: { services.sketchybar = { - enable = true; - package = pkgs.sketchybar; + enable = config.shared.darwin.tiling.enable; + config = '' + # This is a demo config to showcase some of the most important commands. + # It is meant to be changed and configured, as it is intentionally kept sparse. + # For a (much) more advanced configuration example see my dotfiles: + # https://github.com/FelixKratz/dotfiles + + PLUGIN_DIR="$CONFIG_DIR/plugins" + + ##### Bar Appearance ##### + # Configuring the general appearance of the bar. + # These are only some of the options available. For all options see: + # https://felixkratz.github.io/SketchyBar/config/bar + # If you are looking for other colors, see the color picker: + # https://felixkratz.github.io/SketchyBar/config/tricks#color-picker + + sketchybar --bar position=top height=40 blur_radius=30 color=0x04313244 + + # Colours + SURFACE=0xff313244 + + ##### Changing Defaults ##### + # We now change some default values, which are applied to all further items. + # For a full list of all available item properties see: + # https://felixkratz.github.io/SketchyBar/config/items + + default=( + padding_left=5 + padding_right=5 + icon.font="Hack Nerd Font:Bold:17.0" + label.font="Hack Nerd Font:Bold:14.0" + icon.color=0xffcdd6f4 + label.color=0xffcdd6f4 + icon.padding_left=8 + icon.padding_right=4 + label.padding_left=4 + label.padding_right=8 + background.padding_left=2 + background.padding_right=2 + background.color=$SURFACE \ + background.corner_radius=10 \ + background.height=30 \ + background.border_width=1 \ + ) + sketchybar --default "$\{default[@]}" + + sketchybar --add event aerospace_workspace_change + + for sid in $(aerospace list-workspaces --all); do + sketchybar --add item space.$sid left \ + --subscribe space.$sid aerospace_workspace_change \ + --set space.$sid \ + background.border_width=1 \ + background.border_color=0xffb4befe \ + background.corner_radius=5 \ + background.height=20 \ + icon.padding_left=0 \ + icon.padding_right=0 \ + label.padding_right=6 \ + label="$sid" \ + click_script="aerospace workspace $sid" \ + script="$CONFIG_DIR/plugins/aerospace.sh $sid" + done + + ##### Adding Left Items ##### + # We add some regular items to the left side of the bar, where + # only the properties deviating from the current defaults need to be set + + sketchybar --add item chevron left \ + --set chevron icon= label.drawing=off background.drawing=off \ + icon.color=0xfff5e0dc \ + --add item front_app left \ + --set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \ + label.color=0xff94e2d5 \ + label.padding_left=8 \ + background.border_color=0xff94e2d5 \ + --subscribe front_app front_app_switched + + ##### Adding Right Items ##### + # In the same way as the left items we can add items to the right side. + # Additional position (e.g. center) are available, see: + # https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar + + # Some items refresh on a fixed cycle, e.g. the clock runs its script once + # every 10s. Other items respond to events they subscribe to, e.g. the + # volume.sh script is only executed once an actual change in system audio + # volume is registered. More info about the event system can be found here: + # https://felixkratz.github.io/SketchyBar/config/events + + sketchybar --add item clock right \ + --set clock update_freq=10 icon=󰃰 script="$PLUGIN_DIR/clock.sh" \ + icon.color=0xfffab387 \ + label.color=0xffcdd6f4 \ + background.color=$SURFACE \ + background.corner_radius=10 \ + background.height=30 \ + --add item volume right \ + --set volume script="$PLUGIN_DIR/volume.sh" \ + label.color=0xffcdd6f4 \ + background.color=$SURFACE \ + background.corner_radius=10 \ + background.height=30 \ + --subscribe volume volume_change \ + --add item battery right \ + --set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \ + label.color=0xffcdd6f4 \ + background.color=$SURFACE \ + background.corner_radius=10 \ + background.height=30 \ + --subscribe battery system_woke power_source_change + + sketchybar -m --add item mullvad right \ + --set mullvad icon= \ + icon.color=0xfff38ba8 \ + background.color=$SURFACE \ + background.corner_radius=10 \ + background.height=30 \ + background.border_width=1 \ + background.border_color=0xfff38ba8 \ + label.padding_left=0 \ + label.padding_right=0 \ + icon.padding_left=6 \ + update_freq=5 \ + script="$PLUGIN_DIR/mullvad.sh" + + # Add event + sketchybar -m --add event song_update com.apple.iTunes.playerInfo + + # Add Music Item + sketchybar -m --add item music right \ + --set music script="$PLUGIN_DIR/music.sh" \ + click_script="$PLUGIN_DIR/music_click.sh" \ + label.padding_right=10 \ + label.color=0xffcdd6f4 \ + background.color=$SURFACE \ + background.corner_radius=10 \ + background.height=30 \ + background.border_width=1 \ + background.border_color=0xfff38ba8 \ + drawing=off \ + --subscribe music song_update + + ##### Force all scripts to run the first time (never do this in a script) ##### + sketchybar --update + + ''; }; } diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 7ae65d74539bd1e2a2d8f97f067a5e598a5f01e8..e8f99dd2749d64deff3aad98eb631d2d5f19cc39 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,8 +1,14 @@ -{pkgs, ...}: { +{ lib, pkgs, ... }: { imports = [ ./boot.nix ./ld.nix ./nvidia.nix ./services.nix ]; + # make 'shared.darwin' not an error to define. + options.shared.darwin = lib.mkOption { + type = lib.types.anything; + default = {}; + description = "no-op on linux"; + }; } diff --git a/modules/shared/default.nix b/modules/shared/default.nix index 383c1a15a451767ddd65fdd4099cc3ffb4c66c29..e44a841d41a64499ef11b0eebc52e936ecc4e632 100644 --- a/modules/shared/default.nix +++ b/modules/shared/default.nix @@ -1,6 +1,9 @@ +# shared is used by nixos-rebuild and darwin-rebuild {pkgs, ...}: { imports = [ - ./extras.nix + # sort-lines:start + ./user-system-settings.nix ./nix.nix + # sort-lines:end ]; } diff --git a/modules/shared/extras.nix b/modules/shared/extras.nix deleted file mode 100644 index d1ba2b55e8e3db81ba1f7b156ca3d17cdda072d9..0000000000000000000000000000000000000000 --- a/modules/shared/extras.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ - inputs, - pkgs, - userSettings, - ... -}: { - services.tailscale.enable = true; - - networking = { - }; - fonts.packages = with pkgs; [ - nerd-fonts.fira-code - nerd-fonts.iosevka - iosevka - nerd-fonts.symbols-only - nerd-fonts.iosevka - inputs.apple-fonts.packages.${pkgs.system}.sf-pro - ]; - - # Set your time zone. - time.timeZone = userSettings.timeZone; - - home-manager.users.${userSettings.username}.home.sessionVariables = { - EDITOR = userSettings.editor; - VISUAL = userSettings.editor; - TERMINAL = userSettings.term; - BROWSER = userSettings.browser; - }; - - stylix = { - enable = true; - base16Scheme = "${pkgs.base16-schemes}/share/themes/${userSettings.theme}.yaml"; - - fonts = { - serif = { - package = pkgs.nerd-fonts.${userSettings.font}; - name = "${userSettings.font} Nerd Font"; - }; - sansSerif = { - package = pkgs.nerd-fonts.${userSettings.font}; - name = "${userSettings.font} Nerd Font"; - }; - monospace = { - package = pkgs.nerd-fonts.${userSettings.font}; - name = "${userSettings.font} Nerd Font"; - }; - emoji = { - package = pkgs.twemoji-color-font; - name = "Twemoji Color"; - }; - }; - }; -} diff --git a/modules/shared/homeManagerPrograms.nix b/modules/shared/homeManagerPrograms.nix deleted file mode 100644 index 078b1f11f52a2dd827ff180455addf2e6619a310..0000000000000000000000000000000000000000 --- a/modules/shared/homeManagerPrograms.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ - pkgs, - lib, - userSettings, - systemSettings, - ... -}: { - nix-index.enable = true; - atuin = { - enable = true; - enableBashIntegration = true; - enableFishIntegration = true; - daemon.enable = true; - }; - - direnv = { - enable = true; - enableZshIntegration = true; - nix-direnv.enable = true; - }; - - bat = { - enable = true; - extraPackages = with pkgs.bat-extras; [batdiff batman batgrep batwatch batpipe prettybat]; - }; - - hyfetch = { - enable = true; - settings = { - backend = "fastfetch"; - preset = userSettings.sexuality; - mode = "rgb"; - light_dark = "dark"; - lightness = { - }; - color_align = { - mode = "horizontal"; - }; - }; - }; - - fish = { - enable = true; - - plugins = [ - { - name = "tide"; - inherit (pkgs.fishPlugins.tide) src; - } - { - name = "!!"; - inherit (pkgs.fishPlugins.bang-bang) src; - } - ]; - shellAliases = - { - } - // lib.optionalAttrs (!systemSettings.darwin) { - reboot-windows = "sudo efibootmgr --bootnext 0000; sudo reboot -h now"; - }; - shellInit = '' - batman --export-env | source - ''; - ##test -r '/Users/${userSettings.username}/.opam/opam-init/init.fish' && source '/Users/${userSettings.username}/.opam/opam-init/init.fish' > /dev/null 2> /dev/null; or true - }; - home-manager.enable = true; -} diff --git a/modules/shared/packages.nix b/modules/shared/packages.nix deleted file mode 100644 index f54cdc8d2e22524a60d7a56648de7196f81ee18a..0000000000000000000000000000000000000000 --- a/modules/shared/packages.nix +++ /dev/null @@ -1,120 +0,0 @@ -{ - pkgs, - systemSettings, - ... -}: -with pkgs; [ - #general development - just - pkg-config - gnumake - caddy - pm2 - clang-tools - wget - git - unzip - clang - cmake - gnupg - - #ides - zed-editor - emacs - - #virtualization - qemu - podman - docker - - #productivity - glance - anki-bin - tailscale - openconnect - - #nix tools - cachix - direnv - nh - - #terminal stuff - (btop.override {cudaSupport = true;}) - tmux - zellij - lazygit - fzf - neofetch - hyfetch - fastfetch - eza - ollama - uv - fd - ripgrep - file - fish - - #image tools - imagemagick - - #chatting apps - (discord.override { - withMoonlight = true; - }) - vesktop - - #media - spotify - zathura - - #language servers - typst-live - lua-language-server - nil - nixd - texlab - texlivePackages.chktex - - #formatters/linters - stylua - alejandra - statix - - #neovim deps - lua51Packages.lua - lua51Packages.luarocks-nix - codespell - typst - tree-sitter - - #python - pyright - basedpyright - ruff - python312Packages.python - python312Packages.pynvim - python312Packages.pip - - #programming languages - R - deno - ruby - nodePackages.npm - go - coq - elan - - #browsers - tor - firefox - - #math - texlive.combined.scheme-full - zathura - - #fun things - cowsay - cmatrix - sl -] diff --git a/modules/shared/user-system-settings.nix b/modules/shared/user-system-settings.nix new file mode 100644 index 0000000000000000000000000000000000000000..99ef4f76963fe41da74ab26af471929fb16b00bd --- /dev/null +++ b/modules/shared/user-system-settings.nix @@ -0,0 +1,43 @@ +# applies user settings for the system +{ + pkgs, + user, + lib, + ... +}: { + # Set your time zone. + time.timeZone = user.timeZone; + + home-manager.users.${user.username}.home.sessionVariables = + { + EDITOR = user.editor; + TERMINAL = user.term; + } + // lib.optionalAttrs (user ? "browser") { + BROWSER = user.browser; + }; + + stylix = { + enable = user ? "theme"; + base16Scheme = "${pkgs.base16-schemes}/share/themes/${user.theme}.yaml"; + + fonts = lib.optionalAttrs (user ? "font") { + serif = { + package = pkgs.nerd-fonts.${user.font}; + name = "${user.font} Nerd Font"; + }; + sansSerif = { + package = pkgs.nerd-fonts.${user.font}; + name = "${user.font} Nerd Font"; + }; + monospace = { + package = pkgs.nerd-fonts.${user.font}; + name = "${user.font} Nerd Font"; + }; + emoji = { + package = pkgs.twemoji-color-font; + name = "Twemoji Color"; + }; + }; + }; +} diff --git a/oldflake.nix b/oldflake.nix deleted file mode 100644 index e5cf7568791e33b1517f074b6444be9f9b0b8a81..0000000000000000000000000000000000000000 --- a/oldflake.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ - description = "My first flake!"; - - inputs = { - nixpkgs.url = "nixpkgs/nixos-23.11"; - home-manager = { - url = "github:nix-community/home-manager/release-23.11"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - # nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=<0.2.0>"; - - # hyprland.url = "github:hyprwm/Hyprland"; - # hyprland-plugins = { - # url = "github:hyprwm/hyprland-plugins"; - # inputs.hyprland.follows = "hyprland"; - # }; - # use the following for unstable: - # nixpkgs.url = "nixpkgs/nixos-unstable"; - - # or any branch you want: - # nixpkgs.url = "nixpkgs/{BRANCH-NAME}" - }; - - outputs = { - self, - home-manager, - nixpkgs, - ... - }: let - system = "x86_64-linux"; - lib = nixpkgs.lib; - pkgs = nixpkgs.legacyPackages.${system}; - in { - nixosConfigurations = { - nmarks = lib.nixosSystem { - inherit system; - modules = [./configuration.nix]; - }; - }; - homeConfigurations = { - nmarks = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [./home.nix]; - }; - }; - }; -} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..e48f331cd202294e5724674075391236f8c0f2f8 --- /dev/null +++ b/readme.md @@ -0,0 +1,65 @@ +# nix config + +this setup allows natalie and chloe to share common configuration between their machines, but also share useful modules between each other. + +``` +lib/ # reusable functions +modules/ # reusable modules + +-- macos/ # nix-darwin configurations + +-- nixos/ # linux configurations + +-- nixvim/ # neovim configurations + +-- shared/ # shared between nixos-rebuild & darwin-rebuild + +-- home-manager.nix # home program presets +users/ + +-- chloe/ + | +-- user.nix # info about her + | +-- configuration.nix # for all hosts + | +-- home.nix # for all hosts + | +-- sandwich/ + | | +-- configuration.nix # per host + | | +-- home.nix + | +-- paperback/ + | ... + +-- natalie/ + +-- user.nix # info about her + ... +``` + +A new machine can be added by adding a new definition in `flake.nix`. Note that the user and host `configuration.nix` and `home.nix` files are + +## macOS installation instructions + +Install Nix using the upstream Nix (Pick "no" then "yes): + +``` +curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \ + sh -s -- install +``` + +While this installs, now is a good time to perform manual setup steps: + +- Setup your SSH keys in `~/.ssh` +- Configure the device hostname in System Settings in + - About -> Name + - General -> Sharing -> Local Hostname +- Make sure you're logged into iCloud / Mac App Store +- `xcode-select --install` to make sure Git and other utilities are available. +- Optional: Disable app verification with `sudo spctl --master-disable`, then, go to System Settings -> Privacy to allow unsigned apps. + +Once Nix is installed, open a new shell and clone the repository: + +``` +# Clone via HTTPs +git clone https://git.paperclover.net/clo/config.git +# With SSH Authentication +git clone git@git.paperclover.net:clo/config +``` + +The location of the cloned repository must match what is in your `user.nix` file. + +Setup `nix-darwin` using the `switch` helper: + +``` +./switch +``` + diff --git a/switch b/switch new file mode 100755 index 0000000000000000000000000000000000000000..bd3388f8f4ffb43d94b54153ceb0893fdea2411c --- /dev/null +++ b/switch @@ -0,0 +1,12 @@ +#!/bin/sh +nh_subcommand="os" +fallback_command="nixos-rebuild" +if [ "$(uname -o)" ]; then + nh_subcommand="darwin" + fallback_command="nix run .#darwin-rebuild" +fi; +if command -v nh > /dev/null; then + nh $nh_subcommand switch . +else + $fallback_command -- switch --flake . +fi diff --git a/users/chloe/configuration.nix b/users/chloe/configuration.nix new file mode 100644 index 0000000000000000000000000000000000000000..77debafedb18ba6661ae4d20a097e2852043f03c --- /dev/null +++ b/users/chloe/configuration.nix @@ -0,0 +1,28 @@ +# Configuration applied to all of chloe's machines +{ pkgs, ... }: { + # packages for all machines + environment.systemPackages = with pkgs; [ + neovim + ]; + # configuration for shared modules. + # all custom options in 'shared' for clarity. + shared.darwin = { + macAppStoreApps = [ + "adguard" + "magnet" + ]; + }; + # system preferences + system.defaults = { + NSGlobalDomain = { + KeyRepeat = 1; + InitialKeyRepeat = 10; + }; + CustomUserPreferences = { + NSGlobalDomain = { + # TODO: how to change system accent color + AppleHighlightColor = "1.000000 0.874510 0.701961 Orange"; + }; + }; + }; +} diff --git a/users/chloe/home.nix b/users/chloe/home.nix new file mode 100644 index 0000000000000000000000000000000000000000..e5a7181a9c952bab4f6eeecfeb54a0cefb17ee15 --- /dev/null +++ b/users/chloe/home.nix @@ -0,0 +1,24 @@ +{ + inputs, + pkgs, + lib, + ... +}: { + home = { + stateVersion = "23.05"; # Please read the comment before changing. + packages = [ + pkgs.neovim + pkgs.nh + pkgs.ffmpeg + ]; + }; + programs = { + # sort-lines:start + hyfetch.enable = true; + zsh.enable = true; + # sort-lines:end + + # use a git-specific email + git.userEmail = "git@paperclover.net"; + }; +} diff --git a/users/chloe/paperback/configuration.nix b/users/chloe/paperback/configuration.nix new file mode 100644 index 0000000000000000000000000000000000000000..d79cf5920e35ba5f70ff2a6b24a4617a1059ec4c --- /dev/null +++ b/users/chloe/paperback/configuration.nix @@ -0,0 +1,5 @@ +{pkgs, ...}: { + environment.systemPackages = with pkgs; [ + reaper + ]; +} diff --git a/users/chloe/sandwich/configuration.nix b/users/chloe/sandwich/configuration.nix new file mode 100644 index 0000000000000000000000000000000000000000..5ef1b72843e23694ef9787ec17814ea6bcfdd1b4 --- /dev/null +++ b/users/chloe/sandwich/configuration.nix @@ -0,0 +1,14 @@ +{pkgs, ...}: { + environment.systemPackages = with pkgs; [ + ffmpeg + ripgrep + reaper + ]; + shared.darwin = { + macAppStoreApps = [ + "final-cut-pro" + "logic-pro" + "motion" + ]; + }; +} diff --git a/users/chloe/user.nix b/users/chloe/user.nix new file mode 100644 index 0000000000000000000000000000000000000000..376ec6060c73ff8678733f1a5c57360df5f18389 --- /dev/null +++ b/users/chloe/user.nix @@ -0,0 +1,18 @@ +# This definition is used by modules to customize as needed. +{ + username = "clo"; # username + name = "chloe caruso"; + email = "account@paperclover.net"; + timeZone = "America/Los_Angeles"; + + dotfilesDir = "~/config"; # absolute path of the local repo + + # Stylix/Theming + theme = "catppuccin-mocha"; + #font + sexuality = "lesbian"; # hyfetch + + # Default terminal command. NOTE: ghostty is not installed for you + term = "ghostty"; # preferred $TERMINAL + editor = "nvim"; # preferred $EDITOR +} diff --git a/users/natalie/configuration.nix b/users/natalie/configuration.nix new file mode 100644 index 0000000000000000000000000000000000000000..84680c6bd117b78025f925c513af14b8131a1785 --- /dev/null +++ b/users/natalie/configuration.nix @@ -0,0 +1,17 @@ +# Applied to all systems +{pkgs, ...}: { + services.tailscale.enable = true; + fonts.packages = with pkgs; [ + nerd-fonts.fira-code + nerd-fonts.iosevka + iosevka + nerd-fonts.symbols-only + nerd-fonts.iosevka + ]; + + # configuration for shared modules. + # all custom options in 'shared' for clarity. + shared.darwin = { + tiling.enable = true; # use tiling window manager + }; +} diff --git a/users/natalie/desktop/configuration.nix b/users/natalie/desktop/configuration.nix new file mode 100644 index 0000000000000000000000000000000000000000..22c85212df678ed638805419bc5dcbdd55b1f77b --- /dev/null +++ b/users/natalie/desktop/configuration.nix @@ -0,0 +1,181 @@ +{ + pkgs, + user, + host, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + programs = { + gamemode.enable = true; + + _1password.enable = true; + _1password-gui = { + enable = true; + # Certain features, including CLI integration and system authentication support, + # require enabling PolKit integration on some desktop environments (e.g. Plasma). + polkitPolicyOwners = [user.username]; + }; + + noisetorch.enable = true; + + fish.enable = true; + virt-manager.enable = true; + + nh = { + enable = true; + # clean.enable = true; + # clean.extraArgs = "--keep-since 4d --keep 3"; + flake = "/home/nmarks/.dotfiles#nixosConfigurations.nixos"; + }; + + neovim = { + enable = true; + defaultEditor = true; + }; + + steam = { + enable = true; + package = with pkgs; steam.override {extraPkgs = pkgs: [attr];}; + }; + + git = { + enable = true; + lfs.enable = true; + }; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + mtr.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + pinentryPackage = pkgs.pinentry-curses; + }; + + kdeconnect.enable = true; + }; + + hardware.bluetooth.enable = true; + + xdg.portal = { + enable = true; + extraPortals = with pkgs; [xdg-desktop-portal-gtk]; + }; + virtualisation = { + containers.enable = true; + podman = { + enable = true; + # dockerCompat = true; + }; + docker.enable = true; + + libvirtd.enable = true; + }; + + nix.settings.trusted-users = ["root" user.username]; + systemd = { + targets = { + sleep.enable = false; + suspend.enable = false; + hibernate.enable = false; + hybrid-sleep.enable = false; + }; + + packages = [pkgs.observatory]; + + services.monitord.wantedBy = ["multi-user.target"]; + }; + + i18n = { + # Select internationalisation properties. + defaultLocale = "en_US.UTF-8"; + + supportedLocales = ["all"]; + + 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"; + }; + + inputMethod = { + type = "fcitx5"; + enable = true; + fcitx5.waylandFrontend = true; + fcitx5.addons = with pkgs; [ + # fcitx5-gtk + # kdePackages.fcitx5-qt + rime-data + fcitx5-rime + fcitx5-rose-pine + ]; + }; + }; + + # Enable sound with pipewire. + security.rtkit.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.defaultUserShell = pkgs.fish; + users.users.${user.username} = { + shell = pkgs.fish; + isNormalUser = true; + description = user.name; + extraGroups = ["networkmanager" "wheel" "docker"]; + # openssh.authorizedKeys.keyFiles = ["~/.ssh/id_ed25519.pub"]; + packages = with pkgs; [ + firefox + vim + steam + + # thunderbird + ]; + }; + environment = { + sessionVariables.COSMIC_DATA_CONTROL_ENABLED = 1; + variables.EDITOR = "nvim"; + + systemPackages = with pkgs; [ + vim + ]; + }; + + networking = { + hostName = host.name; # Define your hostname. + # wireless.enable = true; # Enables wireless support via wpa_supplicant. + networkmanager.enable = true; + firewall = { + allowedTCPPorts = [22 80 443]; + enable = true; + }; + interfaces.enp11s0.wakeOnLan = { + enable = true; + policy = ["magic"]; + }; + }; + + # Open ports in the firewall. + # 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.05"; # Did you read the comment? +} diff --git a/users/natalie/desktop/hardware-configuration.nix b/users/natalie/desktop/hardware-configuration.nix new file mode 100644 index 0000000000000000000000000000000000000000..92f5c10b57826805acb6e32df721b4d4f5379b37 --- /dev/null +++ b/users/natalie/desktop/hardware-configuration.nix @@ -0,0 +1,52 @@ +# 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 = ["nvme" "ahci" "xhci_pci" "usbhid" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/5838d50d-e6e8-4ad2-a25e-524f4c46da35"; + fsType = "ext4"; + }; + + fileSystems."/boot/efi" = { + device = "/dev/disk/by-uuid/2319-EE79"; + fsType = "vfat"; + options = ["fmask=0022" "dmask=0022"]; + }; + + fileSystems."/home/nmarks/Games/steam" = { + device = "/dev/disk/by-uuid/e7ac46ce-edcb-4763-8717-a7c67de5c7f3"; + fsType = "ext4"; + }; + + swapDevices = [ + {device = "/dev/disk/by-uuid/a4128bb9-239c-4aa9-9777-5067feb77b28";} + ]; + + # 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.docker0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp11s0.useDHCP = lib.mkDefault true; + # networking.interfaces.tailscale0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp10s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/users/natalie/desktop/home.nix b/users/natalie/desktop/home.nix new file mode 100644 index 0000000000000000000000000000000000000000..54607fda2269f1ccf4de9343b3a021c7b1d4fd66 --- /dev/null +++ b/users/natalie/desktop/home.nix @@ -0,0 +1,62 @@ +{ + inputs, + config, + pkgs, + lib, + userSettings, + systemSettings, + ... +}: { + imports = [ + inputs.nixvim.homeManagerModules.nixvim + #set up nixvim + # ../../modules/nixvim + ]; + home = { + stateVersion = "23.05"; # Please read the comment before changing. + + packages = with pkgs; [ + #building macos apps hard :( + ghostty + stremio + julia + qbittorrent + + #gaming + bottles + lutris + mangohud + dxvk_2 + steam-run + vulkan-tools + path-of-building + wineWowPackages.stable + winetricks + (prismlauncher.override {gamemodeSupport = true;}) + + #window manager stuff + wofi + xorg.xauth + #linux tools + legcord + pavucontrol + ethtool + grub2 + efibootmgr + distrobox + xdg-desktop-portal-gtk + xclip + kdePackages.dolphin + #broken on macos + calibre + mpv + wireguard-tools + signal-desktop + inputs.zls.packages.x86_64-linux.zls + rust-bin.stable.latest.default + ]; + # programs.mangohud.enable = true; + }; + + # xdg.mimeApps.defaultApplications."inode/directory" = "dolphin.desktop"; +} diff --git a/users/natalie/glance.yml b/users/natalie/glance.yml new file mode 100644 index 0000000000000000000000000000000000000000..92b4de1c4871cde24a2f8d192f6a74189dbd8986 --- /dev/null +++ b/users/natalie/glance.yml @@ -0,0 +1,108 @@ +pages: + - name: Home + # Optionally, if you only have a single page you can hide the desktop navigation for a cleaner look + # hide-desktop-navigation: true + columns: + - size: small + widgets: + - type: calendar + first-day-of-week: monday + + - type: rss + limit: 10 + collapse-after: 3 + cache: 12h + feeds: + - url: https://selfh.st/rss/ + title: selfh.st + limit: 4 + - url: https://ciechanow.ski/atom.xml + - url: https://www.joshwcomeau.com/rss.xml + title: Josh Comeau + - url: https://samwho.dev/rss.xml + - url: https://ishadeed.com/feed.xml + title: Ahmad Shadeed + + - type: twitch-channels + channels: + - theprimeagen + - j_blow + - piratesoftware + - cohhcarnage + - christitustech + - EJ_SA + + - size: full + widgets: + - type: group + widgets: + - type: hacker-news + - type: lobsters + + - type: videos + channels: + - UCXuqSBlHAE6Xw-yeJA0Tunw # Linus Tech Tips + - UCR-DXc1voovS8nhAvccRZhg # Jeff Geerling + - UCsBjURrPoezykLs9EqgamOA # Fireship + - UCBJycsmduvYEL83R_U4JriQ # Marques Brownlee + - UCHnyfMqiRRG1u-2MsSQLbXA # Veritasium + + - type: group + widgets: + - type: reddit + subreddit: technology + show-thumbnails: true + - type: reddit + subreddit: selfhosted + show-thumbnails: true + + - size: small + widgets: + - type: weather + location: London, United Kingdom + units: metric # alternatively "imperial" + hour-format: 12h # alternatively "24h" + # Optionally hide the location from being displayed in the widget + # hide-location: true + + - type: markets + # The link to go to when clicking on the symbol in the UI, + # {SYMBOL} will be substituded with the symbol for each market + symbol-link-template: https://www.tradingview.com/symbols/{SYMBOL}/news + markets: + - symbol: SPY + name: S&P 500 + - symbol: BTC-USD + name: Bitcoin + - symbol: NVDA + name: NVIDIA + - symbol: AAPL + name: Apple + - symbol: MSFT + name: Microsoft + + - type: releases + cache: 1d + # Without authentication the Github API allows for up to 60 requests per hour. You can create a + # read-only token from your Github account settings and use it here to increase the limit. + # token: ... + repositories: + - glanceapp/glance + - go-gitea/gitea + - immich-app/immich + - syncthing/syncthing + + # Add more pages here: + # - name: Your page name + # columns: + # - size: small + # widgets: + # # Add widgets here + + # - size: full + # widgets: + # # Add widgets here + + # - size: small + # widgets: + # # Add widgets here diff --git a/users/natalie/home.nix b/users/natalie/home.nix new file mode 100644 index 0000000000000000000000000000000000000000..0d8ac9e9ea8d49340d50410088c8112dc851bc28 --- /dev/null +++ b/users/natalie/home.nix @@ -0,0 +1,16 @@ +{ + pkgs, + lib, + ... +} @ args: { + programs = { + # sort-lines:start + atuin.enable = true; + bat.enable = true; + hyfetch.enable = true; + direnv.enable = true; + # sort-lines:end + }; + + home.packages = import ./packages.nix args; +} diff --git a/users/natalie/laptop/configuration.nix b/users/natalie/laptop/configuration.nix new file mode 100644 index 0000000000000000000000000000000000000000..3c1d1948e795f5ea7559c80f6bdb0888fcd190a6 --- /dev/null +++ b/users/natalie/laptop/configuration.nix @@ -0,0 +1,56 @@ +{pkgs, ...}: { + environment.systemPackages = with pkgs; [ + neovim + pinentry_mac + signal-desktop-bin + ]; + + # Custom configuration modules in "modules" are shared between users, + # and can be configured in this "shared" namespace + shared.darwin = { + macAppStoreApps = ["wireguard"]; + }; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs = { + gnupg.agent.enable = true; + zsh.enable = true; # default shell on catalina + }; + + # When opening an interactive shell that isnt fish move into fish + programs.zsh = { + interactiveShellInit = '' + if [[ $(${pkgs.procps}/bin/ps -p $PPID -o comm) != "fish" && -z ''${ZSH_EXUCTION_STRING} ]] + then + [[ -o login ]] && LOGIN_OPTION='--login' || LOGIN_OPTION="" + exec ${pkgs.fish}/bin/fish $LOGIN_OPTION + fi + ''; + }; + + # Use homebrew to install casks + homebrew = { + enable = true; + + onActivation = { + autoUpdate = true; + cleanup = "none"; + upgrade = true; + }; + + brews = [ + "imagemagick" + "opam" + ]; + + casks = [ + "battle-net" + "stremio" + "alt-tab" + "legcord" + "zulip" + "zen-browser" + "supertuxkart" + ]; + }; +} diff --git a/users/natalie/laptop/home.nix b/users/natalie/laptop/home.nix new file mode 100644 index 0000000000000000000000000000000000000000..7aaf69187cb58f5f3071a035ebf028b8a18c9275 --- /dev/null +++ b/users/natalie/laptop/home.nix @@ -0,0 +1,23 @@ +{ + inputs, + config, + pkgs, + lib, + user, + host, + ... +} @ args: { + imports = [ + inputs.nixvim.homeManagerModules.nixvim + #set up nixvim + # ../../modules/nixvim + ]; + home = { + stateVersion = "23.05"; # Please read the comment before changing. + # shell = pkgs.fish; + + sessionPath = [ + "$HOME/.emacs.d/bin" + ]; + }; +} diff --git a/users/natalie/packages.nix b/users/natalie/packages.nix new file mode 100644 index 0000000000000000000000000000000000000000..0222c7508703ec72804b1b7ad839a3904621f1ce --- /dev/null +++ b/users/natalie/packages.nix @@ -0,0 +1,117 @@ +# Packages installed with home-manager +{pkgs, ...}: +with pkgs; [ + #general development + just + pkg-config + gnumake + caddy + pm2 + clang-tools + wget + git + unzip + clang + cmake + gnupg + + #ides + zed-editor + emacs + + #virtualization + qemu + podman + docker + + #productivity + glance + anki-bin + tailscale + openconnect + + #nix tools + cachix + direnv + nh + + #terminal stuff + (btop.override {cudaSupport = true;}) + tmux + zellij + lazygit + fzf + neofetch + hyfetch + fastfetch + eza + ollama + uv + fd + ripgrep + file + fish + + #image tools + imagemagick + + #chatting apps + (discord.override { + withMoonlight = true; + }) + vesktop + + #media + spotify + zathura + + #language servers + typst-live + lua-language-server + nil + nixd + texlab + texlivePackages.chktex + + #formatters/linters + stylua + alejandra + statix + + #neovim deps + lua51Packages.lua + lua51Packages.luarocks-nix + codespell + typst + tree-sitter + + #python + pyright + basedpyright + ruff + python312Packages.python + python312Packages.pynvim + python312Packages.pip + + #programming languages + R + deno + ruby + nodePackages.npm + go + coq + elan + + #browsers + tor + firefox + + #math + texlive.combined.scheme-full + zathura + + #fun things + cowsay + cmatrix + sl +] diff --git a/users/natalie/user.nix b/users/natalie/user.nix new file mode 100644 index 0000000000000000000000000000000000000000..5d87f176330618e7661d8fb3190b9c0beb57518b --- /dev/null +++ b/users/natalie/user.nix @@ -0,0 +1,13 @@ +rec { + username = "nmarks"; # username + name = "Natalie"; # name/identifier + email = "nmarks413@gmail.com"; # email (used for certain configurations) + dotfilesDir = "~/.dotfiles"; # absolute path of the local repo + theme = "catppuccin-mocha"; #name of theme that stylix will use + browser = "firefox"; # Default browser; must select one from ./user/app/browser/ + term = "ghostty"; # Default terminal command; + font = "iosevka"; # Selected font + editor = "neovim"; # Default editor; + timeZone = "America/Los_Angeles"; + sexuality = "bisexual"; +}