mirror of
https://codeberg.org/madmo/trvcontrol.git
synced 2024-12-03 10:33:56 +00:00
Add first flake test
This commit is contained in:
parent
793d03bdd6
commit
4524f67ddf
77
flake.lock
Normal file
77
flake.lock
Normal file
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709126324,
|
||||
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "d465f4819400de7c8d874d50b982301f28a84605",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"import-cargo": {
|
||||
"locked": {
|
||||
"lastModified": 1594305518,
|
||||
"narHash": "sha256-frtArgN42rSaEcEOYWg8sVPMUK+Zgch3c+wejcpX3DY=",
|
||||
"owner": "edolstra",
|
||||
"repo": "import-cargo",
|
||||
"rev": "25d40be4a73d40a2572e0cc233b83253554f06c5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "import-cargo",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1709237383,
|
||||
"narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"import-cargo": "import-cargo",
|
||||
"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
|
||||
}
|
42
flake.nix
Normal file
42
flake.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
import-cargo.url = "github:edolstra/import-cargo";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, import-cargo }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
inherit (import-cargo.builders) importCargo;
|
||||
in {
|
||||
packages.default = pkgs.stdenv.mkDerivation {
|
||||
name = "trvcontrol";
|
||||
src = self;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
# setupHook which makes sure that a CARGO_HOME with vendored dependencies
|
||||
# exists
|
||||
(importCargo {
|
||||
lockFile = ./Cargo.lock;
|
||||
inherit pkgs;
|
||||
}).cargoHome
|
||||
|
||||
# Build-time dependencies
|
||||
rustc
|
||||
cargo
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
cargo build --release --offline
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
install -Dm775 ./target/release/trvcontrol $out/bin/trvcontrol
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue