mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-28 16:00:58 +00:00
feat: simple nix flake
This commit is contained in:
parent
a4c732bd07
commit
f2cd9f606c
282
flake.lock
Normal file
282
flake.lock
Normal file
@ -0,0 +1,282 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"android-nixpkgs": {
|
||||||
|
"inputs": {
|
||||||
|
"devshell": "devshell",
|
||||||
|
"flake-utils": "flake-utils_2",
|
||||||
|
"nixpkgs": [
|
||||||
|
"flakebox",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1695500413,
|
||||||
|
"narHash": "sha256-yinrAWIc4XZbWQoXOYkUO0lCNQ5z/vMyl+QCYuIwdPc=",
|
||||||
|
"owner": "dpc",
|
||||||
|
"repo": "android-nixpkgs",
|
||||||
|
"rev": "2e42268a196375ce9b010a10ec5250d2f91a09b4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "dpc",
|
||||||
|
"repo": "android-nixpkgs",
|
||||||
|
"rev": "2e42268a196375ce9b010a10ec5250d2f91a09b4",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"crane": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"flakebox",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1710886643,
|
||||||
|
"narHash": "sha256-saTZuv9YeZ9COHPuj8oedGdUwJZcbQ3vyRqe7NVJMsQ=",
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"rev": "5bace74e9a65165c918205cf67ad3977fe79c584",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"rev": "5bace74e9a65165c918205cf67ad3977fe79c584",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"devshell": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"flakebox",
|
||||||
|
"android-nixpkgs",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"systems": "systems_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1695195896,
|
||||||
|
"narHash": "sha256-pq9q7YsGXnQzJFkR5284TmxrLNFc0wo4NQ/a5E93CQU=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"rev": "05d40d17bf3459606316e3e9ec683b784ff28f16",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fenix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715322226,
|
||||||
|
"narHash": "sha256-ezoe/FwfJpA7sskLoLP2iwfwkYnscEFCP6Vk5kPwh9k=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"rev": "297c756ba6249d483c1dafe42378560458842173",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1710146030,
|
||||||
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils_2": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems_3"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1694529238,
|
||||||
|
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils_3": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": [
|
||||||
|
"flakebox",
|
||||||
|
"systems"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1710146030,
|
||||||
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flakebox": {
|
||||||
|
"inputs": {
|
||||||
|
"android-nixpkgs": "android-nixpkgs",
|
||||||
|
"crane": "crane",
|
||||||
|
"fenix": [
|
||||||
|
"fenix"
|
||||||
|
],
|
||||||
|
"flake-utils": "flake-utils_3",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"systems": "systems_4"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1712778429,
|
||||||
|
"narHash": "sha256-oile9hEqPZdlLLGAy359Lpek36lPoKPbWtda63I3/5o=",
|
||||||
|
"owner": "dpc",
|
||||||
|
"repo": "flakebox",
|
||||||
|
"rev": "226d584e9a288b9a0471af08c5712e7fac6f87dc",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "dpc",
|
||||||
|
"repo": "flakebox",
|
||||||
|
"rev": "226d584e9a288b9a0471af08c5712e7fac6f87dc",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715218190,
|
||||||
|
"narHash": "sha256-R98WOBHkk8wIi103JUVQF3ei3oui4HvoZcz9tYOAwlk=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "9a9960b98418f8c385f52de3b09a63f9c561427a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-23.11",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"fenix": "fenix",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"flakebox": "flakebox",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-analyzer-src": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715255944,
|
||||||
|
"narHash": "sha256-vLLgYpdtKBaGYTamNLg1rbRo1bPXp4Jgded/gnprPVw=",
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"rev": "5bf2f85c8054d80424899fa581db1b192230efb5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"ref": "nightly",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems_3": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems_4": {
|
||||||
|
"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
|
||||||
|
}
|
101
flake.nix
Normal file
101
flake.nix
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs = { url = "github:nixos/nixpkgs/nixos-23.11"; };
|
||||||
|
|
||||||
|
fenix = {
|
||||||
|
url = "github:nix-community/fenix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
flakebox = {
|
||||||
|
url = "github:dpc/flakebox?rev=226d584e9a288b9a0471af08c5712e7fac6f87dc";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.fenix.follows = "fenix";
|
||||||
|
};
|
||||||
|
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flakebox, fenix, flake-utils }:
|
||||||
|
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
lib = pkgs.lib;
|
||||||
|
flakeboxLib =
|
||||||
|
flakebox.lib.${system} { config.flakebox.init.enable = false; };
|
||||||
|
rustSrc = flakeboxLib.filterSubPaths {
|
||||||
|
root = builtins.path {
|
||||||
|
name = "gossip";
|
||||||
|
path = ./.;
|
||||||
|
};
|
||||||
|
paths = [ "Cargo.toml" "Cargo.lock" ".cargo" "src" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
toolchainArgs = let llvmPackages = pkgs.llvmPackages_11;
|
||||||
|
in {
|
||||||
|
extraRustFlags = "--cfg tokio_unstable";
|
||||||
|
|
||||||
|
components = [ "rustc" "cargo" "clippy" "rust-analyzer" "rust-src" ];
|
||||||
|
|
||||||
|
args = {
|
||||||
|
nativeBuildInputs = [ ]
|
||||||
|
++ lib.optionals (!pkgs.stdenv.isDarwin) [ ];
|
||||||
|
};
|
||||||
|
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
|
||||||
|
stdenv = pkgs.clang11Stdenv;
|
||||||
|
clang = llvmPackages.clang;
|
||||||
|
libclang = llvmPackages.libclang.lib;
|
||||||
|
clang-unwrapped = llvmPackages.clang-unwrapped;
|
||||||
|
};
|
||||||
|
|
||||||
|
# all standard toolchains provided by flakebox
|
||||||
|
toolchainsStd = flakeboxLib.mkStdFenixToolchains toolchainArgs;
|
||||||
|
|
||||||
|
toolchainsNative = (pkgs.lib.getAttrs [ "default" ] toolchainsStd);
|
||||||
|
|
||||||
|
toolchainNative =
|
||||||
|
flakeboxLib.mkFenixMultiToolchain { toolchains = toolchainsNative; };
|
||||||
|
|
||||||
|
commonArgs = {
|
||||||
|
buildInputs = [ ] ++ lib.optionals pkgs.stdenv.isDarwin [
|
||||||
|
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
|
||||||
|
pkgs.darwin.apple_sdk.frameworks.OpenGL
|
||||||
|
pkgs.darwin.apple_sdk.frameworks.AppKit
|
||||||
|
];
|
||||||
|
nativeBuildInputs = [ pkgs.pkg-config ];
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = (flakeboxLib.craneMultiBuild { toolchains = toolchainsStd; })
|
||||||
|
(craneLib':
|
||||||
|
let
|
||||||
|
craneLib = (craneLib'.overrideArgs {
|
||||||
|
pname = "flexbox-multibuild";
|
||||||
|
src = rustSrc;
|
||||||
|
}).overrideArgs commonArgs;
|
||||||
|
in rec {
|
||||||
|
workspaceDeps = craneLib.buildWorkspaceDepsOnly { };
|
||||||
|
workspaceBuild =
|
||||||
|
craneLib.buildWorkspace { cargoArtifacts = workspaceDeps; };
|
||||||
|
gossip = craneLib.buildPackageGroup {
|
||||||
|
pname = "gossip";
|
||||||
|
packages = [ "gossip-bin" "gossip-lib" ];
|
||||||
|
mainProgram = "gossip-bin";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
legacyPackages = outputs;
|
||||||
|
packages = { default = outputs.gossip; };
|
||||||
|
devShells = flakeboxLib.mkShells {
|
||||||
|
packages = [ ];
|
||||||
|
buildInputs = commonArgs.buildInputs;
|
||||||
|
nativeBuildInputs = [ ];
|
||||||
|
shellHook = ''
|
||||||
|
export RUSTFLAGS="--cfg tokio_unstable"
|
||||||
|
export RUSTDOCFLAGS="--cfg tokio_unstable"
|
||||||
|
export RUST_LOG="info"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user