Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
8b648f422e |
4 changed files with 15 additions and 61 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
||||||
/target
|
/target
|
||||||
|
|
||||||
|
.direnv/
|
||||||
|
|
36
flake.lock
36
flake.lock
|
@ -1,39 +1,6 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"naersk": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1659610603,
|
|
||||||
"narHash": "sha256-LYgASYSPYo7O71WfeUOaEUzYfzuXm8c8eavJcel+pfI=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "naersk",
|
|
||||||
"rev": "c6a45e4277fa58abd524681466d3450f896dc094",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"ref": "master",
|
|
||||||
"repo": "naersk",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
|
||||||
"lastModified": 1661008273,
|
|
||||||
"narHash": "sha256-UpDqsGzUswIHG7FwzeIewjWlElF17UVLNbI2pwlbcBY=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "0cc6444e74cd21e8da8d81ef4cd778492e10f843",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"id": "nixpkgs",
|
|
||||||
"type": "indirect"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_2": {
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1661008273,
|
"lastModified": 1661008273,
|
||||||
"narHash": "sha256-UpDqsGzUswIHG7FwzeIewjWlElF17UVLNbI2pwlbcBY=",
|
"narHash": "sha256-UpDqsGzUswIHG7FwzeIewjWlElF17UVLNbI2pwlbcBY=",
|
||||||
|
@ -51,8 +18,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"naersk": "naersk",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs": "nixpkgs_2",
|
|
||||||
"utils": "utils"
|
"utils": "utils"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
37
flake.nix
37
flake.nix
|
@ -1,45 +1,30 @@
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
naersk.url = "github:nix-community/naersk/master";
|
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
utils.url = "github:numtide/flake-utils";
|
utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, utils, naersk }:
|
outputs = { self, nixpkgs, utils }:
|
||||||
utils.lib.eachDefaultSystem (system:
|
utils.lib.eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
name = "tas";
|
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
naersk-lib = pkgs.callPackage naersk { };
|
cargoToml = with builtins; (fromTOML (readFile ./Cargo.toml));
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
# Executes by `nix build .#<name>`
|
packages.default = pkgs.rustPlatform.buildRustPackage {
|
||||||
packages = {
|
inherit (cargoToml.package) name version;
|
||||||
${name} = naersk.lib.${system}.buildPackage {
|
src = nixpkgs.lib.cleanSource ./.;
|
||||||
pname = name;
|
doCheck = true;
|
||||||
root = ./.;
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
};
|
};
|
||||||
};
|
|
||||||
# Executes by `nix build .`
|
|
||||||
packages.default = packages.${name};
|
|
||||||
# the same but deprecated in Nix 2.7
|
|
||||||
defaultPackage = packages.default;
|
|
||||||
|
|
||||||
# Executes by `nix run .#<name> -- <args?>`
|
apps.default = utils.lib.mkApp {
|
||||||
apps = {
|
inherit (cargoToml.package) name;
|
||||||
${name} = utils.lib.mkApp {
|
drv = packages.default;
|
||||||
inherit name;
|
|
||||||
drv = packages.${name};
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
# Executes by `nix run . -- <args?>`
|
|
||||||
apps.default = apps.${name};
|
|
||||||
# the same but deprecated in Nix 2.7
|
|
||||||
defaultApp = apps.default;
|
|
||||||
|
|
||||||
# Used by `nix develop`
|
|
||||||
devShell = with pkgs; mkShell {
|
devShell = with pkgs; mkShell {
|
||||||
buildInputs = [ cargo rustc rustfmt rustPackages.clippy ];
|
packages = [ cargo rustc rustfmt clippy rust-analyzer ];
|
||||||
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue