summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--files/.config7
-rw-r--r--flake.lock20
-rw-r--r--flake.nix52
3 files changed, 78 insertions, 1 deletions
diff --git a/files/.config b/files/.config
index 80044c5..32d2146 100644
--- a/files/.config
+++ b/files/.config
@@ -716,6 +716,7 @@ CONFIG_FEED_packages=y
716CONFIG_FEED_luci=y 716CONFIG_FEED_luci=y
717CONFIG_FEED_routing=y 717CONFIG_FEED_routing=y
718CONFIG_FEED_telephony=y 718CONFIG_FEED_telephony=y
719CONFIG_FEED_sunwait=y
719 720
720# 721#
721# Base system 722# Base system
@@ -6934,6 +6935,12 @@ CONFIG_PACKAGE_e2fsprogs=y
6934# end of Terminal 6935# end of Terminal
6935 6936
6936# 6937#
6938# Utilities
6939#
6940CONFIG_PACKAGE_sunwait=y
6941# end of Utilities
6942
6943#
6937# Virtualization 6944# Virtualization
6938# 6945#
6939# end of Virtualization 6946# end of Virtualization
diff --git a/flake.lock b/flake.lock
index 79e8421..f4aeef7 100644
--- a/flake.lock
+++ b/flake.lock
@@ -121,7 +121,25 @@
121 "openwrt-luci": "openwrt-luci", 121 "openwrt-luci": "openwrt-luci",
122 "openwrt-packages": "openwrt-packages", 122 "openwrt-packages": "openwrt-packages",
123 "openwrt-routing": "openwrt-routing", 123 "openwrt-routing": "openwrt-routing",
124 "openwrt-telephony": "openwrt-telephony" 124 "openwrt-telephony": "openwrt-telephony",
125 "sunwait": "sunwait"
126 }
127 },
128 "sunwait": {
129 "flake": false,
130 "locked": {
131 "lastModified": 1603744793,
132 "narHash": "sha256-XQ16/JuHFQuHfToMZ3O5+5kvmFGJTKHiB4Hqb1nLSDM=",
133 "owner": "risacher",
134 "repo": "sunwait",
135 "rev": "102cb417ecbb7a3757ba9ee4b94d6db3225124c4",
136 "type": "github"
137 },
138 "original": {
139 "owner": "risacher",
140 "ref": "master",
141 "repo": "sunwait",
142 "type": "github"
125 } 143 }
126 } 144 }
127 }, 145 },
diff --git a/flake.nix b/flake.nix
index 33f1e76..ab4a0ef 100644
--- a/flake.nix
+++ b/flake.nix
@@ -38,6 +38,14 @@
38 url = "git+https://git.openwrt.org/feed/telephony.git"; 38 url = "git+https://git.openwrt.org/feed/telephony.git";
39 flake = false; 39 flake = false;
40 }; 40 };
41
42 sunwait = {
43 type = "github";
44 owner = "risacher";
45 repo = "sunwait";
46 ref = "master";
47 flake = false;
48 };
41 }; 49 };
42 50
43 outputs = { self, openwrt, nixpkgs, flake-utils, ... }@inputs: flake-utils.lib.eachDefaultSystem (system: 51 outputs = { self, openwrt, nixpkgs, flake-utils, ... }@inputs: flake-utils.lib.eachDefaultSystem (system:
@@ -100,11 +108,55 @@
100 108
101 phases = [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" ]; 109 phases = [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" ];
102 patchPhase = let 110 patchPhase = let
111 sunwaitRepo = pkgs.runCommand "openwrt-sunwait" {} ''
112 mkdir -p $out/utils/sunwait
113 cp ${pkgs.writeText "Makefile" ''
114 include $(TOPDIR)/rules.mk
115
116 PKG_NAME:=sunwait
117 PKG_VERSION:=${inputs.sunwait.rev}
118 PKG_RELEASE:=1
119
120 include $(INCLUDE_DIR)/package.mk
121
122 define Package/sunwait
123 SECTION:=util
124 CATEGORY:=Utilities
125 TITLE:=Sunwait
126 URL:=https://github.com/risacher/sunwait
127 DEPENDS:=+libstdcpp +libc
128 endef
129
130 define Package/sunwait/description
131 Wait until the specified solar event
132 endef
133
134 define Build/Prepare
135 cp -r ${inputs.sunwait} .
136 cd $(basename ${inputs.sunwait})
137 endef
138
139 define Build/Compile
140 $(TARGET_CC) $(TARGET_CPPFLAGS) -o $(PKG_BUILD_DIR)/sunwait.o -c $(PKG_BUILD_DIR)/sunwait.cpp
141 $(TARGET_CC) $(TARGET_CPPFLAGS) -o $(PKG_BUILD_DIR)/sunriset.o -c $(PKG_BUILD_DIR)/sunriset.cpp
142 $(TARGET_CC) $(TARGET_CPPFLAGS) -o $(PKG_BUILD_DIR)/print.o -c $(PKG_BUILD_DIR)/print.cpp
143 $(TARGET_CC) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/$1 $(PKG_BUILD_DIR)/sunwait.o $(PKG_BUILD_DIR)/sunriset.o $(PKG_BUILD_DIR)/print.o -lm -lstdc++
144 endef
145
146 define Package/sunwait/install
147 $(INSTALL_DIR) $(1)/usr/bin
148 $(INSTALL_BIN) $(PKG_BUILD_DIR)/sunwait $(1)/usr/bin/
149 endef
150
151 $(eval $(call BuildPackage,sunwait))
152 ''} $out/utils/sunwait/Makefile
153 '';
103 feedsConf = pkgs.writeText "feeds.conf" '' 154 feedsConf = pkgs.writeText "feeds.conf" ''
104 src-cpy packages ${inputs.openwrt-packages} 155 src-cpy packages ${inputs.openwrt-packages}
105 src-cpy luci ${inputs.openwrt-luci} 156 src-cpy luci ${inputs.openwrt-luci}
106 src-cpy routing ${inputs.openwrt-routing} 157 src-cpy routing ${inputs.openwrt-routing}
107 src-cpy telephony ${inputs.openwrt-telephony} 158 src-cpy telephony ${inputs.openwrt-telephony}
159 src-cpy sunwait ${sunwaitRepo}
108 ''; 160 '';
109 in '' 161 in ''
110 rm feeds.conf.default 162 rm feeds.conf.default