Add flake.nix
This commit is contained in:
parent
39b97c2532
commit
a32a638723
|
@ -3,6 +3,8 @@ name = "woossh"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "GPL-3.0+"
|
||||
description = "A websocket tunnel for SSH"
|
||||
repository = "https://git.pvv.ntnu.no/oysteikt/woossh"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
"nodes": {
|
||||
"fenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714285404,
|
||||
"narHash": "sha256-MmoQIO+KRiH3UnH0myAp2Fgi84rmpROMfw9VIbqrjHA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "94be183087845937b0fd77281c37d0796572b899",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1714253743,
|
||||
"narHash": "sha256-mdTQw2XlariysyScCv2tTE45QSU9v/ezLcHJ22f0Nxc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "58a1abdbae3217ca6b702f03d3b35125d88a2994",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"fenix": "fenix",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1714217560,
|
||||
"narHash": "sha256-zttBYGaoHpZfqWHQ8OI5f9OkGHCHb8tDBMySwsYNa2U=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "f216be4a0746142c5f30835b254871256a7637b8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rust-lang",
|
||||
"ref": "nightly",
|
||||
"repo": "rust-analyzer",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
fenix.url = "github:nix-community/fenix";
|
||||
fenix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, fenix }:
|
||||
let
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: let
|
||||
toolchain = fenix.packages.${system}.complete;
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
(_: super: let pkgs = fenix.inputs.nixpkgs.legacyPackages.${system}; in fenix.overlays.default pkgs pkgs)
|
||||
];
|
||||
};
|
||||
in f system pkgs toolchain);
|
||||
in {
|
||||
apps = forAllSystems (system: pkgs: _: let
|
||||
mkApp = program: {
|
||||
type = "app";
|
||||
program = "${pkgs.lib.getExe program}";
|
||||
};
|
||||
in {
|
||||
default = mkApp self.packages.${system}.default;
|
||||
});
|
||||
|
||||
devShell = forAllSystems (system: pkgs: toolchain: pkgs.mkShell {
|
||||
packages = [
|
||||
(toolchain.withComponents [
|
||||
"cargo" "rustc" "rustfmt" "clippy"
|
||||
])
|
||||
];
|
||||
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/";
|
||||
});
|
||||
|
||||
overlays.default = final: prev: self.packages.${prev.system};
|
||||
|
||||
packages = (forAllSystems (system: pkgs: _: {
|
||||
default = let
|
||||
cargo-toml = pkgs.lib.importTOML ./Cargo.toml;
|
||||
in pkgs.rustPlatform.buildRustPackage rec {
|
||||
pname = cargo-toml.package.name;
|
||||
version = cargo-toml.package.version;
|
||||
src = ./.;
|
||||
|
||||
cargoSha256 = "sha256-ykcbKz8NnSw1uP8ajBVr/PGZKrDJvjFKpaFOyKoEGTc=";
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
description = cargo-toml.package.description;
|
||||
homepage = cargo-toml.package.repository;
|
||||
license = licenses.mit;
|
||||
platforms = systems;
|
||||
mainProgram = (pkgs.lib.head cargo-toml.bin).name;
|
||||
};
|
||||
};
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue