forked from clan/clan-core
Added machineIcon and machineDescription to buildClan
This commit is contained in:
parent
fc50d8748a
commit
b3815527a5
@ -3,7 +3,9 @@
|
|||||||
, specialArgs ? { } # Extra arguments to pass to nixosSystem i.e. useful to make self available
|
, specialArgs ? { } # Extra arguments to pass to nixosSystem i.e. useful to make self available
|
||||||
, machines ? { } # allows to include machine-specific modules i.e. machines.${name} = { ... }
|
, machines ? { } # allows to include machine-specific modules i.e. machines.${name} = { ... }
|
||||||
, clanName # Needs to be (globally) unique, as this determines the folder name where the flake gets downloaded to.
|
, clanName # Needs to be (globally) unique, as this determines the folder name where the flake gets downloaded to.
|
||||||
, clanIcon ? null # A path to an icon to be used for the clan
|
, clanIcon ? null # A path to an icon to be used for the clan, should be the same for all machines
|
||||||
|
, machineIcon ? null # A path to an icon to be used for the machine
|
||||||
|
, machineDescription ? null # A description of the machine
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
machinesDirs = lib.optionalAttrs (builtins.pathExists "${directory}/machines") (builtins.readDir (directory + /machines));
|
machinesDirs = lib.optionalAttrs (builtins.pathExists "${directory}/machines") (builtins.readDir (directory + /machines));
|
||||||
@ -45,6 +47,8 @@ let
|
|||||||
clanCore.clanName = clanName;
|
clanCore.clanName = clanName;
|
||||||
clanCore.clanIcon = clanIcon;
|
clanCore.clanIcon = clanIcon;
|
||||||
clanCore.clanDir = directory;
|
clanCore.clanDir = directory;
|
||||||
|
clanCore.machineIcon = machineIcon;
|
||||||
|
clanCore.machineDescription = machineDescription;
|
||||||
nixpkgs.hostPlatform = if forceSystem then lib.mkForce system else lib.mkDefault system;
|
nixpkgs.hostPlatform = if forceSystem then lib.mkForce system else lib.mkDefault system;
|
||||||
|
|
||||||
# speeds up nix commands by using the nixpkgs from the host system (especially useful in VMs)
|
# speeds up nix commands by using the nixpkgs from the host system (especially useful in VMs)
|
||||||
|
@ -6,6 +6,18 @@
|
|||||||
the name of the clan
|
the name of the clan
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
machineIcon = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.path;
|
||||||
|
description = ''
|
||||||
|
the location of the machine icon
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
machineDescription = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = ''
|
||||||
|
the description of the machine
|
||||||
|
'';
|
||||||
|
};
|
||||||
clanDir = lib.mkOption {
|
clanDir = lib.mkOption {
|
||||||
type = lib.types.either lib.types.path lib.types.str;
|
type = lib.types.either lib.types.path lib.types.str;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
{
|
{
|
||||||
"path": "../clan-cli/tests"
|
"path": "../clan-cli/tests"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "../../nixosModules"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"python.linting.mypyEnabled": true,
|
"python.linting.mypyEnabled": true,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
@ -16,6 +17,8 @@ from clan_vm_manager.models.use_vms import VMS
|
|||||||
from .constants import constants
|
from .constants import constants
|
||||||
from .windows.main_window import MainWindow
|
from .windows.main_window import MainWindow
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class MainApplication(Adw.Application):
|
class MainApplication(Adw.Application):
|
||||||
def __init__(self, config: ClanConfig) -> None:
|
def __init__(self, config: ClanConfig) -> None:
|
||||||
@ -29,7 +32,7 @@ class MainApplication(Adw.Application):
|
|||||||
Join.use().push(config.url)
|
Join.use().push(config.url)
|
||||||
|
|
||||||
def on_shutdown(self, app: Gtk.Application) -> None:
|
def on_shutdown(self, app: Gtk.Application) -> None:
|
||||||
print("Shutting down")
|
log.debug("Shutting down")
|
||||||
VMS.use().kill_all()
|
VMS.use().kill_all()
|
||||||
|
|
||||||
def do_activate(self) -> None:
|
def do_activate(self) -> None:
|
||||||
|
@ -168,10 +168,9 @@ class VM(GObject.Object):
|
|||||||
return f"{self.data.flake.flake_url}#{self.data.flake.flake_attr}"
|
return f"{self.data.flake.flake_url}#{self.data.flake.flake_attr}"
|
||||||
|
|
||||||
def stop(self) -> None:
|
def stop(self) -> None:
|
||||||
log.info("Stopping VM")
|
|
||||||
if not self.is_running():
|
if not self.is_running():
|
||||||
return
|
return
|
||||||
|
log.info(f"Stopping VM {self.get_id()}")
|
||||||
self.process.kill_group()
|
self.process.kill_group()
|
||||||
|
|
||||||
def read_whole_log(self) -> str:
|
def read_whole_log(self) -> str:
|
||||||
|
Loading…
Reference in New Issue
Block a user