create broken nixosContainer because java deps and no networking

This commit is contained in:
Anish Lakhwara 2022-07-11 15:51:32 +10:00
parent 46a8375532
commit 461c2c02ba

View file

@ -10,6 +10,19 @@
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
{
packages.x86_64-linux.dhyan = pkgs.stdenv.mkDerivation {
name = "dhyan";
src = ./.;
installPhase = ''
mkdir -p $out
cp -r src/ $out/
cp bb.edn $out/
cp deps.edn $out/
'';
};
defaultPackage.x86_64-linux = self.packages.x86_64-linux.dhyan;
nixosModule = { options, lib, config, pkgs, ... }:
let
serviceConfig = config.services.mossnet.dhyan;
@ -24,17 +37,35 @@
'';
wantedBy = [ "multi-user.target" ];
serviceConfig = { Type = "oneshot"; };
startsAt = "*08:00:00";
path = with pkgs; [ babashka jdk11 ];
startAt = "*08:00:00";
path = with pkgs; [ babashka jdk11 self.packages.x86_64-linux.dhyan ];
script = ''
set -ex
cd ~/usr/dhyan
cd ${self.packages.x86_64-linux.dhyan}
bb -m dhyan.main
'';
};
};
};
nixosConfigurations."test" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
self.nixosModule
({ pkgs, ... }: {
boot.isContainer = true;
networking.hostName = "dhyan";
services.mossnet.dhyan.enable = true;
# we need network to download java deps handled by bb
# but we also need to tell network manager locally not to manage this interface
# TODO
# networking.nat.enable = true;
# networking.nat.internalInterfaces = [ "ve-+" ];
# networking.nat.externalInterface = "wlp3s0"; # Change this if it changes
})
];
};
devShell.x86_64-linux = pkgs.mkShell {
buildInputs = with pkgs; [
jdk11