create broken nixosContainer because java deps and no networking
This commit is contained in:
parent
46a8375532
commit
461c2c02ba
37
flake.nix
37
flake.nix
|
@ -10,6 +10,19 @@
|
||||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
in
|
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, ... }:
|
nixosModule = { options, lib, config, pkgs, ... }:
|
||||||
let
|
let
|
||||||
serviceConfig = config.services.mossnet.dhyan;
|
serviceConfig = config.services.mossnet.dhyan;
|
||||||
|
@ -24,17 +37,35 @@
|
||||||
'';
|
'';
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = { Type = "oneshot"; };
|
serviceConfig = { Type = "oneshot"; };
|
||||||
startsAt = "*08:00:00";
|
startAt = "*08:00:00";
|
||||||
path = with pkgs; [ babashka jdk11 ];
|
path = with pkgs; [ babashka jdk11 self.packages.x86_64-linux.dhyan ];
|
||||||
script = ''
|
script = ''
|
||||||
set -ex
|
set -ex
|
||||||
cd ~/usr/dhyan
|
cd ${self.packages.x86_64-linux.dhyan}
|
||||||
bb -m dhyan.main
|
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 {
|
devShell.x86_64-linux = pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
jdk11
|
jdk11
|
||||||
|
|
Loading…
Reference in a new issue