diff --git a/.gitignore b/.gitignore index 6a854f7..4b8089d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ result result-* *.secret.* -.nvimlog \ No newline at end of file +.nvimlog +.pre-commit-config.yaml \ No newline at end of file diff --git a/darwin/bootstrap.nix b/darwin/bootstrap.nix index 875aee4..308179e 100644 --- a/darwin/bootstrap.nix +++ b/darwin/bootstrap.nix @@ -10,6 +10,7 @@ "https://nix-community.cachix.org" "https://mat.cachix.org" "https://helix.cachix.org" + "https://pre-commit-hooks.cachix.org" ]; trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" @@ -17,6 +18,7 @@ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "mat.cachix.org-1:AHqv9SoBEPKlJX2DDZQnjaMcvBAgpH1j8rw5USYDZno=" "helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs=" + "pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc=" ]; trusted-users = [ "@admin" diff --git a/darwin/defaults.nix b/darwin/defaults.nix index ee39970..8ffd10e 100644 --- a/darwin/defaults.nix +++ b/darwin/defaults.nix @@ -1,5 +1,3 @@ -{ ... }: - { system.defaults.NSGlobalDomain = { AppleInterfaceStyleSwitchesAutomatically = true; diff --git a/darwin/general.nix b/darwin/general.nix index 4ffced8..bedb44c 100644 --- a/darwin/general.nix +++ b/darwin/general.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ pkgs, ... }: { environment.systemPackages = [ pkgs.terminal-notifier ]; @@ -10,6 +10,7 @@ inter recursive (nerdfonts.override { + enableWindowsFonts = false; fonts = [ "CascadiaCode" "iA-Writer" diff --git a/flake.lock b/flake.lock index 3e28160..aee2bae 100644 --- a/flake.lock +++ b/flake.lock @@ -321,6 +321,22 @@ "type": "github" } }, + "kitty-rose-pine": { + "flake": false, + "locked": { + "lastModified": 1661351382, + "narHash": "sha256-idqwpNC6hWIz5KtEGqL5C+KcUcKc9iPCstP5FQcZZ0I=", + "owner": "rose-pine", + "repo": "kitty", + "rev": "4dd9bbe6f838e61f0ef7e9ab9625adda34e129ef", + "type": "github" + }, + "original": { + "owner": "rose-pine", + "repo": "kitty", + "type": "github" + } + }, "nci": { "inputs": { "devshell": "devshell", @@ -396,6 +412,42 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1667292599, + "narHash": "sha256-7ISOUI1aj6UKMPIL+wwthENL22L3+A9V+jS8Is3QsRo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ef2f213d9659a274985778bff4ca322f3ef3ac68", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "pre-commit": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1668973924, + "narHash": "sha256-17VnhpKJRoYdt23SJcUUCi/qEt9d3OyFsz9YRYStrew=", + "owner": "cpcloud", + "repo": "pre-commit-hooks.nix", + "rev": "7ee855668b78b9d7d1b504121c5b146c67a2abd8", + "type": "github" + }, + "original": { + "owner": "cpcloud", + "ref": "dot-git-dir", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "dark-mode-notify-src": "dark-mode-notify-src", @@ -408,9 +460,11 @@ "home-manager-atemu": "home-manager-atemu", "homebrew-enabled": "homebrew-enabled", "kitty-icon": "kitty-icon", + "kitty-rose-pine": "kitty-rose-pine", "nixpkgs": "nixpkgs", "nixpkgs-master": "nixpkgs-master", - "nixpkgs-unstable": "nixpkgs-unstable" + "nixpkgs-unstable": "nixpkgs-unstable", + "pre-commit": "pre-commit" } }, "rust-overlay": { diff --git a/flake.nix b/flake.nix index 206a665..7c6747c 100644 --- a/flake.nix +++ b/flake.nix @@ -26,10 +26,10 @@ home-manager-atemu.url = "github:Atemu/home-manager/darwin-copy-apps-fully-wip"; home-manager-atemu.inputs.nixpkgs.follows = "nixpkgs-unstable"; - # Nix language server - nil.url = "github:oxalica/nil"; - nil.inputs.nixpkgs.follows = "nixpkgs-unstable"; - nil.inputs.flake-utils.follows = "flake-utils"; + # pre-commit and hooks + # pre-commit.url = "github:cachix/pre-commit-hooks.nix"; + pre-commit.url = "github:cpcloud/pre-commit-hooks.nix/dot-git-dir"; + pre-commit.inputs.flake-utils.follows = "flake-utils"; # Extra sources helix.url = "github:helix-editor/helix"; @@ -42,7 +42,7 @@ fisher-src.flake = false; }; - outputs = { self, darwin, home-manager, flake-utils, ... }@inputs: + outputs = { self, darwin, home-manager, flake-utils, pre-commit, ... }@inputs: let inherit (darwin.lib) darwinSystem; @@ -55,16 +55,16 @@ nixpkgsConfig = { config = { allowUnfree = true; }; overlays = attrValues self.overlays ++ [ - (final: prev: + (final: _prev: import ./pkgs { inherit inputs; inherit (final) callPackage; inherit (final.stdenv) system; }) - (final: prev: optionalAttrs (prev.stdenv.system == "aarch64-darwin") + (_final: prev: optionalAttrs (prev.stdenv.system == "aarch64-darwin") { # Sub in x86 version of packages that don't build on Apple Silicon yet - inherit (final.pkgs-x86); + # inherit (final.pkgs-x86); }) ]; }; @@ -90,7 +90,7 @@ # `home-manager` module home-manager.darwinModules.home-manager ( - { config, lib, pkgs, ... }: + { config, ... }: let inherit (config.users) primaryUser; in @@ -200,7 +200,7 @@ # Build and activate on new system with: # `nix build .#homeConfigurations..activationPackage; ./result/activate` - homeConfigurations = rec { + homeConfigurations = { cloudVM = home-manager.lib.homeManagerConfiguration { pkgs = import inputs.nixpkgs-unstable { system = "x86_64-linux"; @@ -223,21 +223,21 @@ overlays = { # nixpkgs overlays - pkgs-stable = final: prev: { + pkgs-stable = _final: prev: { pkgs-stable = import inputs.nixpkgs { inherit (prev.stdenv) system; inherit (nixpkgsConfig) config; }; }; - pkgs-unstable = final: prev: { + pkgs-unstable = _final: prev: { pkgs-unstable = import inputs.nixpkgs-unstable { inherit (prev.stdenv) system; inherit (nixpkgsConfig) config; }; }; - pkgs-master = final: prev: { + pkgs-master = _final: prev: { pkgs-master = import inputs.nixpkgs-master { inherit (prev.stdenv) system; inherit (nixpkgsConfig) config; @@ -247,7 +247,7 @@ colors = import ./overlays/colors.nix; # Overlay useful on Macs with Apple Silicon - apple-silicon = final: prev: optionalAttrs (prev.stdenv.system == "aarch64-darwin") { + apple-silicon = _final: prev: optionalAttrs (prev.stdenv.system == "aarch64-darwin") { # Add access to x86 packages system is running Apple Silicon pkgs-x86 = import inputs.nixpkgs-unstable { system = "x86_64-darwin"; @@ -255,12 +255,10 @@ }; }; - patched = final: prev: optionalAttrs prev.stdenv.isDarwin { + patched = _final: prev: optionalAttrs prev.stdenv.isDarwin { inherit (inputs) kitty-icon fisher-src; lib = prev.lib // { homebrew-enabled = inputs.homebrew-enabled.value; }; }; - - nil = inputs.nil.overlays.default; }; # `nix-darwin` configs and modules @@ -305,17 +303,33 @@ }; }; - } // flake-utils.lib.eachDefaultSystem (system: { - legacyPackages = import inputs.nixpkgs-unstable { - inherit system; - inherit (nixpkgsConfig) config; - overlays = with self.overlays; [ - pkgs-master - pkgs-stable - colors - apple-silicon - patched - ]; - }; - }); + } // flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import inputs.nixpkgs-unstable { + inherit system; + inherit (nixpkgsConfig) config; + overlays = with self.overlays; [ + pkgs-master + pkgs-stable + colors + apple-silicon + patched + ]; + }; + in + { + legacyPackages = pkgs; + + checks.pre-commit = pre-commit.lib.${system}.run { + src = ./.; + hooks = { + deadnix.enable = true; + nix-linter.enable = true; + nixpkgs-fmt.enable = true; + statix.enable = true; + }; + }; + + devShells.default = pkgs.mkShell { inherit (self.checks.${system}.pre-commit) shellHook; }; + }); } diff --git a/home/git.nix b/home/git.nix index 7ffb29f..e667e97 100644 --- a/home/git.nix +++ b/home/git.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, ... }: { # Git diff --git a/home/kitty.nix b/home/kitty.nix index 5ea5233..82e3ccf 100644 --- a/home/kitty.nix +++ b/home/kitty.nix @@ -1,7 +1,6 @@ -{ config, lib, pkgs, ... }: +{ pkgs, ... }: # Let-In --------------------------------------------------------------------------------------- {{{ let - inherit (lib) mkIf; colorsToKitty = colors: with colors; { inherit background diff --git a/modules/home/programs/kitty/extras.nix b/modules/home/programs/kitty/extras.nix index 7ade092..7ca8d10 100644 --- a/modules/home/programs/kitty/extras.nix +++ b/modules/home/programs/kitty/extras.nix @@ -131,12 +131,10 @@ in }; programs.kitty.settings = optionalAttrs cfg.colors.enable - ( - { - allow_remote_control = "yes"; - listen_on = "unix:/tmp/mykitty"; - } - ) // optionalAttrs (cfg.useSymbolsFromNerdFont != "") { + { + allow_remote_control = "yes"; + listen_on = "unix:/tmp/mykitty"; + } // optionalAttrs (cfg.useSymbolsFromNerdFont != "") { # 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}"; diff --git a/overlays/colors.nix b/overlays/colors.nix index 9e16800..b821097 100644 --- a/overlays/colors.nix +++ b/overlays/colors.nix @@ -1,4 +1,4 @@ -final: prev: { +_final: prev: { lib = prev.lib // { colors = { tokyonight = import ./colors/tokyonight.nix; diff --git a/pkgs/yubiswitch.nix b/pkgs/yubiswitch.nix index a450575..43a0061 100644 --- a/pkgs/yubiswitch.nix +++ b/pkgs/yubiswitch.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchurl, undmg, unzip, version ? "0.12", ... }: +{ stdenv, fetchurl, undmg, unzip, version ? "0.12", ... }: stdenv.mkDerivation { inherit version;