nix: don't use naersik to build package
This commit is contained in:
parent
c0b010e279
commit
38be5079ff
3 changed files with 35 additions and 72 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,3 +2,5 @@
|
|||
|
||||
.env*
|
||||
!.env.example
|
||||
|
||||
.direnv
|
||||
|
|
36
flake.lock
36
flake.lock
|
@ -1,39 +1,6 @@
|
|||
{
|
||||
"nodes": {
|
||||
"naersk": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1655042882,
|
||||
"narHash": "sha256-9BX8Fuez5YJlN7cdPO63InoyBy7dm3VlJkkmTt6fS1A=",
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"rev": "cddffb5aa211f50c4b8750adbec0bbbdfb26bb9f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "master",
|
||||
"repo": "naersk",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1659190188,
|
||||
"narHash": "sha256-LudYrDFPFaQMW0l68TYkPWRPKmqpxIFU1nWfylIp9AQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a3fddd46a7f3418d7e3940ded94701aba569161d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1659190188,
|
||||
"narHash": "sha256-LudYrDFPFaQMW0l68TYkPWRPKmqpxIFU1nWfylIp9AQ=",
|
||||
|
@ -51,8 +18,7 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"naersk": "naersk",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"utils": "utils"
|
||||
}
|
||||
},
|
||||
|
|
69
flake.nix
69
flake.nix
|
@ -1,46 +1,41 @@
|
|||
{
|
||||
inputs = {
|
||||
naersk.url = "github:nix-community/naersk/master";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, utils, naersk }:
|
||||
utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
name = "vnetod";
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
naersk-lib = pkgs.callPackage naersk { };
|
||||
in
|
||||
rec {
|
||||
# Executes by `nix build .#<name>`
|
||||
packages = {
|
||||
${name} = naersk.lib.${system}.buildPackage {
|
||||
pname = name;
|
||||
root = ./.;
|
||||
};
|
||||
};
|
||||
# Executes by `nix build .`
|
||||
packages.default = packages.${name};
|
||||
# the same but deprecated in Nix 2.7
|
||||
defaultPackage = packages.default;
|
||||
outputs = { self, nixpkgs, utils }:
|
||||
let
|
||||
cargoToml = with builtins; (fromTOML (readFile ./Cargo.toml));
|
||||
|
||||
# Executes by `nix run .#<name> -- <args?>`
|
||||
apps = {
|
||||
${name} = utils.lib.mkApp {
|
||||
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;
|
||||
version = "${cargoToml.package.version}_${builtins.substring 0 8 self.lastModifiedDate}_${self.shortRev or "dirty"}";
|
||||
in
|
||||
utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
# Used by `nix develop`
|
||||
devShell = with pkgs; mkShell {
|
||||
buildInputs = [ cargo rustc rustfmt pre-commit rustPackages.clippy ];
|
||||
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
||||
};
|
||||
});
|
||||
vnetod = pkgs.rustPlatform.buildRustPackage {
|
||||
name = "vnetod-${version}";
|
||||
|
||||
src = lib.cleanSource ./.;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
||||
doCheck = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
apps.default = {
|
||||
type = "app";
|
||||
program = "${vnetod}/bin/vnetod";
|
||||
};
|
||||
|
||||
packages.default = vnetod;
|
||||
|
||||
devShell = pkgs.mkShell {
|
||||
packages = with pkgs; [ cargo rustc rustfmt clippy rust-analyzer ];
|
||||
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue