diff --git a/darwin/aerospace.nix b/darwin/aerospace.nix index dcd7555..4b1e774 100644 --- a/darwin/aerospace.nix +++ b/darwin/aerospace.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: +{ + pkgs, + lib, + config, + ... +}: { options.custom = with lib; { @@ -37,9 +42,10 @@ alt-enter = let script = pkgs.writeText "ghostty.applescript" '' - do shell script "open -n -a Ghostty" - ''; - in "exec-and-forget osascript ${script}"; + do shell script "open -n -a Ghostty" + ''; + in + "exec-and-forget osascript ${script}"; alt-shift-f = "fullscreen"; alt-p = "layout floating tiling"; @@ -120,8 +126,8 @@ on-window-detected = [ { - "if".app-id="com.mitchellh.ghostty"; - run= [ "layout tiling" ]; + "if".app-id = "com.mitchellh.ghostty"; + run = [ "layout tiling" ]; } ]; }; diff --git a/darwin/default.nix b/darwin/default.nix index 4185fdb..565aa46 100644 --- a/darwin/default.nix +++ b/darwin/default.nix @@ -6,7 +6,8 @@ system, host, ... -}: { +}: +{ imports = [ ./aerospace.nix ./homebrew.nix @@ -53,10 +54,13 @@ # networking.hostId = builtins.substring 0 8 (builtins.hashString "md5" config.networking.hostName); # networking.networkmanager.enable = true; - environment.systemPackages = with pkgs; [ - vim - htop - ] ++ (lib.attrValues config.custom.shell.packages); + environment.systemPackages = + with pkgs; + [ + vim + htop + ] + ++ (lib.attrValues config.custom.shell.packages); system.stateVersion = 6; }; diff --git a/darwin/homebrew.nix b/darwin/homebrew.nix index ea9c138..56f0735 100644 --- a/darwin/homebrew.nix +++ b/darwin/homebrew.nix @@ -1,34 +1,87 @@ -{ pkgs, user, inputs, ... }: +{ + config, + lib, + pkgs, + user, + inputs, + ... +}: { - nix-homebrew = { - inherit user; - enable = true; - enableRosetta = true; - taps = { - "homebrew/homebrew-core" = inputs.homebrew-core; - "homebrew/homebrew-cask" = inputs.homebrew-cask; - "homebrew/homebrew-createzap" = inputs.homebrew-createzap; - }; - mutableTaps = false; + options.custom.brew = with lib; { + zen-browser = mkEnableOption "Enable Zen Browser"; + webex = mkEnableOption "Enable Webe"; + zoom = mkEnableOption "Enable Zoom"; + slack = mkEnableOption "Enable Slack"; + ghostty = mkEnableOption "Enable Ghostty"; + ms-office = mkEnableOption "Enable MS Office"; + ms-teams = mkEnableOption "Enable MS Teams"; + spotify = mkEnableOption "Enable Spotify"; }; - homebrew = { - enable = true; - onActivation = { - # autoUpdate = true; - # cleanup = "zap"; - }; - global = { - brewfile = true; - }; - casks = [ - "zen-browser" - "webex" - "slack" - "zoom" - "spotify" - "ghostty" - ]; - }; + config = lib.mkMerge [ + { + nix-homebrew = { + inherit user; + enable = true; + enableRosetta = true; + taps = { + "homebrew/homebrew-core" = inputs.homebrew-core; + "homebrew/homebrew-cask" = inputs.homebrew-cask; + "homebrew/homebrew-createzap" = inputs.homebrew-createzap; + }; + mutableTaps = false; + }; + homebrew = { + enable = true; + onActivation = { + # autoUpdate = true; + # cleanup = "zap"; + }; + global = { + brewfile = true; + }; + }; + } + (lib.mkIf config.custom.brew.zen-browser { + homebrew.casks = [ + "zen-browser" + ]; + }) + (lib.mkIf config.custom.brew.webex { + homebrew.casks = [ + "webex" + ]; + }) + (lib.mkIf config.custom.brew.slack { + homebrew.casks = [ + "slack" + ]; + }) + (lib.mkIf config.custom.brew.zoom { + homebrew.casks = [ + "zoom" + ]; + }) + (lib.mkIf config.custom.brew.spotify { + homebrew.casks = [ + "spotify" + ]; + }) + (lib.mkIf config.custom.brew.ghostty { + homebrew.casks = [ + "ghostty" + ]; + }) + (lib.mkIf config.custom.brew.ms-office { + homebrew.casks = [ + "microsoft-office" + ]; + }) + (lib.mkIf config.custom.brew.ms-teams { + homebrew.casks = [ + "microsoft-teams" + ]; + }) + ]; } diff --git a/flake.nix b/flake.nix index d3a7424..3b087c9 100644 --- a/flake.nix +++ b/flake.nix @@ -36,103 +36,117 @@ homebrew-createzap.flake = false; }; - outputs = { - self, - nixpkgs, - home-manager, - treefmt-nix, - ... - } @ inputs: let - inherit (self) outputs; - user = "rayandrew"; - lib = nixpkgs.lib; - commonArgs = { - inherit + outputs = + { + self, + nixpkgs, + home-manager, + treefmt-nix, + ... + }@inputs: + let + inherit (self) outputs; + user = "rayandrew"; + lib = nixpkgs.lib; + commonArgs = { + inherit self inputs nixpkgs lib ; - specialArgs = { - inherit self inputs; + specialArgs = { + inherit self inputs; + }; }; - }; - # call with forAllSystems (commonArgs: function body) - forAllSystems = - fn: - lib.genAttrs [ - "x86_64-linux" - "aarch64-linux" - "x86_64-darwin" - "aarch64-darwin" - ] (system: fn (commonArgs // { inherit system; pkgs = import inputs.nixpkgs { - inherit system; - config.allowUnfree = true; - }; })); - treefmtEval = forAllSystems ( - { pkgs, ... }: - treefmt-nix.lib.evalModule pkgs { - projectRootFile = "flake.nix"; - programs.nixfmt-rfc-style.enable = true; - settings.global.excludes = [ "flake.lock" ]; - } - ); - in (import ./hosts commonArgs) // - { - checks = forAllSystems ( - { - pkgs, - system, - ... - }: - { - formatting = treefmtEval.${system}.config.build.check self; - pre-commit-check = inputs.git-hooks.lib.${system}.run { - src = ./.; - excludes = [ "flake.lock" ]; - hooks = { - treefmt = { - enable = true; - package = lib.mkForce treefmtEval.${system}.config.build.wrapper; - args = [ - # "--config-file ${treefmtEval.${system}.config.build.configFile}" - ]; + # call with forAllSystems (commonArgs: function body) + forAllSystems = + fn: + lib.genAttrs + [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ] + ( + system: + fn ( + commonArgs + // { + inherit system; + pkgs = import inputs.nixpkgs { + inherit system; + config.allowUnfree = true; + }; + } + ) + ); + treefmtEval = forAllSystems ( + { pkgs, ... }: + treefmt-nix.lib.evalModule pkgs { + projectRootFile = "flake.nix"; + programs.nixfmt-rfc-style.enable = true; + settings.global.excludes = [ "flake.lock" ]; + } + ); + in + (import ./hosts commonArgs) + // { + checks = forAllSystems ( + { + pkgs, + system, + ... + }: + { + formatting = treefmtEval.${system}.config.build.check self; + pre-commit-check = inputs.git-hooks.lib.${system}.run { + src = ./.; + excludes = [ "flake.lock" ]; + hooks = { + treefmt = { + enable = true; + package = lib.mkForce treefmtEval.${system}.config.build.wrapper; + args = [ + # "--config-file ${treefmtEval.${system}.config.build.configFile}" + ]; + }; }; }; - }; - } - ); + } + ); - devShells = forAllSystems ( - { - pkgs, - system, - ... - }: - { - default = pkgs.mkShell { - inherit (self.checks.${system}.pre-commit-check) shellHook; + devShells = forAllSystems ( + { + pkgs, + system, + ... + }: + { + default = pkgs.mkShell { + inherit (self.checks.${system}.pre-commit-check) shellHook; - name = "dotfiles"; - buildInputs = self.checks.${system}.pre-commit-check.enabledPackages; - nativeBuildInputs = [ - treefmtEval.${system}.config.build.wrapper - ]; - packages = with pkgs; [ - sops - age - ssh-to-age - nixfmt-rfc-style - ]; - DIRENV_LOG_FORMAT = ""; - }; - } - ); + name = "dotfiles"; + buildInputs = self.checks.${system}.pre-commit-check.enabledPackages; + nativeBuildInputs = [ + treefmtEval.${system}.config.build.wrapper + ]; + packages = with pkgs; [ + sops + age + ssh-to-age + nixfmt-rfc-style + ]; + DIRENV_LOG_FORMAT = ""; + }; + } + ); - packages = forAllSystems (commonArgs': (import ./packages commonArgs')); + packages = forAllSystems (commonArgs': (import ./packages commonArgs')); - formatter = forAllSystems ({ system, ... }: treefmtEval.${system}.config.build.wrapper); + formatter = forAllSystems ({ system, ... }: treefmtEval.${system}.config.build.wrapper); - }; + }; } diff --git a/home/default.nix b/home/default.nix index 33217a6..5f1aacf 100644 --- a/home/default.nix +++ b/home/default.nix @@ -6,7 +6,8 @@ system, dots, ... -}: { +}: +{ imports = [ ./email ./emacs @@ -53,7 +54,7 @@ programs = { nh = { enable = true; - package = pkgs.custom.nh; + package = pkgs.custom.nh; clean.enable = true; clean.extraArgs = "--keep-since 4d --keep 3"; flake = dots; diff --git a/home/emacs/default.nix b/home/emacs/default.nix index d53929d..1e12d15 100644 --- a/home/emacs/default.nix +++ b/home/emacs/default.nix @@ -5,7 +5,8 @@ config, dots, ... -}: { +}: +{ options.custom = with lib; { emacs = { enable = mkEnableOption "Enable emacs"; @@ -16,11 +17,11 @@ home.packages = with pkgs; [ emacs ]; - + home.file.".emacs.d" = { source = "${pkgs.custom.minimal-emacs-d}"; }; - xdg.configFile."emacs".source = config.lib.file.mkOutOfStoreSymlink "${dots}/home/emacs/config"; + xdg.configFile."emacs".source = config.lib.file.mkOutOfStoreSymlink "${dots}/home/emacs/config"; }; } diff --git a/home/email/default.nix b/home/email/default.nix index 82d88be..a29ef56 100644 --- a/home/email/default.nix +++ b/home/email/default.nix @@ -12,7 +12,7 @@ ./neomutt ./mailcap.nix ]; - + options.custom.email = with lib; { enable = mkEnableOption "Enable email"; davmail = mkEnableOption "Enable DavMail"; @@ -24,7 +24,7 @@ enable = config.custom.email.davmail; settings = { "davmail.mode" = "O365Manual"; - "davmail.url" = "https://outlook.office365.com/EWS/Exchange.asmx"; + "davmail.url" = "https://outlook.office365.com/EWS/Exchange.asmx"; # davmail.mode = "O365Modern"; "davmail.keepDelay" = 30; # log4j.logger.davmail = "DEBUG"; @@ -65,145 +65,147 @@ }; }; - accounts.email = let - cat = lib.getExe' pkgs.coreutils "cat"; - in rec { - maildirBasePath = "${home-dir}/mail"; - accounts = lib.mkMerge ([ - { - "personal" = { - userName = "raydreww@gmail.com"; - address = "raydreww@gmail.com"; - realName = "Ray Andrew"; - primary = !config.custom.email.davmail; - signature = { - text = '' - -- Ray Andrew - ''; - showSignature = "append"; - }; - passwordCommand = "${cat} ${config.sops.secrets."personal".path}"; - gpg = { - key = "1913ECC8FD7076BC8330E11607AA5254804C009F"; - signByDefault = true; - }; - smtp = { - host = "smtp.gmail.com"; - }; - imap = { - host = "imap.gmail.com"; - }; - mbsync = { - enable = true; - create = "both"; - expunge = "both"; - patterns = [ - "*" - "!\"[Airmail]/Done\"" - "!\"[Airmail]/Snooze\"" - "!\"[Airmail]/To Do\"" - "!\"[Airmail]/Send Later\"" - "!\"[Gmail]/All Mail\"" - "!\"[Gmail]/Important\"" - "!\"[Gmail]/Starred\"" - "!\"[Gmail]/Bin\"" - ]; - }; - msmtp = { - enable = true; - }; - neomutt = rec { - enable = true; - mailboxName = "p"; - extraConfig = '' - set use_from = yes - set pgp_verify_sig = yes - set pgp_sign_as = 0x07AA5254804C009F - set pgp_timeout = 3600 - named-mailboxes "${mailboxName}/inbox" =Inbox - named-mailboxes "${mailboxName}/drafts" =Drafts - named-mailboxes "${mailboxName}/sent" =Sent - named-mailboxes "${mailboxName}/important" =Important - named-mailboxes "${mailboxName}/trash" =Trash - named-mailboxes "${mailboxName}/archive" =Archive - ''; - }; - }; - } - (lib.mkIf config.custom.email.davmail { - "uchicago" = { - userName = "rayandrew@uchicago.edu"; - address = "rayandrew@uchicago.edu"; - realName = "Ray Andrew"; - primary = true; - signature = { - text = '' - -- Ray Andrew - ''; - showSignature = "append"; - }; - passwordCommand = "${cat} ${config.sops.secrets."uchicago".path}"; - gpg = { - key = "0BADFAD0FB93296C84956F9CEEF04CFFE9DFE5FC"; - signByDefault = false; - }; - smtp = { - host = "127.0.0.1"; - port = 1025; - tls = { - enable = false; - certificatesFile = null; + accounts.email = + let + cat = lib.getExe' pkgs.coreutils "cat"; + in + rec { + maildirBasePath = "${home-dir}/mail"; + accounts = lib.mkMerge ([ + { + "personal" = { + userName = "raydreww@gmail.com"; + address = "raydreww@gmail.com"; + realName = "Ray Andrew"; + primary = !config.custom.email.davmail; + signature = { + text = '' + -- Ray Andrew + ''; + showSignature = "append"; + }; + passwordCommand = "${cat} ${config.sops.secrets."personal".path}"; + gpg = { + key = "1913ECC8FD7076BC8330E11607AA5254804C009F"; + signByDefault = true; + }; + smtp = { + host = "smtp.gmail.com"; + }; + imap = { + host = "imap.gmail.com"; + }; + mbsync = { + enable = true; + create = "both"; + expunge = "both"; + patterns = [ + "*" + "!\"[Airmail]/Done\"" + "!\"[Airmail]/Snooze\"" + "!\"[Airmail]/To Do\"" + "!\"[Airmail]/Send Later\"" + "!\"[Gmail]/All Mail\"" + "!\"[Gmail]/Important\"" + "!\"[Gmail]/Starred\"" + "!\"[Gmail]/Bin\"" + ]; + }; + msmtp = { + enable = true; + }; + neomutt = rec { + enable = true; + mailboxName = "p"; + extraConfig = '' + set use_from = yes + set pgp_verify_sig = yes + set pgp_sign_as = 0x07AA5254804C009F + set pgp_timeout = 3600 + named-mailboxes "${mailboxName}/inbox" =Inbox + named-mailboxes "${mailboxName}/drafts" =Drafts + named-mailboxes "${mailboxName}/sent" =Sent + named-mailboxes "${mailboxName}/important" =Important + named-mailboxes "${mailboxName}/trash" =Trash + named-mailboxes "${mailboxName}/archive" =Archive + ''; }; }; - imap = { - host = "127.0.0.1"; - port = 1143; - tls.enable = false; - }; - mbsync = { - enable = true; - create = "both"; - expunge = "both"; - patterns = [ - "*" - "!\"[Airmail]/Done\"" - "!\"[Airmail]/Snooze\"" - "!\"[Airmail]/To Do\"" - "!\"[Airmail]/Send Later\"" - ]; - extraConfig.account = { - TLSType = "None"; - AuthMechs = "LOGIN"; - Timeout = 0; + } + (lib.mkIf config.custom.email.davmail { + "uchicago" = { + userName = "rayandrew@uchicago.edu"; + address = "rayandrew@uchicago.edu"; + realName = "Ray Andrew"; + primary = true; + signature = { + text = '' + -- Ray Andrew + ''; + showSignature = "append"; + }; + passwordCommand = "${cat} ${config.sops.secrets."uchicago".path}"; + gpg = { + key = "0BADFAD0FB93296C84956F9CEEF04CFFE9DFE5FC"; + signByDefault = false; + }; + smtp = { + host = "127.0.0.1"; + port = 1025; + tls = { + enable = false; + certificatesFile = null; + }; + }; + imap = { + host = "127.0.0.1"; + port = 1143; + tls.enable = false; + }; + mbsync = { + enable = true; + create = "both"; + expunge = "both"; + patterns = [ + "*" + "!\"[Airmail]/Done\"" + "!\"[Airmail]/Snooze\"" + "!\"[Airmail]/To Do\"" + "!\"[Airmail]/Send Later\"" + ]; + extraConfig.account = { + TLSType = "None"; + AuthMechs = "LOGIN"; + Timeout = 0; + }; + }; + msmtp = { + enable = true; + extraConfig = { + auth = "plain"; + }; + }; + neomutt = rec { + enable = true; + mailboxName = "u"; + extraConfig = '' + set use_from = yes + set pgp_sign_as = 0xEEF04CFFE9DFE5FC + set pgp_verify_sig = yes + set pgp_timeout = 3600 + named-mailboxes "${mailboxName}/inbox" =Inbox + named-mailboxes "${mailboxName}/drafts" =Drafts + named-mailboxes "${mailboxName}/sent" =Sent + named-mailboxes "${mailboxName}/important" =Important + named-mailboxes "${mailboxName}/trash" =Trash + named-mailboxes "${mailboxName}/archive" =Archive + named-mailboxes "${mailboxName}/teaching" =Teaching + ''; }; }; - msmtp = { - enable = true; - extraConfig = { - auth = "plain"; - }; - }; - neomutt = rec { - enable = true; - mailboxName = "u"; - extraConfig = '' - set use_from = yes - set pgp_sign_as = 0xEEF04CFFE9DFE5FC - set pgp_verify_sig = yes - set pgp_timeout = 3600 - named-mailboxes "${mailboxName}/inbox" =Inbox - named-mailboxes "${mailboxName}/drafts" =Drafts - named-mailboxes "${mailboxName}/sent" =Sent - named-mailboxes "${mailboxName}/important" =Important - named-mailboxes "${mailboxName}/trash" =Trash - named-mailboxes "${mailboxName}/archive" =Archive - named-mailboxes "${mailboxName}/teaching" =Teaching - ''; - }; - }; - }) - ]); - }; + }) + ]); + }; sops = { age.keyFile = "${home-dir}/.config/sops/age/keys.txt"; diff --git a/home/email/mailcap.nix b/home/email/mailcap.nix index 4af9daa..771691f 100644 --- a/home/email/mailcap.nix +++ b/home/email/mailcap.nix @@ -23,26 +23,26 @@ in home.file.".mailcap" = { text = '' - # HTML - text/html; ${w3m} -sixel -o tmp_dir=~/.cache/w3m -o auto_image=TRUE -o display_image=1 -T text/html %s; nametemplate=%s.html - # text/html; ${w3m} -o inline_img_protocol=4 -o tmp_dir=~/.cache/w3m -o auto_image=TRUE -o display_image=1 -T text/html %s; nametemplate=%s.html + # HTML + text/html; ${w3m} -sixel -o tmp_dir=~/.cache/w3m -o auto_image=TRUE -o display_image=1 -T text/html %s; nametemplate=%s.html + # text/html; ${w3m} -o inline_img_protocol=4 -o tmp_dir=~/.cache/w3m -o auto_image=TRUE -o display_image=1 -T text/html %s; nametemplate=%s.html - # This second one is chosen by auto_view due to the copiousoutput tag - text/html; ${w3m} -I %{charset} -T text/html -cols 140 -o tmp_dir=~/.cache/w3m -o display_link_number=1 -dump; copiousoutput - text/plain; nvim %s + # This second one is chosen by auto_view due to the copiousoutput tag + text/html; ${w3m} -I %{charset} -T text/html -cols 140 -o tmp_dir=~/.cache/w3m -o display_link_number=1 -dump; copiousoutput + text/plain; nvim %s - #PDFs - application/x-pdf; ${zathura} '%s'; test=test -n "$DISPLAY" - application/pdf; ${zathura} '%s'; test=test -n "$DISPLAY" + #PDFs + application/x-pdf; ${zathura} '%s'; test=test -n "$DISPLAY" + application/pdf; ${zathura} '%s'; test=test -n "$DISPLAY" - message/rfc822; nvim %s + message/rfc822; nvim %s - #Images - # image/png; /usr/bin/feh %s - # image/jpeg; /usr/bin/feh %s - # image/*; (clear && ${term} +kitten icat %s); needsterminal - image/*; (clear && ${term} imgcat %s); needsterminal - ''; + #Images + # image/png; /usr/bin/feh %s + # image/jpeg; /usr/bin/feh %s + # image/*; (clear && ${term} +kitten icat %s); needsterminal + image/*; (clear && ${term} imgcat %s); needsterminal + ''; }; }; } diff --git a/home/email/neomutt/default.nix b/home/email/neomutt/default.nix index 6e34283..f888047 100644 --- a/home/email/neomutt/default.nix +++ b/home/email/neomutt/default.nix @@ -20,13 +20,16 @@ in }; config = lib.mkIf (config.custom.email.enable && config.custom.email.neomutt) { - xsession.windowManager.i3.config = let - i3config = config.xsession.windowManager.i3.config; - in { - keybindings = lib.mkOptionDefault { - "${i3config.modifier}+m" = "exec --no-startup-id ${i3config.terminal} -e ${config.programs.neomutt.package}/bin/neomutt"; + xsession.windowManager.i3.config = + let + i3config = config.xsession.windowManager.i3.config; + in + { + keybindings = lib.mkOptionDefault { + "${i3config.modifier}+m" = + "exec --no-startup-id ${i3config.terminal} -e ${config.programs.neomutt.package}/bin/neomutt"; + }; }; - }; programs.neomutt = { enable = true; @@ -36,40 +39,40 @@ in binds = keybinds.binds ++ [ ]; macros = keybinds.macros ++ [ ]; extraConfig = '' - set abort_key = "" + set abort_key = "" - # set editor = "nvim" - set editor = "emacs -nw" + # set editor = "nvim" + set editor = "emacs -nw" - set edit_headers = yes - set sidebar_visible - set sidebar_format = "%D%?F? [%F]?%* %?N?%N/?%S" - set mail_check_stats - # set new_mail_command="notify-send 'New Email' '%n new messages, %u unread.' &" + set edit_headers = yes + set sidebar_visible + set sidebar_format = "%D%?F? [%F]?%* %?N?%N/?%S" + set mail_check_stats + # set new_mail_command="notify-send 'New Email' '%n new messages, %u unread.' &" - # status bar, date format, finding stuff etc. - set status_chars = " *%A" - # set status_format = "[ Folder: %f ] [%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]%>─%?p?( %p postponed )?" - set status_format = "[ Folder: %D ] [%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]%>─%?p?( %p postponed )?" - set date_format = "%d.%m.%Y %H:%M" - set uncollapse_jump - set sort_re - set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*" - set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+" - set send_charset = "utf-8:iso-8859-1:us-ascii" - set charset = "utf-8" - set arrow_cursor = "no" # Change `color indicator` depending + # status bar, date format, finding stuff etc. + set status_chars = " *%A" + # set status_format = "[ Folder: %f ] [%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]%>─%?p?( %p postponed )?" + set status_format = "[ Folder: %D ] [%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]%>─%?p?( %p postponed )?" + set date_format = "%d.%m.%Y %H:%M" + set uncollapse_jump + set sort_re + set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*" + set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+" + set send_charset = "utf-8:iso-8859-1:us-ascii" + set charset = "utf-8" + set arrow_cursor = "no" # Change `color indicator` depending - # Pager View Options - set pager_index_lines = 10 # Shows 10 lines of index when pager is active - set pager_context = 3 - set pager_stop - set menu_scroll - set tilde - unset markers + # Pager View Options + set pager_index_lines = 10 # Shows 10 lines of index when pager is active + set pager_context = 3 + set pager_stop + set menu_scroll + set tilde + unset markers - ${colors} - ''; + ${colors} + ''; }; }; } diff --git a/home/ghostty.nix b/home/ghostty.nix index 2b440c0..259171f 100644 --- a/home/ghostty.nix +++ b/home/ghostty.nix @@ -15,53 +15,56 @@ }; config = lib.mkIf config.custom.gui.ghostty.enable { - home.packages = lib.mkIf pkgs.stdenv.isLinux (with pkgs; [ - inputs.ghostty.packages."${system}".default - ]); + home.packages = lib.mkIf pkgs.stdenv.isLinux ( + with pkgs; + [ + inputs.ghostty.packages."${system}".default + ] + ); xdg.configFile."ghostty/config".text = '' -gtk-single-instance = true -gtk-titlebar = false -window-decoration = server -quit-after-last-window-closed = true -# gtk-adwaita = false -font-family = ${system-font} -font-size = 11 -app-notifications = no-clipboard-copy -# theme = gruber-darker -# font-family = Iosevka Nerd Font Mono -# font-size = 13 + gtk-single-instance = true + gtk-titlebar = false + window-decoration = server + quit-after-last-window-closed = true + # gtk-adwaita = false + font-family = ${system-font} + font-size = 11 + app-notifications = no-clipboard-copy + # theme = gruber-darker + # font-family = Iosevka Nerd Font Mono + # font-size = 13 -# background = #062329 -background = #072626 -# foreground = #d1b897 -foreground = #d3b58d -cursor-color = #ffffff -# cursor-text = #d1b897 -cursor-text = #d3b58d -# selection-background = #0000ff -# selection-foreground = #d1b897 -selection-background = #0000ff -selection-foreground = #d3b58d -# palette = 0=#062329 -palette = 0=#072626 -# palette = 1=#0b3335 -# palette = 2=#0000ff -palette = 3=#44b340 -palette = 4=#8cde94 -# palette = 5=#d1b897 -palette = 5=#d3b58d -palette = 6=#c1d1e3 -palette = 7=#ffffff -palette = 8=#626880 -palette = 9=#e67172 -palette = 10=#8ec772 -palette = 11=#d9ba73 -palette = 12=#7b9ef0 -palette = 13=#f2a4db -palette = 14=#5abfb5 -palette = 15=#b5bfe2 + # background = #062329 + background = #072626 + # foreground = #d1b897 + foreground = #d3b58d + cursor-color = #ffffff + # cursor-text = #d1b897 + cursor-text = #d3b58d + # selection-background = #0000ff + # selection-foreground = #d1b897 + selection-background = #0000ff + selection-foreground = #d3b58d + # palette = 0=#062329 + palette = 0=#072626 + # palette = 1=#0b3335 + # palette = 2=#0000ff + palette = 3=#44b340 + palette = 4=#8cde94 + # palette = 5=#d1b897 + palette = 5=#d3b58d + palette = 6=#c1d1e3 + palette = 7=#ffffff + palette = 8=#626880 + palette = 9=#e67172 + palette = 10=#8ec772 + palette = 11=#d9ba73 + palette = 12=#7b9ef0 + palette = 13=#f2a4db + palette = 14=#5abfb5 + palette = 15=#b5bfe2 -keybind = all:ctrl+shift+period=text:\x1b\x1f\x4c\x23\x1f -''; + keybind = all:ctrl+shift+period=text:\x1b\x1f\x4c\x23\x1f + ''; }; } diff --git a/home/gui.nix b/home/gui.nix index e249b76..1ec65d5 100644 --- a/home/gui.nix +++ b/home/gui.nix @@ -25,116 +25,109 @@ darwin = { enable = mkEnableOption "Enable Darwin-only GUI"; }; - }; - - config = lib.mkIf config.custom.gui.default.enable { - dconf.settings = { - "org/gnome/desktop/interface" = { - color-scheme = "prefer-dark"; - show-battery-percentage = true; - clock-format = "12h"; - }; + vscode = { + enable = mkEnableOption "Enable VSCode"; }; - - programs.vscode = { - enable = true; - package = pkgs.vscode; - profiles.default = { - extensions = with pkgs.vscode-extensions; [ - bbenoist.nix - ms-python.python - ms-vscode-remote.remote-ssh - ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ - { - name = "remote-ssh-edit"; - publisher = "ms-vscode-remote"; - version = "0.87.0"; - sha256 = "sha256-yeX6RAJl07d+SuYyGQFLZNcUzVKAsmPFyTKEn+y3GuM="; - } - ]; - }; - }; - - programs.firefox = { - enable = true; - # package = lib.mkIf custom.gui.darwin.enable pkgs.firefox-bin or pkgs.firefox; - package = if config.custom.gui.darwin.enable then pkgs.firefox-bin else pkgs.firefox; - }; - - home.sessionVariables = lib.mkIf config.custom.gui.darwin.enable { - MOZ_LEGACY_PROFILES = "1"; - }; - - # launchd.user.envVariables = lib.mkIf config.custom.gui.darwin.enable { - # MOZ_LEGACY_PROFILES = "1"; - # }; - - home.packages = with pkgs; [ - # globalprotect-openconnect - # firefox - # fonts - custom.sf-mono - custom.sf-symbols - ultimate-oldschool-pc-font-pack - vista-fonts - nerd-fonts.ubuntu-mono - nerd-fonts.iosevka - nerd-fonts.fira-code - nerd-fonts.sauce-code-pro - nerd-fonts.inconsolata - nerd-fonts.inconsolata-go - nerd-fonts.droid-sans-mono - nerd-fonts.space-mono - nerd-fonts.dejavu-sans-mono - ] - ++ lib.optionals config.custom.gui.darwin.enable [ - raycast - custom.whatsapp-for-mac - ] - ++ lib.optionals config.custom.gui.linux.enable [ - zotero - zoom-us - spotify - slack - webex - whatsapp-for-linux - teams-for-linux - skypeforlinux - inputs.zen-browser.packages."${system}".twilight - chromium - arandr - seahorse # gnome keyring - xfce.thunar - xfce.thunar-volman - xclip - quickemu - gf # debugger - ]; - - gtk = { - enable = true; - theme = { - name = "Adwaita-dark"; - package = pkgs.gnome-themes-extra; - }; - }; - - qt = { - enable = config.custom.gui.linux.enable; - platformTheme.name = "adwaita"; - style.name = "adwaita-dark"; - }; - - services.redshift = { - enable = config.custom.gui.linux.enable; - # provider = "geoclue2"; - provider = "manual"; - # madison - latitude = "43.07305000"; - longitude = "-89.40123000"; - # chicago - # latitude = "41.85003000"; - # longitude = "-87.65005000"; + firefox = { + enable = mkEnableOption "Enable Firefox"; }; }; + + config = lib.mkMerge [ + { + home.packages = with pkgs; [ + # globalprotect-openconnect + # firefox + # fonts + custom.sf-mono + custom.sf-symbols + ultimate-oldschool-pc-font-pack + vista-fonts + nerd-fonts.ubuntu-mono + nerd-fonts.iosevka + nerd-fonts.fira-code + nerd-fonts.sauce-code-pro + nerd-fonts.inconsolata + nerd-fonts.inconsolata-go + nerd-fonts.droid-sans-mono + nerd-fonts.space-mono + nerd-fonts.dejavu-sans-mono + ]; + } + + (lib.mkIf config.custom.gui.default.enable { + dconf.settings = { + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + show-battery-percentage = true; + clock-format = "12h"; + }; + }; + }) + + (lib.mkIf config.custom.gui.vscode.enable { + programs.vscode = { + enable = true; + package = pkgs.vscode; + profiles.default = { + extensions = + with pkgs.vscode-extensions; + [ + bbenoist.nix + ms-python.python + ms-vscode-remote.remote-ssh + ] + ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + { + name = "remote-ssh-edit"; + publisher = "ms-vscode-remote"; + version = "0.87.0"; + sha256 = "sha256-yeX6RAJl07d+SuYyGQFLZNcUzVKAsmPFyTKEn+y3GuM="; + } + ]; + }; + }; + }) + + (lib.mkIf config.custom.gui.firefox.enable { + programs.firefox = { + enable = true; + # package = lib.mkIf custom.gui.darwin.enable pkgs.firefox-bin or pkgs.firefox; + package = if config.custom.gui.darwin.enable then pkgs.firefox-bin else pkgs.firefox; + }; + + home.sessionVariables = lib.mkIf config.custom.gui.darwin.enable { + MOZ_LEGACY_PROFILES = "1"; + }; + }) + + (lib.mkIf config.custom.gui.darwin.enable { + home.packages = with pkgs; [ + raycast + custom.whatsapp-for-mac + ]; + }) + + (lib.mkIf config.custom.gui.linux.enable { + home.packages = with pkgs; [ + zotero + zoom-us + spotify + slack + webex + whatsapp-for-linux + teams-for-linux + skypeforlinux + inputs.zen-browser.packages."${system}".twilight + chromium + arandr + seahorse # gnome keyring + xfce.thunar + xfce.thunar-volman + xclip + quickemu + gf # debugger + ]; + }) + ]; } diff --git a/home/i3/default.nix b/home/i3/default.nix index bb73770..3681a23 100644 --- a/home/i3/default.nix +++ b/home/i3/default.nix @@ -32,19 +32,19 @@ enable = true; scriptPath = ".xsession-hm"; initExtra = '' - # export GDK_SCALE=2 - # export GDK_DPI_SCALE=0.5 - export _JAVA_OPTIONS="-Dsun.java2d.uiScale=2" - export QT_AUTO_SCREEN_SCALE_FACTOR=1 - export QT_DEVICE_PIXEL_RATIO=2 - # export XCURSOR_SIZE=128 - # ${pkgs.xorg.xsetroot}/bin/xsetroot -cursor_name ${pkgs.vanilla-dmz}/share/icons/Vanilla-DMZ/cursors/left_ptr 128 &disown - if test -e $HOME/.Xresources; then - ${pkgs.xorg.xrdb}/bin/xrdb -merge $HOME/.Xresources &disown - fi - echo "Xft.dpi: 192" | ${pkgs.xorg.xrdb}/bin/xrdb -merge - ''; - windowManager.i3 = + # export GDK_SCALE=2 + # export GDK_DPI_SCALE=0.5 + export _JAVA_OPTIONS="-Dsun.java2d.uiScale=2" + export QT_AUTO_SCREEN_SCALE_FACTOR=1 + export QT_DEVICE_PIXEL_RATIO=2 + # export XCURSOR_SIZE=128 + # ${pkgs.xorg.xsetroot}/bin/xsetroot -cursor_name ${pkgs.vanilla-dmz}/share/icons/Vanilla-DMZ/cursors/left_ptr 128 &disown + if test -e $HOME/.Xresources; then + ${pkgs.xorg.xrdb}/bin/xrdb -merge $HOME/.Xresources &disown + fi + echo "Xft.dpi: 192" | ${pkgs.xorg.xrdb}/bin/xrdb -merge + ''; + windowManager.i3 = let modifier = "Mod4"; powerManagementMode = " : Screen [l]ock, [e]xit, [s]uspend, [h]ibernate, [R]eboot, [S]hutdown"; @@ -84,125 +84,132 @@ # ''; # }; in - { - enable = true; - config = { - inherit modifier terminal; - keybindings = lib.mkOptionDefault { - "${modifier}+h" = "focus left"; - "${modifier}+j" = "focus down"; - "${modifier}+k" = "focus up"; - "${modifier}+l" = "focus right"; - "${modifier}+Shift+h" = "move left"; - "${modifier}+Shift+j" = "move down"; - "${modifier}+Shift+k" = "move up"; - "${modifier}+Shift+l" = "move right"; - "${modifier}+v" = "split h"; - "${modifier}+Shift+v" = "split v"; - "${modifier}+s" = "layout stacking"; - "${modifier}+t" = "layout tabbed"; - "${modifier}+e" = "layout toggle split"; - "${modifier}+p" = "floating toggle"; - "${modifier}+Shift+p" = "focus mode_toggle"; - "${modifier}+Shift+c" = "reload"; - "${modifier}+Shift+r" = "restart"; - # mode - "${modifier}+r" = ''mode "${resizeMode}"''; - "${modifier}+Escape" = ''mode "${powerManagementMode}"''; - "${modifier}+Shift+Escape" = ''mode "${miscellaneousMode}"''; - # workspace - # "${modifier}+Shift+minus" = "move scratchpad"; - # "${modifier}+minus" = "scratchpad show"; - # media - "XF86AudioRaiseVolume" = "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ +1% && ${refresh_i3status}"; - "XF86AudioLowerVolume" = "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ -1% && ${refresh_i3status}"; - "XF86AudioMute" = "exec --no-startup-id ${pactl} set-sink-mute @DEFAULT_SINK@ toggle && ${refresh_i3status}"; - "XF86AudioMicMute" = "exec --no-startup-id ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle && ${refresh_i3status}"; - "XF86AudioPlay" = "exec --no-startup-id ${playerctl} play-pause"; - "XF86AudioPause" = "exec --no-startup-id ${playerctl} play-pause"; - "XF86AudioNext" = "exec --no-startup-id ${playerctl} next"; - "XF86AudioPrev" = "exec --no-startup-id ${playerctl} previous"; - # brightness - "XF86MonBrightnessUp" = "exec --no-startup-id ${light} s +10%"; - "XF86MonBrightnessDown" = "exec --no-startup-id ${light} s 10%-"; - # screenshot - "${modifier}+o" = "exec --no-startup-id ${maim} -s ~/Pictures/screenshots/$(date +%Y-%m-%d-%H-%M-%S).png"; - "${modifier}+Shift+o" = "exec --no-startup-id ${maim} -s | ${clipboard} -selection clipboard -t image/png"; - # others - "${modifier}+space" = "exec --no-startup-id ${dmenu}"; - "${modifier}+b" = "exec --no-startup-id ${terminal} -e ${yazi}"; - "${modifier}+z" = "exec --no-startup-id ${boomer}"; # tsoding's zoom - # "${modifier}+Shift+Return" = "exec ${second_terminal}"; - # reset - "${modifier}+Shift+e" = null; - "${modifier}+w" = null; - "${modifier}+d" = null; - }; - modes = let + { + enable = true; + config = { + inherit modifier terminal; + keybindings = lib.mkOptionDefault { + "${modifier}+h" = "focus left"; + "${modifier}+j" = "focus down"; + "${modifier}+k" = "focus up"; + "${modifier}+l" = "focus right"; + "${modifier}+Shift+h" = "move left"; + "${modifier}+Shift+j" = "move down"; + "${modifier}+Shift+k" = "move up"; + "${modifier}+Shift+l" = "move right"; + "${modifier}+v" = "split h"; + "${modifier}+Shift+v" = "split v"; + "${modifier}+s" = "layout stacking"; + "${modifier}+t" = "layout tabbed"; + "${modifier}+e" = "layout toggle split"; + "${modifier}+p" = "floating toggle"; + "${modifier}+Shift+p" = "focus mode_toggle"; + "${modifier}+Shift+c" = "reload"; + "${modifier}+Shift+r" = "restart"; + # mode + "${modifier}+r" = ''mode "${resizeMode}"''; + "${modifier}+Escape" = ''mode "${powerManagementMode}"''; + "${modifier}+Shift+Escape" = ''mode "${miscellaneousMode}"''; + # workspace + # "${modifier}+Shift+minus" = "move scratchpad"; + # "${modifier}+minus" = "scratchpad show"; + # media + "XF86AudioRaiseVolume" = + "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ +1% && ${refresh_i3status}"; + "XF86AudioLowerVolume" = + "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ -1% && ${refresh_i3status}"; + "XF86AudioMute" = + "exec --no-startup-id ${pactl} set-sink-mute @DEFAULT_SINK@ toggle && ${refresh_i3status}"; + "XF86AudioMicMute" = + "exec --no-startup-id ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle && ${refresh_i3status}"; + "XF86AudioPlay" = "exec --no-startup-id ${playerctl} play-pause"; + "XF86AudioPause" = "exec --no-startup-id ${playerctl} play-pause"; + "XF86AudioNext" = "exec --no-startup-id ${playerctl} next"; + "XF86AudioPrev" = "exec --no-startup-id ${playerctl} previous"; + # brightness + "XF86MonBrightnessUp" = "exec --no-startup-id ${light} s +10%"; + "XF86MonBrightnessDown" = "exec --no-startup-id ${light} s 10%-"; + # screenshot + "${modifier}+o" = + "exec --no-startup-id ${maim} -s ~/Pictures/screenshots/$(date +%Y-%m-%d-%H-%M-%S).png"; + "${modifier}+Shift+o" = + "exec --no-startup-id ${maim} -s | ${clipboard} -selection clipboard -t image/png"; + # others + "${modifier}+space" = "exec --no-startup-id ${dmenu}"; + "${modifier}+b" = "exec --no-startup-id ${terminal} -e ${yazi}"; + "${modifier}+z" = "exec --no-startup-id ${boomer}"; # tsoding's zoom + # "${modifier}+Shift+Return" = "exec ${second_terminal}"; + # reset + "${modifier}+Shift+e" = null; + "${modifier}+w" = null; + "${modifier}+d" = null; + }; + modes = + let exitMode = { "Escape" = "mode default"; "Return" = "mode default"; }; in - { - "${resizeMode}" = { - "Left" = "resize shrink width 10 px or 10 ppt"; - "Down" = "resize grow height 10 px or 10 ppt"; - "Up" = "resize shrink height 10 px or 10 ppt"; - "Right" = "resize grow width 10 px or 10 ppt"; - "Escape" = "mode default"; - "Return" = "mode default"; - } // exitMode; - "${powerManagementMode}" = { - l = "mode default, exec loginctl lock-session"; - e = "mode default, exec loginctl terminate-session $XDG_SESSION_ID"; - s = "mode default, exec systemctl suspend"; - h = "mode default, exec systemctl hibernate"; - "Shift+r" = "mode default, exec systemctl reboot"; - "Shift+s" = "mode default, exec systemctl poweroff"; - } // exitMode; - "${miscellaneousMode}" = { - p = "mode default, exec kill -SIGUSR1 $(pidof dunst)"; - c = "mode default, exec kill -SIGUSR2 $(pidof dunst"; - } // exitMode; - }; - startup = [ - { - command = "${pkgs.hsetroot}/bin/hsetroot -solid \"#062329\""; - notification = false; - } - { - command = "${pkgs.dex}/bin/dex --autostart --environment i3"; - notification = false; - } - { - command = "${pkgs.networkmanagerapplet}/bin/nm-applet"; - notification = false; - } - { - command = "${pkgs.pasystray}/bin/pasystray"; - notification = false; - } - { - command = "${pkgs.xss-lock}/bin/xss-lock --transfer-sleep-lock -- i3lock --nofork"; - notification = false; - } - { - command = "${pkgs.autorandr}/bin/autorandr -c"; - always = false; # Important, run only on first start (will loop otherwise)! - notification = false; - } - { - command = "${pkgs.xfce.xfce4-volumed-pulse}/bin/xfce4-volumed-pulse &"; - always = false; - notification = false; - } - { - command = "${light} s 25%"; - } - ]; - }; + { + "${resizeMode}" = { + "Left" = "resize shrink width 10 px or 10 ppt"; + "Down" = "resize grow height 10 px or 10 ppt"; + "Up" = "resize shrink height 10 px or 10 ppt"; + "Right" = "resize grow width 10 px or 10 ppt"; + "Escape" = "mode default"; + "Return" = "mode default"; + } // exitMode; + "${powerManagementMode}" = { + l = "mode default, exec loginctl lock-session"; + e = "mode default, exec loginctl terminate-session $XDG_SESSION_ID"; + s = "mode default, exec systemctl suspend"; + h = "mode default, exec systemctl hibernate"; + "Shift+r" = "mode default, exec systemctl reboot"; + "Shift+s" = "mode default, exec systemctl poweroff"; + } // exitMode; + "${miscellaneousMode}" = { + p = "mode default, exec kill -SIGUSR1 $(pidof dunst)"; + c = "mode default, exec kill -SIGUSR2 $(pidof dunst"; + } // exitMode; + }; + startup = [ + { + command = "${pkgs.hsetroot}/bin/hsetroot -solid \"#062329\""; + notification = false; + } + { + command = "${pkgs.dex}/bin/dex --autostart --environment i3"; + notification = false; + } + { + command = "${pkgs.networkmanagerapplet}/bin/nm-applet"; + notification = false; + } + { + command = "${pkgs.pasystray}/bin/pasystray"; + notification = false; + } + { + command = "${pkgs.xss-lock}/bin/xss-lock --transfer-sleep-lock -- i3lock --nofork"; + notification = false; + } + { + command = "${pkgs.autorandr}/bin/autorandr -c"; + always = false; # Important, run only on first start (will loop otherwise)! + notification = false; + } + { + command = "${pkgs.xfce.xfce4-volumed-pulse}/bin/xfce4-volumed-pulse &"; + always = false; + notification = false; + } + { + command = "${light} s 25%"; + } + ]; }; - }; + }; + }; }; } diff --git a/home/kitty.nix b/home/kitty.nix index 77e65e2..819ecf0 100644 --- a/home/kitty.nix +++ b/home/kitty.nix @@ -23,33 +23,33 @@ enableBashIntegration = true; }; extraConfig = '' -modify_font cell_height 1.1 -# modify_font cell_width 95% -text_composition_strategy legacy + modify_font cell_height 1.1 + # modify_font cell_width 95% + text_composition_strategy legacy -background #062329 -foreground #d1b897 -cursor-color #ffffff -cursor-text #d1b897 -selection_background #0000ff -selection_foreground #d1b897 -color0 #062329 -# color1 #0b3335 -# color2 #0000ff -color3 #44b340 -color4 #8cde94 -color5 #d1b897 -color6 #c1d1e3 -color7 #ffffff -color8 #626880 -color9 #e67172 -color10 #8ec772 -color11 #d9ba73 -color12 #7b9ef0 -color13 #f2a4db -color14 #5abfb5 -color15 #b5bfe2 -''; + background #062329 + foreground #d1b897 + cursor-color #ffffff + cursor-text #d1b897 + selection_background #0000ff + selection_foreground #d1b897 + color0 #062329 + # color1 #0b3335 + # color2 #0000ff + color3 #44b340 + color4 #8cde94 + color5 #d1b897 + color6 #c1d1e3 + color7 #ffffff + color8 #626880 + color9 #e67172 + color10 #8ec772 + color11 #d9ba73 + color12 #7b9ef0 + color13 #f2a4db + color14 #5abfb5 + color15 #b5bfe2 + ''; keybindings = { # "CTRL+GRAVE_ACCENT" = "send_text all \x1b\x1f\x2a\x62\x1f"; # "SHIFT+CTRL+GRAVE_ACCENT" = "send_text all \x1b\x1f\x2a\x63\x1f"; diff --git a/hosts/dango/default.nix b/hosts/dango/default.nix index b7b3675..c78489b 100644 --- a/hosts/dango/default.nix +++ b/hosts/dango/default.nix @@ -9,7 +9,8 @@ hm, host, ... -}: { +}: +{ imports = [ ]; @@ -17,14 +18,22 @@ nix.enable = false; - users.users = { - ${user} = { - home = "/Users/${user}"; - }; + users.users.${user} = { + home = "/Users/${user}"; }; custom = { aerospace.enable = true; + brew = { + zen-browser = true; + webex = true; + slack = true; + zoom = true; + spotify = true; + ghostty = true; + ms-office = true; + ms-teams = true; + }; }; hm.custom = { @@ -34,6 +43,8 @@ default.enable = true; darwin.enable = true; ghostty.enable = true; + firefox.enable = true; + vscode.enable = true; }; }; } diff --git a/hosts/default.nix b/hosts/default.nix index 2cbb8b9..e53d7ad 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -7,41 +7,43 @@ }: let mkNixosConfiguration = - host: system: + host: system: let pkgs = import inputs.nixpkgs { inherit system; config.allowUnfree = true; - overlays = [ + overlays = [ (import ../overlays { - inherit inputs; - inherit (pkgs) system; - }) + inherit inputs; + inherit (pkgs) system; + }) ]; }; lib = ( import ../lib.nix { - inherit (inputs.nixpkgs) lib; - inherit pkgs; - inherit (inputs) home-manager; + inherit (inputs.nixpkgs) lib; + inherit pkgs; + inherit (inputs) home-manager; } ); - in - lib.nixosSystem { - inherit pkgs lib; + in + lib.nixosSystem { + inherit pkgs lib; - specialArgs = specialArgs // { - inherit host user; - dots = "/home/${user}/dotfiles"; - }; + specialArgs = specialArgs // { + inherit host user; + dots = "/home/${user}/dotfiles"; + }; - modules = [ - inputs.disko.nixosModules.default - ./${host} - ./${host}/hardware.nix - ../nixos - ../overlays - ({config, ...}: { + modules = [ + inputs.disko.nixosModules.default + ./${host} + ./${host}/hardware.nix + ../nixos + ../overlays + ( + { config, ... }: + { home-manager = { useGlobalPkgs = true; useUserPackages = true; @@ -49,7 +51,7 @@ let extraSpecialArgs = specialArgs // { inherit host user system; system-font = "Consolas"; - dots = "/home/${user}/dotfiles"; + dots = "/home/${user}/dotfiles"; home-dir = config.home-manager.users.${user}.home.homeDirectory; }; @@ -58,55 +60,61 @@ let inputs.nix-index-database.hmModules.nix-index inputs.sops-nix.homeManagerModules.sops ../home - ] ++ lib.optional(builtins.pathExists ./${host}/home.nix) ./${host}/home.nix; + ] ++ lib.optional (builtins.pathExists ./${host}/home.nix) ./${host}/home.nix; }; }; - }) - # alias for home-manager - (lib.mkAliasOptionModule [ "hm" ] [ + } + ) + # alias for home-manager + (lib.mkAliasOptionModule + [ "hm" ] + [ "home-manager" "users" user - ]) - inputs.home-manager.nixosModules.home-manager - inputs.sops-nix.nixosModules.sops - ]; - }; + ] + ) + inputs.home-manager.nixosModules.home-manager + inputs.sops-nix.nixosModules.sops + ]; + }; mkDarwinConfiguration = - host: system: + host: system: let pkgs = import inputs.nixpkgs { inherit system; config.allowUnfree = true; - overlays = [ + overlays = [ (import ../overlays { - inherit inputs; - inherit (pkgs) system; - }) + inherit inputs; + inherit (pkgs) system; + }) inputs.nixpkgs-firefox-darwin.overlay ]; }; lib = ( import ../lib.nix { - inherit (inputs.nixpkgs) lib; - inherit pkgs; - inherit (inputs) home-manager; + inherit (inputs.nixpkgs) lib; + inherit pkgs; + inherit (inputs) home-manager; } ); - in - inputs.nix-darwin.lib.darwinSystem { - inherit pkgs lib; + in + inputs.nix-darwin.lib.darwinSystem { + inherit pkgs lib; - specialArgs = specialArgs // { - inherit host user; - dots = "/Users/${user}/dotfiles"; - }; + specialArgs = specialArgs // { + inherit host user; + dots = "/Users/${user}/dotfiles"; + }; - modules = [ - ./${host} - ../darwin - ({config, ...}: { + modules = [ + ./${host} + ../darwin + ( + { config, ... }: + { home-manager = { useGlobalPkgs = true; useUserPackages = true; @@ -115,35 +123,39 @@ let inherit host user system; system-font = "SF Mono"; home-dir = config.home-manager.users.${user}.home.homeDirectory; - dots = "/Users/${user}/dotfiles"; + dots = "/Users/${user}/dotfiles"; }; users.${user} = { imports = [ inputs.nix-index-database.hmModules.nix-index inputs.sops-nix.homeManagerModules.sops - inputs.mac-app-util.homeManagerModules.default + inputs.mac-app-util.homeManagerModules.default ../home - ] ++ lib.optional(builtins.pathExists ./${host}/home.nix) ./${host}/home.nix; + ] ++ lib.optional (builtins.pathExists ./${host}/home.nix) ./${host}/home.nix; }; }; - }) - # alias for home-manager - (lib.mkAliasOptionModule [ "hm" ] [ + } + ) + # alias for home-manager + (lib.mkAliasOptionModule + [ "hm" ] + [ "home-manager" "users" user - ]) - inputs.home-manager.darwinModules.home-manager - inputs.mac-app-util.darwinModules.default - inputs.nix-homebrew.darwinModules.nix-homebrew - ]; - }; + ] + ) + inputs.home-manager.darwinModules.home-manager + inputs.mac-app-util.darwinModules.default + inputs.nix-homebrew.darwinModules.nix-homebrew + ]; + }; in { nixosConfigurations = { pickwick = mkNixosConfiguration "pickwick" "x86_64-linux"; - lemur = mkNixosConfiguration "lemur" "x86_64-linux"; + lemur = mkNixosConfiguration "lemur" "x86_64-linux"; }; darwinConfigurations = { dango = mkDarwinConfiguration "dango" "aarch64-darwin"; diff --git a/hosts/lemur/default.nix b/hosts/lemur/default.nix index 27635fc..669648d 100644 --- a/hosts/lemur/default.nix +++ b/hosts/lemur/default.nix @@ -9,7 +9,8 @@ hm, host, ... -}: { +}: +{ imports = [ ./hardware.nix ]; @@ -37,8 +38,13 @@ ${user} = { initialPassword = "abc123"; isNormalUser = true; - openssh.authorizedKeys.keys = []; - extraGroups = ["wheel" "video" "audio" "networkmanager"]; + openssh.authorizedKeys.keys = [ ]; + extraGroups = [ + "wheel" + "video" + "audio" + "networkmanager" + ]; }; }; diff --git a/hosts/lemur/disko.nix b/hosts/lemur/disko.nix index 4213cdc..429d8b5 100644 --- a/hosts/lemur/disko.nix +++ b/hosts/lemur/disko.nix @@ -20,9 +20,9 @@ type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = [ - "defaults" - "umask=0077" + mountOptions = [ + "defaults" + "umask=0077" ]; extraArgs = [ "-n" diff --git a/hosts/lemur/hardware.nix b/hosts/lemur/hardware.nix index 67e6607..1bf942c 100644 --- a/hosts/lemur/hardware.nix +++ b/hosts/lemur/hardware.nix @@ -1,14 +1,27 @@ -{ config, lib, pkgs, modulesPath, inputs, ... }: +{ + config, + lib, + pkgs, + modulesPath, + inputs, + ... +}: { boot.loader.systemd-boot.enable = true; - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ./disko.nix - inputs.nixos-hardware.nixosModules.system76 - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ./disko.nix + inputs.nixos-hardware.nixosModules.system76 + ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "sd_mod" "sdhci_pci" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "usbhid" + "sd_mod" + "sdhci_pci" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; diff --git a/hosts/pickwick/default.nix b/hosts/pickwick/default.nix index 2bc66f1..48232f2 100644 --- a/hosts/pickwick/default.nix +++ b/hosts/pickwick/default.nix @@ -9,7 +9,8 @@ hm, host, ... -}: { +}: +{ imports = [ ./hardware.nix ]; @@ -17,10 +18,10 @@ custom = { keyd = { enable = true; - ids = [ - "0001:0001:70533846" # framework + ids = [ + "0001:0001:70533846" # framework "3434:06a0:d7dfbeabt" # keychron q10 - "046d:c339:9f276ca6" # Logitech Pro + "046d:c339:9f276ca6" # Logitech Pro ]; }; displaymanager.enable = true; @@ -38,8 +39,13 @@ ${user} = { initialPassword = "abc123"; isNormalUser = true; - openssh.authorizedKeys.keys = []; - extraGroups = ["wheel" "video" "audio" "networkmanager"]; + openssh.authorizedKeys.keys = [ ]; + extraGroups = [ + "wheel" + "video" + "audio" + "networkmanager" + ]; }; }; diff --git a/hosts/pickwick/disko.nix b/hosts/pickwick/disko.nix index 6d71da5..a3b5c8e 100644 --- a/hosts/pickwick/disko.nix +++ b/hosts/pickwick/disko.nix @@ -20,9 +20,9 @@ type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = [ - "defaults" - "umask=0077" + mountOptions = [ + "defaults" + "umask=0077" ]; extraArgs = [ "-n" diff --git a/hosts/pickwick/hardware.nix b/hosts/pickwick/hardware.nix index f7c6f0b..5d4e546 100644 --- a/hosts/pickwick/hardware.nix +++ b/hosts/pickwick/hardware.nix @@ -1,14 +1,28 @@ -{ config, lib, pkgs, modulesPath, inputs, ... }: +{ + config, + lib, + pkgs, + modulesPath, + inputs, + ... +}: { boot.loader.systemd-boot.enable = true; - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ./disko.nix - inputs.nixos-hardware.nixosModules.framework-13-7040-amd - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ./disko.nix + inputs.nixos-hardware.nixosModules.framework-13-7040-amd + ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "thunderbolt" + "usb_storage" + "usbhid" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; @@ -17,7 +31,7 @@ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - swapDevices = [ + swapDevices = [ { device = "/dev/disk/by-label/SWAP"; } diff --git a/nixos/1password.nix b/nixos/1password.nix index b80890d..353a0bd 100644 --- a/nixos/1password.nix +++ b/nixos/1password.nix @@ -3,7 +3,7 @@ lib, pkgs, ... -}: +}: { options.custom = with lib; { _1password = { @@ -21,12 +21,12 @@ environment.etc = { "1password/custom_allowed_browsers" = { text = '' -zen -zen-twilight -.zen-wrapped -.firefox-wrapped -firefox - ''; + zen + zen-twilight + .zen-wrapped + .firefox-wrapped + firefox + ''; mode = "0755"; }; }; diff --git a/nixos/audio.nix b/nixos/audio.nix index 8440339..97a89c5 100644 --- a/nixos/audio.nix +++ b/nixos/audio.nix @@ -1,8 +1,8 @@ -{ - config, +{ + config, pkgs, lib, - ... + ... }: { options.custom = with lib; { @@ -10,10 +10,10 @@ enable = mkEnableOption "Enable audio"; }; }; - + config = lib.mkIf config.custom.audio.enable { environment.systemPackages = with pkgs; [ - pwvucontrol + pwvucontrol ]; services.pulseaudio.enable = false; @@ -50,5 +50,5 @@ }; }; }; - }; + }; } diff --git a/nixos/bluetooth.nix b/nixos/bluetooth.nix index b2f387f..ef5bf39 100644 --- a/nixos/bluetooth.nix +++ b/nixos/bluetooth.nix @@ -1,8 +1,8 @@ -{ - config, +{ + config, pkgs, lib, - ... + ... }: { options.custom = with lib; { @@ -10,7 +10,7 @@ enable = mkEnableOption "Enable bluetooth"; }; }; - + config = lib.mkIf config.custom.bluetooth.enable { hardware.bluetooth = { enable = true; diff --git a/nixos/default.nix b/nixos/default.nix index c177776..fad52a8 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -6,7 +6,8 @@ system, host, ... -}: { +}: +{ imports = [ ./1password.nix ./audio.nix @@ -84,10 +85,13 @@ }; }; - environment.systemPackages = with pkgs; [ - vim - htop - ] ++ (lib.attrValues config.custom.shell.packages); + environment.systemPackages = + with pkgs; + [ + vim + htop + ] + ++ (lib.attrValues config.custom.shell.packages); system.stateVersion = "25.05"; }; diff --git a/nixos/displaymanager.nix b/nixos/displaymanager.nix index 1bfcaf6..68f4ff6 100644 --- a/nixos/displaymanager.nix +++ b/nixos/displaymanager.nix @@ -1,53 +1,53 @@ -{ - config, +{ + config, pkgs, lib, - ... + ... }: { - options.custom = with lib; { + options.custom = with lib; { displaymanager = { enable = mkEnableOption "Enable displaymanager"; }; }; - - config = lib.mkIf config.custom.displaymanager.enable { - services = { - xserver = { - enable = true; - desktopManager = { - xterm.enable = false; - }; - displayManager = { - lightdm = { - enable = true; - greeters.enso = { - enable = true; - }; - }; - session = [ - { - manage = "window"; - name = "hm"; - start = '' - export CURRENT_XSESSION="hm" - ${pkgs.stdenv.shell} $HOME/.xsession-hm & - waitPID=$! - ''; - } - ]; - }; - windowManager.i3 = { + + config = lib.mkIf config.custom.displaymanager.enable { + services = { + xserver = { enable = true; - extraPackages = with pkgs; [ - dmenu - i3status - i3lock - ]; + desktopManager = { + xterm.enable = false; + }; + displayManager = { + lightdm = { + enable = true; + greeters.enso = { + enable = true; + }; + }; + session = [ + { + manage = "window"; + name = "hm"; + start = '' + export CURRENT_XSESSION="hm" + ${pkgs.stdenv.shell} $HOME/.xsession-hm & + waitPID=$! + ''; + } + ]; + }; + windowManager.i3 = { + enable = true; + extraPackages = with pkgs; [ + dmenu + i3status + i3lock + ]; + }; }; + xserver.xkb.layout = "us"; + gnome.gnome-keyring.enable = true; }; - xserver.xkb.layout = "us"; - gnome.gnome-keyring.enable = true; }; - }; } diff --git a/nixos/keyd.nix b/nixos/keyd.nix index c2ff195..3b0829f 100644 --- a/nixos/keyd.nix +++ b/nixos/keyd.nix @@ -11,7 +11,7 @@ ids = mkOption { type = types.listOf types.str; default = [ ]; - example = [ + example = [ "0001:0001:70533846" "3434:06a0:d7dfbeabt" "046d:c339:9f276ca6" @@ -20,7 +20,6 @@ }; }; }; - config = lib.mkIf config.custom.keyd.enable { environment.systemPackages = with pkgs; [ @@ -28,49 +27,51 @@ ]; users.groups.keyd = { }; - services.keyd = let - commonSettings = { - main = { - capslock = "layer(capslock)"; - insert = "S-insert"; + services.keyd = + let + commonSettings = { + main = { + capslock = "layer(capslock)"; + insert = "S-insert"; + }; + meta = { + w = "macro(C-w)"; + a = "macro(C-a)"; + }; + "capslock:C" = { }; }; - meta = { - w = "macro(C-w)"; - a = "macro(C-a)"; - }; - "capslock:C" = { }; - }; - in { - enable = true; - keyboards = { - default = { - ids = [ "*" ]; - settings = commonSettings; - }; - workstation = { - ids = config.custom.keyd.ids; - settings = lib.mkMerge [ - commonSettings - { - main = { - leftalt = "layer(meta)"; - leftmeta = "layer(alt)"; - }; - } - ]; + in + { + enable = true; + keyboards = { + default = { + ids = [ "*" ]; + settings = commonSettings; + }; + workstation = { + ids = config.custom.keyd.ids; + settings = lib.mkMerge [ + commonSettings + { + main = { + leftalt = "layer(meta)"; + leftmeta = "layer(alt)"; + }; + } + ]; + }; }; }; - }; systemd.services.keyd.serviceConfig.CapabilityBoundingSet = [ "CAP_SETGID" ]; environment.etc."libinput/local-overrides.quirks".text = '' - [Serial Keyboards] - MatchUdevType=keyboard - MatchName=keyd virtual keyboard - AttrKeyboardIntegration=internal + [Serial Keyboards] + MatchUdevType=keyboard + MatchName=keyd virtual keyboard + AttrKeyboardIntegration=internal ''; }; } diff --git a/nixos/nix.nix b/nixos/nix.nix index 411c758..25fbc57 100644 --- a/nixos/nix.nix +++ b/nixos/nix.nix @@ -58,7 +58,7 @@ inherit nixPath; channel.enable = false; # required for nix-shell -p to work - registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs; + registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs; # gc = { # # Automatic garbage collection # automatic = true; diff --git a/overlays/default.nix b/overlays/default.nix index ce8ba4c..7204461 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,21 +1,22 @@ { inputs, ... -}: _: prev: { - # include nixpkgs stable - stable = import inputs.nixpkgs-stable { - inherit (prev.pkgs) system; - config.allowUnfree = true; - }; +}: +_: prev: { + # include nixpkgs stable + stable = import inputs.nixpkgs-stable { + inherit (prev.pkgs) system; + config.allowUnfree = true; + }; - # include custom packages - custom = - (prev.custom or { }) - // (import ../packages { - inherit (prev) pkgs; - inherit inputs; - }); + # include custom packages + custom = + (prev.custom or { }) + // (import ../packages { + inherit (prev) pkgs; + inherit inputs; + }); - # use nixfmt-rfc-style as the default - nixfmt = prev.nixfmt-rfc-style; - } + # use nixfmt-rfc-style as the default + nixfmt = prev.nixfmt-rfc-style; +} diff --git a/packages/boomer/default.nix b/packages/boomer/default.nix index 6c1f57f..97cd5ab 100644 --- a/packages/boomer/default.nix +++ b/packages/boomer/default.nix @@ -1,4 +1,13 @@ -{ lib, stdenv, fetchFromGitHub, nim, libX11, libXrandr, libGL, nim-1_0 }: +{ + lib, + stdenv, + fetchFromGitHub, + nim, + libX11, + libXrandr, + libGL, + nim-1_0, +}: let x11-nim = fetchFromGitHub { @@ -13,7 +22,8 @@ let rev = "8e2e098f82dc5eefd874488c37b5830233cd18f4"; sha256 = "sha256-v3bMDobYQZqX0anBFIUfZx5q5/vxTHO6PDtKQlf5mgU="; }; -in stdenv.mkDerivation rec { +in +stdenv.mkDerivation rec { pname = "boomer"; version = "unstable-2024-02-08"; src = fetchFromGitHub { @@ -22,11 +32,23 @@ in stdenv.mkDerivation rec { rev = "dfd4e1f5514e2a9d7c7a6429c1c0642c2021e792"; sha256 = "sha256-o65/VVxttriA5Qqt35lLKkWIZYS7T4VBBuYdAIGUmx8="; }; - buildInputs = [ nim-1_0 libX11 libXrandr libGL ]; + buildInputs = [ + nim-1_0 + libX11 + libXrandr + libGL + ]; buildPhase = '' HOME=$TMPDIR nim -p:${x11-nim}/ -p:${opengl-nim}/src c -d:release src/boomer.nim ''; installPhase = "install -Dt $out/bin src/boomer"; - fixupPhase = "patchelf --set-rpath ${lib.makeLibraryPath [stdenv.cc.cc libX11 libXrandr libGL]} $out/bin/boomer"; + fixupPhase = "patchelf --set-rpath ${ + lib.makeLibraryPath [ + stdenv.cc.cc + libX11 + libXrandr + libGL + ] + } $out/bin/boomer"; } diff --git a/packages/default.nix b/packages/default.nix index e6234af..fd23ac8 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -5,7 +5,8 @@ }: let inherit (pkgs) lib callPackage; -in rec { +in +rec { minimal-emacs-d = callPackage ./minimal-emacs-d { }; boomer = callPackage ./boomer { }; nh = callPackage ./nh { }; diff --git a/packages/minimal-emacs-d/default.nix b/packages/minimal-emacs-d/default.nix index 9b09ed8..6513a6a 100644 --- a/packages/minimal-emacs-d/default.nix +++ b/packages/minimal-emacs-d/default.nix @@ -1,4 +1,8 @@ -{ lib, stdenv, pkgs }: +{ + lib, + stdenv, + pkgs, +}: let pre-early-init = ./pre-early-init.el; diff --git a/packages/sf-symbols/default.nix b/packages/sf-symbols/default.nix index 998ffe6..8e5e023 100644 --- a/packages/sf-symbols/default.nix +++ b/packages/sf-symbols/default.nix @@ -34,15 +34,10 @@ stdenvNoCC.mkDerivation rec { sourceRoot = "."; installPhase = - '' - '' + '''' + lib.optionalString fonts '' mkdir -p $out/share/fonts/truetype - cp ./Library/Fonts/${ - if full - then "*" - else "SF-Pro.ttf" - } $out/share/fonts/truetype + cp ./Library/Fonts/${if full then "*" else "SF-Pro.ttf"} $out/share/fonts/truetype '' + lib.optionalString app '' mkdir -p $out/Applications @@ -51,13 +46,11 @@ stdenvNoCC.mkDerivation rec { meta = { description = - if app - then "Tool that provides consistent, highly configurable symbols for apps" - else "Fonts from SF Symbols"; + if app then + "Tool that provides consistent, highly configurable symbols for apps" + else + "Fonts from SF Symbols"; homepage = "https://developer.apple.com/sf-symbols/"; - platforms = - if app - then lib.platforms.darwin - else lib.platforms.all; + platforms = if app then lib.platforms.darwin else lib.platforms.all; }; }