diff --git a/.gitignore b/.gitignore index ea8c4bf..8ea0ee8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +result* diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..77bd438 --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1722719969, + "narHash": "sha256-E47qbT/mRtBCSZra+9S9208sp/QnNeOAq7EhHX+eMNE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "83a364ced9d5b8a6bdac897bbef6b91e70777b97", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4ee4f5f --- /dev/null +++ b/flake.nix @@ -0,0 +1,17 @@ +{ + description = "A microscopic fetch script in Rust, for NixOS systems"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs"; + + outputs = { + self, + nixpkgs, + }: let + systems = ["x86_64-linux" "aarch64-linux"]; + forEachSystem = nixpkgs.lib.genAttrs systems; + pkgsForEach = nixpkgs.legacyPackages; + in { + packages = forEachSystem (system: { + default = pkgsForEach.${system}.callPackage ./nix/package.nix {}; + }); + }; +} diff --git a/nix/package.nix b/nix/package.nix new file mode 100644 index 0000000..f2c6e4f --- /dev/null +++ b/nix/package.nix @@ -0,0 +1,26 @@ +{ + lib, + rustPlatform, +}: let + toml = (lib.importTOML ../Cargo.toml).package; + pname = toml.name; + inherit (toml) version; +in + rustPlatform.buildRustPackage { + inherit pname version; + + src = builtins.path { + name = "${pname}-${version}"; + path = ../.; + }; + + cargoLock.lockFile = ../Cargo.lock; + + meta = { + description = "A microscopic fetch script in Rust, for NixOS systems"; + homepage = "https://github.com/NotAShelf/microfetch"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [NotAShelf]; + mainProgram = "microfetch"; + }; + }