uhh it almost works
This commit is contained in:
parent
bcd9706454
commit
ab4704240b
9 changed files with 318 additions and 131 deletions
25
calliope.nix
25
calliope.nix
|
@ -1,17 +1,30 @@
|
|||
# Consumes user.nix, configuration.nix
|
||||
{ config, pkgs, lib, ... }:
|
||||
{ config, pkgs, lib, ...}:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./configuration.nix
|
||||
./user.nix
|
||||
];
|
||||
calliope = {
|
||||
hostName = "marcille";
|
||||
hostname = "marcille";
|
||||
ipv4Address = "172.18.154.50";
|
||||
cec = "akristip";
|
||||
username = "mira";
|
||||
name = "Mira Lastname";
|
||||
# username = "mira";
|
||||
shell = pkgs.xonsh;
|
||||
#password = "";
|
||||
}
|
||||
};
|
||||
|
||||
virtualisation.vmVariant = {
|
||||
virtualisation = {
|
||||
memorySize = 1024; # 16GiB
|
||||
cores = 2; # 40 cores
|
||||
# memorySize = 16384; # 16GiB
|
||||
# cores = 40; # 40 cores
|
||||
graphics = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page
|
||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
# imports =
|
||||
# [ # Include the results of the hardware scan.
|
||||
# ./user.nix
|
||||
# ];
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [];
|
||||
|
||||
networking.nameservers = [ "64.102.6.247" ];
|
||||
networking.search = [ "cisco.com" ];
|
||||
networking.nameservers = ["64.102.6.247"];
|
||||
networking.search = ["cisco.com"];
|
||||
|
||||
# Bootloader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
nix.package = pkgs.lix;
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
||||
|
||||
# TODO: migrate to calliope.nix
|
||||
networking.hostName = "marcille"; # Define your hostname.
|
||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||
|
||||
# Configure network proxy if necessary
|
||||
# networking.proxy.default = "http://user:password@proxy:port/";
|
||||
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "America/New_York";
|
||||
|
||||
|
@ -51,45 +51,44 @@
|
|||
variant = "";
|
||||
};
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.mira = {
|
||||
isNormalUser = true;
|
||||
description = "Mira";
|
||||
extraGroups = [ "networkmanager" "wheel" ];
|
||||
packages = with pkgs; [];
|
||||
};
|
||||
|
||||
users.users.chris = {
|
||||
isNormalUser = true;
|
||||
description = "Chris";
|
||||
extraGroups = [ "networkmanager" "wheel" ];
|
||||
packages = with pkgs; [];
|
||||
};
|
||||
# Enable automatic login for the user.
|
||||
services.getty.autologinUser = lib.mkDefault "mira";
|
||||
|
||||
# Allow unfree packages
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
||||
# wget
|
||||
lsd
|
||||
fd
|
||||
ripgrep
|
||||
thefuck
|
||||
nh
|
||||
hyfetch
|
||||
fastfetch
|
||||
uv
|
||||
edit
|
||||
wget
|
||||
curl
|
||||
lsd
|
||||
fd
|
||||
ripgrep
|
||||
thefuck
|
||||
nh
|
||||
disko
|
||||
hyfetch
|
||||
fastfetch
|
||||
uv
|
||||
edit
|
||||
networkmanager
|
||||
gum
|
||||
nushell
|
||||
];
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
programs = {
|
||||
xonsh.enable = true;
|
||||
zsh.enable = true;
|
||||
fish.enable = true;
|
||||
neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
};
|
||||
zoxide = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
enableFishIntegration = true;
|
||||
enableXonshIntegration = true;
|
||||
enableBashIntegration = true;
|
||||
};
|
||||
};
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
|
@ -103,7 +102,6 @@
|
|||
enable = true;
|
||||
shortcut = "a";
|
||||
keyMode = "vi";
|
||||
|
||||
};
|
||||
|
||||
# TODO: copy git config here
|
||||
|
@ -112,7 +110,6 @@
|
|||
|
||||
# TODO: set aliases (eg ls to lsd)
|
||||
|
||||
|
||||
# List services that you want to enable:
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
|
|
57
disko-config.nix
Normal file
57
disko-config.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
# USAGE in your configuration.nix.
|
||||
# Update devices to match your hardware.
|
||||
# {
|
||||
# imports = [ ./disko-config.nix ];
|
||||
# disko.devices.disk.main.device = "/dev/sda";
|
||||
# }
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/vda"; # Format the first disk
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
priority = 1;
|
||||
name = "ESP";
|
||||
start = "1M";
|
||||
end = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = ["umask=0077"];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = ["-f"]; # Override existing partition
|
||||
subvolumes = {
|
||||
"@rootfs" = {
|
||||
mountpoint = "/";
|
||||
};
|
||||
"@home" = {
|
||||
mountOptions = ["compress=zstd"];
|
||||
mountpoint = "/home";
|
||||
};
|
||||
"@nix" = {
|
||||
mountOptions = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
];
|
||||
mountpoint = "/nix";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
21
flake.lock
generated
21
flake.lock
generated
|
@ -1,5 +1,25 @@
|
|||
{
|
||||
"nodes": {
|
||||
"disko": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1747742835,
|
||||
"narHash": "sha256-kYL4GCwwznsypvsnA20oyvW8zB/Dvn6K5G/tgMjVMT4=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "df522e787fdffc4f32ed3e1fca9ed0968a384d62",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1747825515,
|
||||
|
@ -18,6 +38,7 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"disko": "disko",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
|
|
47
flake.nix
47
flake.nix
|
@ -1,27 +1,34 @@
|
|||
{
|
||||
inputs = {
|
||||
# NOTE: Replace "nixos-23.11" with that which is in system.stateVersion of
|
||||
# configuration.nix. You can also use latter versions if you wish to
|
||||
# upgrade.
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
|
||||
};
|
||||
outputs = inputs@{ self, nixpkgs, ... }: {
|
||||
# NOTE: 'nixos' is the default hostname set by the installer
|
||||
nixosConfigurations.marcille = nixpkgs.lib.nixosSystem {
|
||||
# NOTE: Change this to aarch64-linux if you are on ARM
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./configuration.nix
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
disko = {
|
||||
url = "github:nix-community/disko";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixosConfigurations.live = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
(nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
|
||||
./configuration.nix
|
||||
];
|
||||
};
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
}: {
|
||||
nixosConfigurations = {
|
||||
calliope = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
inputs.disko.nixosModules.disko
|
||||
./calliope.nix
|
||||
./disko-config.nix
|
||||
];
|
||||
};
|
||||
installer = inputs.nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = {
|
||||
targetSystem = inputs.self.nixosConfigurations.calliope;
|
||||
};
|
||||
modules = [
|
||||
./installer.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,29 +1,33 @@
|
|||
# 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 = [ ];
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ata_piix" "vmw_pvscsi" "ahci" "sd_mod" "sr_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.initrd.availableKernelModules = ["ata_piix" "vmw_pvscsi" "ahci" "sd_mod" "sr_mod"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = [];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/2135c59d-9c2d-487c-9c4e-0f566fa9d316";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@" ];
|
||||
};
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/2135c59d-9c2d-487c-9c4e-0f566fa9d316";
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=@"];
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/7E60-8E0B";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0077" "dmask=0077" ];
|
||||
};
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/7E60-8E0B";
|
||||
fsType = "vfat";
|
||||
options = ["fmask=0077" "dmask=0077"];
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
swapDevices = [];
|
||||
|
||||
# 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
|
||||
|
@ -32,10 +36,12 @@
|
|||
networking.useDHCP = lib.mkDefault false;
|
||||
# networking.interfaces.ens33.useDHCP = lib.mkDefault true;
|
||||
networking.interfaces.ens33 = {
|
||||
ipv4.addresses = [{
|
||||
address = "172.18.154.50";
|
||||
prefixLength = 24;
|
||||
}];
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "172.18.154.50";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Enable networking
|
||||
|
@ -45,7 +51,7 @@
|
|||
address = "172.18.154.1";
|
||||
interface = "ens33";
|
||||
};
|
||||
networking.nameservers = [ "64.102.6.247" ];
|
||||
networking.search = [ "cisco.com" ];
|
||||
networking.nameservers = ["64.102.6.247"];
|
||||
networking.search = ["cisco.com"];
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
||||
|
|
58
installer.nix
Normal file
58
installer.nix
Normal file
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
modulesPath,
|
||||
targetSystem,
|
||||
...
|
||||
}: let
|
||||
installer = pkgs.writeShellApplication {
|
||||
name = "installer";
|
||||
runtimeInputs = [];
|
||||
text = ''
|
||||
#!${pkgs.runtimeShell}
|
||||
set -euo pipefail
|
||||
echo "Formatting the disk..."
|
||||
${pkgs.util-linux}/bin/blkid -o device > /tmp/devices
|
||||
# DISKO_DEVICE_MAIN="$(${pkgs.gum}/bin/gum choose < /tmp/devices)"
|
||||
DISKO_DEVICE_MAIN=/dev/vda
|
||||
export DISKO_DEVICE_MAIN
|
||||
echo "Selected device: $DISKO_DEVICE_MAIN"
|
||||
${targetSystem.config.system.build.diskoScript}
|
||||
export PATH=${lib.makeBinPath [
|
||||
# hack for a progress bar
|
||||
# https://nix.dev/manual/nix/2.18/command-ref/nix-build#opt-log-format
|
||||
(pkgs.writeShellScriptBin "nix-env" ''
|
||||
exec ${lib.getExe' config.nix.package "nix-env"} --log-format bar "$@"
|
||||
'')
|
||||
]}:$PATH
|
||||
|
||||
echo "Installing NixOS..."
|
||||
${pkgs.nixos-install}/bin/nixos-install --no-channel-copy --no-root-password --option substituters "" --system ${targetSystem.config.system.build.toplevel}
|
||||
|
||||
|
||||
'';
|
||||
};
|
||||
# This is a failsafe script that will run if the installer fails to start
|
||||
installerFailsafe = pkgs.writeShellScript "failsafe" ''
|
||||
${lib.getExe installer} || echo "ERROR: Installation failure!"
|
||||
sleep 3600
|
||||
'';
|
||||
in {
|
||||
imports = [
|
||||
(modulesPath + "/installer/cd-dvd/iso-image.nix")
|
||||
(modulesPath + "/profiles/all-hardware.nix")
|
||||
];
|
||||
boot.kernelParams = ["systemd.unit=getty.target"];
|
||||
isoImage.squashfsCompression = "zstd -Xcompression-level 15"; # xz takes forever
|
||||
# systemd service to start the installer on boot
|
||||
system.stateVersion = "25.05";
|
||||
systemd.services."getty@tty1" = {
|
||||
overrideStrategy = "asDropin";
|
||||
serviceConfig = {
|
||||
ExecStart = ["" installerFailsafe];
|
||||
Restart = "no";
|
||||
StandardInput = "null";
|
||||
};
|
||||
};
|
||||
}
|
10
justfile
Normal file
10
justfile
Normal file
|
@ -0,0 +1,10 @@
|
|||
build:
|
||||
nix --extra-experimental-features nix-command --extra-experimental-features flakes build '.#nixosConfigurations.calliope.config.system.build.toplevel'
|
||||
build-iso:
|
||||
nix build -L '.#nixosConfigurations.installer.config.system.build.isoImage'
|
||||
|
||||
build-installer:
|
||||
nixos-generate -f install-iso -c calliope.nix
|
||||
#build-vm:
|
||||
# nix --extra-experimental-features nix-command --extra-experimental-features flakes build '.#nixosConfigurations.calliopeISO.config.system.build.vm'
|
||||
|
88
user.nix
88
user.nix
|
@ -1,44 +1,62 @@
|
|||
# User config definitions
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
|
||||
options = {
|
||||
calliope = {
|
||||
hostname = lib.mkOption {
|
||||
type = string;
|
||||
default = "calliope";
|
||||
|
||||
};
|
||||
ipv4Address = lib.mkOption {
|
||||
type = string;
|
||||
};
|
||||
# TODO:
|
||||
password = lib.mkOption {};
|
||||
cec = lib.mkOption {
|
||||
type = string;
|
||||
username = lib.mkOption {
|
||||
type = string;
|
||||
# TODO: make this default to CEC
|
||||
};
|
||||
defaultShell = mkPackageOption pkgs "shell" {
|
||||
default = [ "bash" ];
|
||||
};
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.calliope;
|
||||
in {
|
||||
options.calliope = {
|
||||
hostname = mkOption {
|
||||
type = types.str;
|
||||
default = "calliope";
|
||||
};
|
||||
ipv4Address = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
cec = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
username = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
shell = mkOption {
|
||||
default = pkgs.zsh;
|
||||
type = types.package;
|
||||
};
|
||||
authorizedKeys = mkOption {
|
||||
type = types.listOf types.singleLineStr;
|
||||
default = [];
|
||||
};
|
||||
# TODO:
|
||||
authorizedKeys = lib.mkOption {};
|
||||
|
||||
# TODO:
|
||||
sshIdentities = lib.mkOption {};
|
||||
}
|
||||
sshIdentities = mkOption {};
|
||||
};
|
||||
|
||||
config = {
|
||||
networking.hostName = options.calliope.hostname;
|
||||
# TODO: set the ipv4 address, and figure out how to set this without knowing interface name
|
||||
# TODO: set default gateway
|
||||
# TODO: use CEC to set up git identity
|
||||
# TODO: set default shell
|
||||
# TODO: set authorized_keys
|
||||
# TODO: set SSH Private keys
|
||||
calliope.username = lib.mkDefault cfg.cec;
|
||||
networking.hostName = cfg.hostname;
|
||||
|
||||
# Enable automatic login for the user.
|
||||
services.getty.autologinUser = lib.mkDefault cfg.username;
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users."${cfg.username}" = {
|
||||
isNormalUser = true;
|
||||
description = cfg.name;
|
||||
initialPassword = "C!sc0!@#";
|
||||
shell = cfg.shell;
|
||||
extraGroups = ["networkmanager" "wheel"];
|
||||
openssh.authorizedKeys.keys = cfg.authorizedKeys;
|
||||
};
|
||||
# TODO: set the ipv4 address, and figure out how to set this without knowing interface name
|
||||
# TODO: set default gateway
|
||||
# TODO: use CEC to set up git identity
|
||||
# TODO: set SSH Private keys
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue