Add pre-commit hooks and other fixes

work
mat ess 2022-11-20 17:07:02 -05:00
parent e11c455279
commit 5f6c3ffd97
11 changed files with 113 additions and 46 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ result
result-*
*.secret.*
.nvimlog
.pre-commit-config.yaml

View File

@ -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"

View File

@ -1,5 +1,3 @@
{ ... }:
{
system.defaults.NSGlobalDomain = {
AppleInterfaceStyleSwitchesAutomatically = true;

View File

@ -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"

View File

@ -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": {

View File

@ -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.<name>.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,8 +303,9 @@
};
};
} // flake-utils.lib.eachDefaultSystem (system: {
legacyPackages = import inputs.nixpkgs-unstable {
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import inputs.nixpkgs-unstable {
inherit system;
inherit (nixpkgsConfig) config;
overlays = with self.overlays; [
@ -317,5 +316,20 @@
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; };
});
}

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }:
{ config, pkgs, ... }:
{
# Git

View File

@ -1,7 +1,6 @@
{ config, lib, pkgs, ... }:
{ pkgs, ... }:
# Let-In --------------------------------------------------------------------------------------- {{{
let
inherit (lib) mkIf;
colorsToKitty = colors: with colors; {
inherit
background

View File

@ -131,12 +131,10 @@ in
};
programs.kitty.settings = optionalAttrs cfg.colors.enable
(
{
allow_remote_control = "yes";
listen_on = "unix:/tmp/mykitty";
}
) // optionalAttrs (cfg.useSymbolsFromNerdFont != "") {
} // 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}";

View File

@ -1,4 +1,4 @@
final: prev: {
_final: prev: {
lib = prev.lib // {
colors = {
tokyonight = import ./colors/tokyonight.nix;

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchurl, undmg, unzip, version ? "0.12", ... }:
{ stdenv, fetchurl, undmg, unzip, version ? "0.12", ... }:
stdenv.mkDerivation {
inherit version;