updates to split local config out from modular config

This commit is contained in:
James Andariese 2022-09-28 11:28:28 -05:00
parent 1eade740bd
commit 8694d5bff1
8 changed files with 13 additions and 197 deletions

View File

@ -4,6 +4,15 @@ with import (toString ../functions);
{pkgs, config, lib, ...}: { {pkgs, config, lib, ...}: {
options = with lib; with types; { options = with lib; with types; {
cascade.nixpkgs-source = mkOption {
default = null;
type = nullOr str;
description = ''
where to point nixpkgs in NIX_PATH for the system.
if null, nixpkgs will not be set by this module
'';
};
cascade.source.enable = mkOption { cascade.source.enable = mkOption {
default = true; default = true;
type = bool; type = bool;
@ -34,6 +43,7 @@ config = with lib; {
(mkIf config.cascade.source.enable '' (mkIf config.cascade.source.enable ''
if [ ! -f /usr/src/cascade/.created-by-nixos ];then if [ ! -f /usr/src/cascade/.created-by-nixos ];then
mkdir -m 0755 -p /usr/src /etc/nixos mkdir -m 0755 -p /usr/src /etc/nixos
# if it's just a symlink, delete it.
[ -e /usr/src/cascade ] && mv /usr/src/cascade /usr/src/cascade.before-nixos [ -e /usr/src/cascade ] && mv /usr/src/cascade /usr/src/cascade.before-nixos
${pkgs.git}/bin/git clone ${config.cascade.source.git-url} /usr/src/cascade ${pkgs.git}/bin/git clone ${config.cascade.source.git-url} /usr/src/cascade
touch /usr/src/cascade/.created-by-nixos touch /usr/src/cascade/.created-by-nixos
@ -48,6 +58,7 @@ config = with lib; {
'') '')
]; ];
nix.nixPath = mkMerge [ nix.nixPath = mkMerge [
(mkIf (config.cascade.nixpkgs-source != null) [ "nixpkgs=${config.cascade.nixpkgs-source}" ])
(mkIf (config.cascade.source.set-nix-path && config.cascade.source.enable) [ "cascade=/usr/src/cascade" ]) (mkIf (config.cascade.source.set-nix-path && config.cascade.source.enable) [ "cascade=/usr/src/cascade" ])
(mkIf (!(config.cascade.source.set-nix-path && config.cascade.source.enable)) [ "cascade=https://gitlab.com/jamesandariese/cascade/-/archive/main/cascade-main.tar.gz" ]) (mkIf (!(config.cascade.source.set-nix-path && config.cascade.source.enable)) [ "cascade=https://gitlab.com/jamesandariese/cascade/-/archive/main/cascade-main.tar.gz" ])
]; ];

View File

@ -1,24 +0,0 @@
{pkgs, ...}: {
config = {
users.users = rec {
james = {
createHome = true;
description = "James Andariese";
extraGroups = [ "wheel" ];
group = "users";
home = "/home/james";
shell = pkgs.bashInteractive;
uid = 1982;
isNormalUser = true;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBDEj6S+ISygrn6D7a5GBsrYaUMWjcReyMmrlgRdDUGx james@chimecho"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBW+t2we/HTgV9ykgcQWiHqiA+vEehVhwOcbsLr4jJvL james@Jamess-MBP.cascade.strudelline.net"
];
};
root.shell = james.shell;
root.openssh.authorizedKeys.keys = james.openssh.authorizedKeys.keys;
};
security.sudo.wheelNeedsPassword = false;
nix.settings.trusted-users = [ "root" "@wheel" ];
};
}

View File

@ -1,14 +0,0 @@
with builtins;
with import ./functions;
let pkgs = (import "${import ./nixpkgs-path.nix}" {});
network = {
inherit pkgs;
description = "cascade";
};
hosts = import (toString ./hosts) {};
in
hosts // {
inherit network;
}

View File

@ -1,47 +0,0 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ (toString ../base) ];
config = {
deployment.targetUser = lib.mkDefault "root";
boot.initrd.availableKernelModules = [ "xhci_pci" "dwc3_pci" "usbhid" "usb_storage" "uas" "sd_mod" "sdhci_acpi" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/mmcblk1p1";
fsType = "xfs";
};
fileSystems."/boot" =
{ device = "/dev/mmcblk1p3";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/mmcblk1p2"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.interfaces.wlp0s20u3.useDHCP = lib.mkDefault false;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# high-resolution display
hardware.video.hidpi.enable = lib.mkDefault true;
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
cascade.bridge-interface = "enp1s0";
systemd.network.wait-online.ignoredInterfaces = lib.mkDefault [ "wlp0s20u3" ];
};
}

View File

@ -1,38 +0,0 @@
#{pkgs ? (import "${import ../../nixpkgs-path.nix}" {}), ...}:
{pkgs, ...}:
{
imports = [
(toString ../../common)
<morph-options> # we include the options here to ensure that we can build with or without morph.
# morph-lib must be NIX_PATH and point to the lib path of the morph that is being
# used for deployment. This is done automatically with shell.nix.
];
config = {
environment.systemPackages = with pkgs; [ bridge-utils git cascade-installer ];
programs.neovim.enable = true;
programs.neovim.vimAlias = true;
programs.neovim.viAlias = true;
networking.domain = "cascade.strudelline.net";
networking.search = [ "cascade.strudelline.net" "strudelline.net" ];
networking.nameservers = [ "172.16.44.1" "172.16.1.1" ];
cascade.bridge-mac-prefix = "00:80:10";
environment.binbash.enable = true;
services.getty.autologinUser = pkgs.lib.mkForce "root";
services.sshd.enable = true;
networking.firewall.allowedTCPPorts = [ 22 ];
system.stateVersion = "22.11";
nix.nixPath = with pkgs; [
"nixos-config=/etc/nixos/configuration.nix"
"nixpkgs=${ import ../../nixpkgs-path.nix }"
"home-manager=/usr/src/home-manager"
"morph-options=${morph.lib}/options.nix"
];
};
}

View File

@ -1,13 +0,0 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ (toString ../base) "${import ../../nixpkgs-path.nix}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" ];
config = {
hardware.video.hidpi.enable = lib.mkDefault true;
isoImage.squashfsCompression = "gzip -Xcompression-level 1";
};
}

View File

@ -1,12 +0,0 @@
{lib, config, ...}:
with lib;
{
imports = [
(toString ../qemu-vm)
];
config = {
cascade.bridge-interface = mkForce null; # let it come up with its default interface with dhcp first
};
}

View File

@ -1,47 +0,0 @@
{lib, config, ...}:
with lib;
{
imports = [ (toString ../base) ];
config = {
deployment.targetUser = lib.mkDefault "root";
cascade.bridge-interface = mkImageMediaOverride "ens18";
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
autoResize = true;
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/ESP";
fsType = "vfat";
};
swapDevices = [
{device = "/swap"; size = 1024;} # make sure we always have enough memory to rebuild nixos.
];
# boot.initrd.network.enable = true;
# networking.useDHCP = true;
networking.useNetworkd = mkForce true;
networking.networkmanager.enable = false;
boot.initrd.availableKernelModules = [ "virtio_net" "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_scsi" "9p" "9pnet_virtio" ];
boot.initrd.kernelModules = [ "virtio_balloon" "virtio_console" "virtio_rng" ];
boot.growPartition = true;
boot.kernelParams = [ "console=ttyS0" ];
boot.loader.grub.device = "/dev/vda";
boot.loader.timeout = mkDefault 3;
boot.consoleLogLevel = 3;
boot.initrd.verbose = true;
services.getty.autologinUser = "root";
services.sshd.enable = true;
networking.firewall.allowedTCPPorts = [ 22 ];
services.qemuGuest.enable = true;
};
}