From 4bce05df3e6bccc727b2638f4ef7a4e05bf0163e Mon Sep 17 00:00:00 2001 From: sloane ess Date: Thu, 18 Jul 2024 10:16:04 -0400 Subject: [PATCH] Initial name change, formatting --- .gitignore | 1 + darwin/copy-apps.nix | 7 - darwin/default.nix | 23 ++- darwin/fish.nix | 8 +- darwin/fonts.nix | 18 +- darwin/homebrew.nix | 9 +- flake.lock | 226 +++++++++++------------ flake.nix | 29 ++- home/copy-apps.nix | 10 -- home/default.nix | 5 +- home/extras/helix/auto-theme.nix | 26 +-- home/extras/kitty/auto-theme.nix | 19 +- home/extras/kitty/nerd-font.nix | 9 +- home/fish.nix | 276 +++++++++++++++-------------- home/ghostty.nix | 60 ++++--- home/git.nix | 12 +- home/helix.nix | 3 +- home/kitty.nix | 15 +- home/pijul.nix | 3 +- home/programs.nix | 162 +++++++++-------- home/services/dark-mode-notify.nix | 14 +- home/services/tarsnap.nix | 66 ++++--- home/ssh.nix | 13 +- home/starship.nix | 10 +- nixos/default.nix | 29 +-- nixos/nix.nix | 29 ++- nixos/ssh-access.nix | 19 +- pkgs/dark-mode-notify.nix | 10 +- pkgs/default.nix | 26 +-- pkgs/ia-writer-family.nix | 6 +- pkgs/recursive-patched.nix | 6 +- systems/darwin/m1.nix | 10 +- systems/darwin/work.nix | 32 ++-- systems/nixos/pihole.nix | 3 +- templates/rust/flake.nix | 45 +++-- users/config.nix | 20 ++- users/default.nix | 9 +- 37 files changed, 705 insertions(+), 563 deletions(-) delete mode 100644 darwin/copy-apps.nix delete mode 100644 home/copy-apps.nix diff --git a/.gitignore b/.gitignore index 8873a10..ed9a534 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ result-* .nvimlog .pre-commit-config.yaml .direnv/ +.DS_Store diff --git a/darwin/copy-apps.nix b/darwin/copy-apps.nix deleted file mode 100644 index 23f241e..0000000 --- a/darwin/copy-apps.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, lib, ... }: -let mac-app-util = lib.getExe' pkgs.mac-app-util "mac-app-util"; -in { - system.activationScripts.postActivation.text = '' - ${mac-app-util} sync-trampolines "/Applications/Nix Apps" "/Applications/Nix Trampolines" - ''; -} diff --git a/darwin/default.nix b/darwin/default.nix index aeb9cff..679a883 100644 --- a/darwin/default.nix +++ b/darwin/default.nix @@ -1,19 +1,24 @@ -{ self, config, ... }: { +{ self, config, ... }: +{ flake.darwinModules = { - home = let inherit (config.users) me; - in { - home-manager.users.${me} = { imports = [ self.homeModules.darwin ]; }; - users.users.${me} = { - name = me; - home = "/Users/${me}"; + home = + let + inherit (config.users) me; + in + { + home-manager.users.${me} = { + imports = [ self.homeModules.darwin ]; + }; + users.users.${me} = { + name = me; + home = "/Users/${me}"; + }; }; - }; default.imports = [ self.darwinModules_.home-manager self.darwinModules.home self.nixosModules.common - ./copy-apps.nix ./fish.nix ./fonts.nix ./homebrew.nix diff --git a/darwin/fish.nix b/darwin/fish.nix index f0e6cd0..eb9cd67 100644 --- a/darwin/fish.nix +++ b/darwin/fish.nix @@ -1,4 +1,10 @@ -{ config, pkgs, lib, ... }: { +{ + config, + pkgs, + lib, + ... +}: +{ environment.variables.SHELL = lib.getExe pkgs.fish; environment.shells = [ pkgs.fish ]; programs.fish = { diff --git a/darwin/fonts.nix b/darwin/fonts.nix index 9df38c6..e277be7 100644 --- a/darwin/fonts.nix +++ b/darwin/fonts.nix @@ -1,15 +1,19 @@ -{ pkgs, ... }: { - fonts.fontDir.enable = true; - fonts.fonts = builtins.attrValues { +{ pkgs, ... }: +{ + fonts.packages = builtins.attrValues { inherit (pkgs) - borg-sans-mono recursive-patched + borg-sans-mono + recursive-patched # code^ - ia-writer-family ibm-plex + ia-writer-family + ibm-plex # hybrid^ - inter source-sans-pro source-serif-pro + inter + source-sans-pro + source-serif-pro # display^ - ; + ; }; } diff --git a/darwin/homebrew.nix b/darwin/homebrew.nix index ce68d9a..99eafd8 100644 --- a/darwin/homebrew.nix +++ b/darwin/homebrew.nix @@ -1,4 +1,5 @@ -{ flake, config, ... }: { +{ flake, config, ... }: +{ environment.variables.HOMEBREW_NO_ANALYTICS = "1"; programs.fish = { shellInit = '' @@ -36,6 +37,7 @@ Amphetamine = 937984704; "Draw Things" = 6444050820; GrandPerspective = 1111570163; + Omnivore = 1564031042; Tailscale = 1475387142; Things = 904280696; Xcode = 497799835; @@ -49,9 +51,11 @@ "knockknock" "lulu" "protonvpn" + "rectangle" "secretive" "shortcat" "stay" + "utm" # design "imageoptim" @@ -64,8 +68,11 @@ "orion" # messaging apps + "discord" "messenger" "signal" + "slack" + "zoom" # editors and IDEs "lapce" diff --git a/flake.lock b/flake.lock index c87fda4..089eeb8 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "cl-nix-lite": { "locked": { - "lastModified": 1698901928, - "narHash": "sha256-gMHZybEVA3uMOBu1483gXfvUqpv4Qn7GJs3ZfCQYxpc=", + "lastModified": 1717972076, + "narHash": "sha256-hnZEsDInTcsVSL5LBGDAZegAxVLBus/wiJh+sNM15zU=", "owner": "hraban", "repo": "cl-nix-lite", - "rev": "9ad861b45bda7f59eba5ad1b43565a03c7c58553", + "rev": "cc920bfb0a6402d3871f470c98d65266126973e4", "type": "github" }, "original": { @@ -23,11 +23,11 @@ ] }, "locked": { - "lastModified": 1701025348, - "narHash": "sha256-42GHmYH+GF7VjwGSt+fVT1CQuNpGanJbNgVHTAZppUM=", + "lastModified": 1709610799, + "narHash": "sha256-5jfLQx0U9hXbi2skYMGodDJkIgffrjIOgMRjZqms2QE=", "owner": "ipetkov", "repo": "crane", - "rev": "42afaeb1a0325194a7cdb526332d2cb92fddd07b", + "rev": "81c393c776d5379c030607866afef6406ca1be57", "type": "github" }, "original": { @@ -43,11 +43,11 @@ ] }, "locked": { - "lastModified": 1704741201, - "narHash": "sha256-Y420NeqPWRSpxHpXsxhKILfTxT5exjtTgCgDwSpcEfU=", + "lastModified": 1718822777, + "narHash": "sha256-Y+YlmSc7ME+xDue3SJKEyUhwC3ZMLMvZrXsRr7rindM=", "owner": "nix-community", "repo": "disko", - "rev": "f0a3425a7b173701922e7959d8bfb136ef53aa54", + "rev": "48580409a2df1b0364116541228df3bcc84fc3a4", "type": "github" }, "original": { @@ -91,11 +91,11 @@ "fish-plugin-done": { "flake": false, "locked": { - "lastModified": 1704894068, - "narHash": "sha256-VSCYsGjNPSFIZSdLrkc7TU7qyPVm8UupOoav5UqXPMk=", + "lastModified": 1712867771, + "narHash": "sha256-DMIRKRAVOn7YEnuAtz4hIxrU93ULxNoQhW6juxCoh4o=", "owner": "franciscolourenco", "repo": "done", - "rev": "d47f4d6551cccb0e46edfb14213ca0097ee22f9a", + "rev": "eb32ade85c0f2c68cbfcff3036756bbf27a4f366", "type": "github" }, "original": { @@ -172,11 +172,11 @@ "flake-compat_2": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -190,11 +190,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1704152458, - "narHash": "sha256-DS+dGw7SKygIWf9w4eNBUZsK+4Ug27NwEWmn2tnbycg=", + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "88a2cd8166694ba0b6cb374700799cec53aef527", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", "type": "github" }, "original": { @@ -208,11 +208,11 @@ "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { - "lastModified": 1701473968, - "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "lastModified": 1714606777, + "narHash": "sha256-bMkNmAXLj8iyTvxaaD/StcLSadbj1chPcJOjtuVnLmA=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "rev": "4d34ce6412bc450b1d4208c953dc97c7fc764f1a", "type": "github" }, "original": { @@ -221,16 +221,31 @@ "type": "github" } }, + "flake-root": { + "locked": { + "lastModified": 1713493429, + "narHash": "sha256-ztz8JQkI08tjKnsTpfLqzWoKFQF4JGu2LRz8bkdnYUk=", + "owner": "srid", + "repo": "flake-root", + "rev": "bc748b93b86ee76e2032eecda33440ceb2532fcd", + "type": "github" + }, + "original": { + "owner": "srid", + "repo": "flake-root", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", "type": "github" }, "original": { @@ -244,11 +259,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -261,29 +276,11 @@ "systems": "systems_3" }, "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_4": { - "inputs": { - "systems": "systems_4" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -315,11 +312,11 @@ ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { @@ -338,11 +335,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1704763276, - "narHash": "sha256-dwRpOmBql51/BDcyDPSOAYZyHXYrW/Hry0smjOHZuCI=", + "lastModified": 1718727545, + "narHash": "sha256-j9h28WtYUswzsF/mwm7DJMxCPleloFrGUsnuysyE0OQ=", "owner": "helix-editor", "repo": "helix", - "rev": "84e24b33dcda16d1d64805f34dcc02d82d0de8f1", + "rev": "9b7dffbd613b3ba981890de78712ac0df520f145", "type": "github" }, "original": { @@ -358,11 +355,11 @@ ] }, "locked": { - "lastModified": 1704809957, - "narHash": "sha256-Z8sBeoeeY2O+BNqh5C+4Z1h1F1wQ2mij7yPZ2GY397M=", + "lastModified": 1718788307, + "narHash": "sha256-SqiOz0sljM0GjyQEVinPXQxaGcbOXw5OgpCWGPgh/vo=", "owner": "nix-community", "repo": "home-manager", - "rev": "e13aa9e287b3365473e5897e3667ea80a899cdfb", + "rev": "d7830d05421d0ced83a0f007900898bdcaf2a2ca", "type": "github" }, "original": { @@ -412,11 +409,11 @@ ] }, "locked": { - "lastModified": 1704221387, - "narHash": "sha256-XXsRjoz6IwMnY5MlMNi1QXqKFnJXYkIg3l/fnXn0oSs=", + "lastModified": 1718336101, + "narHash": "sha256-ynZTySa2iTry8be1NZMrnDoya1vZBfM3chBzHNHEYZw=", "owner": "hraban", "repo": "mac-app-util", - "rev": "4f48e20f25a620c3d4ef658bb3804c849d46cc93", + "rev": "a3873969fc0198b308881cbd9a1863e6ca429f26", "type": "github" }, "original": { @@ -434,11 +431,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1704611696, - "narHash": "sha256-4ZCgV5oHdEc3q+XaIzy//gh20uC/aSuAtMU9bsfgLZk=", + "lastModified": 1717086091, + "narHash": "sha256-GmsEQa4HZeMfec37LZnwG/Lt/XmqFLXsjv5QWojeNiM=", "owner": "oxalica", "repo": "nil", - "rev": "059d33a24bb76d2048740bcce936362bf54b5bc9", + "rev": "ab3ddb8f063774cf7e22eb610f5ecfdb77309f3c", "type": "github" }, "original": { @@ -454,11 +451,11 @@ ] }, "locked": { - "lastModified": 1704277720, - "narHash": "sha256-meAKNgmh3goankLGWqqpw73pm9IvXjEENJloF0coskE=", + "lastModified": 1718662658, + "narHash": "sha256-AKG7BsqtVWDlefgzyKz7vjaKTLi4+bmTSBhowbQoZtM=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "0dd382b70c351f528561f71a0a7df82c9d2be9a4", + "rev": "29b3096a6e283d7e6779187244cb2a3942239fdf", "type": "github" }, "original": { @@ -471,16 +468,17 @@ "nixd": { "inputs": { "flake-parts": "flake-parts_2", + "flake-root": "flake-root", "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1704598429, - "narHash": "sha256-HG1cl3X/oL0oNt9WhZzWrlJbDC572qzo85NGDf7K74A=", + "lastModified": 1718200260, + "narHash": "sha256-YcifM/i8wMzZHjyY9FNoruDb5Arm6Xw4RKfdvZBLdQU=", "owner": "nix-community", "repo": "nixd", - "rev": "2d970a6a7b86d0f389dc47c728e38758f3460c90", + "rev": "6811dcf03ac055752a3f28cbabf90bd0b0cee417", "type": "github" }, "original": { @@ -491,11 +489,11 @@ }, "nixos-flake": { "locked": { - "lastModified": 1702145288, - "narHash": "sha256-apVeRT0kOnDejwwBwbwNccm+qq1l6+qUOiRKE0vK5qk=", + "lastModified": 1718654494, + "narHash": "sha256-IuVb1NwGif8IzPcj1bYD2Uiz80Mc+sfFtBUxADSTj/Q=", "owner": "srid", "repo": "nixos-flake", - "rev": "4e422edf6b511f8e214b392cf1a0d4707a0399a4", + "rev": "90360c36a09b4348a3c61bf60e416b3cb1570264", "type": "github" }, "original": { @@ -506,11 +504,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1704842529, - "narHash": "sha256-OTeQA+F8d/Evad33JMfuXC89VMetQbsU4qcaePchGr4=", + "lastModified": 1718606988, + "narHash": "sha256-pmjP5ePc1jz+Okona3HxD7AYT0wbrCwm9bXAlj08nDM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "eabe8d3eface69f5bb16c18f8662a702f50c20d5", + "rev": "38d3352a65ac9d621b0cd3074d3bef27199ff78f", "type": "github" }, "original": { @@ -522,30 +520,24 @@ }, "nixpkgs-lib": { "locked": { - "dir": "lib", - "lastModified": 1703961334, - "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9", - "type": "github" + "lastModified": 1717284937, + "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" }, "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" } }, "nixpkgs-lib_2": { "locked": { "dir": "lib", - "lastModified": 1701253981, - "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", + "lastModified": 1714253743, + "narHash": "sha256-mdTQw2XlariysyScCv2tTE45QSU9v/ezLcHJ22f0Nxc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", + "rev": "58a1abdbae3217ca6b702f03d3b35125d88a2994", "type": "github" }, "original": { @@ -558,16 +550,16 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1685801374, - "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "lastModified": 1710695816, + "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "rev": "614b4613980a522ba49f0d194531beddbb7220d3", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.05", + "ref": "nixos-23.11", "repo": "nixpkgs", "type": "github" } @@ -575,7 +567,6 @@ "pre-commit": { "inputs": { "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_4", "gitignore": "gitignore", "nixpkgs": [ "nixpkgs" @@ -583,11 +574,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1704913983, - "narHash": "sha256-K/GuHFFriQhH3VPWMhm6bYelDuPyGGjGu1OF1EWUn5k=", + "lastModified": 1718825512, + "narHash": "sha256-nz7idS/SZWcTUGJ+lOFL+eJayrL/LpkUiy7+FxThAh4=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "b0265634df1dc584585c159b775120e637afdb41", + "rev": "97c0dc865fe9a062c5970f4bcf55bb9e6028bcf5", "type": "github" }, "original": { @@ -634,11 +625,11 @@ ] }, "locked": { - "lastModified": 1701137803, - "narHash": "sha256-0LcPAdql5IhQSUXJx3Zna0dYTgdIoYO7zUrsKgiBd04=", + "lastModified": 1709604635, + "narHash": "sha256-le4fwmWmjGRYWwkho0Gr7mnnZndOOe4XGbLw68OvF40=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "9dd940c967502f844eacea52a61e9596268d4f70", + "rev": "e86c0fb5d3a22a5f30d7f64ecad88643fe26449d", "type": "github" }, "original": { @@ -659,11 +650,11 @@ ] }, "locked": { - "lastModified": 1704593904, - "narHash": "sha256-nDoXZDTRdgF3b4n3m011y99nYFewvOl9UpzFvP8Rb3c=", + "lastModified": 1717035469, + "narHash": "sha256-MzH+yjKULH3HCRj9QCTwBvqq4LZkR0ZqRE/QfGOGC2E=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "c36fd70a99decfa6e110c86f296a97613034a680", + "rev": "095702e63a40e86f339d11864da9dc965b70a01e", "type": "github" }, "original": { @@ -675,11 +666,11 @@ "starship-src": { "flake": false, "locked": { - "lastModified": 1704732905, - "narHash": "sha256-rmbn7MBL90eG7Bdq0pTwkihNwnorWZGNK2FsCzPmZQ4=", + "lastModified": 1718643547, + "narHash": "sha256-PZQRuAncc3J67kQDUHNeyZBNofuwuDh3Ua61dPVHYCE=", "owner": "starship", "repo": "starship", - "rev": "fd32e35c3d144f361f432f9ca05bb2d9340fb949", + "rev": "37fba4cfb706533988404255e6226f37cdab13f9", "type": "github" }, "original": { @@ -733,29 +724,14 @@ "type": "github" } }, - "systems_4": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "terminal-themes": { "flake": false, "locked": { - "lastModified": 1704855600, - "narHash": "sha256-RV/4n8n6sHvLOUxchVaIYGC0uTvKFdSYGewzr/UOQ0s=", + "lastModified": 1718137856, + "narHash": "sha256-1wzGUnmUiLImoJKF1Nl19Q4Mk8084w7zpYlNn59D188=", "owner": "mbadolato", "repo": "iTerm2-Color-Schemes", - "rev": "0f6babed6b545fa953cfcd1254516399d02c91fd", + "rev": "32cc7dfc887801b004e27d476b043ae64db51ba1", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index b47d5b8..91f2bcd 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "mat's nix configs"; + description = "sloane's nix configs"; inputs = { # base inputs @@ -55,14 +55,17 @@ fish-plugin-replay.flake = false; fish-plugin-fish-bang-bang.url = "github:oh-my-fish/plugin-bang-bang"; fish-plugin-fish-bang-bang.flake = false; - fish-plugin-colored-man-pages.url = - "github:PatrickF1/colored_man_pages.fish"; + fish-plugin-colored-man-pages.url = "github:PatrickF1/colored_man_pages.fish"; fish-plugin-colored-man-pages.flake = false; }; - outputs = { self, flake-parts, ... }@inputs: + outputs = + { self, flake-parts, ... }@inputs: flake-parts.lib.mkFlake { inherit inputs; } { - systems = [ "aarch64-darwin" "aarch64-linux" ]; + systems = [ + "aarch64-darwin" + "aarch64-linux" + ]; imports = [ inputs.nixos-flake.flakeModule inputs.pre-commit.flakeModule @@ -100,10 +103,18 @@ }; }; }; - perSystem = { self', pkgs, config, ... }: + perSystem = + { + self', + pkgs, + config, + ... + }: # formatter for this flake - let formatter = pkgs.nixfmt; - in { + let + formatter = pkgs.nixfmt-rfc-style; + in + { # controls which flake inputs are updated by `nix run .#update` nixos-flake.primary-inputs = [ # system inputs @@ -121,7 +132,7 @@ pre-commit.settings.hooks = { deadnix.enable = true; nil.enable = true; - nixfmt.enable = true; + # nixfmt.enable = true; statix.enable = true; }; diff --git a/home/copy-apps.nix b/home/copy-apps.nix deleted file mode 100644 index 0cef99f..0000000 --- a/home/copy-apps.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, lib, ... }: -let mac-app-util = lib.getExe' pkgs.mac-app-util "mac-app-util"; -in { - home.activation.trampolineApps = lib.mkIf pkgs.stdenv.isDarwin - (lib.hm.dag.entryAfter [ "writeBoundary" ] '' - fromDir="$HOME/Applications/Home Manager Apps" - toDir="$HOME/Applications/Home Manager Trampolines" - ${mac-app-util} sync-trampolines "$fromDir" "$toDir" - ''); -} diff --git a/home/default.nix b/home/default.nix index 6d7208a..bd323eb 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,11 +1,10 @@ -{ self, ... }: { +{ self, ... }: +{ flake.homeModules = { common = { home.enableNixpkgsReleaseCheck = true; home.stateVersion = "22.05"; imports = [ - # fix app copying on darwin - ./copy-apps.nix # misc file configuration ./files.nix # misc program configuration diff --git a/home/extras/helix/auto-theme.nix b/home/extras/helix/auto-theme.nix index 8c6326d..b6ebf13 100644 --- a/home/extras/helix/auto-theme.nix +++ b/home/extras/helix/auto-theme.nix @@ -1,12 +1,17 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.programs.helix; tomlFormat = pkgs.formats.toml { }; -in { +in +{ options.programs.helix = { autoTheme = { - enable = - lib.mkEnableOption "Automatically switch helix theme with night mode"; + enable = lib.mkEnableOption "Automatically switch helix theme with night mode"; light = lib.mkOption { type = lib.types.str; @@ -22,17 +27,18 @@ in { config = lib.mkIf (cfg.enable && cfg.autoTheme.enable) { xdg.configFile = { - "helix/light.toml".source = tomlFormat.generate "helix-autotheme" - (cfg.settings // { theme = cfg.autoTheme.light; }); - "helix/dark.toml".source = tomlFormat.generate "helix-autotheme" - (cfg.settings // { theme = cfg.autoTheme.dark; }); + "helix/light.toml".source = tomlFormat.generate "helix-autotheme" ( + cfg.settings // { theme = cfg.autoTheme.light; } + ); + "helix/dark.toml".source = tomlFormat.generate "helix-autotheme" ( + cfg.settings // { theme = cfg.autoTheme.dark; } + ); }; programs.fish.functions = { hx = { wraps = "hx"; - description = - "Helix invocation wrapper to automatically select the right theme"; + description = "Helix invocation wrapper to automatically select the right theme"; body = '' if is-dark-mode command hx --config ${config.xdg.configHome}/helix/dark.toml $argv diff --git a/home/extras/kitty/auto-theme.nix b/home/extras/kitty/auto-theme.nix index 2611f20..31f107b 100644 --- a/home/extras/kitty/auto-theme.nix +++ b/home/extras/kitty/auto-theme.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let cfg = config.programs.kitty; # helper scripts for changing kitty colors @@ -16,7 +21,8 @@ let term-dark = pkgs.writeShellScriptBin "term-dark" '' ${term-background}/bin/term-background ${cfg.colors.dark-name} ''; -in { +in +{ options.programs.kitty = { colors = { enable = lib.mkOption { @@ -64,14 +70,17 @@ in { }; config = lib.mkIf (cfg.enable && cfg.colors.enable) { - home.packages = [ term-light term-dark term-background ]; + home.packages = [ + term-light + term-dark + term-background + ]; programs.kitty.settings = { allow_remote_control = "yes"; listen_on = "unix:/tmp/mykitty"; }; - xdg.configFile."kitty/macos-launch-services-cmdline".text = - lib.mkIf pkgs.stdenv.isDarwin "--listen-on unix:/tmp/mykitty"; + xdg.configFile."kitty/macos-launch-services-cmdline".text = lib.mkIf pkgs.stdenv.isDarwin "--listen-on unix:/tmp/mykitty"; }; } diff --git a/home/extras/kitty/nerd-font.nix b/home/extras/kitty/nerd-font.nix index 20d495f..b6db49c 100644 --- a/home/extras/kitty/nerd-font.nix +++ b/home/extras/kitty/nerd-font.nix @@ -1,6 +1,8 @@ { config, lib, ... }: -let cfg = config.programs.kitty; -in { +let + cfg = config.programs.kitty; +in +{ options.programs.kitty = { useSymbolsFromNerdFont = lib.mkOption { type = lib.types.str; @@ -19,8 +21,7 @@ in { config = lib.mkIf (cfg.enable && cfg.useSymbolsFromNerdFont != "") { programs.kitty.settings = { # https://github.com/ryanoasis/nerd-fonts/wiki/Glyph-Sets-and-Code-Points - symbol_map = - "U+E5FA-U+E62B,U+E700-U+E7C5,U+F000-U+F2E0,U+E200-U+E2A9,U+F500-U+FD46,U+E300-U+E3EB,U+F400-U+F4A8,U+2665,U+26a1,U+F27C,U+E0A3,U+E0B4-U+E0C8,U+E0CA,U+E0CC-U+E0D2,U+E0D4,U+23FB-U+23FE,U+2B58,U+F300-U+F313,U+E000-U+E00D ${cfg.useSymbolsFromNerdFont}"; + symbol_map = "U+E5FA-U+E62B,U+E700-U+E7C5,U+F000-U+F2E0,U+E200-U+E2A9,U+F500-U+FD46,U+E300-U+E3EB,U+F400-U+F4A8,U+2665,U+26a1,U+F27C,U+E0A3,U+E0B4-U+E0C8,U+E0CA,U+E0CC-U+E0D2,U+E0D4,U+23FB-U+23FE,U+2B58,U+F300-U+F313,U+E000-U+E00D ${cfg.useSymbolsFromNerdFont}"; }; }; } diff --git a/home/fish.nix b/home/fish.nix index c7d43a5..9357410 100644 --- a/home/fish.nix +++ b/home/fish.nix @@ -1,158 +1,166 @@ { pkgs, lib, ... }: -let nixConfigDirectory = "~/dotfiles.nix"; -in { +let + nixConfigDirectory = "~/dotfiles.nix"; +in +{ programs.fish = { enable = true; # see flake.nix and pkgs/default.nix plugins = pkgs.fishPlugins.flakePlugins; - functions = { - # user functions - mkdcd = { - argumentNames = [ "target" ]; - body = '' - if test -z "$target" - echo "mkdcd requires an argument" 1>&2 - return 1 - end - mkdir -p $target - cd $target + functions = + { + # user functions + mkdcd = { + argumentNames = [ "target" ]; + body = '' + if test -z "$target" + echo "mkdcd requires an argument" 1>&2 + return 1 + end + mkdir -p $target + cd $target + ''; + }; + + from-dir = { + argumentNames = [ "dir" ]; + body = '' + pushd $dir + set -e argv[1] + $argv + popd + ''; + }; + + darwin-rebuild-edit-with = { + argumentNames = [ + "editor" + "file" + ]; + body = '' + if test -z "$file" + set file flake.nix + end + from-nix $editor $file + ''; + }; + + # TODO: use these to implement !! and .. abbreviations + # blocked on additional support for abbr in home-manager + # https://github.com/nix-community/home-manager/issues/3706 + # + # taken from + # https://fishshell.com/docs/current/relnotes.html#fish-3-6-0-released-january-7-2023 + # last-history-item.body = '' + # echo $history[1] + # ''; + # multi-cd.body = '' + # echo cd (string repeat -n (math (string length -- $argv[1]) - 1) ../) + # ''; + } + // lib.optionalAttrs pkgs.stdenv.isDarwin { + # light/dark mode helpers + # determine if dark mode is active + is-dark-mode.body = '' + defaults read -g AppleInterfaceStyle &>/dev/null ''; - }; - from-dir = { - argumentNames = [ "dir" ]; - body = '' - pushd $dir - set -e argv[1] - $argv - popd - ''; - }; - - darwin-rebuild-edit-with = { - argumentNames = [ "editor" "file" ]; - body = '' - if test -z "$file" - set file flake.nix - end - from-nix $editor $file - ''; - }; - - # TODO: use these to implement !! and .. abbreviations - # blocked on additional support for abbr in home-manager - # https://github.com/nix-community/home-manager/issues/3706 - # - # taken from - # https://fishshell.com/docs/current/relnotes.html#fish-3-6-0-released-january-7-2023 - # last-history-item.body = '' - # echo $history[1] - # ''; - # multi-cd.body = '' - # echo cd (string repeat -n (math (string length -- $argv[1]) - 1) ../) - # ''; - } // lib.optionalAttrs pkgs.stdenv.isDarwin { - # light/dark mode helpers - # determine if dark mode is active - is-dark-mode.body = '' - defaults read -g AppleInterfaceStyle &>/dev/null - ''; - - # toggles `$term_background` between "light" and "dark". other Fish functions trigger when this - # variable changes. we use a universal variable so that all instances of Fish have the same - # value for the variable. - toggle-background.body = '' - if test "$term_background" = light - set -U term_background dark - else - set -U term_background light - end - ''; - - # set `$term_background` based on whether macOS is light or dark mode - set-background-to-macOS.body = '' - if is-dark-mode - set -U term_background dark - else - set -U term_background light - end - ''; - - # set `$term_background` based on an env var - set-background-to-env = { - argumentNames = [ "env_var" ]; - body = '' - switch $$env_var - case 1 - echo "Setting dark mode" + # toggles `$term_background` between "light" and "dark". other Fish functions trigger when this + # variable changes. we use a universal variable so that all instances of Fish have the same + # value for the variable. + toggle-background.body = '' + if test "$term_background" = light set -U term_background dark - case 0 - echo "Setting light mode" + else set -U term_background light end ''; - }; - # sets shell utilities to light or dark colorscheme based on `$term_background`. - set-shell-colors = { - body = '' - # Use correct theme for `btm` and `bat` - if test "$term_background" = light - alias btm "btm --color nord-light" - set -xg BAT_THEME OneHalfLight + # set `$term_background` based on whether macOS is light or dark mode + set-background-to-macOS.body = '' + if is-dark-mode + set -U term_background dark else - alias btm "btm --color nord" - set -xg BAT_THEME OneHalfDark + set -U term_background light end - # Set LS_COLORS - set -xg LS_COLORS (${pkgs.vivid}/bin/vivid generate one-$term_background) ''; - onVariable = "term_background"; + + # set `$term_background` based on an env var + set-background-to-env = { + argumentNames = [ "env_var" ]; + body = '' + switch $$env_var + case 1 + echo "Setting dark mode" + set -U term_background dark + case 0 + echo "Setting light mode" + set -U term_background light + end + ''; + }; + + # sets shell utilities to light or dark colorscheme based on `$term_background`. + set-shell-colors = { + body = '' + # Use correct theme for `btm` and `bat` + if test "$term_background" = light + alias btm "btm --color nord-light" + set -xg BAT_THEME OneHalfLight + else + alias btm "btm --color nord" + set -xg BAT_THEME OneHalfDark + end + # Set LS_COLORS + set -xg LS_COLORS (${pkgs.vivid}/bin/vivid generate one-$term_background) + ''; + onVariable = "term_background"; + }; }; - }; - shellAbbrs = { - ".." = "cd .."; + shellAbbrs = + { + ".." = "cd .."; - # darwin-rebuild build - drb = "from-nix darwin-rebuild build --flake ."; - # darwin-rebuild switch full - drsf = "from-nix darwin-rebuild switch --flake ."; - # darwin-rebuild switch (no homebrew) - drs = - "from-nix darwin-rebuild switch --flake . --override-input homebrew-enabled github:boolean-option/false"; - # edit darwin-rebuild config in helix - drh = "darwin-rebuild-edit-with hx"; - # edit darwin-rebuild config in zed - drz = "zed ${nixConfigDirectory}"; + # darwin-rebuild build + drb = "from-nix darwin-rebuild build --flake ."; + # darwin-rebuild switch full + drsf = "from-nix darwin-rebuild switch --flake ."; + # darwin-rebuild switch (no homebrew) + drs = "from-nix darwin-rebuild switch --flake . --override-input homebrew-enabled github:boolean-option/false"; + # edit darwin-rebuild config in helix + drh = "darwin-rebuild-edit-with hx"; + # edit darwin-rebuild config in zed + drz = "zed ${nixConfigDirectory}"; - nb = "nix build"; - nd = "nix develop"; - nf = "nix flake"; - nfc = "nix flake check"; - nfi = "nix flake init"; - nfs = "nix flake show"; - nfu = "nix flake update"; - nr = "nix run"; - ns = "nix search nixpkgs"; - nsh = "nix shell"; - nrp = "nix repl --expr '{ pkgs = (import { }); }'"; - g = "git"; - ga = "git add"; - gc = "git commit"; - gd = "git diff"; - gl = "git log"; - gp = "git push"; - stage = "git add ."; - commit = "git commit"; - push = "git push"; - pull = "git pull"; - } // lib.optionalAttrs pkgs.stdenv.isDarwin { - tb = "toggle-background"; - sb = "set-background-to-macOS"; - }; + nb = "nix build"; + nd = "nix develop"; + nf = "nix flake"; + nfc = "nix flake check"; + nfi = "nix flake init"; + nfs = "nix flake show"; + nfu = "nix flake update"; + nr = "nix run"; + ns = "nix search nixpkgs"; + nsh = "nix shell"; + nrp = "nix repl --expr '{ pkgs = (import { }); }'"; + g = "git"; + ga = "git add"; + gc = "git commit"; + gd = "git diff"; + gl = "git log"; + gp = "git push"; + stage = "git add ."; + commit = "git commit"; + push = "git push"; + pull = "git pull"; + } + // lib.optionalAttrs pkgs.stdenv.isDarwin { + tb = "toggle-background"; + sb = "set-background-to-macOS"; + }; shellAliases = { # nix related diff --git a/home/ghostty.nix b/home/ghostty.nix index 76afa93..d616fa7 100644 --- a/home/ghostty.nix +++ b/home/ghostty.nix @@ -1,33 +1,43 @@ -{ flake, pkgs, lib, ... }: { +{ + flake, + pkgs, + lib, + ... +}: +{ imports = [ flake.inputs.ghostty.homeModules.default ]; programs.ghostty = { enable = true; # ghostty is externally managed for now package = null; - settings = let font = "RecMonoDuotone Nerd Font"; - in { - # TODO: auto-theme - config-file = [ "${pkgs.terminal-themes}/ghostty/rose-pine" ]; - font-family = font; - # font-family-bold = "${font} Bold"; - # font-family-italic = "${font} Italic"; - # font-family-bold-italic = "${font} Bold Italic"; - # font-codepoint-map = - # "U+E5FA-U+E62B,U+E700-U+E7C5,U+F000-U+F2E0,U+E200-U+E2A9,U+F500-U+FD46,U+E300-U+E3EB,U+F400-U+F4A8,U+2665,U+26a1,U+F27C,U+E0A3,U+E0B4-U+E0C8,U+E0CA,U+E0CC-U+E0D2,U+E0D4,U+23FB-U+23FE,U+2B58,U+F300-U+F313,U+E000-U+E00D=RecMonoDuotone Nerd Font"; - font-size = 15; - background-opacity = 0.95; - unfocused-split-opacity = 0.8; - window-decoration = true; - window-padding-x = 10; - window-padding-y = 10; - window-inherit-working-directory = false; - working-directory = "home"; - } // lib.optionalAttrs pkgs.stdenv.isDarwin { - copy-on-select = "clipboard"; - background-blur-radius = 20; - macos-non-native-fullscreen = "visible-menu"; - macos-option-as-alt = true; - }; + settings = + let + font = "RecMonoDuotone Nerd Font"; + in + { + # TODO: auto-theme + config-file = [ "${pkgs.terminal-themes}/ghostty/rose-pine-dawn" ]; + font-family = font; + # font-family-bold = "${font} Bold"; + # font-family-italic = "${font} Italic"; + # font-family-bold-italic = "${font} Bold Italic"; + # font-codepoint-map = + # "U+E5FA-U+E62B,U+E700-U+E7C5,U+F000-U+F2E0,U+E200-U+E2A9,U+F500-U+FD46,U+E300-U+E3EB,U+F400-U+F4A8,U+2665,U+26a1,U+F27C,U+E0A3,U+E0B4-U+E0C8,U+E0CA,U+E0CC-U+E0D2,U+E0D4,U+23FB-U+23FE,U+2B58,U+F300-U+F313,U+E000-U+E00D=RecMonoDuotone Nerd Font"; + font-size = 15; + background-opacity = 0.95; + unfocused-split-opacity = 0.8; + window-decoration = true; + window-padding-x = 10; + window-padding-y = 10; + window-inherit-working-directory = false; + working-directory = "home"; + } + // lib.optionalAttrs pkgs.stdenv.isDarwin { + copy-on-select = "clipboard"; + background-blur-radius = 20; + macos-non-native-fullscreen = "visible-menu"; + macos-option-as-alt = true; + }; }; } diff --git a/home/git.nix b/home/git.nix index 594d1e4..887e539 100644 --- a/home/git.nix +++ b/home/git.nix @@ -1,6 +1,8 @@ { flake, ... }: -let inherit (flake.config.users) me'; -in { +let + inherit (flake.config.users) me'; +in +{ programs.git = { enable = true; @@ -17,7 +19,11 @@ in { merge.conflictStyle = "diff3"; }; - ignores = [ ".DS_Store" ".direnv" "result" ]; + ignores = [ + ".DS_Store" + ".direnv" + "result" + ]; # enhanced diffs # TODO: fix light colorscheme diff --git a/home/helix.nix b/home/helix.nix index 0e1115b..87ac02b 100644 --- a/home/helix.nix +++ b/home/helix.nix @@ -1,4 +1,5 @@ -{ pkgs, lib, ... }: { +{ pkgs, lib, ... }: +{ imports = [ ./extras/helix/auto-theme.nix ]; programs.helix = { enable = true; diff --git a/home/kitty.nix b/home/kitty.nix index 5aa0387..3cad461 100644 --- a/home/kitty.nix +++ b/home/kitty.nix @@ -1,7 +1,12 @@ { pkgs, lib, ... }: -let font = "Rec Mono Duotone"; -in { - imports = [ ./extras/kitty/auto-theme.nix ./extras/kitty/nerd-font.nix ]; +let + font = "Rec Mono Duotone"; +in +{ + imports = [ + ./extras/kitty/auto-theme.nix + ./extras/kitty/nerd-font.nix + ]; programs.kitty = { enable = true; # using kitty from homebrew @@ -29,9 +34,7 @@ in { # shell integration is manually enabled for fish shell_integration = "disabled"; - } // lib.optionalAttrs pkgs.stdenv.isDarwin { - macos_option_as_alt = "both"; - }; + } // lib.optionalAttrs pkgs.stdenv.isDarwin { macos_option_as_alt = "both"; }; useSymbolsFromNerdFont = "CaskaydiaCove Nerd Font"; colors = { diff --git a/home/pijul.nix b/home/pijul.nix index 03eb5c9..1abb899 100644 --- a/home/pijul.nix +++ b/home/pijul.nix @@ -2,7 +2,8 @@ let inherit (flake.config.users) me me'; tomlFormat = pkgs.formats.toml { }; -in { +in +{ home = { packages = [ pkgs.pijul ]; file = { diff --git a/home/programs.nix b/home/programs.nix index 5e976cf..0bc7b73 100644 --- a/home/programs.nix +++ b/home/programs.nix @@ -1,88 +1,97 @@ -{ pkgs, lib, ... }: { +{ pkgs, lib, ... }: +{ - home.packages = builtins.attrValues ({ - inherit (pkgs) - # GUI apps - discord-ptb obsidian rectangle slack utm zoom-us + home.packages = builtins.attrValues ( + { + inherit (pkgs) + # system tools + curl + wget + # `tmux` session alternative + abduco + # archive tool + atool + # `top` alternative with ASCII graphs + bottom + # `ncdu` alternative + diskonaut + # `dig` alternative. dogs _can_ look up + dogdns + # `du` alternative + du-dust + # `find` alternative + fd + # `ping` with a graph + gping + # `ps` alternative + procs + # pipe progress viewer + pv + # command line file encryption + rage + # `sed` alternative for _batch file_ edits + sad + # `sed` alternative for _stream_ edits + sd + # backups for the truly paranoid + tarsnap + # terminal color support testing + terminal-colors + # (La)TeX alternative + typst + # extract RAR archives + unrar + # extract XZ archives + xz + # `tmux` multiplexing/layout alternative + zellij - # system tools - curl wget - # `tmux` session alternative - abduco - # archive tool - atool - # `top` alternative with ASCII graphs - bottom - # `ncdu` alternative - diskonaut - # `dig` alternative. dogs _can_ look up - dogdns - # `du` alternative - du-dust - # `find` alternative - fd - # `ping` with a graph - gping - # `ps` alternative - procs - # pipe progress viewer - pv - # command line file encryption - rage - # `sed` alternative for _batch file_ edits - sad - # `sed` alternative for _stream_ edits - sd - # backups for the truly paranoid - tarsnap - # terminal color support testing - terminal-colors - # (La)TeX alternative - typst - # extract RAR archives - unrar - # extract XZ archives - xz - # `tmux` multiplexing/layout alternative - zellij + # dev platforms + # command line tools for fly.io + flyctl + # command line tools for netlify + netlify-cli - # dev platforms - # command line tools for fly.io - flyctl - # command line tools for netlify - netlify-cli + # dev tools + # session recording + asciinema + # benchmarking tool + hyperfine + # task runner + just + # source code line counter + tokei + # reimplementation of `httpie` in rust + xh - # dev tools - # session recording - asciinema - # benchmarking tool - hyperfine - # task runner - just - # source code line counter - tokei - # reimplementation of `httpie` in rust - xh - - # useful nix related tools - nix-prefetch-git nix-tree - # adding/managing alternative binary caches hosted by Cachix - cachix - # run software from nixpkgs without installing it - comma - # nix language servers - nil nixd; - } // lib.optionalAttrs pkgs.stdenv.isDarwin { - inherit (pkgs) - # useful macOS CLI commands - m-cli; - }); + # useful nix related tools + nix-prefetch-git + nix-tree + nixfmt-rfc-style + # adding/managing alternative binary caches hosted by Cachix + cachix + # run software from nixpkgs without installing it + comma + # nix language servers + nil + nixd + ; + } + // lib.optionalAttrs pkgs.stdenv.isDarwin { + inherit (pkgs) + # useful macOS CLI commands + m-cli + ; + } + ); programs = { # `cat` with wings bat = { enable = true; - config = { style = "auto"; }; + config = { + style = "auto"; + }; }; # multi-shell / multi-command argument completion daemon carapace.enable = true; @@ -94,7 +103,6 @@ # fork of `exa`, an `ls` alternative eza = { enable = true; - enableAliases = true; icons = true; git = true; extraOptions = [ "--group-directories-first" ]; diff --git a/home/services/dark-mode-notify.nix b/home/services/dark-mode-notify.nix index 5613106..468efe9 100644 --- a/home/services/dark-mode-notify.nix +++ b/home/services/dark-mode-notify.nix @@ -1,8 +1,16 @@ -{ config, pkgs, lib, ... }: { +{ + config, + pkgs, + lib, + ... +}: +{ # dark-mode-notify configuration launchd.agents.dark-mode-notify = - let logPath = "${config.xdg.stateHome}/dark-mode-notify"; - in { + let + logPath = "${config.xdg.stateHome}/dark-mode-notify"; + in + { enable = true; config = { Label = "ke.bou.dark-mode-notify"; diff --git a/home/services/tarsnap.nix b/home/services/tarsnap.nix index a183b83..ab97fbb 100644 --- a/home/services/tarsnap.nix +++ b/home/services/tarsnap.nix @@ -1,4 +1,10 @@ -{ config, pkgs, lib, ... }: { +{ + config, + pkgs, + lib, + ... +}: +{ # set configuration in ~ so tarsnap cli works interactively home.file.".tarsnaprc".text = '' cachedir ${config.xdg.cacheHome} @@ -9,32 +15,36 @@ humanize-numbers ''; # tarsnap periodic backup configuration - launchd.agents.tarsnap = let - logPath = "${config.xdg.stateHome}/tarsnap"; - tarsnapBackup = pkgs.writeShellScriptBin "tarsnap-backup-helper" '' - date=$(date -u +%Y-%m-%dT%H:%M:%SZ) - echo - echo "Running tarsnap backup for $date" - ${lib.getExe pkgs.tarsnap} -c \ - --configfile ${config.home.homeDirectory}/.tarsnaprc \ - --keyfile ${config.xdg.configHome}/tarsnap/write-only.key \ - -f $(uname -n)-$date \ - ${config.home.homeDirectory}/{dotfiles.nix,Desktop,Development,Documents} - ''; - in { - enable = true; - config = { - Label = "com.tarsnap.tarsnap"; - StandardErrorPath = "${logPath}/error.log"; - StandardOutPath = "${logPath}/out.log"; - StartCalendarInterval = [{ - # every sunday - Weekday = 0; - # at midnight - Hour = 0; - Minute = 0; - }]; - Program = lib.getExe tarsnapBackup; + launchd.agents.tarsnap = + let + logPath = "${config.xdg.stateHome}/tarsnap"; + tarsnapBackup = pkgs.writeShellScriptBin "tarsnap-backup-helper" '' + date=$(date -u +%Y-%m-%dT%H:%M:%SZ) + echo + echo "Running tarsnap backup for $date" + ${lib.getExe pkgs.tarsnap} -c \ + --configfile ${config.home.homeDirectory}/.tarsnaprc \ + --keyfile ${config.xdg.configHome}/tarsnap/write-only.key \ + -f $(uname -n)-$date \ + ${config.home.homeDirectory}/{dotfiles.nix,Desktop,Development,Documents} + ''; + in + { + enable = true; + config = { + Label = "com.tarsnap.tarsnap"; + StandardErrorPath = "${logPath}/error.log"; + StandardOutPath = "${logPath}/out.log"; + StartCalendarInterval = [ + { + # every sunday + Weekday = 0; + # at midnight + Hour = 0; + Minute = 0; + } + ]; + Program = lib.getExe tarsnapBackup; + }; }; - }; } diff --git a/home/ssh.nix b/home/ssh.nix index 2e33fb2..6d0e577 100644 --- a/home/ssh.nix +++ b/home/ssh.nix @@ -1,8 +1,13 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - socket = - "${config.home.homeDirectory}/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh"; -in { + socket = "${config.home.homeDirectory}/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh"; +in +{ home.sessionVariables.SSH_AUTH_SOCK = socket; programs.ssh = { enable = true; diff --git a/home/starship.nix b/home/starship.nix index e278ad9..6eb9ce1 100644 --- a/home/starship.nix +++ b/home/starship.nix @@ -2,10 +2,12 @@ programs.starship = { enable = true; settings = { - battery.display = [{ - # display battery information if charge is <= 25% - threshold = 25; - }]; + battery.display = [ + { + # display battery information if charge is <= 25% + threshold = 25; + } + ]; # turn on fish directory truncation directory.fish_style_pwd_dir_length = 1; # number of directories not to truncate diff --git a/nixos/default.nix b/nixos/default.nix index 0d500b5..349fa3b 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,16 +1,25 @@ -{ self, config, ... }: { +{ self, config, ... }: +{ flake.nixosModules = { - common.imports = [ ./nix.nix ./caches ]; + common.imports = [ + ./nix.nix + ./caches + ]; - home = let inherit (config.users) me; - in { - home-manager.users.${me} = { imports = [ self.homeModules.linux ]; }; - users.users.${me} = { - name = me; - home = "/home/${me}"; - isNormalUser = true; + home = + let + inherit (config.users) me; + in + { + home-manager.users.${me} = { + imports = [ self.homeModules.linux ]; + }; + users.users.${me} = { + name = me; + home = "/home/${me}"; + isNormalUser = true; + }; }; - }; default.imports = [ self.nixosModules.home-manager diff --git a/nixos/nix.nix b/nixos/nix.nix index 5709d80..8c3fb32 100644 --- a/nixos/nix.nix +++ b/nixos/nix.nix @@ -1,4 +1,10 @@ -{ flake, pkgs, lib, ... }: { +{ + flake, + pkgs, + lib, + ... +}: +{ nixpkgs = { config = { allowBroken = true; @@ -14,12 +20,9 @@ }; nix = { - package = pkgs.nixUnstable; nixPath = { nixpkgs = "${flake.inputs.nixpkgs}"; - } // lib.optionalAttrs pkgs.stdenv.isDarwin { - darwin = "${flake.inputs.nix-darwin}"; - }; + } // lib.optionalAttrs pkgs.stdenv.isDarwin { darwin = "${flake.inputs.nix-darwin}"; }; registry = { nixpkgs.flake = flake.inputs.nixpkgs; self.flake = flake.inputs.self; @@ -27,15 +30,23 @@ settings = { # TODO: automatic optimizing and gc # https://github.com/montchr/dotfield/blob/main/profiles/darwinProfiles/core/nix-optimizations-darwin.nix - experimental-features = [ "nix-command" "flakes" "repl-flake" ]; + experimental-features = [ + "nix-command" + "flakes" + "repl-flake" + ]; extra-platforms = lib.mkIf (pkgs.system == "aarch64-darwin") [ "x86_64-darwin" "aarch64-darwin" ]; # wipe out the registry for purity, cf. https://github.com/MatthewCroughan/nixcfg/commit/ce86bee2755127a4fdaca91e5e037d3fe625cba9 - flake-registry = builtins.toFile "empty-flake-registry.json" - ''{"flakes":[],"version":2}''; - trusted-users = [ flake.config.users.me "root" "@admin" "@wheel" ]; + flake-registry = builtins.toFile "empty-flake-registry.json" ''{"flakes":[],"version":2}''; + trusted-users = [ + flake.config.users.me + "root" + "@admin" + "@wheel" + ]; }; }; } diff --git a/nixos/ssh-access.nix b/nixos/ssh-access.nix index 61864f0..e37d7ea 100644 --- a/nixos/ssh-access.nix +++ b/nixos/ssh-access.nix @@ -1,10 +1,13 @@ -{ flake, ... }: { +{ flake, ... }: +{ # remote access - users.users = let - inherit (flake.config.users) me me'; - myKeys = me'.sshKeys; - in { - root.openssh.authorizedKeys.keys = myKeys; - ${me}.openssh.authorizedKeys.keys = myKeys; - }; + users.users = + let + inherit (flake.config.users) me me'; + myKeys = me'.sshKeys; + in + { + root.openssh.authorizedKeys.keys = myKeys; + ${me}.openssh.authorizedKeys.keys = myKeys; + }; } diff --git a/pkgs/dark-mode-notify.nix b/pkgs/dark-mode-notify.nix index 052a51f..82be4e5 100644 --- a/pkgs/dark-mode-notify.nix +++ b/pkgs/dark-mode-notify.nix @@ -1,10 +1,16 @@ -{ stdenv, lib, xcodeenv, dark-mode-notify-src }: +{ + stdenv, + lib, + xcodeenv, + dark-mode-notify-src, +}: let xcode = xcodeenv.composeXcodeWrapper { version = "*.*"; xcodeBaseDir = "/Applications/Xcode.app"; }; -in stdenv.mkDerivation { +in +stdenv.mkDerivation { pname = "dark-mode-notify"; version = dark-mode-notify-src.shortRev; diff --git a/pkgs/default.nix b/pkgs/default.nix index fad4642..8b9b778 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -2,24 +2,24 @@ inputs: self: super: { inherit (inputs) terminal-themes; # get flake inputs prefixed with fish-plugin- and inject them into fishPlugins as a single list fishPlugins = super.fishPlugins // { - flakePlugins = let - srcs = - self.lib.filterAttrs (input: _: self.lib.hasPrefix "fish-plugin-" input) - inputs; - in self.lib.mapAttrsToList (input: src: { - name = self.lib.removePrefix "fish-plugin-" input; - inherit src; - }) srcs; + flakePlugins = + let + srcs = self.lib.filterAttrs (input: _: self.lib.hasPrefix "fish-plugin-" input) inputs; + in + self.lib.mapAttrsToList (input: src: { + name = self.lib.removePrefix "fish-plugin-" input; + inherit src; + }) srcs; }; ia-writer-family = self.callPackage ./ia-writer-family.nix { inherit (inputs) ia-writer-family-src; }; - mac-app-util = - inputs.mac-app-util.packages.${super.stdenv.system}.default.overrideAttrs - (old: { - postInstall = old.postInstall + '' + mac-app-util = inputs.mac-app-util.packages.${super.stdenv.system}.default.overrideAttrs (old: { + postInstall = + old.postInstall + + '' wrapProgram "$out/bin/mac-app-util" --suffix PATH : "${super.jq}/bin" ''; - }); + }); recursive-patched = self.callPackage ./recursive-patched.nix { }; } diff --git a/pkgs/ia-writer-family.nix b/pkgs/ia-writer-family.nix index 31f3725..8976e40 100644 --- a/pkgs/ia-writer-family.nix +++ b/pkgs/ia-writer-family.nix @@ -1,4 +1,8 @@ -{ stdenv, lib, ia-writer-family-src }: +{ + stdenv, + lib, + ia-writer-family-src, +}: stdenv.mkDerivation { pname = "ia-writer-family"; version = ia-writer-family-src.shortRev; diff --git a/pkgs/recursive-patched.nix b/pkgs/recursive-patched.nix index b5de0ef..dbdf454 100644 --- a/pkgs/recursive-patched.nix +++ b/pkgs/recursive-patched.nix @@ -1,4 +1,8 @@ -{ stdenv, nerd-font-patcher, recursive }: +{ + stdenv, + nerd-font-patcher, + recursive, +}: stdenv.mkDerivation { name = "recursive-nerd-font-patched"; src = recursive; diff --git a/systems/darwin/m1.nix b/systems/darwin/m1.nix index e341257..d169eab 100644 --- a/systems/darwin/m1.nix +++ b/systems/darwin/m1.nix @@ -1,10 +1,14 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ environment.systemPackages = [ pkgs.terminal-notifier ]; # networking settings # TODO: do we need to add Tailscale, ProtonVPN, RNDIS (reMarkable), etc? - networking.knownNetworkServices = - [ "USB 10/100/1000 LAN" "Wi-Fi" "Thunderbolt Bridge" ]; + networking.knownNetworkServices = [ + "USB 10/100/1000 LAN" + "Wi-Fi" + "Thunderbolt Bridge" + ]; # TODO: where / how to configure hostname etc? # manage build users, package, and daemon diff --git a/systems/darwin/work.nix b/systems/darwin/work.nix index 2a08efe..cf3ea21 100644 --- a/systems/darwin/work.nix +++ b/systems/darwin/work.nix @@ -1,14 +1,20 @@ -{ lib, ... }: { - homebrew.casks = [ "itsycal" "pallotron-yubiswitch" ]; - home-manager.sharedModules = [{ - launchd.agents.tarsnap.enable = lib.mkForce false; - programs.ssh.matchBlocks.devbox = { - hostname = "csdev6"; - forwardAgent = true; - serverAliveInterval = 120; - }; - programs.fish.functions.devbox.body = '' - ssh -t devbox "agenttmux attach; or agenttmux new -s yelp" - ''; - }]; +{ lib, ... }: +{ + homebrew.casks = [ + "itsycal" + "pallotron-yubiswitch" + ]; + home-manager.sharedModules = [ + { + launchd.agents.tarsnap.enable = lib.mkForce false; + programs.ssh.matchBlocks.devbox = { + hostname = "csdev6"; + forwardAgent = true; + serverAliveInterval = 120; + }; + programs.fish.functions.devbox.body = '' + ssh -t devbox "agenttmux attach; or agenttmux new -s yelp" + ''; + } + ]; } diff --git a/systems/nixos/pihole.nix b/systems/nixos/pihole.nix index a4ac335..9995f20 100644 --- a/systems/nixos/pihole.nix +++ b/systems/nixos/pihole.nix @@ -1,4 +1,5 @@ -{ flake, ... }: { +{ flake, ... }: +{ imports = [ flake.inputs.disko.nixosModules.disko ]; disko.devices.disk = { }; diff --git a/templates/rust/flake.nix b/templates/rust/flake.nix index 58012c7..46a7fcc 100644 --- a/templates/rust/flake.nix +++ b/templates/rust/flake.nix @@ -10,26 +10,45 @@ pre-commit.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs@{ self, flake-parts, crane, pre-commit, ... }: + outputs = + inputs@{ + self, + flake-parts, + crane, + pre-commit, + ... + }: flake-parts.lib.mkFlake { inherit inputs; } { imports = [ pre-commit.flakeModule ]; - systems = - [ "aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux" ]; - perSystem = { config, pkgs, system, ... }: + systems = [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" + "x86_64-linux" + ]; + perSystem = + { + config, + pkgs, + system, + ... + }: let crane-lib = crane.lib.${system}; package = crane-lib.buildPackage { src = crane-lib.cleanCargoSource ./.; - nativeBuildInputs = - pkgs.lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ]; + nativeBuildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ]; }; - in { + in + { pre-commit.settings.hooks = { rustfmt.enable = true; clippy.enable = true; cargo-check.enable = true; }; - checks = { inherit package; }; + checks = { + inherit package; + }; packages.default = package; devShells.default = pkgs.mkShell { shellHook = '' @@ -38,13 +57,9 @@ ''; inputsFrom = builtins.attrValues self.checks; - RUST_SRC_PATH = - "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; - nativeBuildInputs = - builtins.attrValues { inherit (pkgs) cargo rustc; }; - buildInputs = builtins.attrValues { - inherit (pkgs) rust-analyzer rustfmt clippy; - }; + RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; + nativeBuildInputs = builtins.attrValues { inherit (pkgs) cargo rustc; }; + buildInputs = builtins.attrValues { inherit (pkgs) rust-analyzer rustfmt clippy; }; }; }; }; diff --git a/users/config.nix b/users/config.nix index 1461e90..dc64777 100644 --- a/users/config.nix +++ b/users/config.nix @@ -1,20 +1,22 @@ { - me = "mat"; + me = "sloane"; users = { - mat = { - name = "mat ess"; - email = "mat@mat.services"; + sloane = { + name = "sloane ess"; + username = "sloane"; + email = "sloane@sloane.lol"; sshKeys = [ # secretive - "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKTVoMVtHSvosU9SCam4S5RTP0R2V09vqw5Xiuff+x4J7NtUxsBhqIrkPSfJHSbYlBKITX5RFyFBo5mtsTa95v0= mat" + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKTVoMVtHSvosU9SCam4S5RTP0R2V09vqw5Xiuff+x4J7NtUxsBhqIrkPSfJHSbYlBKITX5RFyFBo5mtsTa95v0= sloane" ]; }; - mess = { - name = "Matthew Ess"; - email = "mess@yelp.com"; + sloane-work = { + name = "Sloane Ess"; + username = "sloane"; + email = "sloane@yelp.com"; sshKeys = [ # secretive - "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLWD/lvxFOdmE48MUKdigYZOAc3bSIyPxW4M7frWe8Nks9cr58Z/1btvUUmAK+u+J6gw5g+Mt9X0uwR7KPQlavg= mat" + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLWD/lvxFOdmE48MUKdigYZOAc3bSIyPxW4M7frWe8Nks9cr58Z/1btvUUmAK+u+J6gw5g+Mt9X0uwR7KPQlavg= sloane" "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOkqyHm9fBDXChdmNgbhxd2U1IpkiD4xjC8AVOvil+uEeKYqDi5mF3oeAGYJrV6BRc7hEO+DQP60pN0wI5tMoYE= yelp" ]; }; diff --git a/users/default.nix b/users/default.nix index b24c21c..50b939c 100644 --- a/users/default.nix +++ b/users/default.nix @@ -8,6 +8,12 @@ let full name ''; }; + username = lib.mkOption { + type = lib.types.str; + description = '' + user account name + ''; + }; email = lib.mkOption { type = lib.types.str; }; sshKeys = lib.mkOption { type = lib.types.listOf lib.types.str; @@ -39,7 +45,8 @@ let }; }; }; -in { +in +{ # TODO: can we hack in an assertion that `me` is a key in `users`? options.users = lib.mkOption { type = usersSubmodule; }; config.users = (import ./config.nix) // {