Compare commits
1 commit
main
...
feat/flake
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbce1ae3a2 |
4 changed files with 87 additions and 25 deletions
22
default.nix
Normal file
22
default.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
let
|
||||||
|
lockFile = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||||
|
flake-compat-node = lockFile.nodes.${lockFile.nodes.root.inputs.flake-compat};
|
||||||
|
flake-compat = builtins.fetchTarball {
|
||||||
|
inherit (flake-compat-node.locked) url;
|
||||||
|
sha256 = flake-compat-node.locked.narHash;
|
||||||
|
};
|
||||||
|
|
||||||
|
flake' = (
|
||||||
|
import flake-compat {
|
||||||
|
src = ./.;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
flake = flake'.defaultNix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
useFlake ? true,
|
||||||
|
nixpkgs ? if useFlake then flake.inputs.nixpkgs else <nixpkgs>,
|
||||||
|
pkgs ? import nixpkgs { },
|
||||||
|
}:
|
||||||
|
|
||||||
|
pkgs.callPackage ./scope.nix { }
|
||||||
15
flake.lock
generated
15
flake.lock
generated
|
|
@ -1,5 +1,19 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1751685974,
|
||||||
|
"narHash": "sha256-NKw96t+BgHIYzHUjkTK95FqYRVKB8DHpVhefWSz/kTw=",
|
||||||
|
"rev": "549f2762aebeff29a2e5ece7a7dc0f955281a1d1",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://git.lix.systems/api/v1/repos/lix-project/flake-compat/archive/549f2762aebeff29a2e5ece7a7dc0f955281a1d1.tar.gz?rev=549f2762aebeff29a2e5ece7a7dc0f955281a1d1"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://git.lix.systems/lix-project/flake-compat/archive/main.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-parts": {
|
"flake-parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": [
|
"nixpkgs-lib": [
|
||||||
|
|
@ -38,6 +52,7 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
34
flake.nix
34
flake.nix
|
|
@ -3,6 +3,10 @@
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||||
|
flake-compat = {
|
||||||
|
url = "https://git.lix.systems/lix-project/flake-compat/archive/main.tar.gz";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
|
|
@ -16,27 +20,7 @@
|
||||||
perSystem =
|
perSystem =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
let
|
let
|
||||||
buildEnvVars = {
|
scope = pkgs.callPackage ./scope.nix { };
|
||||||
BIN_XDG_PERMISSION_STORE = "${pkgs.xdg-desktop-portal}/libexec/xdg-permission-store";
|
|
||||||
BIN_XDG_DOCUMENT_PORTAL = "${pkgs.xdg-desktop-portal}/libexec/xdg-document-portal";
|
|
||||||
BIN_VIRTIOFSD = "${pkgs.virtiofsd}/bin/virtiofsd";
|
|
||||||
};
|
|
||||||
|
|
||||||
rustPackage =
|
|
||||||
crate:
|
|
||||||
let
|
|
||||||
cargoToml = builtins.fromTOML (builtins.readFile ./${crate}/Cargo.toml);
|
|
||||||
in
|
|
||||||
pkgs.rustPlatform.buildRustPackage {
|
|
||||||
inherit (cargoToml.package) name version;
|
|
||||||
src = ./.;
|
|
||||||
cargoLock.lockFile = ./Cargo.lock;
|
|
||||||
cargoLock.outputHashes = {
|
|
||||||
"busd-0.5.0" = "sha256-IZZ2MeEmUbzRrH6SUz0pnecMH4f8Mh54WdhI4q44YfI=";
|
|
||||||
};
|
|
||||||
buildAndTestSubdir = crate;
|
|
||||||
env = buildEnvVars;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
|
|
@ -46,11 +30,11 @@
|
||||||
rust-analyzer
|
rust-analyzer
|
||||||
clippy
|
clippy
|
||||||
];
|
];
|
||||||
env = buildEnvVars;
|
env = scope.buildEnvVars;
|
||||||
|
};
|
||||||
|
packages = {
|
||||||
|
inherit (scope) sidebus-agent sidebus-broker;
|
||||||
};
|
};
|
||||||
|
|
||||||
packages.sidebus-agent = rustPackage "sidebus-agent";
|
|
||||||
packages.sidebus-broker = rustPackage "sidebus-broker";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
flake = {
|
flake = {
|
||||||
|
|
|
||||||
41
scope.nix
Normal file
41
scope.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
{ lib, newScope }:
|
||||||
|
|
||||||
|
lib.makeScope newScope (self: {
|
||||||
|
forgetScope = lib.flip lib.removeAttrs [
|
||||||
|
"override"
|
||||||
|
"overrideDerivation"
|
||||||
|
"overrideScope"
|
||||||
|
"newScope"
|
||||||
|
"packages"
|
||||||
|
"forgetScope"
|
||||||
|
];
|
||||||
|
buildEnvVars = self.forgetScope (
|
||||||
|
self.callPackage (
|
||||||
|
{ xdg-desktop-portal, virtiofsd }:
|
||||||
|
{
|
||||||
|
BIN_XDG_PERMISSION_STORE = "${xdg-desktop-portal}/libexec/xdg-permission-store";
|
||||||
|
BIN_XDG_DOCUMENT_PORTAL = "${xdg-desktop-portal}/libexec/xdg-document-portal";
|
||||||
|
BIN_VIRTIOFSD = "${virtiofsd}/bin/virtiofsd";
|
||||||
|
}
|
||||||
|
) { }
|
||||||
|
);
|
||||||
|
rustPackage =
|
||||||
|
{
|
||||||
|
crate,
|
||||||
|
cargoToml ? builtins.fromTOML (builtins.readFile ./${crate}/Cargo.toml),
|
||||||
|
rustPlatform,
|
||||||
|
buildEnvVars,
|
||||||
|
}:
|
||||||
|
rustPlatform.buildRustPackage {
|
||||||
|
inherit (cargoToml.package) name version;
|
||||||
|
src = ./.;
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
cargoLock.outputHashes = {
|
||||||
|
"busd-0.5.0" = "sha256-IZZ2MeEmUbzRrH6SUz0pnecMH4f8Mh54WdhI4q44YfI=";
|
||||||
|
};
|
||||||
|
buildAndTestSubdir = crate;
|
||||||
|
env = buildEnvVars;
|
||||||
|
};
|
||||||
|
sidebus-agent = self.callPackage self.rustPackage { crate = "sidebus-agent"; };
|
||||||
|
sidebus-broker = self.callPackage self.rustPackage { crate = "sidebus-broker"; };
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue