Base scaffold

This commit is contained in:
Greg Hellings
2024-10-15 19:57:26 -05:00
parent 7f97b1ed9f
commit c31d638dc0
5 changed files with 213 additions and 85 deletions
+1
View File
@@ -1,2 +1,3 @@
/target
.direnv
result
+8
View File
@@ -0,0 +1,8 @@
phases:
- check
check:
tags:
- nix
script:
- nix flake check
Generated
+94 -3
View File
@@ -18,6 +18,22 @@
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
@@ -51,9 +67,51 @@
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"hooks",
"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"
}
},
"hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1728778939,
"narHash": "sha256-WybK5E3hpGxtCYtBwpRj1E9JoiVxe+8kX83snTNaFHE=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "ff68f91754be6f3427e4986d7949e6273659be1d",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1721727458,
@@ -97,7 +155,39 @@
"url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1720386169,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"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": {
"lastModified": 0,
"narHash": "sha256-HP89HZOT0ReIbI7IJZJQoJgxvB2Tn28V6XS3MNKnfLs=",
@@ -109,7 +199,7 @@
"type": "indirect"
}
},
"nixpkgs_3": {
"nixpkgs_4": {
"locked": {
"lastModified": 1728538411,
"narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=",
@@ -130,8 +220,9 @@
"devshell": "devshell",
"flake-parts": "flake-parts",
"flake-root": "flake-root",
"hooks": "hooks",
"naersk": "naersk",
"nixpkgs": "nixpkgs_3"
"nixpkgs": "nixpkgs_4"
}
}
},
+57 -28
View File
@@ -6,12 +6,12 @@
devshell.url = "github:numtide/devshell";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-root.url = "github:srid/flake-root";
hooks.url = "github:cachix/git-hooks.nix";
naersk.url = "github:nix-community/naersk";
#process-compose.url = "github:Platonic-Systems/process-compose-flake";
#services-flake.url = "github:juspay/services-flake";
};
outputs = { flake-parts, ... }@inputs:
outputs =
{ flake-parts, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.devshell.flakeModule
@@ -20,58 +20,87 @@
];
flake = {
# Universal things
overlays.default = final: prev: {};
# final: prev:
overlays.default = _: _: { };
};
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
perSystem = { pkgs, ... }@inputs': let
perSystem =
{ pkgs, ... }@inputs':
let
naersk-lib = pkgs.callPackage inputs.naersk { };
in {
in
{
_module.args.pkgs = import inputs.nixpkgs {
inherit (inputs') system;
overlays = [ ];
};
# https://numtide.github.io/devshell/intro.html
devshells.default = {
env = [{
name = "RUST_SRC_PATH";
value = pkgs.rustPlatform.rustLibSrc;
}];
# These commands will be shown in the motd that users read
# upon entering the shell
commands = [{
commands = [
{
package = pkgs.cargo;
category = "languages";
help = "The Cargo tool";
} {
category = "tools";
help = "Rust build and package tool";
}
{
package = pkgs.rustc;
category = "languages";
help = "The rust compiler";
} {
help = "Rust compiler";
}
{
package = pkgs.rustfmt;
category = "tools";
help = "Formatting tool for Rust";
} {
package = pkgs.pre-commit;
help = "Standard Rust formatting tool";
}
{
package = pkgs.clippy;
category = "tools";
help = "Helps run certain checks";
} {
package = pkgs.rustPackages.clippy;
category = "tools";
help = "Standard Rust clippy tool";
} {
help = "Rust linter";
}
{
package = pkgs.stdenv.cc;
category = "languages";
help = "The C compiler, to help things out";
}];
help = "C compiler to help with building native code";
}
{
package = pkgs.pre-commit;
category = "tools";
help = "Tool to help enforce commits make sense";
}
];
};
checks = {
pre-commit-check = inputs.hooks.lib.${inputs'.system}.run {
src = ./.;
hooks = {
check-added-large-files.enable = true;
check-case-conflicts.enable = true;
check-merge-conflicts.enable = true;
check-symlinks.enable = true;
deadnix.enable = true;
end-of-file-fixer.enable = true;
fix-byte-order-marker.enable = true;
mixed-line-endings.enable = true;
nixfmt-rfc-style.enable = true;
trim-trailing-whitespace.enable = true;
# Rust hooks
cargo-check.enable = true;
clippy.enable = true;
rustfmt.enable = true;
};
};
};
# This is not special, this is just flakes
packages = {
default = naersk-lib.buildPackage ./.;
rustpkg = naersk-lib.buildPackage ./.;
};
};
};
+4 -5
View File
@@ -8,13 +8,12 @@ pub enum CellValue {
Six,
Seven,
Eight,
Nine
Nine,
}
pub struct Cell {
value: Option<CellValue>,
candidates: Vec<CellValue>,
}
impl Default for Cell {
@@ -30,15 +29,15 @@ impl Default for Cell {
CellValue::Six,
CellValue::Seven,
CellValue::Eight,
CellValue::Nine
]
CellValue::Nine,
],
}
}
}
#[derive(Default)]
pub struct Board {
cells: [ [ Cell ; 9 ] ; 9 ]
cells: [[Cell; 9]; 9],
}
impl Board {