Move away from numtide

Get rid of the numtide shell, as it doesn't have any good support for
shellHook. Also, directly create the pre-commit check so that we can
leverage its resulting bits in the packages.

We now will have acces to things like pre-commit-config.yaml in the
folder structure
This commit is contained in:
Greg Hellings
2024-10-20 20:50:49 -05:00
parent 0c1b09404b
commit e4c678833b
5 changed files with 52 additions and 110 deletions
+1
View File
@@ -1,3 +1,4 @@
/target /target
.direnv .direnv
result result
.pre-commit-config.yaml
+1 -1
View File
@@ -24,4 +24,4 @@
"cwd": "${workspaceFolder}" "cwd": "${workspaceFolder}"
} }
] ]
} }
+1 -1
View File
@@ -7,4 +7,4 @@ edition = "2021"
assertables = "8.18.0" assertables = "8.18.0"
ndarray = "0.16.1" ndarray = "0.16.1"
num-traits = "0.2.19" num-traits = "0.2.19"
iced = "0.13.1" iced = "0.13.1"
Generated
+7 -42
View File
@@ -1,23 +1,5 @@
{ {
"nodes": { "nodes": {
"devshell": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1728330715,
"narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=",
"owner": "numtide",
"repo": "devshell",
"rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -92,7 +74,7 @@
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"gitignore": "gitignore", "gitignore": "gitignore",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
@@ -111,7 +93,7 @@
}, },
"naersk": { "naersk": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1721727458, "lastModified": 1721727458,
@@ -129,11 +111,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1722073938, "lastModified": 1719082008,
"narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=", "narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae", "rev": "9693852a2070b398ee123a329e68f0dab5526681",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -172,22 +154,6 @@
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": {
"lastModified": 1719082008,
"narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9693852a2070b398ee123a329e68f0dab5526681",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": { "locked": {
"lastModified": 0, "lastModified": 0,
"narHash": "sha256-HP89HZOT0ReIbI7IJZJQoJgxvB2Tn28V6XS3MNKnfLs=", "narHash": "sha256-HP89HZOT0ReIbI7IJZJQoJgxvB2Tn28V6XS3MNKnfLs=",
@@ -199,7 +165,7 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs_4": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1728538411, "lastModified": 1728538411,
"narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=", "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=",
@@ -217,12 +183,11 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"devshell": "devshell",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"flake-root": "flake-root", "flake-root": "flake-root",
"hooks": "hooks", "hooks": "hooks",
"naersk": "naersk", "naersk": "naersk",
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_3"
} }
} }
}, },
+42 -66
View File
@@ -3,7 +3,6 @@
description = "Greg's homepage"; description = "Greg's homepage";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
devshell.url = "github:numtide/devshell";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
flake-root.url = "github:srid/flake-root"; flake-root.url = "github:srid/flake-root";
hooks.url = "github:cachix/git-hooks.nix"; hooks.url = "github:cachix/git-hooks.nix";
@@ -13,15 +12,11 @@
outputs = outputs =
{ flake-parts, ... }@inputs: { flake-parts, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ imports = [ inputs.flake-root.flakeModule ];
inputs.devshell.flakeModule
inputs.flake-root.flakeModule
inputs.hooks.flakeModule
];
flake = { flake = {
# Universal things # Universal things
# final: prev: # final: prev:
overlays.default = _: _: { }; overlays.default = _final: _prev: { };
}; };
systems = [ systems = [
"x86_64-linux" "x86_64-linux"
@@ -29,7 +24,7 @@
"aarch64-darwin" "aarch64-darwin"
]; ];
perSystem = perSystem =
{ pkgs, ... }@inputs': { pkgs, self', ... }@inputs':
let let
naersk-lib = pkgs.callPackage inputs.naersk { }; naersk-lib = pkgs.callPackage inputs.naersk { };
in in
@@ -38,11 +33,10 @@
inherit (inputs') system; inherit (inputs') system;
overlays = [ ]; overlays = [ ];
}; };
# https://numtide.github.io/devshell/intro.html devShells.default = pkgs.mkShell rec {
devshells.default = rec {
# These commands will be shown in the motd that users read # These commands will be shown in the motd that users read
# upon entering the shell # upon entering the shell
packages = with pkgs; [ inputsFrom = with pkgs; [
expat expat
fontconfig fontconfig
freetype freetype
@@ -57,64 +51,46 @@
libxkbcommon libxkbcommon
]; ];
env = [ packages = with pkgs; [
{ cargo
name = "LD_LIBRARY_PATH"; clippy
value = builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" packages; pre-commit
} rustc
]; rustfmt
commands = [ stdenv.cc
{
package = pkgs.cargo;
category = "tools";
help = "Rust build and package tool";
}
{
package = pkgs.rustc;
category = "languages";
help = "Rust compiler";
}
{
package = pkgs.rustfmt;
category = "tools";
help = "Standard Rust formatting tool";
}
{
package = pkgs.clippy;
category = "tools";
help = "Rust linter";
}
{
package = pkgs.stdenv.cc;
category = "languages";
help = "C compiler to help with building native code";
}
{
package = pkgs.pre-commit;
category = "tools";
help = "Tool to help enforce commits make sense";
}
]; ];
buildInputs = self'.checks.pre-commit.enabledPackages;
shellHook =
let
lib_path = builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" packages;
in
''
export LD_LIBRARY_PATH="${lib_path}"
''
+ self'.checks.pre-commit.shellHook;
}; };
pre-commit = { checks = {
check.enable = true; pre-commit = inputs.hooks.lib.${inputs'.system}.run {
settings.src = ./.; src = ./.;
settings.hooks = { hooks = {
check-added-large-files.enable = true; check-added-large-files.enable = true;
check-case-conflicts.enable = true; check-case-conflicts.enable = true;
check-merge-conflicts.enable = true; check-merge-conflicts.enable = true;
check-symlinks.enable = true; check-symlinks.enable = true;
deadnix.enable = true; deadnix.enable = true;
end-of-file-fixer.enable = true; end-of-file-fixer.enable = true;
fix-byte-order-marker.enable = true; fix-byte-order-marker.enable = true;
mixed-line-endings.enable = true; mixed-line-endings.enable = true;
nixfmt-rfc-style.enable = true; nixfmt-rfc-style.enable = true;
trim-trailing-whitespace.enable = true; trim-trailing-whitespace.enable = true;
# Rust hooks # Rust hooks
cargo-check.enable = true; cargo-check.enable = true;
clippy.enable = true; clippy.enable = true;
rustfmt.enable = true; rustfmt.enable = true;
};
}; };
}; };