This commit is contained in:
Rongsong Shen 2025-11-05 16:42:06 +08:00
parent f7244c7e45
commit c28b44152f
5 changed files with 114 additions and 13 deletions

View file

@ -16,6 +16,7 @@ let
uem = callPackage ./pkgs/u/uem/package.nix { uem = callPackage ./pkgs/u/uem/package.nix {
pkgs = pkgs; pkgs = pkgs;
}; };
cetcd = callPackage ./pkgs/cetcd/package.nix {};
in in
{ {
xbuild = xbuild; xbuild = xbuild;
@ -25,4 +26,5 @@ in
tinylog = tinylog; tinylog = tinylog;
unity_test_with_color = unity_test_with_color; unity_test_with_color = unity_test_with_color;
uem = uem; uem = uem;
cetcd = cetcd;
} }

34
flake.lock generated
View file

@ -1,5 +1,23 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1762111121, "lastModified": 1762111121,
@ -18,8 +36,24 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "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", "root": "root",

View file

@ -1,21 +1,29 @@
{ {
description = "A very basic flake"; description = "Flake for some special packages";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs}: outputs = { self, nixpkgs, flake-utils}:
let let
supportedSystems = [ "x86_64-linux" ]; supportedSystems = [ "x86_64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in in
{ flake-utils.lib.eachSystem supportedSystems (
packages = forAllSystems (system: let system: let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in xpkgs = import ./default.nix { inherit pkgs; };
import ./default.nix { inherit pkgs; }); in rec {
packages = xpkgs;
defaultPackage = xpkgs.uem;
devShells.default = pkgs.mkShell {
nativeBuildInputs = xpkgs.uem.nativeBuildInputs;
}; };
devShell = self.devShells.${system}.default;
}
);
} }

40
pkgs/c/cetcd/package.nix Normal file
View file

@ -0,0 +1,40 @@
{
lib,
stdenv,
fetchFromGitHub,
pkgs,
...
}:
stdenv.mkDerivation {
pname = "cetcd";
version = "1.0.0";
src = fetchFromGitHub {
owner = "shen390s";
repo = "cetcd";
rev = "master";
# sha256 = "sha256-9dzSc3w+yxYzsF/rZe3qIarKOpjt2zvIyjuS5FXngIM=";
};
nativeBuildInputs = [
pkgs.make
pkgs.curl
pkgs.pkg-config
pkgs.yajl
];
configurePhase = ''
true
'';
buildPhase = ''
make prefix=$out
'';
installPhase = ''
runHook preInstall
make install prefix=$out
runHook postInstall
'';
}

View file

@ -3,6 +3,7 @@
stdenv, stdenv,
fetchFromGitHub, fetchFromGitHub,
cmake, cmake,
pkgs,
}: }:
let let
@ -22,14 +23,30 @@ stdenv.mkDerivation (finalAttrs: {
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "shen390s"; owner = "shen390s";
repo = "uem"; repo = "uem";
tag = "v${finalAttrs.version}"; rev = "develop";
# hash = "sha256-g0ubq7RxGQmL1R6vz9RIGJpVWYsgrZhsTWSrL1ySEug="; hash = "sha256-WLQak+5dbD4Zo3EgnW5YVhj5tNPJlkXYdd4lNLzRlq0=";
}; };
nativeBuildInputs = [ roswell ]; nativeBuildInputs = [ pkgs.roswell ];
doCheck = true; doCheck = true;
buildPhase = '' buildPhase = ''
ros build roswell/uem.ros set +e
export HOME=/build
env
ros version
find .
mkdir -p $HOME/.roswell
cat >$HOME/.roswell/init.lisp <<EOF
;; (ql:quickload 'asdf-driver)
(let ((cwd (parse-native-namestring (sb-posix:getcwd)
nil
*default-pathname-defaults*
:as-directory t)))
(push cwd
asdf:*central-registry*))
EOF
ros -l $HOME/.roswell/init.lisp build roswell/uem.ros
''; '';
}) })