~kmaasrud/prompt

7ebbe504b124fe45fdeb53ca7aece1e688dd53c9 — kmaasrud 1 year, 6 months ago
init repo
7 files changed, 233 insertions(+), 0 deletions(-)

A .envrc
A .gitignore
A Cargo.lock
A Cargo.toml
A flake.lock
A flake.nix
A src/main.rs
A  => .envrc +1 -0
@@ 1,1 @@
use flake

A  => .gitignore +2 -0
@@ 1,2 @@
/target
.direnv/

A  => Cargo.lock +7 -0
@@ 1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3

[[package]]
name = "prompt"
version = "0.1.0"

A  => Cargo.toml +4 -0
@@ 1,4 @@
[package]
name = "prompt"
version = "0.1.0"
edition = "2021"

A  => flake.lock +162 -0
@@ 1,162 @@
{
  "nodes": {
    "crane": {
      "inputs": {
        "flake-compat": "flake-compat",
        "flake-utils": "flake-utils",
        "nixpkgs": [
          "nixpkgs"
        ],
        "rust-overlay": "rust-overlay"
      },
      "locked": {
        "lastModified": 1680584903,
        "narHash": "sha256-uraq+D3jcLzw/UVk0xMHcnfILfIMa0DLrtAEq2nNlxU=",
        "owner": "ipetkov",
        "repo": "crane",
        "rev": "65d3f6a3970cd46bef5eedfd458300f72c56b3c5",
        "type": "github"
      },
      "original": {
        "owner": "ipetkov",
        "repo": "crane",
        "type": "github"
      }
    },
    "fenix": {
      "inputs": {
        "nixpkgs": [
          "nixpkgs"
        ],
        "rust-analyzer-src": "rust-analyzer-src"
      },
      "locked": {
        "lastModified": 1680762089,
        "narHash": "sha256-62lgi+xb+nn9H4O+ZIYNkHeQ8ryzstALKMJuoXiot0I=",
        "owner": "nix-community",
        "repo": "fenix",
        "rev": "5794e58068fb6a8eccad9e4ff77ffe1c08ded13c",
        "type": "github"
      },
      "original": {
        "owner": "nix-community",
        "repo": "fenix",
        "type": "github"
      }
    },
    "flake-compat": {
      "flake": false,
      "locked": {
        "lastModified": 1673956053,
        "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
        "owner": "edolstra",
        "repo": "flake-compat",
        "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
        "type": "github"
      },
      "original": {
        "owner": "edolstra",
        "repo": "flake-compat",
        "type": "github"
      }
    },
    "flake-utils": {
      "locked": {
        "lastModified": 1678901627,
        "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    },
    "flake-utils_2": {
      "locked": {
        "lastModified": 1680776469,
        "narHash": "sha256-3CXUDK/3q/kieWtdsYpDOBJw3Gw4Af6x+2EiSnIkNQw=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "411e8764155aa9354dbcd6d5faaeb97e9e3dce24",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1680728981,
        "narHash": "sha256-ZhsViPJJvET7iLyD9ey63q6GwPKquDqIbOn2letvb/A=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "38263d02cf3a22e011e137b8f67cdf8419f28015",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixpkgs-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "crane": "crane",
        "fenix": "fenix",
        "flake-utils": "flake-utils_2",
        "nixpkgs": "nixpkgs"
      }
    },
    "rust-analyzer-src": {
      "flake": false,
      "locked": {
        "lastModified": 1680727375,
        "narHash": "sha256-hb8AosuONAg0D9yoZ4VrBsjf5hINMYVLPEGekXF4qVE=",
        "owner": "rust-lang",
        "repo": "rust-analyzer",
        "rev": "ea22d245b671f97b820cf761108251c6292c3152",
        "type": "github"
      },
      "original": {
        "owner": "rust-lang",
        "ref": "nightly",
        "repo": "rust-analyzer",
        "type": "github"
      }
    },
    "rust-overlay": {
      "inputs": {
        "flake-utils": [
          "crane",
          "flake-utils"
        ],
        "nixpkgs": [
          "crane",
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1680488274,
        "narHash": "sha256-0vYMrZDdokVmPQQXtFpnqA2wEgCCUXf5a3dDuDVshn0=",
        "owner": "oxalica",
        "repo": "rust-overlay",
        "rev": "7ec2ff598a172c6e8584457167575b3a1a5d80d8",
        "type": "github"
      },
      "original": {
        "owner": "oxalica",
        "repo": "rust-overlay",
        "type": "github"
      }
    }
  },
  "root": "root",
  "version": 7
}

A  => flake.nix +54 -0
@@ 1,54 @@
{
  description = "My personal shell prompt";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

    crane = {
      url = "github:ipetkov/crane";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    flake-utils.url = "github:numtide/flake-utils";

    fenix = {
      url = "github:nix-community/fenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {
    nixpkgs,
    crane,
    flake-utils,
    fenix,
    ...
  }:
    flake-utils.lib.eachDefaultSystem (system: let
      pkgs = import nixpkgs {inherit system;};

      toolchain = with fenix.packages.${system};
        combine [
          complete.rustc
          complete.rust-src
          complete.cargo
          complete.clippy
          complete.rustfmt
        ];

      buildInputs = [] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [pkgs.libiconv];

      craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;

      prompt = craneLib.buildPackage {
        inherit buildInputs;
        src = craneLib.cleanCargoSource (craneLib.cleanSource ./.);
      };
    in rec {
      packages.default = prompt;
      devShells.default = pkgs.mkShell {
        inherit buildInputs;
        nativeBuildInputs = [toolchain];
      };
    });
}

A  => src/main.rs +3 -0
@@ 1,3 @@
fn main() {
    println!("Hello, world!");
}