From 3ff7bfa83837f2df7c1e7585b11d965d196a9e48 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Fri, 27 Oct 2023 10:06:49 -0500 Subject: [PATCH] Update Nix flake, add readme --- .gitignore | 1 + Cargo.lock | 2 +- Cargo.toml | 2 +- flake.lock | 19 ++++--------------- flake.nix | 13 +++++++++++-- readme.md | 8 ++++++++ src/main.rs | 1 + 7 files changed, 27 insertions(+), 19 deletions(-) create mode 100644 readme.md diff --git a/.gitignore b/.gitignore index 6abfe1b..fdf11bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target /.direnv +/result diff --git a/Cargo.lock b/Cargo.lock index f3c2b16..52f2a73 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,5 +3,5 @@ version = 3 [[package]] -name = "learn-rust-in-a-month-of-lunches" +name = "learnrust" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 31a4fa4..51973b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "learn-rust-in-a-month-of-lunches" +name = "learnrust" version = "0.1.0" edition = "2021" diff --git a/flake.lock b/flake.lock index 96a762b..8efbabe 100644 --- a/flake.lock +++ b/flake.lock @@ -2,7 +2,9 @@ "nodes": { "naersk": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { "lastModified": 1698153314, @@ -20,19 +22,6 @@ } }, "nixpkgs": { - "locked": { - "lastModified": 1697723726, - "narHash": "sha256-SaTWPkI8a5xSHX/rrKzUe+/uVNy6zCGMXgoeMb7T9rg=", - "path": "/nix/store/4jfc6vrkmq7z5pb651jh5b4kra5f1kwp-source", - "rev": "7c9cc5a6e5d38010801741ac830a3f8fd667a7a0", - "type": "path" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_2": { "locked": { "lastModified": 1697915759, "narHash": "sha256-WyMj5jGcecD+KC8gEs+wFth1J1wjisZf8kVZH13f1Zo=", @@ -51,7 +40,7 @@ "root": { "inputs": { "naersk": "naersk", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs", "utils": "utils" } }, diff --git a/flake.nix b/flake.nix index fb7aaec..a289545 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,12 @@ { inputs = { - naersk.url = "github:nix-community/naersk/master"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + naersk = { + url = "github:nix-community/naersk/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + utils.url = "github:numtide/flake-utils"; }; @@ -15,7 +20,11 @@ pkgs = import nixpkgs {inherit system;}; naersk-lib = pkgs.callPackage naersk {}; in { - defaultPackage = naersk-lib.buildPackage ./.; + packages.default = naersk-lib.buildPackage ./.; + formatter = nixpkgs.legacyPackages.${system}.alejandra; + checks = { + inherit (self.packages.${system}) default; + }; devShell = with pkgs; mkShell { buildInputs = [ diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..91a3f7d --- /dev/null +++ b/readme.md @@ -0,0 +1,8 @@ +# Learn Rust in a Month of Lunches + +Bought [this book][book] and this code contains my musings and other stuff that +I write as I work through it. + +Enjoy! + +[book]: https://www.manning.com/books/learn-rust-in-a-month-of-lunches?ar=false&lpse=B diff --git a/src/main.rs b/src/main.rs index e7a11a9..d5746f0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +/// a doc comment - use `cargo doc --open` to see it? fn main() { println!("Hello, world!"); }