From ca5c737f047119f31e42a8700b8ae1ad4fabd17a Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Fri, 27 May 2022 16:29:49 -0400 Subject: Initial Commit --- .envrc | 1 + .gitignore | 2 ++ Cargo.lock | 7 ++++++ Cargo.toml | 8 +++++++ flake.lock | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 33 +++++++++++++++++++++++++++ src/main.rs | 3 +++ 7 files changed, 128 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 src/main.rs diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0e71e34 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +.direnv/ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..d7f03b8 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "homeworld" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..f96297e --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "homeworld" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..1dbda15 --- /dev/null +++ b/flake.lock @@ -0,0 +1,74 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1652776076, + "narHash": "sha256-gzTw/v1vj4dOVbpBSJX4J0DwUR6LIyXo7/SuuTJp1kM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "04c1b180862888302ddfb2e3ad9eaa63afc60cf8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1653413650, + "narHash": "sha256-wojDHjb+eU80MPH+3HQaK0liUy8EgR95rvmCl24i58Y=", + "owner": "nix-community", + "repo": "naersk", + "rev": "69daaceebe12c070cd5ae69ba38f277bbf033695", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1653326962, + "narHash": "sha256-W8feCYqKTsMre4nAEpv5Kx1PVFC+hao/LwqtB2Wci/8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "41cc1d5d9584103be4108c1815c350e07c807036", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1653326962, + "narHash": "sha256-W8feCYqKTsMre4nAEpv5Kx1PVFC+hao/LwqtB2Wci/8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "41cc1d5d9584103be4108c1815c350e07c807036", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "naersk": "naersk", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4764b03 --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + naersk.url = "github:nix-community/naersk"; + }; + + outputs = { self, nixpkgs, flake-utils, naersk }: + flake-utils.lib.eachDefaultSystem ( + system: let + pkgs = nixpkgs.legacyPackages."${system}"; + naersk-lib = naersk.lib."${system}"; + in + rec { + # `nix build` + packages.homeworld = naersk-lib.buildPackage { + pname = "homeworld"; + root = ./.; + }; + defaultPackage = packages.homeworld; + + # `nix run` + apps.homeworld = flake-utils.lib.mkApp { + drv = packages.homeworld; + }; + defaultApp = apps.homeworld; + + # `nix develop` + devShell = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ rustc cargo ]; + }; + } + ); +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} -- cgit v1.2.3