diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..b85b26d --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +has nix && use flake diff --git a/.gitignore b/.gitignore index b2be92b..9fd00ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -result +result/ +.direnv/ diff --git a/flake.lock b/flake.lock index ae7f7ca..7f63b17 100644 --- a/flake.lock +++ b/flake.lock @@ -1,139 +1,5 @@ { "nodes": { - "blender-bin": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "dir": "blender", - "lastModified": 1742939360, - "narHash": "sha256-YeM/A4SWHlz2trSNjriPi4QR5zsYMC8vkQawSlRw2+w=", - "owner": "edolstra", - "repo": "nix-warez", - "rev": "c9d2d5c61a37f2217e9241ccfa6c394ed2f3e52b", - "type": "github" - }, - "original": { - "id": "blender-bin", - "type": "indirect" - } - }, - "catppuccin": { - "inputs": { - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1744447794, - "narHash": "sha256-z5uK5BDmFg0L/0EW2XYLGr39FbQeXyNVnIEhkZrG8+Q=", - "owner": "catppuccin", - "repo": "nix", - "rev": "c44fe73ed8e5d5809eded7cc6156ca9c40044e42", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "repo": "nix", - "type": "github" - } - }, - "crane": { - "locked": { - "lastModified": 1741148495, - "narHash": "sha256-EV8KUaIZ2/CdBXlutXrHoZYbWPeB65p5kKZk71gvDRI=", - "owner": "ipetkov", - "repo": "crane", - "rev": "75390a36cd0c2cdd5f1aafd8a9f827d7107f2e53", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "ctp-discord-compiled": { - "flake": false, - "locked": { - "lastModified": 1740810360, - "narHash": "sha256-Y1HDjEiw/MP+t2oqkdZT7mUvm09YmRUPQ9FFi1Hk26U=", - "owner": "catppuccin", - "repo": "discord", - "rev": "075f4e53795e336a77f922a61680d32d57b424f5", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "ref": "gh-pages", - "repo": "discord", - "type": "github" - } - }, - "ctp-vscode-compiled": { - "flake": false, - "locked": { - "lastModified": 1713966373, - "narHash": "sha256-ODqdy+17MxSRLFzj2TYYSvG7xUXDYEDZfjW5SkzRGyA=", - "owner": "catppuccin", - "repo": "vscode", - "rev": "4b857d9b86cbb393e121f0f2544a6efb549dbbf4", - "type": "github" - }, - "original": { - "owner": "catppuccin", - "ref": "catppuccin-vsc-v3.14.0", - "repo": "vscode", - "type": "github" - } - }, - "fenix": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ], - "rust-analyzer-src": "rust-analyzer-src" - }, - "locked": { - "lastModified": 1742452566, - "narHash": "sha256-sVuLDQ2UIWfXUBbctzrZrXM2X05YjX08K7XHMztt36E=", - "owner": "nix-community", - "repo": "fenix", - "rev": "7d9ba794daf5e8cc7ee728859bc688d8e26d5f06", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "monthly", - "repo": "fenix", - "type": "github" - } - }, - "firefox-addons": { - "inputs": { - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "dir": "pkgs/firefox-addons", - "lastModified": 1742025179, - "narHash": "sha256-gxfMDCQeGZk3wZjqdl2boaGGm+yiAkaNFNp3x5vhuYg=", - "owner": "~rycee", - "repo": "nur-expressions", - "rev": "9b8d2f4a1e3a199878d1eb14d7e0f176052a8038", - "type": "sourcehut" - }, - "original": { - "dir": "pkgs/firefox-addons", - "owner": "~rycee", - "repo": "nur-expressions", - "type": "sourcehut" - } - }, "flake-compat": { "flake": false, "locked": { @@ -150,22 +16,6 @@ "type": "github" } }, - "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1733328505, - "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -204,28 +54,10 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "ghostty": { "inputs": { "flake-compat": "flake-compat", - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils", "nixpkgs-stable": [ "nixpkgs" ], @@ -250,28 +82,6 @@ "type": "github" } }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "lanzaboote", - "pre-commit-hooks-nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, "hjem": { "inputs": { "nixpkgs": [ @@ -299,11 +109,11 @@ ] }, "locked": { - "lastModified": 1745861051, - "narHash": "sha256-L1B2KkvbNHCtNbmYNli/DqCwEhshcwrt/p904iIYPNs=", + "lastModified": 1745973953, + "narHash": "sha256-s1ZHPUq9mi0VHVLI927tFdsMQqB5ClEBrYCwI8C7BMA=", "owner": "snugnug", "repo": "hjem-rum", - "rev": "1ad4898417031a6b280894f80f041118b6964432", + "rev": "d152f54bcd38dff8badc9449f6aa8f44944e1b17", "type": "github" }, "original": { @@ -312,93 +122,6 @@ "type": "github" } }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1744618730, - "narHash": "sha256-n3gN7aHwVRnnBZI64EDoKyJnWidNYJ0xezhqQtdjH2Q=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "85dd758c703ffbf9d97f34adcef3a898b54b4014", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "krunner-nix": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1696278906, - "narHash": "sha256-z2tbFXMC+nSN7vhn2WSoMVdViolucLeoDSfOfnRcmCE=", - "owner": "pluiedev", - "repo": "krunner-nix", - "rev": "8a819944620db8eab35e7dbb14d1916c9e7a478d", - "type": "github" - }, - "original": { - "owner": "pluiedev", - "repo": "krunner-nix", - "type": "github" - } - }, - "lanzaboote": { - "inputs": { - "crane": "crane", - "flake-compat": "flake-compat_2", - "flake-parts": [ - "flake-parts" - ], - "nixpkgs": [ - "nixpkgs" - ], - "pre-commit-hooks-nix": "pre-commit-hooks-nix", - "rust-overlay": "rust-overlay" - }, - "locked": { - "lastModified": 1741442524, - "narHash": "sha256-tVcxLDLLho8dWcO81Xj/3/ANLdVs0bGyCPyKjp70JWk=", - "owner": "nix-community", - "repo": "lanzaboote", - "rev": "d8099586d9a84308ffedac07880e7f07a0180ff4", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "lanzaboote", - "type": "github" - } - }, - "nix-darwin": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1744478979, - "narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=", - "owner": "LnL7", - "repo": "nix-darwin", - "rev": "43975d782b418ebf4969e9ccba82466728c2851b", - "type": "github" - }, - "original": { - "owner": "LnL7", - "repo": "nix-darwin", - "type": "github" - } - }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -406,11 +129,11 @@ ] }, "locked": { - "lastModified": 1744518957, - "narHash": "sha256-RLBSWQfTL0v+7uyskC5kP6slLK1jvIuhaAh8QvB75m4=", + "lastModified": 1745725746, + "narHash": "sha256-iR+idGZJ191cY6NBXyVjh9QH8GVWTkvZw/w+1Igy45A=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "4fc9ea78c962904f4ea11046f3db37c62e8a02fd", + "rev": "187524713d0d9b2d2c6f688b81835114d4c2a7c6", "type": "github" }, "original": { @@ -421,11 +144,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1744366945, - "narHash": "sha256-OuLhysErPHl53BBifhesrRumJNhrlSgQDfYOTXfgIMg=", + "lastModified": 1745955289, + "narHash": "sha256-mmV2oPhQN+YF2wmnJzXX8tqgYmUYXUj3uUUBSTmYN5o=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "1fe3cc2bc5d2dc9c81cb4e63d2f67c1543340df1", + "rev": "72081c9fbbef63765ae82bff9727ea79cc86bd5b", "type": "github" }, "original": { @@ -437,11 +160,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1744098102, - "narHash": "sha256-tzCdyIJj9AjysC3OuKA+tMD/kDEDAF9mICPDU7ix0JA=", + "lastModified": 1745930157, + "narHash": "sha256-y3h3NLnzRSiUkYpnfvnS669zWZLoqqI6NprtLQ+5dck=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c8cd81426f45942bb2906d5ed2fe21d2f19d95b7", + "rev": "46e634be05ce9dc6d4db8e664515ba10b78151ae", "type": "github" }, "original": { @@ -451,147 +174,15 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1744463964, - "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1735554305, - "narHash": "sha256-zExSA1i/b+1NMRhGGLtNfFGXgLtgo+dcuzHzaWA6w3Q=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "0e82ab234249d8eee3e8c91437802b32c74bb3fd", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "plasma-manager": { - "inputs": { - "home-manager": [ - "home-manager" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1742765550, - "narHash": "sha256-2vVIh2JrL6GAGfgCeY9e6iNKrBjs0Hw3bGQEAbwVs68=", - "owner": "nix-community", - "repo": "plasma-manager", - "rev": "b70be387276e632fe51232887f9e04e2b6ef8c16", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "plasma-manager", - "type": "github" - } - }, - "pre-commit-hooks-nix": { - "inputs": { - "flake-compat": [ - "lanzaboote", - "flake-compat" - ], - "gitignore": "gitignore", - "nixpkgs": [ - "lanzaboote", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1740915799, - "narHash": "sha256-JvQvtaphZNmeeV+IpHgNdiNePsIpHD5U/7QN5AeY44A=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "42b1ba089d2034d910566bf6b40830af6b8ec732", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "root": { "inputs": { - "blender-bin": "blender-bin", - "catppuccin": "catppuccin", - "ctp-discord-compiled": "ctp-discord-compiled", - "ctp-vscode-compiled": "ctp-vscode-compiled", - "fenix": "fenix", - "firefox-addons": "firefox-addons", "flake-parts": "flake-parts", - "flake-utils": "flake-utils", "ghostty": "ghostty", "hjem": "hjem", "hjem-rum": "hjem-rum", - "home-manager": "home-manager", - "krunner-nix": "krunner-nix", - "lanzaboote": "lanzaboote", - "nix-darwin": "nix-darwin", "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_2", - "plasma-manager": "plasma-manager", - "treefmt-nix": "treefmt-nix" - } - }, - "rust-analyzer-src": { - "flake": false, - "locked": { - "lastModified": 1742296961, - "narHash": "sha256-gCpvEQOrugHWLimD1wTFOJHagnSEP6VYBDspq96Idu0=", - "owner": "rust-lang", - "repo": "rust-analyzer", - "rev": "15d87419f1a123d8f888d608129c3ce3ff8f13d4", - "type": "github" - }, - "original": { - "owner": "rust-lang", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" - } - }, - "rust-overlay": { - "inputs": { - "nixpkgs": [ - "lanzaboote", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1741228283, - "narHash": "sha256-VzqI+k/eoijLQ5am6rDFDAtFAbw8nltXfLBC6SIEJAE=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "38e9826bc4296c9daf18bc1e6aa299f3e932a403", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" + "nixpkgs": "nixpkgs" } }, "systems": { @@ -609,39 +200,6 @@ "type": "github" } }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "treefmt-nix": { - "inputs": { - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1743748085, - "narHash": "sha256-uhjnlaVTWo5iD3LXics1rp9gaKgDRQj6660+gbUU3cE=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "815e4121d6a5d504c0f96e5be2dd7f871e4fd99d", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, "zig": { "inputs": { "flake-compat": [ diff --git a/flake.nix b/flake.nix index 37d597f..0dbdd0d 100644 --- a/flake.nix +++ b/flake.nix @@ -6,44 +6,21 @@ # NOTE: please keep this in alphabetical order. - blender-bin = { - url = "blender-bin"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - catppuccin.url = "github:catppuccin/nix"; - - ctp-discord-compiled = { - url = "github:catppuccin/discord/gh-pages"; - flake = false; - }; + # ctp-discord-compiled = { + # url = "github:catppuccin/discord/gh-pages"; + # flake = false; + # }; - ctp-vscode-compiled = { - url = "github:catppuccin/vscode/catppuccin-vsc-v3.14.0"; - flake = false; - }; - - fenix = { - url = "github:nix-community/fenix/monthly"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - firefox-addons = { - url = "sourcehut:~rycee/nur-expressions?dir=pkgs/firefox-addons"; - inputs = { - nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "flake-utils"; - }; - }; + # ctp-vscode-compiled = { + # url = "github:catppuccin/vscode/catppuccin-vsc-v3.14.0"; + # flake = false; + # }; flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; }; - # Only for input deduplication - flake-utils.url = "github:numtide/flake-utils"; - ghostty = { url = "github:pluiedev/ghostty/edge"; inputs = { @@ -53,37 +30,27 @@ }; hjem = { - url = "github:feel-co/hjem"; - inputs.nixpkgs.follows = "nixpkgs"; + url = "github:feel-co/hjem"; + inputs.nixpkgs.follows = "nixpkgs"; }; hjem-rum = { - url = "github:snugnug/hjem-rum"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - krunner-nix = { - url = "github:pluiedev/krunner-nix"; + url = "github:snugnug/hjem-rum"; inputs.nixpkgs.follows = "nixpkgs"; }; - lanzaboote = { - url = "github:nix-community/lanzaboote"; - inputs = { - flake-parts.follows = "flake-parts"; - nixpkgs.follows = "nixpkgs"; - }; - }; + # lanzaboote = { + # url = "github:nix-community/lanzaboote"; + # inputs = { + # flake-parts.follows = "flake-parts"; + # nixpkgs.follows = "nixpkgs"; + # }; + # }; - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - nix-darwin = { - url = "github:LnL7/nix-darwin"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + # home-manager = { + # url = "github:nix-community/home-manager"; + # inputs.nixpkgs.follows = "nixpkgs"; + # }; nix-index-database = { url = "github:nix-community/nix-index-database"; @@ -92,20 +59,19 @@ nixos-hardware.url = "github:NixOS/nixos-hardware/master"; - plasma-manager = { - url = "github:nix-community/plasma-manager"; - inputs = { - home-manager.follows = "home-manager"; - nixpkgs.follows = "nixpkgs"; - }; - }; - - treefmt-nix.url = "github:numtide/treefmt-nix"; + # plasma-manager = { + # url = "github:nix-community/plasma-manager"; + # inputs = { + # home-manager.follows = "home-manager"; + # nixpkgs.follows = "nixpkgs"; + # }; + # }; }; outputs = inputs: let + inherit (inputs.nixpkgs) lib; packages' = pkgs': pkgs'.lib.packagesFromDirectoryRecursive { @@ -114,33 +80,33 @@ }; in inputs.flake-parts.lib.mkFlake { inherit inputs; } { - imports = [ - ./hm-modules - ./systems - ]; - systems = [ - "x86_64-linux" - "x86_64-darwin" - ]; - - flake.overlays.default = _: packages'; + imports = [ ./systems ]; + + systems = lib.systems.flakeExposed; + + flake = { + overlays.default = _: packages'; + hjemModules = { + hjem-ext.imports = lib.fileset.toList ( + lib.fileset.fileFilter (file: file.hasExt "nix") ./modules/hjem-ext + ); + hjem-ctp.imports = lib.fileset.toList ( + lib.fileset.fileFilter (file: file.hasExt "nix") ./modules/hjem-ctp + ); + }; + }; perSystem = { pkgs, ... }: { packages = packages' pkgs; - }; - # perSystem = - # { pkgs, ... }: - # let - # treefmt = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix; - # formatter = treefmt.config.build.wrapper; - # in - # { - # inherit formatter; - # devShells.default = pkgs.mkShell { packages = [ formatter ]; }; - # checks.formatting = treefmt.config.build.check inputs.self; - # }; + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + nil + nixfmt-rfc-style + ]; + }; + }; }; } diff --git a/hm-modules/ctp-plus/default.nix b/hm-modules/ctp-plus/default.nix deleted file mode 100644 index 7ae71e4..0000000 --- a/hm-modules/ctp-plus/default.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ inputs, ... }: -{ - config, - lib, - pkgs, - ... -}@args: -let - args' = args // { - inherit inputs; - ctpLib = import "${inputs.catppuccin}/modules/lib" { inherit config lib pkgs; }; - }; -in -{ - imports = map (p: import p args') [ - ./plasma.nix - ./vencord.nix - ]; -} diff --git a/hm-modules/default.nix b/hm-modules/default.nix deleted file mode 100644 index b4cead9..0000000 --- a/hm-modules/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ flake-parts-lib, moduleWithSystem, inputs, ... }: -let - inherit (flake-parts-lib) importApply; -in -{ - flake.hmModules = { - ctp-plus = importApply ./ctp-plus { inherit inputs; }; - hm-plus = moduleWithSystem (import ./hm-plus); - }; -} diff --git a/hm-modules/hm-plus/default.nix b/hm-modules/hm-plus/default.nix deleted file mode 100644 index fdd27d2..0000000 --- a/hm-modules/hm-plus/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ inputs' }: { - imports = [ - ./programs - ]; - _module.args = { inherit inputs'; }; -} diff --git a/hm-modules/hm-plus/programs/1password.nix b/hm-modules/hm-plus/programs/1password.nix deleted file mode 100644 index c4ba9b5..0000000 --- a/hm-modules/hm-plus/programs/1password.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -let - inherit (lib) - mkDefault - mkIf - mkEnableOption - mkPackageOption - optional - getExe' - ; - - cfg = config.programs._1password; -in -{ - options.programs._1password = { - enable = mkEnableOption "1Password"; - - package = mkPackageOption pkgs "1Password" { default = [ "_1password-gui" ]; }; - - autostart = mkEnableOption "autostarting 1Password"; - - enableSshAgent = mkEnableOption "1Password's SSH agent"; - }; - config = mkIf cfg.enable { - home.packages = - [ cfg.package ] - ++ optional cfg.autostart ( - pkgs.makeAutostartItem { - name = "1password"; - inherit (cfg) package; - } - ); - - programs = mkIf cfg.enableSshAgent { - git.signer = getExe' cfg.package "op-ssh-sign"; - ssh.enable = mkDefault true; - ssh.extraConfig = "IdentityAgent ${config.home.homeDirectory}/.1password/agent.sock"; - }; - - # Some tools like Jujutsu don't care about ~/.ssh/config, so we have to set this manually - home.sessionVariables.SSH_AUTH_SOCK = mkIf cfg.enableSshAgent "${config.home.homeDirectory}/.1password/agent.sock"; - }; -} diff --git a/hm-modules/hm-plus/programs/default.nix b/hm-modules/hm-plus/programs/default.nix deleted file mode 100644 index e45db51..0000000 --- a/hm-modules/hm-plus/programs/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - imports = [ - ./1password.nix - ./discord.nix - ./fcitx5 - ./git.nix - ./moar.nix - ./vesktop.nix - ]; -} diff --git a/hm-modules/hm-plus/programs/discord.nix b/hm-modules/hm-plus/programs/discord.nix deleted file mode 100644 index 79b64f9..0000000 --- a/hm-modules/hm-plus/programs/discord.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -let - inherit (lib) - mkEnableOption - mkPackageOption - mkOption - mkIf - optionalAttrs - types - ; - cfg = config.programs.discord; - format = pkgs.formats.json { }; -in -{ - options.programs.discord = { - enable = mkEnableOption "Discord"; - - package = mkPackageOption pkgs "Discord" { default = [ "discord" ]; }; - - settings = mkOption { - inherit (format) type; - description = '' - Configuration written to {file}`$XDG_CONFIG_HOME/discord/settings.json`. - ''; - default = { }; - }; - - openAsar.enable = mkEnableOption "OpenASAR"; - - vencord = { - enable = mkEnableOption "Vencord"; - - settings = mkOption { - inherit (format) type; - description = '' - Configuration written to {file}`$XDG_CONFIG_HOME/Vencord/settings/settings.json`. - ''; - default = { }; - }; - - css = mkOption { - type = types.lines; - description = '' - Style sheet written to {file}`$XDG_CONFIG_HOME/Vencord/settings/quickCss.css`. - ''; - default = ""; - }; - }; - }; - - config = mkIf cfg.enable { - home.packages = [ - (cfg.package.override { - withOpenASAR = cfg.openAsar.enable; - withVencord = cfg.vencord.enable; - }) - ]; - - xdg.configFile = - { - "discord/settings.json".source = format.generate "discord-settings.json" cfg.settings; - } - // optionalAttrs cfg.vencord.enable { - "Vencord/settings/settings.json".source = format.generate "vencord-settings.json" cfg.vencord.settings; - "Vencord/settings/quickCss.css".text = cfg.vencord.css; - }; - }; -} diff --git a/hm-modules/hm-plus/programs/fcitx5/default.nix b/hm-modules/hm-plus/programs/fcitx5/default.nix deleted file mode 100644 index 21576b9..0000000 --- a/hm-modules/hm-plus/programs/fcitx5/default.nix +++ /dev/null @@ -1,137 +0,0 @@ -{ - config, - osConfig, - lib, - pkgs, - ... -}: -let - inherit (lib) - mkMerge - mkIf - mkOption - types - literalExpression - ; - im = config.i18n.inputMethod; - cfg = im.fcitx5; - - fcitx5Package = - if cfg.plasma6Support then - pkgs.qt6Packages.fcitx5-with-addons.override { inherit (cfg) addons; } - else - pkgs.libsForQt5.fcitx5-with-addons; - - fcitx5Package' = fcitx5Package.override { inherit (cfg) addons; }; - - format = pkgs.formats.ini { }; - formatWithGlobalSection = pkgs.formats.iniWithGlobalSection { }; -in -{ - imports = [ ./rime.nix ]; - - options.i18n.inputMethod.fcitx5 = { - plasma6Support = mkOption { - type = types.bool; - default = osConfig.services.desktopManager.plasma6.enable; - defaultText = literalExpression "config.services.desktopManager.plasma6.enable"; - description = '' - Use qt6 versions of fcitx5 packages. - Required for configuring fcitx5 in KDE System Settings. - ''; - }; - quickPhrase = mkOption { - type = with types; attrsOf str; - default = { }; - example = literalExpression '' - { - smile = "(・∀・)"; - angry = "( ̄ー ̄)"; - } - ''; - description = "Quick phrases."; - }; - quickPhraseFiles = mkOption { - type = with types; attrsOf path; - default = { }; - example = literalExpression '' - { - words = ./words.mb; - numbers = ./numbers.mb; - } - ''; - description = "Quick phrase files."; - }; - settings = { - globalOptions = mkOption { - type = types.submodule { freeformType = format.type; }; - default = { }; - description = '' - The global options in `config` file in ini format. - ''; - }; - inputMethod = mkOption { - type = types.submodule { freeformType = format.type; }; - default = { }; - description = '' - The input method configure in `profile` file in ini format. - ''; - }; - addons = mkOption { - type = with types; (attrsOf anything); - default = { }; - description = '' - The addon configures in `conf` folder in ini format with global sections. - Each item is written to the corresponding file. - ''; - example = literalExpression "{ pinyin.globalSection.EmojiEnabled = \"True\"; }"; - }; - }; - ignoreUserConfig = lib.mkOption { - type = lib.types.bool; - default = false; - description = '' - Ignore the user configures. **Warning**: When this is enabled, the - user config files are totally ignored and the user dict can't be saved - and loaded. - ''; - }; - }; - - config = mkIf (im.enabled == "fcitx5") { - # override HM defaults - i18n.inputMethod.package = lib.mkForce fcitx5Package'; - - i18n.inputMethod.fcitx5.addons = - lib.optionals (cfg.quickPhrase != { }) [ - (pkgs.writeTextDir "share/fcitx5/data/QuickPhrase.mb" ( - lib.concatStringsSep "\n" (lib.mapAttrsToList (name: value: "${name} ${value}") cfg.quickPhrase) - )) - ] - ++ lib.optionals (cfg.quickPhraseFiles != { }) [ - (pkgs.linkFarm "quickPhraseFiles" ( - lib.mapAttrs' ( - name: value: lib.nameValuePair "share/fcitx5/data/quickphrase.d/${name}.mb" value - ) cfg.quickPhraseFiles - )) - ]; - - xdg.configFile = - let - optionalFile = - p: f: v: - lib.optionalAttrs (v != { }) { "fcitx5/${p}".source = f p v; }; - in - lib.attrsets.mergeAttrsList [ - (optionalFile "config" format cfg.settings.globalOptions) - (optionalFile "profile" format cfg.settings.inputMethod) - (lib.concatMapAttrs ( - name: value: optionalFile "conf/${name}.conf" formatWithGlobalSection value - ) cfg.settings.addons) - ]; - - home.sessionVariables = mkMerge [ - (mkIf cfg.ignoreUserConfig { SKIP_FCITX_USER_PATH = "1"; }) - ]; - }; -} diff --git a/hm-modules/hm-plus/programs/fcitx5/rime.nix b/hm-modules/hm-plus/programs/fcitx5/rime.nix deleted file mode 100644 index c033a86..0000000 --- a/hm-modules/hm-plus/programs/fcitx5/rime.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -let - inherit (lib) - mkIf - mkEnableOption - mkOption - mapAttrs' - nameValuePair - types - ; - cfg = config.i18n.inputMethod.fcitx5.rime; - format = pkgs.formats.yaml { }; -in -{ - options.i18n.inputMethod.fcitx5.rime = { - enable = mkEnableOption "the Rime input engine for Fcitx5"; - - dataPkgs = mkOption { - type = types.listOf types.package; - default = [ pkgs.rime-data ]; - }; - - settings = mkOption { - inherit (format) type; - default = { }; - example = { - default.patch.schema_list = [ - { schema = "luna_pinyin_simp"; } - { schema = "luna_pinyin"; } - ]; - }; - }; - }; - - config = mkIf cfg.enable { - i18n.inputMethod.fcitx5.addons = [ (pkgs.fcitx5-rime.override { rimeDataPkgs = cfg.dataPkgs; }) ]; - xdg.dataFile = mapAttrs' ( - n: v: nameValuePair "fcitx5/rime/${n}.custom.yaml" { source = format.generate n v; } - ) cfg.settings; - }; -} diff --git a/hm-modules/hm-plus/programs/git.nix b/hm-modules/hm-plus/programs/git.nix deleted file mode 100644 index 93c3f01..0000000 --- a/hm-modules/hm-plus/programs/git.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -let - inherit (lib) - getExe - getExe' - mkIf - mkOption - types - ; - cfg = config.programs.git; -in -{ - options.programs.git = { - signingFormat = mkOption { - type = types.enum [ - "openpgp" - "ssh" - "x509" - ]; - default = "openpgp"; - }; - - signer = mkOption { - type = types.path; - default = - { - openpgp = getExe' pkgs.gnupg "gpg2"; - ssh = getExe pkgs.openssh; - x509 = getExe' pkgs.gnupg "gpgsm"; - } - .${cfg.signingFormat}; - }; - }; - config = mkIf cfg.enable { - programs.git.extraConfig.gpg = { - format = cfg.signingFormat; - ${cfg.signingFormat}.program = cfg.signer; - }; - }; -} diff --git a/hm-modules/ctp-plus/plasma.nix b/modules/hjem-ctp/plasma.nix similarity index 100% rename from hm-modules/ctp-plus/plasma.nix rename to modules/hjem-ctp/plasma.nix diff --git a/hm-modules/ctp-plus/vencord.nix b/modules/hjem-ctp/vencord.nix similarity index 100% rename from hm-modules/ctp-plus/vencord.nix rename to modules/hjem-ctp/vencord.nix diff --git a/hm-modules/hm-plus/README.md b/modules/hjem-ext/README.md similarity index 100% rename from hm-modules/hm-plus/README.md rename to modules/hjem-ext/README.md diff --git a/modules/hjem-ext/programs/direnv.nix b/modules/hjem-ext/programs/direnv.nix new file mode 100644 index 0000000..25b7fa3 --- /dev/null +++ b/modules/hjem-ext/programs/direnv.nix @@ -0,0 +1,31 @@ +{ + config, + pkgs, + lib, + ... +}: +let + cfg = config.ext.programs.direnv; +in +{ + options.ext.programs.direnv = { + enable = lib.mkEnableOption "direnv"; + package = lib.mkPackageOption pkgs "direnv" { }; + + nix-direnv = { + enable = lib.mkEnableOption "nix-direnv"; + package = lib.mkPackageOption pkgs "nix-direnv" { }; + }; + }; + + config = lib.mkIf cfg.enable { + packages = [ cfg.package ]; + + rum.programs.fish.earlyConfigFiles.direnv = '' + ${lib.getExe cfg.package} hook fish | source + ''; + + files.".config/direnv/lib/hm-nix-direnv.sh".source = + lib.mkIf cfg.nix-direnv.enable "${cfg.nix-direnv.package}/share/nix-direnv/direnvrc"; + }; +} diff --git a/modules/hjem-ext/programs/git.nix b/modules/hjem-ext/programs/git.nix new file mode 100644 index 0000000..05d1b8f --- /dev/null +++ b/modules/hjem-ext/programs/git.nix @@ -0,0 +1,29 @@ +{ + config, + pkgs, + lib, + ... +}: +let + cfg = config.ext.programs.git; + format = pkgs.formats.gitIni { }; +in +{ + options.ext.programs.git = { + enable = lib.mkEnableOption "Git"; + package = lib.mkPackageOption pkgs "git" { }; + + settings = lib.mkOption { + type = lib.types.submodule { + freeformType = format.type; + }; + default = { }; + }; + }; + + config = lib.mkIf cfg.enable { + packages = [ cfg.package ]; + files.".config/git/config".source = lib.mkIf (cfg.settings != { }) + (format.generate "git-config" cfg.settings); + }; +} diff --git a/modules/hjem-ext/programs/hyfetch.nix b/modules/hjem-ext/programs/hyfetch.nix new file mode 100644 index 0000000..0353b7f --- /dev/null +++ b/modules/hjem-ext/programs/hyfetch.nix @@ -0,0 +1,44 @@ +{ + config, + pkgs, + lib, + ... +}: +let + cfg = config.ext.programs.hyfetch; + format = pkgs.formats.json { }; + configFile = format.generate "hyfetch.json" cfg.settings; +in +{ + options.ext.programs.hyfetch = { + enable = lib.mkEnableOption "Hyfetch"; + package = lib.mkPackageOption pkgs "hyfetch" { }; + + settings = lib.mkOption { + type = lib.types.submodule { + freeformType = format.type; + + options = { + backend = lib.mkOption { + type = lib.types.enum [ + "neofetch" + "fastfetch" + "qwqfetch" + ]; + }; + }; + }; + default = { }; + }; + }; + + config = lib.mkIf cfg.enable { + packages = + [ cfg.package ] + ++ lib.optional (cfg.settings.backend == "fastfetch") pkgs.fastfetch + ++ lib.optional (cfg.settings.backend == "neofetch") pkgs.neofetch; + # TODO: add qwqfetch when it's added to nixpkgs + + files.".config/hyfetch.json".source = lib.mkIf (cfg.settings != { }) configFile; + }; +} diff --git a/modules/hjem-ext/programs/jujutsu.nix b/modules/hjem-ext/programs/jujutsu.nix new file mode 100644 index 0000000..c10e596 --- /dev/null +++ b/modules/hjem-ext/programs/jujutsu.nix @@ -0,0 +1,29 @@ +{ + config, + pkgs, + lib, + ... +}: +let + cfg = config.ext.programs.jujutsu; + format = pkgs.formats.toml { }; +in +{ + options.ext.programs.jujutsu = { + enable = lib.mkEnableOption "Jujutsu"; + package = lib.mkPackageOption pkgs "jujutsu" { }; + + settings = lib.mkOption { + type = lib.types.submodule { + freeformType = format.type; + }; + default = { }; + }; + }; + + config = lib.mkIf cfg.enable { + packages = [ cfg.package ]; + files.".config/jj/config.toml".source = lib.mkIf (cfg.settings != { }) + (format.generate "jj-config.toml" cfg.settings); + }; +} diff --git a/hm-modules/hm-plus/programs/moar.nix b/modules/hjem-ext/programs/moar.nix similarity index 78% rename from hm-modules/hm-plus/programs/moar.nix rename to modules/hjem-ext/programs/moar.nix index 5b3192d..a32e9b8 100644 --- a/hm-modules/hm-plus/programs/moar.nix +++ b/modules/hjem-ext/programs/moar.nix @@ -5,7 +5,7 @@ ... }: let - cfg = config.programs.moar; + cfg = config.ext.programs.moar; toFlag = k: v: if lib.isBool v then lib.optionalString (v) "-${k}" @@ -16,7 +16,7 @@ let in { - options.programs.moar = { + options.ext.programs.moar = { enable = lib.mkEnableOption "Moar"; package = lib.mkPackageOption pkgs "moar" {}; @@ -32,8 +32,9 @@ in }; }; - config = lib.mkIf (cfg.enable) { - home.sessionVariables = { + config = lib.mkIf cfg.enable { + packages = [ cfg.package ]; + environment.sessionVariables = { PAGER = "moar"; MOAR = lib.concatStringsSep " " (lib.mapAttrsToList toFlag cfg.settings); }; diff --git a/hm-modules/hm-plus/programs/vesktop.nix b/modules/hjem-ext/programs/vesktop.nix similarity index 69% rename from hm-modules/hm-plus/programs/vesktop.nix rename to modules/hjem-ext/programs/vesktop.nix index b4a4167..6865de4 100644 --- a/hm-modules/hm-plus/programs/vesktop.nix +++ b/modules/hjem-ext/programs/vesktop.nix @@ -13,11 +13,11 @@ let types optionalAttrs ; - cfg = config.programs.vesktop; + cfg = config.ext.programs.vesktop; format = pkgs.formats.json { }; in { - options.programs.vesktop = { + options.ext.programs.vesktop = { enable = mkEnableOption "Vesktop"; package = mkPackageOption pkgs "Vesktop" { default = [ "vesktop" ]; }; @@ -58,13 +58,21 @@ in }; config = mkIf cfg.enable { - home.packages = [ (cfg.package.override { withSystemVencord = cfg.vencord.useSystemPackage; }) ]; + packages = [ + (cfg.package.override { + withSystemVencord = cfg.vencord.useSystemPackage; + }) + ]; - xdg.configFile = { - "vesktop/settings.json".source = format.generate "vesktop-settings.json" cfg.settings; - } // optionalAttrs cfg.vencord.enable { - "vesktop/settings/settings.json".source = format.generate "vencord-settings.json" cfg.vencord.settings; - "vesktop/settings/quickCss.css".text = cfg.vencord.css; - }; + files = + { + ".config/vesktop/settings.json".source = format.generate "vesktop-settings.json" cfg.settings; + } + // optionalAttrs cfg.vencord.enable { + ".config/vesktop/settings/settings.json".source = + format.generate "vencord-settings.json" cfg.vencord.settings; + + ".config/vesktop/settings/quickCss.css".text = cfg.vencord.css; + }; }; } diff --git a/packages/catppuccin-fcitx5/package.nix b/packages/catppuccin-fcitx5/package.nix deleted file mode 100644 index 1c6d717..0000000 --- a/packages/catppuccin-fcitx5/package.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ stdenvNoCC, fetchFromGitHub }: -stdenvNoCC.mkDerivation { - pname = "catppuccin-fcitx5"; - version = "2022-10-05"; - - src = fetchFromGitHub { - owner = "catppuccin"; - repo = "fcitx5"; - rev = "ce244cfdf43a648d984719fdfd1d60aab09f5c97"; - hash = "sha256-uFaCbyrEjv4oiKUzLVFzw+UY54/h7wh2cntqeyYwGps="; - }; - - installPhase = '' - runHook preInstall - mkdir -p $out/share/fcitx5 - cp -r src $out/share/fcitx5/themes - runHook postInstall - ''; -} diff --git a/packages/catppuccin-fish/package.nix b/packages/catppuccin-fish/package.nix new file mode 100644 index 0000000..97989a7 --- /dev/null +++ b/packages/catppuccin-fish/package.nix @@ -0,0 +1,22 @@ +{ + stdenvNoCC, + fetchFromGitHub, +}: +stdenvNoCC.mkDerivation { + pname = "catppuccin-fish"; + version = "0-unstable-2025-03-01"; + + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "fish"; + rev = "6a85af2ff722ad0f9fbc8424ea0a5c454661dfed"; + hash = "sha256-Oc0emnIUI4LV7QJLs4B2/FQtCFewRFVp7EDv8GawFsA="; + }; + + installPhase = '' + runHook preInstall + mkdir -p $out/share/fish + cp -r themes $out/share/fish/themes + runHook postInstall + ''; +} diff --git a/roles/audio/default.nix b/roles/audio/default.nix deleted file mode 100644 index 6307bb9..0000000 --- a/roles/audio/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ lib, ... }: -let - inherit (lib) mkEnableOption; -in -{ - options.roles.audio.enable = mkEnableOption "audio support" // { - default = true; - }; -} diff --git a/roles/audio/nixos.nix b/roles/audio/nixos.nix deleted file mode 100644 index 85dce4f..0000000 --- a/roles/audio/nixos.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.roles.audio; - inherit (lib) mkIf; -in -{ - config = mkIf cfg.enable { - services.pulseaudio.enable = false; - security.rtkit.enable = true; - - roles.base.user.extraGroups = [ "rtkit" ]; - - services.pipewire = { - enable = true; - wireplumber.enable = true; - alsa.enable = true; - jack.enable = true; - pulse.enable = true; - }; - }; -} diff --git a/roles/base/default.nix b/roles/base/default.nix deleted file mode 100644 index 2ecb9e7..0000000 --- a/roles/base/default.nix +++ /dev/null @@ -1,86 +0,0 @@ -{ config, lib, ... }: -let - inherit (lib) - mkAliasOptionModule - mkEnableOption - mkOption - types - optional - ; - - cfg = config.roles.base; -in -{ - options.roles.base = { - username = mkOption { - type = types.str; - example = "cavej"; - description = "The primary user's internal user name."; - }; - realName = mkOption { - type = types.nullOr types.str; - default = null; - example = "Cave"; - description = "The primary user's real name."; - }; - fullName = mkOption { - type = types.nullOr types.str; - default = null; - example = "Cave Johnson"; - description = "The primary user's full name."; - }; - publicKey = mkOption { - type = types.nullOr types.str; - default = null; - description = "The primary user's public key."; - }; - - canSudo = mkEnableOption "admin permissions for the primary user"; - }; - - imports = [ - (mkAliasOptionModule [ "hm" ] [ - "home-manager" - "users" - cfg.username - ]) - (mkAliasOptionModule - [ - "roles" - "base" - "user" - ] - [ - "users" - "users" - cfg.username - ] - ) - ]; - - config = { - assertions = [ - { - assertion = builtins.hasAttr "username" cfg; - message = "base role username has to be set"; - } - ]; - - nix.settings.trusted-users = optional cfg.canSudo cfg.username; - - home-manager = { - backupFileExtension = "backup"; - useGlobalPkgs = true; - useUserPackages = true; - }; - - hm = { - home = { - inherit (cfg) username; - homeDirectory = config.roles.base.user.home; - }; - - programs.home-manager.enable = true; - }; - }; -} diff --git a/roles/base/nixos.nix b/roles/base/nixos.nix deleted file mode 100644 index 422b265..0000000 --- a/roles/base/nixos.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ config, lib, ... }: -let - inherit (lib.lists) optional; - - cfg = config.roles.base; -in -{ - config = { - roles.base.user = { - isNormalUser = true; - description = cfg.realName; - extraGroups = optional cfg.canSudo "wheel"; - home = "/home/${cfg.username}"; - }; - - hm.home.stateVersion = config.system.stateVersion; - }; -} diff --git a/roles/boot/default.nix b/roles/boot/default.nix deleted file mode 100644 index dd15ad1..0000000 --- a/roles/boot/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ lib, ... }: -let - inherit (lib) mkEnableOption; -in -{ - imports = [ ./lanzaboote ]; - - options.roles.boot = { - enable = mkEnableOption "boot settings" // { - default = true; - }; - }; -} diff --git a/roles/boot/lanzaboote/default.nix b/roles/boot/lanzaboote/default.nix deleted file mode 100644 index e37537c..0000000 --- a/roles/boot/lanzaboote/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - config, - lib, - inputs, - ... -}: -{ - imports = [ inputs.lanzaboote.nixosModules.lanzaboote ]; - - options.roles.boot.lanzaboote.enable = lib.mkEnableOption "Lanzaboote, a secure boot implementation for NixOS"; - - config = lib.mkIf config.roles.boot.lanzaboote.enable { - boot.lanzaboote = { - enable = true; - pkiBundle = "/etc/secureboot"; - }; - - boot.loader.systemd-boot.enable = lib.mkForce false; - }; -} diff --git a/roles/boot/nixos.nix b/roles/boot/nixos.nix deleted file mode 100644 index ab1117b..0000000 --- a/roles/boot/nixos.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.roles.boot; -in -{ - config = lib.mkIf cfg.enable { - boot.loader = { - systemd-boot = { - enable = true; - editor = false; - consoleMode = "2"; - configurationLimit = 10; - }; - efi.canTouchEfiVariables = true; - }; - }; -} diff --git a/roles/darwin.nix b/roles/darwin.nix deleted file mode 100644 index 060a832..0000000 --- a/roles/darwin.nix +++ /dev/null @@ -1,11 +0,0 @@ -inputs@{ lib, ... }: -{ - imports = - [ ./. ] - ++ (lib.pipe (import ./. inputs).imports [ - (map (s: /${s}/darwin.nix)) - (builtins.filter builtins.pathExists) - ]); - - system.stateVersion = 4; -} diff --git a/roles/default.nix b/roles/default.nix deleted file mode 100644 index a28d7b7..0000000 --- a/roles/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ lib, ... }: -{ - imports = lib.pipe ./. [ - builtins.readDir - (lib.filterAttrs (n: ty: ty == "directory" && builtins.pathExists ./${n}/default.nix)) - (lib.mapAttrsToList (n: _: ./${n})) - ]; -} diff --git a/roles/email/default.nix b/roles/email/default.nix deleted file mode 100644 index 7ec3d14..0000000 --- a/roles/email/default.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.roles.email; - inherit (lib) - mkEnableOption - mkIf - mkOption - types - ; - - serverModule.options = { - host = mkOption { - type = types.str; - example = "imap.migadu.com"; - }; - port = mkOption { - type = types.port; - example = 143; - }; - }; - hostModule.options = { - imap = mkOption { - type = types.submodule serverModule; - example = { - host = "imap.migadu.com"; - port = 993; - }; - }; - smtp = mkOption { - type = types.submodule serverModule; - example = { - host = "smtp.migadu.com"; - port = 465; - }; - }; - }; - emailModule.options = { - primary = mkOption { - type = types.bool; - default = false; - example = true; - }; - realName = mkOption { - type = types.str; - example = "Leah"; - }; - host = mkOption { type = types.submodule hostModule; }; - }; -in -{ - options.roles.email = { - enable = mkEnableOption "E-Mail configurations"; - - accounts = mkOption { - type = types.attrsOf (types.submodule emailModule); - default = { }; - }; - }; - - config.hm.accounts.email = - let - accounts = builtins.mapAttrs (address: account: rec { - inherit (account) primary realName; - inherit (account.host) imap smtp; - inherit address; - userName = address; # Use the address as the IMAP/SMTP username by default - thunderbird.enable = true; - }) cfg.accounts; - in - mkIf cfg.enable { inherit accounts; }; -} diff --git a/roles/fish/default.nix b/roles/fish/default.nix deleted file mode 100644 index dd58e92..0000000 --- a/roles/fish/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ lib, ... }: -{ - options.roles.fish = { - enable = lib.mkEnableOption "Fish shell"; - defaultShell = lib.mkEnableOption "Fish shell as the user's default shell"; - }; -} diff --git a/roles/fish/nixos.nix b/roles/fish/nixos.nix deleted file mode 100644 index 3fc774e..0000000 --- a/roles/fish/nixos.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -let - inherit (lib) mkIf; - cfg = config.roles.fish; -in -{ - config = mkIf cfg.enable { - programs.fish.enable = true; - hm.programs.fish.enable = true; - - roles.base.user.shell = mkIf cfg.defaultShell pkgs.fish; - }; -} diff --git a/roles/fonts/darwin.nix b/roles/fonts/darwin.nix deleted file mode 100644 index a5d7f91..0000000 --- a/roles/fonts/darwin.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.roles.fonts; - inherit (lib) mkIf; -in -{ - config = mkIf cfg.enable { fonts.fonts = cfg.packages; }; -} diff --git a/roles/fonts/default.nix b/roles/fonts/default.nix deleted file mode 100644 index 11dac4c..0000000 --- a/roles/fonts/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ lib, ... }: -let - inherit (lib) mkEnableOption mkOption types; -in -{ - options.roles.fonts = { - enable = mkEnableOption "default fonts"; - packages = mkOption { - type = types.listOf types.package; - default = [ ]; - }; - defaults = mkOption { - type = types.attrsOf (types.listOf types.str); - default = { }; - }; - }; -} diff --git a/roles/fonts/nixos.nix b/roles/fonts/nixos.nix deleted file mode 100644 index f0d36f1..0000000 --- a/roles/fonts/nixos.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.roles.fonts; - inherit (lib) mkIf; -in -{ - config = mkIf cfg.enable { - fonts = { - inherit (cfg) packages; - enableDefaultPackages = true; - - fontconfig = { - enable = true; - defaultFonts = cfg.defaults; - }; - }; - }; -} diff --git a/roles/mirrors/default.nix b/roles/mirrors/default.nix deleted file mode 100644 index 16e72f7..0000000 --- a/roles/mirrors/default.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - config, - lib, - ... -}: -let - inherit (lib) - mkEnableOption - mkIf - mkOption - types - ; - - cfg = config.roles.mirrors; -in -{ - options.roles.mirrors.chinese = { - enable = mkEnableOption "Chinese mirror sites to speed up downloads in Mainland China"; - - sites = mkOption { - description = "A list of Chinese mirror sites to use."; - type = types.listOf types.str; - default = [ - "https://mirrors.ustc.edu.cn" - "https://mirrors6.tuna.tsinghua.edu.cn" - "https://mirrors.tuna.tsinghua.edu.cn" - # "https://mirror.sjtu.edu.cn" - ]; - }; - }; - - config = mkIf cfg.chinese.enable { - # cache.nixos.org is *unbearably* slow when accessed from Mainland China. - # Fortunately, mirror sites exist... Hooray(?) - nix.settings.substituters = map (url: "${url}/nix-channels/store") cfg.chinese.sites; - }; -} diff --git a/roles/networking/default.nix b/roles/networking/default.nix deleted file mode 100644 index a58ba1f..0000000 --- a/roles/networking/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ lib, ... }: -let - inherit (lib) mkEnableOption; -in -{ - options.roles.networking = { - enable = mkEnableOption "Networking" // { - default = true; - }; - }; -} diff --git a/roles/networking/nixos.nix b/roles/networking/nixos.nix deleted file mode 100644 index f846988..0000000 --- a/roles/networking/nixos.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -let - inherit (lib) mkIf getExe; - cfg = config.roles.networking; -in -{ - config = mkIf cfg.enable { - networking.networkmanager.enable = true; - roles.base.user.extraGroups = mkIf config.roles.base.canSudo [ "networkmanager" ]; - - hm.home.packages = [ pkgs.networkmanagerapplet ]; - }; -} diff --git a/roles/nix/default.nix b/roles/nix/default.nix deleted file mode 100644 index a5b9e92..0000000 --- a/roles/nix/default.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ lib, inputs, self, ... }: -let - inherit (lib) mkDefault; -in -{ - nix = { - registry = { - nixpkgs.flake = inputs.nixpkgs; - n.flake = inputs.nixpkgs; - }; - nixPath = - let - toNixPath = input: "${input}=${inputs.${input}.outPath}"; - in - [ (toNixPath "nixpkgs") ]; - - gc = { - automatic = mkDefault true; - dates = mkDefault "weekly"; - options = mkDefault "--delete-older-than 7d"; - }; - - settings = { - auto-optimise-store = true; - experimental-features = [ - "nix-command" - "flakes" - "auto-allocate-uids" - ]; - trusted-users = [ "@wheel" ]; - }; - }; - nixpkgs = { - # I'm not part of the FSF and I don't care - config.allowUnfree = true; - - overlays = [ self.overlays.default ]; - }; -} diff --git a/roles/nix/nixos.nix b/roles/nix/nixos.nix deleted file mode 100644 index 8823561..0000000 --- a/roles/nix/nixos.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - pkgs, - lib, - self, - ... -}: -{ - system = { - # Thank @luishfonseca for this - # https://github.com/luishfonseca/dotfiles/blob/ab7625ec406b48493eda701911ad1cd017ce5bc1/modules/upgrade-diff.nix - activationScripts.diff = { - supportsDryActivation = true; - text = '' - ${lib.getExe pkgs.nvd} --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig" - ''; - }; - - # thanks to @getchoo - autoUpgrade = { - enable = true; - flake = "github:pluiedev/flake#${config.networking.hostName}"; - flags = [ "--refresh" ]; - }; - - configurationRevision = self.rev or self.dirtyRev or "unknown-dirty"; - }; -} diff --git a/roles/nixos.nix b/roles/nixos.nix deleted file mode 100644 index 28fc95b..0000000 --- a/roles/nixos.nix +++ /dev/null @@ -1,11 +0,0 @@ -inputs@{ lib, ... }: -{ - imports = - [ ./. ] - ++ (lib.pipe (import ./. inputs).imports [ - (map (s: /${s}/nixos.nix)) - (builtins.filter builtins.pathExists) - ]); - - system.stateVersion = "24.05"; -} diff --git a/roles/plasma/default.nix b/roles/plasma/default.nix deleted file mode 100644 index 9f31ce2..0000000 --- a/roles/plasma/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ lib, ... }: -{ - options.roles.plasma = { - enable = lib.mkEnableOption "Plasma"; - krunner-nix.enable = lib.mkEnableOption "krunner-nix, a KRunner plugin that suggests Nix programs to run"; - }; -} diff --git a/roles/plasma/nixos.nix b/roles/plasma/nixos.nix deleted file mode 100644 index 08d67bd..0000000 --- a/roles/plasma/nixos.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ - config, - lib, - pkgs, - inputs, - inputs', - ... -}: -let - cfg = config.roles.plasma; - inherit (lib) mkIf; -in -{ - config = mkIf cfg.enable { - services = { - desktopManager.plasma6.enable = true; - displayManager = { - defaultSession = "plasma"; - sddm = { - enable = true; - wayland.enable = true; - }; - }; - }; - - xdg.portal.extraPortals = [ pkgs.kdePackages.xdg-desktop-portal-kde ]; - - hm = { - imports = [ inputs.plasma-manager.homeManagerModules.plasma-manager ]; - - home.packages = lib.optional cfg.krunner-nix.enable inputs'.krunner-nix.packages.default; - - # Janky workaround - # https://github.com/nix-community/home-manager/issues/1586 - programs.firefox.package = pkgs.firefox.override { - cfg.nativeMessagingHosts.packages = [ pkgs.plasma6Packages.plasma-browser-integration ]; - }; - - programs.plasma.enable = true; - }; - }; -} diff --git a/roles/rust/default.nix b/roles/rust/default.nix deleted file mode 100644 index a3345ea..0000000 --- a/roles/rust/default.nix +++ /dev/null @@ -1,79 +0,0 @@ -{ - lib, - pkgs, - config, - inputs', - ... -}: -let - cfg = config.roles.rust; - inherit (lib) - mkIf - mkOption - mkEnableOption - types - ; -in -{ - options.roles.rust = { - enable = mkEnableOption "Rust"; - - package = mkOption { - type = types.package; - default = - let - fenix = inputs'.fenix.packages; - in - fenix.combine [ - fenix.default.toolchain - fenix.rust-analyzer - ]; - description = "Version of Rust to install. Defaults to nightly with rust-analyzer"; - }; - - linker = mkOption { - type = types.nullOr types.pathInStore; - default = lib.getExe' pkgs.mold "mold"; - example = "lib.getExe' pkgs.lld \"lld\""; - description = "Linker to use when linking compiled Rust code"; - }; - - settings = mkOption { - type = types.nullOr (types.attrsOf types.anything); - default = { }; - }; - - rustfmt.settings = mkOption { - type = types.nullOr (types.attrsOf types.anything); - default = null; - example = { - hard_tabs = true; - tab_spaces = 4; - newline_style = "Unix"; - }; - }; - }; - - config.hm = - let - toml = pkgs.formats.toml { }; - linkerSettings = lib.optionalAttrs (cfg.linker != null) { - target.${pkgs.hostPlatform.rust.rustcTarget} = { - linker = "${lib.getExe pkgs.clang_16}"; - rustflags = [ - "-C" - "link-arg=-fuse-ld=${cfg.linker}" - ]; - }; - }; - in - mkIf cfg.enable { - home.packages = [ cfg.package ]; - - xdg.configFile."rustfmt/rustfmt.toml".source = mkIf (cfg.rustfmt.settings != null) - (toml.generate "rustfmt.toml" cfg.rustfmt.settings); - - home.file.".cargo/config.toml".source = mkIf (cfg.settings != null) - (toml.generate "config.toml" (linkerSettings // cfg.settings)); - }; -} diff --git a/systems/common.nix b/systems/common.nix new file mode 100644 index 0000000..5a72887 --- /dev/null +++ b/systems/common.nix @@ -0,0 +1,129 @@ +{ + config, + self, + pkgs, + lib, + inputs, + ... +}: +{ + imports = [ + inputs.hjem.nixosModules.hjem + ]; + + hjem.extraModules = [ + inputs.hjem-rum.hjemModules.default + self.hjemModules.hjem-ext + ]; + + system.stateVersion = "24.11"; + + nix = { + # Add `n` as an alias of `nixpkgs` + registry.n.to = { + type = "path"; + path = config.nixpkgs.flake.source; + }; + + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + + settings = { + auto-optimise-store = true; + experimental-features = [ + "nix-command" + "flakes" + "auto-allocate-uids" + "configurable-impure-env" + ]; + trusted-users = [ "@wheel" ]; + impure-env = [ "all_proxy=http://127.0.0.1:2080" ]; + }; + }; + + nixpkgs = { + # I'm not part of the FSF and I don't care + config.allowUnfree = true; + flake.setNixPath = true; + + overlays = [ self.overlays.default ]; + }; + + boot = { + loader = { + systemd-boot = { + enable = true; + editor = false; + consoleMode = "2"; + configurationLimit = 10; + }; + efi.canTouchEfiVariables = true; + }; + + # Silence NixOS Stage 1 logs, jump straight into plymouth + consoleLogLevel = 0; + initrd.verbose = false; + plymouth.enable = true; + kernelParams = [ + "quiet" + "splash" + "plymouth.use-simpledrm" + "i915.fastboot=1" + ]; + }; + + # Use native Wayland when possible + environment.variables = { + NIXOS_OZONE_WL = "1"; + SDL_VIDEODRIVER = "wayland"; + }; + + services = { + flatpak.enable = true; + + desktopManager.plasma6.enable = true; + displayManager = { + defaultSession = "plasma"; + sddm = { + enable = true; + wayland.enable = true; + }; + }; + + pulseaudio.enable = false; + pipewire = { + enable = true; + wireplumber.enable = true; + alsa.enable = true; + jack.enable = true; + pulse.enable = true; + }; + }; + + security.rtkit.enable = true; + + networking.networkmanager.enable = true; + + system = { + # Thank @luishfonseca for this + # https://github.com/luishfonseca/dotfiles/blob/ab7625ec406b48493eda701911ad1cd017ce5bc1/modules/upgrade-diff.nix + activationScripts.diff = { + supportsDryActivation = true; + text = '' + ${lib.getExe pkgs.nvd} --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig" + ''; + }; + + # thanks to @getchoo + autoUpgrade = { + enable = true; + flake = "github:pluiedev/flake#${config.networking.hostName}"; + flags = [ "--refresh" ]; + }; + + configurationRevision = self.rev or self.dirtyRev or "unknown-dirty"; + }; +} diff --git a/systems/default.nix b/systems/default.nix index a6ef060..53078c7 100644 --- a/systems/default.nix +++ b/systems/default.nix @@ -1,50 +1,19 @@ -{ withSystem, inputs, self, ... }: -let - mkMachine = - name: { system, modules, builder }: - withSystem system ({ inputs', self', ... }: - builder { - specialArgs = { inherit inputs inputs' self self'; }; - modules = modules ++ [ - ./${name} - { - networking.hostName = name; - nixpkgs.hostPlatform = system; - } - ]; - } - ); - - mkMachines = builtins.mapAttrs mkMachine; - - # Composable parts - personal = [ - inputs.home-manager.nixosModules.home-manager - ../users/personal.nix - ]; - nixos = [ ../roles/nixos.nix ]; - darwin = [ ../roles/darwin.nix ]; - - # Presets - nixos-pc = { - system = "x86_64-linux"; - modules = nixos ++ personal; - builder = inputs.nixpkgs.lib.nixosSystem; - }; - darwin-pc = { - system = "x86_64-darwin"; - modules = darwin ++ personal; - builder = inputs.nix-darwin.lib.darwinSystem; - }; -in { - flake = { - nixosConfigurations = mkMachines { - fettuccine = nixos-pc; - tagliatelle = nixos-pc; - }; - darwinConfigurations = mkMachines { - fromage = darwin-pc; + inputs, + self, + ... +}: +{ + flake.nixosConfigurations = { + fettuccine = inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./fettuccine + ../users/leah + ]; + specialArgs = { + inherit inputs self; + }; }; }; } diff --git a/systems/fettuccine/default.nix b/systems/fettuccine/default.nix index be57786..ce92e80 100644 --- a/systems/fettuccine/default.nix +++ b/systems/fettuccine/default.nix @@ -1,43 +1,66 @@ { - lib, + config, pkgs, + lib, inputs, - config, ... }: { imports = with inputs.nixos-hardware.nixosModules; [ + ../common.nix ./hardware-configuration.nix common-hidpi asus-zephyrus-gu603h ]; - roles = { - # boot.lanzaboote.enable = true; - # nvidia.enable = true; + networking.hostName = "fettuccine"; + + boot = { + # Disable Nvidia's HDMI audio + blacklistedKernelModules = [ "snd_hda_codec_hdmi" ]; + kernelPackages = pkgs.linuxPackages_xanmod_latest; }; - hardware.bluetooth.enable = true; + # Enable building and testing aarch64 packages for Nixpkgs dev + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + nix.settings.extra-platforms = [ "aarch64-linux" ]; - # Other Nvidia settings are set via nixos-hardware + hardware = { + bluetooth.enable = true; - hardware.nvidia.prime.offload.enable = lib.mkForce true; - hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta; - # Disable Nvidia's HDMI audio - boot.blacklistedKernelModules = [ "snd_hda_codec_hdmi" ]; + nvidia = { + # PCI bus IDs are already conveniently set by nixos-hardware + prime.offload.enable = lib.mkForce true; + # Beta can sometimes be more stable than, well, stable + package = config.boot.kernelPackages.nvidiaPackages.beta; + }; + }; + + # Nix can sometimes overload my poor, poor laptop CPU + # so much that it can freeze my entire system. Amazing. + # Please don't do that. + nix.daemonCPUSchedPolicy = "idle"; + + # This is an ASUS computer after all services.asusd.enable = true; - specialisation.china.configuration = { - roles.mirrors.chinese.enable = true; - environment.variables.NIXOS_SPECIALISATION = "china"; + networking.firewall = { + enable = true; - environment.systemPackages = [ pkgs.nekoray ]; + # Allow previewing local Vite builds on other devices via LAN + allowedTCPPorts = [ 5173 ]; + }; - nix.settings = { - experimental-features = [ "configurable-impure-env" ]; - impure-env = [ "all_proxy=http://127.0.0.1:2080" ]; - }; + specialisation.china.configuration = { + # cache.nixos.org is *unbearably* slow when accessed from Mainland China. + # Fortunately, mirror sites exist... Hooray(?) + nix.settings.substituters = map (url: "${url}/nix-channels/store") [ + "https://mirrors.ustc.edu.cn" + "https://mirrors6.tuna.tsinghua.edu.cn" + "https://mirrors.tuna.tsinghua.edu.cn" + # "https://mirror.sjtu.edu.cn" # FIXME: buggy? + ]; }; } diff --git a/users/leah/appearance.nix b/users/leah/appearance.nix index f5cfef8..a41d3e8 100644 --- a/users/leah/appearance.nix +++ b/users/leah/appearance.nix @@ -1,6 +1,4 @@ { - self, - inputs, pkgs, lib, ... @@ -8,59 +6,44 @@ let flavor = "mocha"; accent = "maroon"; + + mkUpper = str: (lib.toUpper (lib.substring 0 1 str)) + (lib.substring 1 (lib.stringLength str) str); + fcitx5ini = pkgs.formats.iniWithGlobalSection { }; in { - imports = [ inputs.catppuccin.nixosModules.catppuccin ]; - catppuccin = { - enable = true; - inherit flavor accent; + boot.plymouth = { + themePackages = [ pkgs.plymouth-blahaj-theme ]; + theme = "blahaj"; }; - catppuccin.plymouth.enable = false; - boot.plymouth.themePackages = [ pkgs.plymouth-blahaj-theme ]; - boot.plymouth.theme = "blahaj"; + hjem.users.leah = { + packages = [ pkgs.breezex-cursor ]; - hm.imports = [ - inputs.catppuccin.homeModules.catppuccin - self.hmModules.ctp-plus - ]; + files = { + ".local/share/fcitx5/themes/catppuccin-${flavor}-${accent}".source = + "${pkgs.catppuccin-fcitx5}/share/fcitx5/themes/catppuccin-${flavor}-${accent}"; - hm.catppuccin = { - enable = true; - inherit flavor accent; - }; + ".config/fcitx5/conf/classicui.conf".source = fcitx5ini.generate "fcitx5-classicui.conf" { + globalSection = { + Theme = "catppuccin-${flavor}-${accent}"; + }; + }; - hm.programs.fish.interactiveShellInit = '' - set -x LS_COLORS (${lib.getExe pkgs.vivid} generate catppuccin-${flavor}) - ''; + ".config/fish/themes/Catppuccin ${mkUpper flavor}.theme".source = + "${pkgs.catppuccin-fish}/share/fish/themes/Catppuccin ${mkUpper flavor}.theme"; + }; - hm.programs.moar.settings.style = "catppuccin-${flavor}"; + rum.programs.fish.earlyConfigFiles.theme = '' + fish_config theme choose "Catppuccin ${mkUpper flavor}" + set -x LS_COLORS (${lib.getExe pkgs.vivid} generate catppuccin-${flavor}) + ''; - hm.programs.plasma.fonts = - let - rethink = { - family = "Rethink Sans"; - pointSize = 12; - }; - in - { - general = rethink // { - pointSize = 14; - }; - fixedWidth = { - family = "Iosevka"; - pointSize = 14; - }; - small = rethink // { - pointSize = 11; - }; - toolbar = rethink; - menu = rethink; - windowTitle = rethink; - }; + ext.programs.moar.settings.style = "catppuccin-${flavor}"; + }; + + fonts = { + enableDefaultPackages = true; - roles.fonts = { - enable = true; packages = with pkgs; [ iosevka noto-fonts-color-emoji @@ -70,19 +53,21 @@ in dm-sans-unstable ]; - defaults = { - serif = [ - "I.Ming" - ]; - sansSerif = [ - "DM Sans" - "LXGW Neo XiHei" - ]; - emoji = [ "Noto Color Emoji" ]; - monospace = [ - "Iosevka" - "LXGW Neo XiHei" - ]; + fontconfig = { + defaultFonts = { + serif = [ + "I.Ming" + ]; + sansSerif = [ + "DM Sans" + "LXGW Neo XiHei" + ]; + emoji = [ "Noto Color Emoji" ]; + monospace = [ + "Iosevka" + "LXGW Neo XiHei" + ]; + }; }; }; } diff --git a/users/leah/default.nix b/users/leah/default.nix index 50055b8..a33a2be 100644 --- a/users/leah/default.nix +++ b/users/leah/default.nix @@ -1,83 +1,37 @@ { config, - pkgs, - self, + inputs, ... }: { imports = [ ./appearance.nix - ./presets/plasma + # ./presets/plasma ./programs - ]; - - hm.imports = [ self.hmModules.hm-plus ]; - boot = { - binfmt.emulatedSystems = [ "aarch64-linux" ]; - kernelParams = [ "plymouth.use-simpledrm" ]; - kernelPackages = pkgs.linuxPackages_xanmod_latest; - }; + inputs.hjem.nixosModules.hjem + inputs.nix-index-database.nixosModules.nix-index + ]; - nix = { - settings.extra-platforms = [ "aarch64-linux" ]; - daemonCPUSchedPolicy = "idle"; - }; + hjem.extraModules = [ + inputs.hjem-rum.hjemModules.default + ]; i18n.supportedLocales = [ "all" ]; - roles.base = { - username = "leah"; - realName = "Leah"; - fullName = "Leah Amelia Chen"; - publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC7uJGE2/25M4a3DIVxtnTA5INqWsFGw+49qHXaN/kqy"; - canSudo = true; - }; - - roles.email = - let - realName = config.roles.base.fullName; - host = { - imap = { - host = "imap.migadu.com"; - port = 993; - }; - smtp = { - host = "smtp.migadu.com"; - port = 465; - }; - }; - in - { - enable = true; - accounts = { - "hi@pluie.me" = { - inherit realName host; - primary = true; - }; - "acc@pluie.me" = { - inherit host; - realName = "${realName} [accounts]"; - }; - }; - }; - - roles.fish = { - enable = true; - defaultShell = true; + users.users.leah = { + isNormalUser = true; + description = "Leah C"; + extraGroups = [ + "wheel" # 1984 powers + "rtkit" # Some apps may need to adjust audio priority at runtime + "networkmanager" # Manage networks + ]; + home = "/home/leah"; }; - environment.variables = { - NIXOS_OZONE_WL = "1"; - SDL_VIDEODRIVER = "wayland"; - }; + # Name and directory should be populated by users.users + hjem.users.leah.enable = true; - networking.firewall = { - enable = true; - allowedTCPPorts = [ - 80 - 443 - 5173 - ]; - }; + hjem.clobberByDefault = true; } diff --git a/users/leah/presets/plasma/default.nix b/users/leah/presets/plasma/default.nix index 9df759b..202870d 100644 --- a/users/leah/presets/plasma/default.nix +++ b/users/leah/presets/plasma/default.nix @@ -4,17 +4,4 @@ ./sddm.nix ./settings ]; - - boot.plymouth.enable = true; - roles.plasma = { - enable = true; - krunner-nix.enable = true; - }; - - # KDE manages GTK stuff by itself - #hm.gtk.enable = lib.mkForce false; - - hm.home.packages = with pkgs; [ - wl-clipboard - ]; } diff --git a/users/leah/presets/plasma/settings/default.nix b/users/leah/presets/plasma/settings/default.nix index f5eb81c..3716e95 100644 --- a/users/leah/presets/plasma/settings/default.nix +++ b/users/leah/presets/plasma/settings/default.nix @@ -2,8 +2,6 @@ { imports = [ ./panels.nix ]; - hm.programs.konsole.enable = true; - hm.programs.plasma = { enable = true; diff --git a/users/leah/programs/1password.nix b/users/leah/programs/1password.nix new file mode 100644 index 0000000..f163a1b --- /dev/null +++ b/users/leah/programs/1password.nix @@ -0,0 +1,29 @@ +{ + config, + pkgs, + lib, + ... +}: +{ + programs = { + _1password.enable = true; + _1password-gui = { + enable = true; + package = pkgs._1password-gui-beta; + + # Unlock 1Pass via PolKit + polkitPolicyOwners = [ "leah" ]; + }; + }; + + # Add 1Pass as SSH agent + hjem.users.leah = { + files.".ssh/config".text = '' + Host * + IdentityAgent ${config.hjem.users.leah.directory}/.1password/agent.sock + ''; + + ext.programs.git.settings.gpg.ssh.program = + lib.getExe' config.programs._1password-gui.package "op-ssh-sign"; + }; +} diff --git a/users/leah/programs/default.nix b/users/leah/programs/default.nix index b6a8655..a3754d5 100644 --- a/users/leah/programs/default.nix +++ b/users/leah/programs/default.nix @@ -1,157 +1,72 @@ { - config, pkgs, - lib, - inputs, - inputs', ... }: { imports = [ + ./1password.nix ./discord - ./fcitx5 + ./fcitx5.nix ./firefox - ./ghostty - ./helix - ./jj - ./rust + ./fish.nix + ./ghostty.nix + ./helix.nix + ./vcs.nix + ./steam.nix ]; - hm.imports = [ inputs.nix-index-database.hmModules.nix-index ]; - - hm.home.packages = with pkgs; [ - # Apps - inputs'.blender-bin.packages.default - chromium - gimp - inkscape-with-extensions - vlc - - # Command-line apps - just - fastfetch - nix-output-monitor - nurl - xclip - moar - - (inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix).config.build.wrapper - ]; - - services.touchegg.enable = true; - - xdg.icons.enable = true; - environment.systemPackages = [ - pkgs.nekoray - pkgs.adwaita-icon-theme - ]; - - services.flatpak.enable = true; - programs = { - appimage.enable = true; gamemode.enable = true; localsend.enable = true; - - steam = { - enable = true; - extraCompatPackages = [ pkgs.proton-ge-bin ]; - extraPackages = [ - pkgs.ncurses6 # Crusader Kings III - ]; - remotePlay.openFirewall = true; - }; - nix-ld.enable = true; + nix-index-database.comma.enable = true; }; - - hm.programs = { - bat = { - enable = true; - config = { - map-syntax = [ "flake.lock:JSON" ]; + hjem.users.leah = { + packages = with pkgs; [ + # Apps + nekoray + prismlauncher + vlc + thunderbird + telegram-desktop + + # Command-line apps + just + nix-output-monitor + ripgrep + starship + wl-clipboard + eza + ]; + + files.".config/starship.toml".source = ./starship.toml; + + rum.programs.obs-studio.enable = true; + + ext.programs = { + direnv = { + enable = true; + nix-direnv.enable = true; }; - syntaxes = { - just = { - src = lib.cleanSourceWith { - filter = - name: type: - lib.cleanSourceFilter name type - && !builtins.elem (baseNameOf name) [ - "ShellScript (for Just).sublime-syntax" - "Python (for Just).sublime-syntax" - ]; - src = pkgs.fetchFromGitHub { - owner = "nk9"; - repo = "just_sublime"; - rev = "352bae277961d41e2a1795a834dbf22661c8910f"; - hash = "sha256-QCp6ypSBhgGZG4T7fNiFfCgZIVJoDSoJBkpcdw3aiuQ="; - }; - }; - file = "Syntax/Just.sublime-syntax"; + hyfetch = { + enable = true; + settings = { + preset = "lesbian"; + mode = "rgb"; + lightness = 0.6; + color_align.mode = "horizontal"; + backend = "fastfetch"; }; }; - }; - - eza = { - enable = true; - git = true; - icons = "auto"; - }; - direnv = { - enable = true; - nix-direnv.enable = true; - }; - gh = { - enable = true; - settings.git_protocol = "ssh"; - }; - - git = { - enable = true; - userName = config.roles.base.fullName; - userEmail = "hi@pluie.me"; - - signing.key = config.roles.base.publicKey; - signingFormat = "ssh"; - - extraConfig = { - init.defaultBranch = "main"; - push.autoSetupRemote = true; - url."https://github.com/".insteadOf = "gh:"; - }; - }; - - hyfetch = { - enable = true; - settings = { - preset = "lesbian"; - mode = "rgb"; - lightness = 0.6; - color_align.mode = "horizontal"; - backend = "fastfetch"; - }; - }; - - moar = { - enable = true; - settings = { - style = "catppuccin-mocha"; - no-statusbar = true; - wrap = true; + moar = { + enable = true; + settings = { + no-statusbar = true; + wrap = true; + }; }; }; - - nix-index-database.comma.enable = true; - - obs-studio.enable = true; - ripgrep.enable = true; - - starship = { - enable = true; - settings = builtins.fromTOML (builtins.readFile ./starship.toml); - }; }; } diff --git a/users/leah/programs/discord/default.nix b/users/leah/programs/discord/default.nix index 2c932a3..e9df619 100644 --- a/users/leah/programs/discord/default.nix +++ b/users/leah/programs/discord/default.nix @@ -1,7 +1,7 @@ { - hm.catppuccin.vesktop.splashTheming = true; + # hm.catppuccin.vesktop.splashTheming = true; - hm.programs.vesktop = { + hjem.users.leah.ext.programs.vesktop = { enable = true; settings = { diff --git a/users/leah/programs/fcitx5.nix b/users/leah/programs/fcitx5.nix new file mode 100644 index 0000000..92761f5 --- /dev/null +++ b/users/leah/programs/fcitx5.nix @@ -0,0 +1,41 @@ +{ pkgs, ... }: +let + luna_pinyin = yaml.generate "luna_pinyin.yaml" { + patch."speller/algebra" = [ + "erase/^xx$/" + "derive/in$/ing/" # in/ing 不分 + "derive/ing$/in/" + + # 非标拼写就 + "derive/^([nl])ve$/$1ue/" # nve = nue, lve = lue + "derive/^([jqxy])v/$1u/" # ju = jv + "derive/uen$/un/" # gun = guen + "derive/uei$/ui/" # gui = guei + "derive/iou$/iu/" # jiu = jiou + ]; + }; + + yaml = pkgs.formats.yaml { }; +in +{ + i18n.inputMethod = { + enable = true; + type = "fcitx5"; + fcitx5.addons = with pkgs; [ + fcitx5-mozc + fcitx5-rime + ]; + }; + + hjem.users.leah.files = { + ".local/share/fcitx5/rime/default.custom.yaml".source = yaml.generate "default.yaml" { + patch.schema_list = [ + { schema = "luna_pinyin_simp"; } + { schema = "luna_pinyin"; } + ]; + }; + ".local/share/fcitx5/rime/luna_pinyin.custom.yaml".source = luna_pinyin; + ".local/share/fcitx5/rime/luna_pinyin_simp.custom.yaml".source = luna_pinyin; + }; + +} diff --git a/users/leah/programs/fcitx5/default.nix b/users/leah/programs/fcitx5/default.nix deleted file mode 100644 index b3cfe20..0000000 --- a/users/leah/programs/fcitx5/default.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ pkgs, ... }: -{ - hm.catppuccin.fcitx5.enable = false; # TODO - - hm.i18n.inputMethod = { - enabled = "fcitx5"; - fcitx5 = { - addons = [ pkgs.fcitx5-mozc ]; - - # settings.groups = [ - # { - # name = "Default"; - # defaultLayout = "us"; - # defaultIM = "keyboard-us"; - # items = map (name: {inherit name;}) ["keyboard-us" "rime" "mozc"]; - # } - # ]; - - rime = { - enable = true; - - settings = - let - luna_pinyin.patch."speller/algebra" = [ - "erase/^xx$/" - "derive/in$/ing/" # in/ing 不分 - "derive/ing$/in/" - - # 非标拼写 - "derive/^([nl])ve$/$1ue/" # nve = nue, lve = lue - "derive/^([jqxy])v/$1u/" # ju = jv - "derive/uen$/un/" # gun = guen - "derive/uei$/ui/" # gui = guei - "derive/iou$/iu/" # jiu = jiou - ]; - in - { - default.patch.schema_list = [ - { schema = "luna_pinyin_simp"; } - { schema = "luna_pinyin"; } - ]; - inherit luna_pinyin; - luna_pinyin_simp = luna_pinyin; - }; - }; - }; - }; -} diff --git a/users/leah/programs/firefox/default.nix b/users/leah/programs/firefox/default.nix index 6aa8b7e..e06a435 100644 --- a/users/leah/programs/firefox/default.nix +++ b/users/leah/programs/firefox/default.nix @@ -1,147 +1,59 @@ { - config, lib, pkgs, - inputs', ... }: -{ - hm.programs.firefox = { - enable = true; - - profiles.${config.roles.base.username} = { - isDefault = true; - name = config.roles.base.realName; - - extensions.packages = - let - # FIXME: firefox-addons currently receives free-only nixpkgs, - # and so unfree plugins are blocked from evaluation. - # Use this one dirty trick to make the FSF mad! :trolley: - gaslight = pkgs: pkgs.overrideAttrs { meta.license.free = true; }; - in - with inputs'.firefox-addons.packages; - map gaslight [ - # Essentials - auto-tab-discard - onepassword-password-manager - ublock-origin - - # Avoid annoyances - consent-o-matic - don-t-fuck-with-paste - enhanced-h264ify - fastforwardteam - faststream - gaoptout - istilldontcareaboutcookies - link-cleaner - musescore-downloader - native-mathml - privacy-possum - re-enable-right-click - sponsorblock - terms-of-service-didnt-read - youtube-nonstop - - # Redirectors - indie-wiki-buddy - libredirect - localcdn - modrinthify - - # Augmentations - augmented-steam - github-file-icons - octolinker - protondb-for-steam - refined-github - widegithub - wikiwand-wikipedia-modernized - - # Language - furiganaize - immersive-translate - languagetool - - # Styling - darkreader - firefox-color - stylus - - # Dev - a11ycss - header-editor - rust-search-extension - - disconnect - pronoundb - search-by-image - unpaywall - wayback-machine - ]; - - search = - let - mkParams = lib.mapAttrsToList lib.nameValuePair; - nixIcon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - nixosSearch = path: aliases: { - urls = [ { template = "https://nixpkgs.dev${path}/{searchTerms}"; } ]; - icon = nixIcon; - definedAliases = aliases; - }; +let + json = pkgs.formats.json { }; + wrappedFirefox = pkgs.firefox.override { + extraPoliciesFiles = [(json.generate "firefox-policies.json" policies)]; + }; - search = path: queryKey: { - template = path; - params = mkParams { ${queryKey} = "{searchTerms}"; }; - }; - in - { - default = "ddg"; - force = true; - engines = { - "Nixpkgs" = nixosSearch "" [ "@np" ]; - "NixOS Options" = nixosSearch "/option" [ - "@ns" - "@no" - ]; - "NixOS Wiki" = { - urls = [ (search "https://wiki.nixos.org/index.php" "search") ]; - icon = nixIcon; - definedAliases = [ "@nw" ]; - }; - "Nixpkgs PR Tracker" = { - urls = [ (search "https://nixpk.gs/pr-tracker.html" "pr") ]; - icon = nixIcon; - definedAliases = [ "@npr" ]; - }; - "Home Manager Settings" = { - urls = [ (search "https://home-manager-options.extranix.com" "query") ]; - icon = nixIcon; - definedAliases = [ "@hm" ]; - }; - "Wiktionary" = { - urls = [ (search "https://en.wiktionary.org/wiki/Special:Search" "search") ]; - icon = "https://en.wiktionary.org/favicon.ico"; - definedAliases = [ "@wkt" ]; - }; - "GitHub" = { - urls = [ (search "https://github.com/search" "q") ]; - icon = "https://github.com/favicon.ico"; - definedAliases = [ "@gh" ]; - }; - "docs.rs" = { - urls = [ (search "https://docs.rs/releases/search" "query") ]; - icon = "https://docs.rs/-/static/favicon.ico"; - definedAliases = [ "@rs" ]; - }; - "lib.rs" = { - urls = [ (search "https://lib.rs/search" "q") ]; - icon = "https://lib.rs/favicon.ico"; - definedAliases = [ "@lrs" ]; - }; - }; - }; - }; + addons = [ + # Styling + "addon@darkreader.org" # Dark Reader + "{85860b32-02a8-431a-b2b1-40fbd64c9c69}" # File Icons for Git{Hub,Lab} + "FirefoxColor@mozilla.com" # Firefox Color + "{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}" # Stylus + "{a4c4eda4-fb84-4a84-b4a1-f7c1cbf2a1ad}" # Refined GitHub + "{72742915-c83b-4485-9023-b55dc5a1e730}" # Wide GitHub + + # Privacy + "gdpr@cavi.au.dk" # Consent-O-Matic + "addon@fastforward.team" # FastForward + "{6d96bb5e-1175-4ebf-8ab5-5f56f1c79f65}" # Google Analytics Opt-out + "{6d85dea2-0fb4-4de3-9f8c-264bce9a2296}" # Link Cleaner + "uBlock0@raymondhill.net" # uBlock Origin + + # "Stop Websites from Doing Stupid Things I Don't Want" + "{278b0ae0-da9d-4cc6-be81-5aa7f3202672}" # Allow Right Click + "DontFuckWithPaste@raim.ist" # Don't Fuck With Paste + + # YouTube + "{9a41dee2-b924-4161-a971-7fb35c053a4a}" # enhanced-h264ify + "sponsorBlocker@ajay.app" # SponsorBlock for YouTube + "{0d7cafdd-501c-49ca-8ebb-e3341caaa55e}" # YouTube NonStop + + # Utilities + "{d634138d-c276-4fc8-924b-40a0ea21d284}" # 1Password + "{c2c003ee-bd69-42a2-b0e9-6f34222cb046}" # Auto Tab Discard + "{cb31ec5d-c49a-4e5a-b240-16c767444f62}" # Indie Wiki Buddy + "octolinker@stefanbuck.com" # OctoLinker + "firefox-addon@pronoundb.org" # PronounDB + "wayback_machine@mozilla.org" # Wayback Machine + ]; + + policies = { + ExtensionSettings = lib.listToAttrs ( + map (id: lib.nameValuePair id { + installation_mode = "normal_installed"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/${id}/latest.xpi"; + }) addons); }; + + # TODO: Specifying custom search engines is *very* cursed. + # I've seen how HM does it, and I don't think it's worth it at all... +in +{ + hjem.users.leah.packages = [ wrappedFirefox ]; } diff --git a/users/leah/programs/fish.nix b/users/leah/programs/fish.nix new file mode 100644 index 0000000..ea988f7 --- /dev/null +++ b/users/leah/programs/fish.nix @@ -0,0 +1,23 @@ +{ + config, + ... +}: +{ + + programs.fish.enable = true; + users.users.leah.shell = config.programs.fish.package; + + hjem.users.leah.rum.programs.fish = { + enable = true; + inherit (config.programs.fish) package; + + functions.eza = "eza --git --icons=auto"; + abbrs = { + ls = "eza"; + ll = "eza -l"; + la = "eza -a"; + lt = "eza --tree"; + lla = "eza -la"; + }; + }; +} diff --git a/users/leah/programs/ghostty/default.nix b/users/leah/programs/ghostty.nix similarity index 85% rename from users/leah/programs/ghostty/default.nix rename to users/leah/programs/ghostty.nix index 0ce32ab..9a2e384 100644 --- a/users/leah/programs/ghostty/default.nix +++ b/users/leah/programs/ghostty.nix @@ -1,14 +1,12 @@ { - inputs', + inputs, + pkgs, ... }: { - hm.programs.ghostty = { + hjem.users.leah.rum.programs.ghostty = { enable = true; - - package = inputs'.ghostty.packages.default; - - enableFishIntegration = true; + package = inputs.ghostty.packages.${pkgs.system}.default; settings = { font-family = "Iosevka"; diff --git a/users/leah/programs/helix.nix b/users/leah/programs/helix.nix new file mode 100644 index 0000000..4e0bdd2 --- /dev/null +++ b/users/leah/programs/helix.nix @@ -0,0 +1,185 @@ +{ + hjem.users.leah = { + environment.sessionVariables.EDITOR = "hx"; + + # TODO: upstream this + files.".config/helix/ignore".text = '' + flake.lock + ''; + + rum.programs.helix = { + enable = true; + + settings = { + theme = "catppuccin_mocha_plus"; + + editor = { + line-number = "relative"; + bufferline = "multiple"; + cursorline = true; + color-modes = true; + text-width = 100; + popup-border = "all"; + rulers = [ 100 ]; + + end-of-line-diagnostics = "hint"; + inline-diagnostics = { + cursor-line = "info"; + other-lines = "error"; + }; + + soft-wrap.enable = true; + + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + + statusline = { + left = [ + "mode" + "spacer" + "spinner" + ]; + right = [ + "read-only-indicator" + "file-modification-indicator" + "file-name" + "separator" + "file-type" + "position-percentage" + "spacer" + "separator" + "position" + ]; + mode = { + normal = "NORMAL"; + insert = "INSERT"; + select = "VISUAL"; + }; + }; + + lsp = { + display-messages = true; + display-progress-messages = true; + display-inlay-hints = true; + }; + + auto-save = { + focus-lost = true; # Ghostty supports it :) + after-delay.enable = true; + }; + + whitespace.render = { + space = "none"; + tab = "all"; + }; + + indent-guides.render = true; + + gutters.layout = [ + "diff" + "diagnostics" + "line-numbers" + "spacer" + ]; + }; + keys = { + normal = { + "C-s" = ":w"; + "tab" = "move_parent_node_end"; + "S-tab" = "move_parent_node_start"; + "A-h" = "goto_previous_buffer"; + "A-l" = "goto_next_buffer"; + }; + insert = { + "S-tab" = "move_parent_node_start"; + }; + select = { + "tab" = "move_parent_node_end"; + "S-tab" = "move_parent_node_start"; + }; + }; + }; + themes.catppuccin_mocha_plus = { + inherits = "catppuccin_mocha"; + + "ui.statusline" = { + fg = "subtext0"; + bg = "mantle"; + }; + "ui.statusline.normal" = { + fg = "mantle"; + bg = "rosewater"; + modifiers = [ "bold" ]; + }; + "ui.statusline.insert" = { + fg = "mantle"; + bg = "maroon"; + modifiers = [ "bold" ]; + }; + "ui.statusline.select" = { + fg = "mantle"; + bg = "mauve"; + modifiers = [ "bold" ]; + }; + + "ui.cursor.primary.normal" = { + fg = "base"; + bg = "rosewater"; + }; + "ui.cursor.primary.insert" = { + fg = "base"; + bg = "maroon"; + }; + "ui.cursor.primary.select" = { + fg = "base"; + bg = "mauve"; + }; + + # Underlines are gross + "ui.bufferline" = { + fg = "subtext0"; + bg = "mantle"; + modifiers = [ "dim" ]; + }; + "ui.bufferline.active" = { + fg = "text"; + bg = "base"; + modifiers = [ "bold" ]; + }; + + # Mimick VS Code + "ui.virtual.inlay-hint" = { + fg = "overlay0"; + bg = "base"; + }; + + "ui.popup".fg = "rosewater"; + "ui.popup.info".fg = "maroon"; + "ui.help".fg = "maroon"; + "ui.menu".fg = "text"; + "ui.menu.selected" = { + fg = "maroon"; + modifiers = [ "bold" ]; + }; + "ui.menu.scroll".fg = "maroon"; + "ui.background".bg = ""; # Transparent + + # Why the heck is it *blue*?; + "diff.delta" = "yellow"; + + # Maroon itself is already eye-catching enough, no need to italicize + "variable.parameter" = "maroon"; + # Teal is wayyyyyy too obtrusive in Nix + "variable.other.member" = "subtext1"; + "variable.builtin" = "peach"; + + # Fix ${} in Nix + "punctuation.special" = "maroon"; + "operator" = "maroon"; + }; + }; + }; +} diff --git a/users/leah/programs/helix/default.nix b/users/leah/programs/helix/default.nix deleted file mode 100644 index 1063452..0000000 --- a/users/leah/programs/helix/default.nix +++ /dev/null @@ -1,210 +0,0 @@ -{ - pkgs, - ... -}: -{ - hm.catppuccin.helix.enable = false; - - hm.programs.helix = { - enable = true; - defaultEditor = true; - - ignores = [ - "flake.lock" - ]; - settings = { - theme = "catppuccin_mocha_plus"; - - editor = { - line-number = "relative"; - bufferline = "multiple"; - cursorline = true; - color-modes = true; - text-width = 100; - popup-border = "all"; - rulers = [ 100 ]; - - end-of-line-diagnostics = "hint"; - inline-diagnostics = { - cursor-line = "info"; - other-lines = "error"; - }; - - soft-wrap.enable = true; - - cursor-shape = { - insert = "bar"; - normal = "block"; - select = "underline"; - }; - - statusline = { - left = [ - "mode" - "spacer" - "spinner" - ]; - right = [ - "read-only-indicator" - "file-modification-indicator" - "file-name" - "separator" - "file-type" - "position-percentage" - "spacer" - "separator" - "position" - ]; - mode = { - normal = "NORMAL"; - insert = "INSERT"; - select = "VISUAL"; - }; - }; - - lsp = { - display-messages = true; - display-progress-messages = true; - display-inlay-hints = true; - }; - - auto-save = { - focus-lost = true; # Ghostty supports it :) - after-delay.enable = true; - }; - - whitespace.render = { - space = "none"; - tab = "all"; - }; - - indent-guides.render = true; - - gutters.layout = [ - "diff" - "diagnostics" - "line-numbers" - "spacer" - ]; - }; - keys = { - normal = { - "C-s" = ":w"; - "tab" = "move_parent_node_end"; - "S-tab" = "move_parent_node_start"; - "A-h" = "goto_previous_buffer"; - "A-l" = "goto_next_buffer"; - }; - insert = { - "S-tab" = "move_parent_node_start"; - }; - select = { - "tab" = "move_parent_node_end"; - "S-tab" = "move_parent_node_start"; - }; - }; - }; - themes.catppuccin_mocha_plus = { - inherits = "catppuccin_mocha"; - - "ui.statusline" = { - fg = "subtext0"; - bg = "mantle"; - }; - "ui.statusline.normal" = { - fg = "mantle"; - bg = "rosewater"; - modifiers = [ "bold" ]; - }; - "ui.statusline.insert" = { - fg = "mantle"; - bg = "maroon"; - modifiers = [ "bold" ]; - }; - "ui.statusline.select" = { - fg = "mantle"; - bg = "mauve"; - modifiers = [ "bold" ]; - }; - - "ui.cursor.primary.normal" = { - fg = "base"; - bg = "rosewater"; - }; - "ui.cursor.primary.insert" = { - fg = "base"; - bg = "maroon"; - }; - "ui.cursor.primary.select" = { - fg = "base"; - bg = "mauve"; - }; - - # Underlines are gross - "ui.bufferline" = { - fg = "subtext0"; - bg = "mantle"; - modifiers = [ "dim" ]; - }; - "ui.bufferline.active" = { - fg = "text"; - bg = "base"; - modifiers = [ "bold" ]; - }; - - # Mimick VS Code - "ui.virtual.inlay-hint" = { - fg = "overlay0"; - bg = "base"; - }; - - "ui.popup".fg = "rosewater"; - "ui.popup.info".fg = "maroon"; - "ui.help".fg = "maroon"; - "ui.menu".fg = "text"; - "ui.menu.selected" = { - fg = "maroon"; - modifiers = [ "bold" ]; - }; - "ui.menu.scroll".fg = "maroon"; - "ui.background".bg = ""; # Transparent - - # Why the heck is it *blue*?; - "diff.delta" = "yellow"; - - # Maroon itself is already eye-catching enough, no need to italicize - "variable.parameter" = "maroon"; - # Teal is wayyyyyy too obtrusive in Nix - "variable.other.member" = "subtext1"; - "variable.builtin" = "peach"; - - # Fix ${} in Nix - "punctuation.special" = "maroon"; - "operator" = "maroon"; - }; - }; - - hm.home.packages = with pkgs; [ - # Language servers - lua-language-server - nil - basedpyright - oxlint - ruff-lsp - typescript-language-server - vscode-langservers-extracted - zls - - # Formatters - black - nixfmt-rfc-style - prettierd - shfmt - stylua - - tree-sitter - ]; - # ++ (with pkgs.nodePackages_latest; [ - # svelte-language-server - # ]); -} diff --git a/users/leah/programs/jj/default.nix b/users/leah/programs/jj/default.nix deleted file mode 100644 index dde71fa..0000000 --- a/users/leah/programs/jj/default.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ pkgs, config, ... }: -{ - hm.programs.git.difftastic.enable = true; - - hm.home.packages = with pkgs; [ - watchman - meld - ]; - - hm.programs.jujutsu = { - enable = true; - settings = { - user = { - name = config.roles.base.fullName; - email = "hi@pluie.me"; - }; - ui = { - default-command = ["log"]; - diff.tool = [ - "difft" - "--color=always" - "$left" - "$right" - ]; - pager = "moar -no-linenumbers"; - diff-editor = "meld"; - merge-editor = "meld"; - log-word-wrap = true; - editor = "hx"; - }; - template-aliases = { - "format_short_id(id)" = ''id.shortest(12).prefix() ++ "[" ++ id.shortest(12).rest() ++ "]"''; - "format_timestamp(timestamp)" = "timestamp.ago()"; - "format_short_signature(signature)" = "signature"; - }; - - fix.tools = { - nixfmt = { - command = [ "nixfmt" ]; - patterns = [ "glob:'**/*.nix'" ]; - }; - }; - - signing = { - behavior = "drop"; - backend = "ssh"; - key = config.roles.base.publicKey; - }; - - git = { - sign-on-push = true; - private-commits = "description(glob:'wip:*')"; - }; - - core = { - fsmonitor = "watchman"; - watchman.register-snapshot-trigger = true; - }; - }; - }; -} diff --git a/users/leah/programs/steam.nix b/users/leah/programs/steam.nix new file mode 100644 index 0000000..a443772 --- /dev/null +++ b/users/leah/programs/steam.nix @@ -0,0 +1,40 @@ +{ + config, + pkgs, + lib, + ... +}: +let + # Helper script for running Steam games with + # a *reasonable* preset + steam-assist = + lib.optionalString config.hardware.nvidia.prime.offload.enable '' + export __NV_PRIME_RENDER_OFFLOAD=1 + export __GLX_VENDOR_LIBRARY_NAME=nvidia + '' + '' + ${lib.getExe' pkgs.gamemode "gamemoderun"} $@ + ''; +in +{ + programs.gamemode.enable = true; + + programs.steam = { + enable = true; + + # Install Proton GE by default + extraCompatPackages = [ pkgs.proton-ge-bin ]; + + # Some native Linux games *assume* the distro has + # certain packages that may not be present on NixOS. + extraPackages = [ + pkgs.ncurses6 # Crusader Kings III + ]; + + protontricks.enable = true; + remotePlay.openFirewall = true; + }; + + hjem.users.leah.packages = [ + (pkgs.writeShellScriptBin "steam-assist" steam-assist) + ]; +} diff --git a/users/leah/programs/vcs.nix b/users/leah/programs/vcs.nix new file mode 100644 index 0000000..d4152c3 --- /dev/null +++ b/users/leah/programs/vcs.nix @@ -0,0 +1,81 @@ +{ + pkgs, + lib, + ... +}: +{ + hjem.users.leah.packages = with pkgs; [ + jujutsu + difftastic + watchman + ]; + + hjem.users.leah.ext.programs = { + git = { + enable = true; + settings = { + diff.external = "${lib.getExe pkgs.difftastic} --color auto --background light --display side-by-side"; + + init.defaultBranch = "main"; + push.autoSetupRemote = true; + url."https://github.com/".insteadOf = "gh:"; + gpg.format = "ssh"; + + user = { + name = "Leah Amelia Chen"; + email = "hi@pluie.me"; + signingKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC7uJGE2/25M4a3DIVxtnTA5INqWsFGw+49qHXaN/kqy"; + }; + }; + }; + + jujutsu = { + enable = true; + settings = { + user = { + name = "Leah Amelia Chen"; + email = "hi@pluie.me"; + }; + ui = { + default-command = [ "log" ]; + diff.tool = [ + "${lib.getExe pkgs.difftastic}" + "--color=always" + "$left" + "$right" + ]; + pager = "${lib.getExe pkgs.moar} -no-linenumbers"; + log-word-wrap = true; + }; + template-aliases = { + "format_short_id(id)" = ''id.shortest(12).prefix() ++ "[" ++ id.shortest(12).rest() ++ "]"''; + "format_timestamp(timestamp)" = "timestamp.ago()"; + "format_short_signature(signature)" = "signature"; + }; + + fix.tools = { + nixfmt = { + command = [ "nixfmt" ]; + patterns = [ "glob:'**/*.nix'" ]; + }; + }; + + signing = { + behavior = "drop"; + backend = "ssh"; + key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC7uJGE2/25M4a3DIVxtnTA5INqWsFGw+49qHXaN/kqy"; + }; + + git = { + sign-on-push = true; + private-commits = "description(glob:'wip:*')"; + }; + + core = { + fsmonitor = "watchman"; + watchman.register-snapshot-trigger = true; + }; + }; + }; + }; +}