Format, move overlay to overlays to match ~/.config/nixpkgs/overlays/

This commit is contained in:
Sandro - 2022-12-04 07:48:45 +01:00
parent a9590e3242
commit 695e095d44
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
24 changed files with 332 additions and 288 deletions

View File

@ -202,7 +202,7 @@
extraHostRegistry.hosts = import ./host-registry.nix; extraHostRegistry.hosts = import ./host-registry.nix;
hostRegistry = lib.recursiveUpdate zwHostRegistry extraHostRegistry; hostRegistry = lib.recursiveUpdate zwHostRegistry extraHostRegistry;
in { in {
overlay = import ./overlay { overlay = import ./overlays {
inherit nixos-unstable; inherit nixos-unstable;
inherit (inputs) tracer bevy-mandelbrot bevy-julia; inherit (inputs) tracer bevy-mandelbrot bevy-julia;
}; };

View File

@ -33,12 +33,14 @@ with final; {
postFixup = '' postFixup = ''
patchelf --set-rpath ${lib.makeLibraryPath buildInputs} $out/bin/allcolors-rs patchelf --set-rpath ${lib.makeLibraryPath buildInputs} $out/bin/allcolors-rs
''; '';
desktopItems = [ (makeDesktopItem { desktopItems = [
(makeDesktopItem {
name = "allcolors"; name = "allcolors";
desktopName = "Polygon's allcolors-rs"; desktopName = "Polygon's allcolors-rs";
categories = [ "Game" ]; categories = [ "Game" ];
exec = "allcolors-rs"; exec = "allcolors-rs";
}) ]; })
];
}; };
inherit (bevy-julia.packages.${system}) bevy_julia; inherit (bevy-julia.packages.${system}) bevy_julia;

View File

@ -1,5 +1,7 @@
{ fetchFromGitHub, rustPlatform { fetchFromGitHub
, pkg-config, llvmPackages , rustPlatform
, pkg-config
, llvmPackages
, soapysdr-with-plugins , soapysdr-with-plugins
}: }:

View File

@ -1,8 +1,18 @@
{ naersk, fenix { naersk
, curl, nodejs, rustPlatform , fenix
, stdenv, fetchFromGitHub, buildEnv, fetchCrate , curl
, pkg-config, gettext, wasm-pack, binaryen , nodejs
, openssl, postgresql , rustPlatform
, stdenv
, fetchFromGitHub
, buildEnv
, fetchCrate
, pkg-config
, gettext
, wasm-pack
, binaryen
, openssl
, postgresql
}: }:
let let
@ -80,7 +90,8 @@ let
inherit src version; inherit src version;
nativeBuildInputs = [ nativeBuildInputs = [
pkg-config gettext pkg-config
gettext
wasm-bindgen-cli wasm-bindgen-cli
]; ];
buildInputs = [ buildInputs = [
@ -115,7 +126,10 @@ let
pname = "plume-front"; pname = "plume-front";
root = src; root = src;
nativeBuildInputs = [ nativeBuildInputs = [
gettext wasm-pack wasm-bindgen-cli binaryen gettext
wasm-pack
wasm-bindgen-cli
binaryen
]; ];
CARGO_BUILD_TARGET = "wasm32-unknown-unknown"; CARGO_BUILD_TARGET = "wasm32-unknown-unknown";
cargoBuildOptions = x: cargoBuildOptions = x:
@ -133,7 +147,8 @@ let
''; '';
}; };
}; };
in buildEnv { in
buildEnv {
name = "plume-env"; name = "plume-env";
paths = [ plume plume-front plm ]; paths = [ plume plume-front plm ];
passthru = { inherit plume plm; }; passthru = { inherit plume plm; };

View File

@ -1,7 +1,12 @@
{ stdenv, fetchFromGitHub { stdenv
, pkg-config, protobufc , fetchFromGitHub
, ncurses, rrdtool, libusb1 , pkg-config
, libbladeRF, librtlsdr , protobufc
, ncurses
, rrdtool
, libusb1
, libbladeRF
, librtlsdr
# , libad9361, libiio # , libad9361, libiio
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -17,12 +22,16 @@ stdenv.mkDerivation rec {
}; };
nativeBuildInputs = [ nativeBuildInputs = [
pkg-config protobufc pkg-config
protobufc
]; ];
buildInputs = [ buildInputs = [
ncurses rrdtool libusb1 ncurses
libbladeRF librtlsdr rrdtool
libusb1
libbladeRF
librtlsdr
# libad9361 libiio # libad9361 libiio
]; ];

View File

@ -16,15 +16,20 @@ let
# allowing --override-input # allowing --override-input
inputPaths = lib.escapeShellArgs (builtins.attrValues inputs); inputPaths = lib.escapeShellArgs (builtins.attrValues inputs);
in in
lib.attrsets.mapAttrs (system: pkgs: lib.attrsets.mapAttrs
let overlayPkgs = builtins.intersectAttrs (self.overlay {} {}) pkgs; (system: pkgs:
in overlayPkgs // let
overlayPkgs = builtins.intersectAttrs (self.overlay { } { }) pkgs;
in
overlayPkgs //
{
host-registry = pkgs.runCommand "host-registry"
{ {
host-registry = pkgs.runCommand "host-registry" {
src = builtins.toFile "host-registry.nix" ( src = builtins.toFile "host-registry.nix" (
lib.generators.toPretty { } hostRegistry lib.generators.toPretty { } hostRegistry
); );
} '' }
''
ln -s $src $out ln -s $src $out
''; '';
@ -65,9 +70,11 @@ lib.attrsets.mapAttrs (system: pkgs:
'') (builtins.attrNames self.nixosConfigurations)} '') (builtins.attrNames self.nixosConfigurations)}
''; '';
prebuild-all = pkgs.runCommand "prebuild-all" { prebuild-all = pkgs.runCommand "prebuild-all"
{
preferLocalBuild = true; preferLocalBuild = true;
} '' }
''
mkdir $out mkdir $out
${pkgs.lib.concatMapStrings (name: '' ${pkgs.lib.concatMapStrings (name: ''
@ -90,16 +97,20 @@ lib.attrsets.mapAttrs (system: pkgs:
} // } //
builtins.foldl' (result: host: result // { builtins.foldl'
(result: host: result // {
# TODO: check if the ethernet address is reachable and if not, # TODO: check if the ethernet address is reachable and if not,
# execute wol on a machine in HQ. # execute wol on a machine in HQ.
"${host}-wake" = pkgs.writeScriptBin "${host}-wake" '' "${host}-wake" = pkgs.writeScriptBin "${host}-wake" ''
#!${pkgs.runtimeShell} #!${pkgs.runtimeShell}
exec ${pkgs.wol}/bin/wol ${hostRegistry.hosts."${host}".ether} exec ${pkgs.wol}/bin/wol ${hostRegistry.hosts."${host}".ether}
''; '';
}) {} (builtins.attrNames (lib.filterAttrs (_: { wol ? false, ... }: wol) hostRegistry.hosts)) // })
{ }
(builtins.attrNames (lib.filterAttrs (_: { wol ? false, ... }: wol) hostRegistry.hosts)) //
builtins.foldl' (result: name: builtins.foldl'
(result: name:
let let
host = getHostAddr name; host = getHostAddr name;
target = ''root@"${host}"''; target = ''root@"${host}"'';
@ -108,7 +119,8 @@ lib.attrsets.mapAttrs (system: pkgs:
# let /var/lib/microvm/*/flake point to the flake-update branch so that # let /var/lib/microvm/*/flake point to the flake-update branch so that
# `microvm -u $NAME` updates to what hydra built today. # `microvm -u $NAME` updates to what hydra built today.
selfRef = "git+https://gitea.c3d2.de/c3d2/nix-config?ref=flake-update"; selfRef = "git+https://gitea.c3d2.de/c3d2/nix-config?ref=flake-update";
in result // { in
result // {
# Generate a small script for copying this flake to the # Generate a small script for copying this flake to the
# remote machine and bulding and switching there. # remote machine and bulding and switching there.
# Can be run with `nix run c3d2#…-nixos-rebuild switch` # Can be run with `nix run c3d2#…-nixos-rebuild switch`
@ -257,16 +269,18 @@ lib.attrsets.mapAttrs (system: pkgs:
ssh root@hydra.serv.zentralwerk.org -- \ ssh root@hydra.serv.zentralwerk.org -- \
nomad run -detach $JOB nomad run -detach $JOB
''; '';
}) {} (builtins.attrNames self.nixosConfigurations) // })
{ }
(builtins.attrNames self.nixosConfigurations) //
builtins.foldl' (result: host: builtins.foldl'
(result: host:
let let
inherit (self.nixosConfigurations.${host}) config; inherit (self.nixosConfigurations.${host}) config;
in in
result // { result // {
# boot any machine in a microvm # boot any machine in a microvm
"${host}-vm" = (self.nixosConfigurations.${host} "${host}-vm" = (self.nixosConfigurations.${host}.extendModules {
.extendModules {
modules = [{ modules = [{
microvm = { microvm = {
mem = lib.mkForce 2048; mem = lib.mkForce 2048;
@ -293,13 +307,15 @@ lib.attrsets.mapAttrs (system: pkgs:
}] ++ lib.optionals (! config ? microvm) [ }] ++ lib.optionals (! config ? microvm) [
microvm.nixosModules.microvm microvm.nixosModules.microvm
]; ];
}) }).config.microvm.declaredRunner;
.config.microvm.declaredRunner;
"${host}-tftproot" = "${host}-tftproot" =
if config.system.build ? tftproot if config.system.build ? tftproot
then config.system.build.tftproot then config.system.build.tftproot
else lib.trace "No tftproot for ${host}" null; else lib.trace "No tftproot for ${host}" null;
} }
) {} (builtins.attrNames self.nixosConfigurations) )
) self.legacyPackages { }
(builtins.attrNames self.nixosConfigurations)
)
self.legacyPackages