Compare commits
4 commits
dc7d7071d9
...
f522d2c362
Author | SHA1 | Date | |
---|---|---|---|
f522d2c362 | |||
bbfef8c4ee | |||
7e7234e00a | |||
c07c6baeae |
6 changed files with 78 additions and 3 deletions
|
@ -50,8 +50,14 @@ def _vm(args):
|
|||
vm_path = Path(f"/etc/nixos/hosts/virtual-machines/{vm_name}")
|
||||
if vm_path.exists():
|
||||
c = colors.Colors
|
||||
|
||||
if (vm_path / "flake.nix").exists():
|
||||
build_vm_args.extend(["--flake", f"{vm_path}#nixos"])
|
||||
elif (vm_path / "default.nix").exists():
|
||||
build_vm_args.extend(["-I", f"nixos-config={vm_path}/default.nix", "--no-flake"])
|
||||
|
||||
print(f"{c.BLUE}Building virtual machine {c.YELLOW}{vm_name}{c.END}")
|
||||
run(["nixos-rebuild", "build-vm", "-I", "nixos-config=./default.nix", *build_vm_args, "--no-flake"], cwd=vm_path)
|
||||
run(["nixos-rebuild", "build-vm", *build_vm_args], cwd=vm_path)
|
||||
print(f"{c.BLUE}Starting virtual vachine {c.YELLOW}{vm_name}{c.END}")
|
||||
run(["./result/bin/run-nixos-vm"], cwd=vm_path)
|
||||
print(f"{c.BLUE}Virtual machine {c.YELLOW}{vm_name} {c.BLUE}has {c.RED}stopped.{c.END}")
|
||||
|
|
32
hosts/virtual-machines/cosmic/default.nix
Normal file
32
hosts/virtual-machines/cosmic/default.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
packages = with pkgs; [ fastfetch ];
|
||||
in
|
||||
{
|
||||
services = {
|
||||
desktopManager.cosmic.enable = true;
|
||||
displayManager.cosmic-greeter.enable = true;
|
||||
};
|
||||
|
||||
virtualisation.vmVariant.virtualisation = {
|
||||
memorySize = 8192;
|
||||
cores = 6;
|
||||
};
|
||||
|
||||
environment.systemPackages = lib.lists.unique (packages);
|
||||
|
||||
nix = {
|
||||
settings = {
|
||||
substituters = [
|
||||
"https://cosmic.cachix.org"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
37
hosts/virtual-machines/cosmic/flake.nix
Normal file
37
hosts/virtual-machines/cosmic/flake.nix
Normal file
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
description = "System Configuration @ cswimr 2024";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
cosmic.url = "github:lilyinstarlight/nixos-cosmic";
|
||||
};
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
cosmic,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
user = "nixos";
|
||||
system = "x86_64-linux";
|
||||
in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
nixos = nixpkgs.lib.nixosSystem {
|
||||
system = system;
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
system = system;
|
||||
hostname = "nixos";
|
||||
user = user;
|
||||
};
|
||||
modules = [
|
||||
# imports
|
||||
../common.nix
|
||||
./default.nix
|
||||
cosmic.nixosModules.default
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -5,7 +5,7 @@ let
|
|||
in
|
||||
{
|
||||
imports = [
|
||||
../template.nix
|
||||
../common.nix
|
||||
#../../../nixos/shell.nix
|
||||
];
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
../template.nix
|
||||
../common.nix
|
||||
#../../../nixos/shell.nix
|
||||
];
|
||||
environment.systemPackages = with pkgs; [ fastfetch ];
|
||||
|
|
Loading…
Add table
Reference in a new issue