summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-01-09 00:52:03 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-01-09 00:52:03 +0100
commit1d3fc62af786ec1694cfe879e6f2abb4f50a6056 (patch)
treea7ea0f101c7ca037323f53cf2a4e086d13dc0386 /flake.nix
parentf92e45745a67f689ddf3e9fe73571de96a624312 (diff)
downloadap01-1d3fc62af786ec1694cfe879e6f2abb4f50a6056.tar
ap01-1d3fc62af786ec1694cfe879e6f2abb4f50a6056.tar.gz
ap01-1d3fc62af786ec1694cfe879e6f2abb4f50a6056.tar.bz2
ap01-1d3fc62af786ec1694cfe879e6f2abb4f50a6056.tar.xz
ap01-1d3fc62af786ec1694cfe879e6f2abb4f50a6056.zip
sunwait
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix52
1 files changed, 52 insertions, 0 deletions
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