Skip to content

Commit

Permalink
Merge pull request #10 from Openmesh-Network/feature/xnode-common
Browse files Browse the repository at this point in the history
abstracted common nix configuration
  • Loading branch information
harrys522 authored Jun 25, 2024
2 parents a421dfa + 3866d65 commit db4cecc
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 241 deletions.
60 changes: 1 addition & 59 deletions systems/iso.nix
Original file line number Diff line number Diff line change
@@ -1,64 +1,6 @@
{ inputs, ... }@flakeContext:
let
isoModule = { config, lib, pkgs, ... }: {
imports = [
../repo/modules/services/openmesh/xnode/admin.nix
];
config = {
documentation = {
nixos = {
enable = false;
};
doc = {
enable = false;
};
};
services = {
getty = {
greetingLine = ''<<< Welcome to Openmesh XnodeOS ${config.system.nixos.label} (\m) - \l >>>'';
};
openmesh = {
xnode = {
admin = {
enable = true;
};
};
};
};
boot = {
loader = {
timeout = lib.mkForce 1;
grub = {
timeoutStyle = lib.mkForce "countdown";
};
};
};
isoImage = {
forceTextMode = true;
makeBiosBootable = true;
makeEfiBootable = true;
makeUsbBootable = true;
squashfsCompression = "gzip -Xcompression-level 1";
};
environment = {
systemPackages = with pkgs; [
nyancat
];
};
networking = {
hostName = "xnode";
};
users = {
users = {
"xnode" = {
isNormalUser = true;
password = "xnode";
extraGroups = [ "wheel" ];
};
};
};
};
};
isoModule = import ./xnode-common.nix;
in
inputs.nixos-generators.nixosGenerate {
system = "x86_64-linux";
Expand Down
92 changes: 1 addition & 91 deletions systems/kexec.nix
Original file line number Diff line number Diff line change
@@ -1,96 +1,6 @@
{ inputs, ... }@flakeContext:
let
kexec = { config, lib, pkgs, ... }: {
imports = [
../repo/modules/services/openmesh/xnode/admin.nix
];
config = {
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.trusted-users = [ "root" "xnode" "openmesh-xnode-admin" ];
documentation = {
nixos = {
enable = false;
};
doc = {
enable = false;
};
};
services = {
openmesh = {
xnode = {
admin = {
enable = true;
remoteDir = "https://dpl-staging.openmesh.network/xnodes/functions";
};
};
};
getty = {
autologinUser = lib.mkForce "xnode";
greetingLine = ''<<< Welcome to Openmesh XnodeOS ${config.system.nixos.label} (\m) - \l >>>'';
};
};
environment = {
systemPackages = with pkgs; [
nyancat
];
};
netboot = {
squashfsCompression = "gzip -Xcompression-level 1";
};
boot = {
postBootCommands = ''
cat > /etc/nixos/configuration.nix <<ENDFILE
{config, lib, pkgs, ...}:{
imports=[./hardware-configuration.nix] ++ lib.optional (builtins.pathExists /var/lib/openmesh-xnode-admin/config.nix) /var/lib/openmesh-xnode-admin/config.nix ++ lib.optional (builtins.pathExists /var/lib/openmesh-xnode-admin/xnodeos) /var/lib/openmesh-xnode-admin/xnodeos/repo/modules/services/openmesh/xnode/admin.nix ;
config = {
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.trusted-users = [ "root" "xnode" "openmesh-xnode-admin" ];
boot.loader.grub.enable=false;
nixpkgs.config.allowUnfree = true;
services.openmesh.xnode.admin = {
enable = true;
remoteDir = "https://dpl-staging.openmesh.network/xnodes/functions";
};
users.users = {
"xnode" = {
isNormalUser = true;
password = "xnode";
extraGroups = [ "wheel" ];
};
};
};
}
ENDFILE
cat > /etc/nixos/hardware-configuration.nix <<ENDFILE
{config, lib, pkgs, modulesPath, ...}: {
fileSystems = {
"/" = {
device = "none";
fsType = "tmpfs";
};
};
networking.useDHCP = lib.mkForce true;
nixpkgs.hostPlatform=lib.mkDefault "x86_64-linux";
}
ENDFILE
'';
};
networking = {
hostName = "xnode";
};
users = {
users = {
xnode = {
isNormalUser = true;
password = "xnode";
extraGroups = [ "wheel" ];
};
};
};
};
};
kexec = import ./xnode-common.nix;
in
inputs.nixos-generators.nixosGenerate {
system = "x86_64-linux";
Expand Down
94 changes: 3 additions & 91 deletions systems/netboot.nix
Original file line number Diff line number Diff line change
@@ -1,97 +1,9 @@
{ inputs, ... }@flakeContext:
let
pkgs = inputs.nixpkgs;
netboot = { config, lib, pkgs, ... }: {
imports = [
../repo/modules/services/openmesh/xnode/admin.nix
];
config = {
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.trusted-users = [ "root" "xnode" "openmesh-xnode-admin" ];
documentation = {
nixos = {
enable = false;
};
doc = {
enable = false;
};
};
services = {
openmesh = {
xnode = {
admin = {
enable = true;
remoteDir = "https://dpl-staging.openmesh.network/xnodes/functions";
};
};
};
getty = {
autologinUser = lib.mkForce "xnode";
greetingLine = ''<<< Welcome to Openmesh XnodeOS ${config.system.nixos.label} (\m) - \l >>>'';
};
};
environment = {
systemPackages = with pkgs; [
nyancat
];
};
netboot = {
squashfsCompression = "gzip -Xcompression-level 1";
};
boot = {
postBootCommands = ''
cat > /etc/nixos/configuration.nix <<ENDFILE
{config, lib, pkgs, ...}:{
imports=[./hardware-configuration.nix] ++ lib.optional (builtins.pathExists /var/lib/openmesh-xnode-admin/config.nix) /var/lib/openmesh-xnode-admin/config.nix ++ lib.optional (builtins.pathExists /var/lib/openmesh-xnode-admin/xnodeos) /var/lib/openmesh-xnode-admin/xnodeos/repo/modules/services/openmesh/xnode/admin.nix ;
config = {
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.trusted-users = [ "root" "xnode" "openmesh-xnode-admin" ];
boot.loader.grub.enable=false;
nixpkgs.config.allowUnfree = true;
services.openmesh.xnode.admin = {
enable = true;
remoteDir = "https://dpl-staging.openmesh.network/xnodes/functions";
};
users.users = {
"xnode" = {
isNormalUser = true;
password = "xnode";
extraGroups = [ "wheel" ];
};
};
};
}
ENDFILE
cat > /etc/nixos/hardware-configuration.nix <<ENDFILE
{config, lib, pkgs, modulesPath, ...}: {
fileSystems = {
"/" = {
device = "none";
fsType = "tmpfs";
};
};
networking.useDHCP = lib.mkForce true;
nixpkgs.hostPlatform=lib.mkDefault "x86_64-linux";
}
ENDFILE
'';
};
networking = {
hostName = "xnode";
};
users = {
users = {
xnode = {
isNormalUser = true;
password = "xnode";
extraGroups = [ "wheel" ];
};
};
};
};
config.netboot = {
squashfsCompression = "gzip -Xcompression-level 1";
};
netboot = import ./xnode-common.nix;
in
inputs.nixos-generators.nixosGenerate {
system = "x86_64-linux";
Expand Down
88 changes: 88 additions & 0 deletions systems/xnode-common.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{ config, lib, pkgs, ... }: {
imports = [
../repo/modules/services/openmesh/xnode/admin.nix
];
config = {
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.trusted-users = [ "root" "xnode" "openmesh-xnode-admin" ];
documentation = {
nixos = {
enable = false;
};
doc = {
enable = false;
};
};
services = {
openmesh = {
xnode = {
admin = {
enable = true;
remoteDir = "https://dpl-staging.openmesh.network/xnodes/functions";
};
};
};
getty = {
autologinUser = lib.mkForce "xnode";
greetingLine = ''<<< Welcome to Openmesh XnodeOS ${config.system.nixos.label} (\m) - \l >>>'';
};
};
environment = {
systemPackages = with pkgs; [
nyancat
];
};
boot = {
postBootCommands = ''
cat > /etc/nixos/configuration.nix <<ENDFILE
{config, lib, pkgs, ...}:{
imports=[./hardware-configuration.nix] ++ lib.optional (builtins.pathExists /var/lib/openmesh-xnode-admin/config.nix) /var/lib/openmesh-xnode-admin/config.nix ++ lib.optional (builtins.pathExists /var/lib/openmesh-xnode-admin/xnodeos) /var/lib/openmesh-xnode-admin/xnodeos/repo/modules/services/openmesh/xnode/admin.nix ;
config = {
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.trusted-users = [ "root" "xnode" "openmesh-xnode-admin" ];
boot.loader.grub.enable=false;
nixpkgs.config.allowUnfree = true;
services.openmesh.xnode.admin = {
enable = true;
remoteDir = "https://dpl-staging.openmesh.network/xnodes/functions";
};
users.users = {
"xnode" = {
isNormalUser = true;
password = "xnode";
extraGroups = [ "wheel" ];
};
};
};
}
ENDFILE
cat > /etc/nixos/hardware-configuration.nix <<ENDFILE
{config, lib, pkgs, modulesPath, ...}: {
fileSystems = {
"/" = {
device = "none";
fsType = "tmpfs";
};
};
networking.useDHCP = lib.mkForce true;
nixpkgs.hostPlatform=lib.mkDefault "x86_64-linux";
}
ENDFILE
'';
};
networking = {
hostName = "xnode";
};
users = {
users = {
xnode = {
isNormalUser = true;
password = "xnode";
extraGroups = [ "wheel" ];
};
};
};
};
}

0 comments on commit db4cecc

Please sign in to comment.