This commit is contained in:
Astro 2021-10-30 01:18:04 +02:00
parent 54efe3f631
commit d35c3aa18a
2 changed files with 131 additions and 0 deletions

79
flake.lock Normal file
View File

@ -0,0 +1,79 @@
{
"nodes": {
"mozillapkgs": {
"flake": false,
"locked": {
"lastModified": 1634833229,
"narHash": "sha256-uDbVCkW91/AY87mTwm8XrX2E133LTFqwYsYNNxBcY9M=",
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"rev": "6070a8ee799f629cb1d0004821f77ceed94d3992",
"type": "github"
},
"original": {
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1635444951,
"narHash": "sha256-1y3YkERwoYDIZjGow7HLAR8K3C/9VBPCBy8VpftMPsM=",
"owner": "nmattia",
"repo": "naersk",
"rev": "0d2ce479df4633dbeb53a8ea96e5098ed37fbcc6",
"type": "github"
},
"original": {
"owner": "nmattia",
"repo": "naersk",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1635547145,
"narHash": "sha256-qhyl0MMqBal5io91P6Qu7Lb20NM5Y1+2Y4TkUCN1nJQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ecebf0602cb068c784f386dd7f0bbeba57d619e4",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"mozillapkgs": "mozillapkgs",
"naersk": "naersk",
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"utils": {
"locked": {
"lastModified": 1634851050,
"narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c91f3de5adaf1de973b797ef7485e441a65b8935",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

52
flake.nix Normal file
View File

@ -0,0 +1,52 @@
{
inputs = {
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nmattia/naersk";
mozillapkgs.url = "github:mozilla/nixpkgs-mozilla";
mozillapkgs.flake = false;
};
outputs = { self, nixpkgs, utils, naersk, mozillapkgs }:
utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages."${system}";
mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") {};
rust = (mozilla.rustChannelOf {
channel = "stable";
date = "2021-10-04";
sha256 = "0swglfa63i14fpgg98agx4b5sz0nckn6phacfy3k6imknsiv8mrg";
}).rust;
# Override the version used in naersk
naersk-lib = naersk.lib."${system}".override {
cargo = rust;
rustc = rust;
};
in rec {
# `nix build`
packages.heliwatch = naersk-lib.buildPackage {
pname = "heliwatch";
root = builtins.filterSource (path: type:
builtins.elem (baseNameOf path) [
"src"
"Cargo.toml"
"Cargo.lock"
] || baseNameOf (dirOf path) == "src"
) ./.;
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ openssl ];
};
defaultPackage = packages.heliwatch;
# `nix run`
apps.heliwatch = utils.lib.mkApp {
drv = packages.heliwatch;
};
defaultApp = apps.heliwatch;
# `nix develop`
devShell = pkgs.mkShell {
nativeBuildInputs = with defaultPackage;
nativeBuildInputs ++ buildInputs;
};
});
}