Base scaffold
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
/target
|
||||
.direnv
|
||||
result
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
phases:
|
||||
- check
|
||||
|
||||
check:
|
||||
tags:
|
||||
- nix
|
||||
script:
|
||||
- nix flake check
|
||||
Generated
+94
-3
@@ -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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,78 +1,107 @@
|
||||
# github.com/brianmcgee has lots of great ideas for going above and beyond for this
|
||||
{
|
||||
description = "Greg's homepage";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
devshell.url = "github:numtide/devshell";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
flake-root.url = "github:srid/flake-root";
|
||||
naersk.url = "github:nix-community/naersk";
|
||||
#process-compose.url = "github:Platonic-Systems/process-compose-flake";
|
||||
#services-flake.url = "github:juspay/services-flake";
|
||||
};
|
||||
description = "Greg's homepage";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
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";
|
||||
};
|
||||
|
||||
outputs = { flake-parts, ... }@inputs:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [
|
||||
inputs.devshell.flakeModule
|
||||
inputs.flake-root.flakeModule
|
||||
#inputs.process-compose.flakeModule
|
||||
];
|
||||
flake = {
|
||||
# Universal things
|
||||
overlays.default = final: prev: {};
|
||||
};
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
perSystem = { pkgs, ... }@inputs': let
|
||||
naersk-lib = pkgs.callPackage inputs.naersk { };
|
||||
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 = [{
|
||||
package = pkgs.cargo;
|
||||
category = "languages";
|
||||
help = "The Cargo tool";
|
||||
} {
|
||||
package = pkgs.rustc;
|
||||
category = "languages";
|
||||
help = "The rust compiler";
|
||||
} {
|
||||
package = pkgs.rustfmt;
|
||||
category = "tools";
|
||||
help = "Formatting tool for Rust";
|
||||
} {
|
||||
package = pkgs.pre-commit;
|
||||
category = "tools";
|
||||
help = "Helps run certain checks";
|
||||
} {
|
||||
package = pkgs.rustPackages.clippy;
|
||||
category = "tools";
|
||||
help = "Standard Rust clippy tool";
|
||||
} {
|
||||
package = pkgs.stdenv.cc;
|
||||
category = "languages";
|
||||
help = "The C compiler, to help things out";
|
||||
}];
|
||||
};
|
||||
outputs =
|
||||
{ flake-parts, ... }@inputs:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [
|
||||
inputs.devshell.flakeModule
|
||||
inputs.flake-root.flakeModule
|
||||
#inputs.process-compose.flakeModule
|
||||
];
|
||||
flake = {
|
||||
# Universal things
|
||||
# final: prev:
|
||||
overlays.default = _: _: { };
|
||||
};
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
perSystem =
|
||||
{ pkgs, ... }@inputs':
|
||||
let
|
||||
naersk-lib = pkgs.callPackage inputs.naersk { };
|
||||
in
|
||||
{
|
||||
_module.args.pkgs = import inputs.nixpkgs {
|
||||
inherit (inputs') system;
|
||||
overlays = [ ];
|
||||
};
|
||||
# https://numtide.github.io/devshell/intro.html
|
||||
devshells.default = {
|
||||
# These commands will be shown in the motd that users read
|
||||
# upon entering the shell
|
||||
commands = [
|
||||
{
|
||||
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";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# This is not special, this is just flakes
|
||||
packages = {
|
||||
default = naersk-lib.buildPackage ./.;
|
||||
};
|
||||
};
|
||||
};
|
||||
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 = {
|
||||
rustpkg = naersk-lib.buildPackage ./.;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
+8
-9
@@ -1,4 +1,4 @@
|
||||
#[derive(Clone,Debug,Copy)]
|
||||
#[derive(Clone, Debug, Copy)]
|
||||
pub enum CellValue {
|
||||
One,
|
||||
Two,
|
||||
@@ -8,20 +8,19 @@ pub enum CellValue {
|
||||
Six,
|
||||
Seven,
|
||||
Eight,
|
||||
Nine
|
||||
Nine,
|
||||
}
|
||||
|
||||
pub struct Cell {
|
||||
value: Option<CellValue>,
|
||||
candidates: Vec<CellValue>,
|
||||
|
||||
}
|
||||
|
||||
impl Default for Cell {
|
||||
fn default() -> Cell {
|
||||
Cell {
|
||||
value : None,
|
||||
candidates : vec![
|
||||
value: None,
|
||||
candidates: vec![
|
||||
CellValue::One,
|
||||
CellValue::Two,
|
||||
CellValue::Three,
|
||||
@@ -30,19 +29,19 @@ 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 {
|
||||
fn value(self, x: usize, y : usize) -> Option<CellValue> {
|
||||
fn value(self, x: usize, y: usize) -> Option<CellValue> {
|
||||
self.cells[x][y].value
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user