diff --git a/.gitignore b/.gitignore index 33db462..4ab016a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ /target Token.toml Config.toml +.envrc +.direnv +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f792602 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1707546158, + "narHash": "sha256-nYYJTpzfPMDxI8mzhQsYjIUX+grorqjKEU9Np6Xwy/0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d934204a0f8d9198e1e4515dd6fec76a139c87f0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8b14677 --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "warriors-names"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + }; + in + { + packages = rec { + warriors-names = pkgs.callPackage ./warriors-names.nix { }; + + default = warriors-names; + }; + + apps = rec { + dev = flake-utils.lib.mkApp { drv = self.packages.${system}.warriors-names; }; + default = dev; + }; + + devShell = with pkgs; mkShell { + nativeBuildInputs = [ cargo cargo-outdated clippy gcc rust-analyzer rustc rustfmt ]; + + RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; + }; + }); +} diff --git a/warriors-names.nix b/warriors-names.nix new file mode 100644 index 0000000..6092672 --- /dev/null +++ b/warriors-names.nix @@ -0,0 +1,21 @@ +{ lib +, nixosTests +, rustPlatform +}: + +rustPlatform.buildRustPackage { + pname = "warriors-names"; + version = "0.2.2"; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + + nativeBuildInputs = [ ]; + + passthru.tests = { inherit (nixosTests) warriors-names; }; + + meta = with lib; { + description = "A simple image hosting service"; + homepage = "https://git.asonix.dog/asonix/warriors-names"; + license = with licenses; [ agpl3Plus ]; + }; +}