mirror of
https://github.com/szymon-jozef/checkers.git
synced 2026-10-27 19:20:44 +01:00
init
This commit is contained in:
16
.envrc
Normal file
16
.envrc
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if ! has nix_direnv_version || ! nix_direnv_version 3.1.0; then
|
||||||
|
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.1.0/direnvrc" "sha256-yMJ2OVMzrFaDPn7q8nCBZFRYpL/f0RcHzhmw/i6btJM="
|
||||||
|
fi
|
||||||
|
|
||||||
|
watch_file flake.nix
|
||||||
|
watch_file flake.lock
|
||||||
|
|
||||||
|
mkdir -p "$PWD/.devenv"
|
||||||
|
DEVENV_ROOT_FILE="$PWD/.devenv/root"
|
||||||
|
printf %s "$PWD" >"$DEVENV_ROOT_FILE"
|
||||||
|
if ! use flake . --override-input devenv-root "file+file://$DEVENV_ROOT_FILE"; then
|
||||||
|
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
|
||||||
|
fi
|
||||||
|
|
||||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
target
|
||||||
7
Cargo.lock
generated
Normal file
7
Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "example"
|
||||||
|
version = "0.0.1"
|
||||||
12
Cargo.toml
Normal file
12
Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[package]
|
||||||
|
name = "Checkers"
|
||||||
|
description = "Game of checkers"
|
||||||
|
version = "0.0.1"
|
||||||
|
readme = "README.md"
|
||||||
|
license = "gpl3"
|
||||||
|
repository = "https://example.com"
|
||||||
|
authors = [ "szymon-jozef" ]
|
||||||
|
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
77
flake.lock
generated
Normal file
77
flake.lock
generated
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1785627969,
|
||||||
|
"narHash": "sha256-4dtXQk/NMePegK/nWp5NSeuZKLATItOq61lpEvmXqGw=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "427bf4bd9435fdf21321c8cc628c24efc14c0f7a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"import-tree": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1784254960,
|
||||||
|
"narHash": "sha256-iI88R3wHz8wTKQb5orvpc51L/Xr64AJyxid/0MKa/b8=",
|
||||||
|
"owner": "vic",
|
||||||
|
"repo": "import-tree",
|
||||||
|
"rev": "4ebb10ae17d5f1ad366e7aef5b92cb8eecf24f69",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "vic",
|
||||||
|
"repo": "import-tree",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1785571196,
|
||||||
|
"narHash": "sha256-KoTsyMQqnXQZq8deCEnu4QkyldkwH/bpMMhUcfMdGIw=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "148bab9c1c3c53136ecb44a6ea356a0ed5b39b06",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-lib": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1785031560,
|
||||||
|
"narHash": "sha256-OmshNvn2vupOFpYinLUu+1Dnpu4n7Q5N3ggGVNHpkUI=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixpkgs.lib",
|
||||||
|
"rev": "0e79af5e3d4dcfcd676ab5ba3f95d2e3352e078c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixpkgs.lib",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-parts": "flake-parts",
|
||||||
|
"import-tree": "import-tree",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
30
flake.nix
Normal file
30
flake.nix
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
description = "Rust project template";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs = {
|
||||||
|
url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
import-tree.url = "github:vic/import-tree";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
inputs:
|
||||||
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } (
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
_module.args.metadata = fromTOML (builtins.readFile ./Cargo.toml);
|
||||||
|
|
||||||
|
systems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
#"aarch64-darwin"
|
||||||
|
];
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
(inputs.import-tree ./nix)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
37
nix/module.nix
Normal file
37
nix/module.nix
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{ self, metadata, ... }:
|
||||||
|
{
|
||||||
|
flake.nixosModules.default =
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.programs.example;
|
||||||
|
|
||||||
|
inherit (lib)
|
||||||
|
mkEnableOption
|
||||||
|
mkOption
|
||||||
|
mkIf
|
||||||
|
;
|
||||||
|
|
||||||
|
inherit (pkgs.stdenv.hostPlatform) system;
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.programs.example = {
|
||||||
|
enable = mkEnableOption metadata.package.name;
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
default = self.packages.${system}.default;
|
||||||
|
description = "Package to use";
|
||||||
|
type = lib.types.package;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
37
nix/package.nix
Normal file
37
nix/package.nix
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{ metadata, ... }:
|
||||||
|
{
|
||||||
|
perSystem = { pkgs, lib, ... }: {
|
||||||
|
packages.default = (
|
||||||
|
pkgs.rustPlatform.buildRustPackage {
|
||||||
|
pname = metadata.package.name;
|
||||||
|
version = metadata.package.version;
|
||||||
|
|
||||||
|
src = lib.cleanSource ./..;
|
||||||
|
|
||||||
|
cargoLock.lockFile = ./../Cargo.lock;
|
||||||
|
|
||||||
|
# build deps
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
# cargo
|
||||||
|
# rustc
|
||||||
|
# already provided by buildRustPackage :p
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
|
||||||
|
# runtime deps
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = metadata.package.description;
|
||||||
|
homepage = metadata.package.repository;
|
||||||
|
downloadPage = "https://example.com";
|
||||||
|
license = lib.licenses."${metadata.package.license}";
|
||||||
|
# platforms = lib.platforms.linux;
|
||||||
|
mainProgram = metadata.package.name;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
11
nix/shell.nix
Normal file
11
nix/shell.nix
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
perSystem = { pkgs, config, ... }: {
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
packages = with pkgs; [ ];
|
||||||
|
|
||||||
|
inputsFrom = [
|
||||||
|
(config.packages.default)
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
3
src/main.rs
Normal file
3
src/main.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user