From c28b44152f39cabd4c16a34cd9e73bad24685de7 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Wed, 5 Nov 2025 16:42:06 +0800 Subject: [PATCH] cetcd --- default.nix | 2 ++ flake.lock | 34 ++++++++++++++++++++++++++++++++++ flake.nix | 26 +++++++++++++++++--------- pkgs/c/cetcd/package.nix | 40 ++++++++++++++++++++++++++++++++++++++++ pkgs/u/uem/package.nix | 25 +++++++++++++++++++++---- 5 files changed, 114 insertions(+), 13 deletions(-) create mode 100644 pkgs/c/cetcd/package.nix diff --git a/default.nix b/default.nix index d0f57cd..6c5d401 100644 --- a/default.nix +++ b/default.nix @@ -16,6 +16,7 @@ let uem = callPackage ./pkgs/u/uem/package.nix { pkgs = pkgs; }; + cetcd = callPackage ./pkgs/cetcd/package.nix {}; in { xbuild = xbuild; @@ -25,4 +26,5 @@ in tinylog = tinylog; unity_test_with_color = unity_test_with_color; uem = uem; + cetcd = cetcd; } diff --git a/flake.lock b/flake.lock index b161c00..171c4ba 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "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": { "locked": { "lastModified": 1762111121, @@ -18,8 +36,24 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "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", diff --git a/flake.nix b/flake.nix index b680291..ff47767 100644 --- a/flake.nix +++ b/flake.nix @@ -1,21 +1,29 @@ { - description = "A very basic flake"; + description = "Flake for some special packages"; inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs}: + outputs = { self, nixpkgs, flake-utils}: let supportedSystems = [ "x86_64-linux" ]; - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; in - { - packages = forAllSystems (system: let - pkgs = nixpkgs.legacyPackages.${system}; - in - import ./default.nix { inherit pkgs; }); - }; + flake-utils.lib.eachSystem supportedSystems ( + system: let + pkgs = nixpkgs.legacyPackages.${system}; + xpkgs = 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; + } + ); } diff --git a/pkgs/c/cetcd/package.nix b/pkgs/c/cetcd/package.nix new file mode 100644 index 0000000..a4dba99 --- /dev/null +++ b/pkgs/c/cetcd/package.nix @@ -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 + ''; +} diff --git a/pkgs/u/uem/package.nix b/pkgs/u/uem/package.nix index 4d607de..fc7e9ac 100644 --- a/pkgs/u/uem/package.nix +++ b/pkgs/u/uem/package.nix @@ -3,6 +3,7 @@ stdenv, fetchFromGitHub, cmake, + pkgs, }: let @@ -22,14 +23,30 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "shen390s"; repo = "uem"; - tag = "v${finalAttrs.version}"; -# hash = "sha256-g0ubq7RxGQmL1R6vz9RIGJpVWYsgrZhsTWSrL1ySEug="; + rev = "develop"; + hash = "sha256-WLQak+5dbD4Zo3EgnW5YVhj5tNPJlkXYdd4lNLzRlq0="; }; - nativeBuildInputs = [ roswell ]; + nativeBuildInputs = [ pkgs.roswell ]; doCheck = true; buildPhase = '' - ros build roswell/uem.ros + set +e + export HOME=/build + env + ros version + find . + mkdir -p $HOME/.roswell + cat >$HOME/.roswell/init.lisp <