add an installer for not522
All checks were successful
Hydra nixosConfigurations.container-default-riscv64-linux Hydra build #22463 of nixos-config:pr618:nixosConfigurations.container-default-riscv64-linux
Hydra nixosConfigurations.not522 Hydra build #22465 of nixos-config:pr618:nixosConfigurations.not522
Hydra nixosConfigurations.not522-installer Hydra build #22466 of nixos-config:pr618:nixosConfigurations.not522-installer
Hydra nixosConfigurations.container-default-x86_64-linux Hydra build #22464 of nixos-config:pr618:nixosConfigurations.container-default-x86_64-linux
Hydra checks.x86_64-linux.containers-default Hydra build #22461 of nixos-config:pr618:checks.x86_64-linux.containers-default
Hydra nixosConfigurations.container-default-aarch64-linux Hydra build #22462 of nixos-config:pr618:nixosConfigurations.container-default-aarch64-linux

This commit is contained in:
Charlotte 🦝 Delenk 2024-10-30 09:06:52 +01:00
parent 69dd93c11b
commit 8efe0d5149
9 changed files with 134 additions and 1 deletions

View file

@ -2,6 +2,7 @@
imports = [
"${nixos-config}/modules"
"${nixos-config}/services/tailscale.nix"
"${nixos-config}/services/openssh.nix"
"${nixos-config}/users"
./systemd-boot.nix
];

View file

@ -75,6 +75,7 @@
nixos-config = self;
inherit inputs;
inTester = false;
pureInputs = inputs';
};
pkgsFor = system: let
inputs' =
@ -143,6 +144,10 @@
config = ./machine/not522;
system = "riscv64-linux";
};
not522-installer = {
config = ./machine/not522/installer;
system = "riscv64-linux";
};
};
containers = mapAttrs (_: container:
mkSystem {

View file

@ -11,4 +11,5 @@
./cross-packages.nix
];
system.stateVersion = "24.11";
nixpkgs.config.allowUnsupportedSystem = true;
}

View file

@ -21,7 +21,7 @@
};
};
root = {
size = "-8G";
end = "-8G";
content = {
type = "btrfs";
extraArgs = ["-f"]; # Override existing partition

View file

@ -0,0 +1,40 @@
{
nixos-config,
nixos-hardware,
config,
pureInputs,
pkgs,
lib,
...
}: let
dependencies =
[
nixos-config.nixosConfigurations.not522.config.system.build.toplevel
nixos-config.nixosConfigurations.not522.config.system.build.diskoScript
nixos-config.nixosConfigurations.not522.config.system.build.diskoScript.drvPath
nixos-config.nixosConfigurations.not522.pkgs.stdenv.drvPath
(nixos-config.nixosConfigurations.not522.pkgs.closureInfo {rootPaths = [];}).drvPath
]
++ map (i: i.outPath) (builtins.filter builtins.isAttrs (builtins.attrValues pureInputs));
closureInfo = pkgs.closureInfo {rootPaths = dependencies;};
in {
networking.hostName = "not522-installer";
imports = [
"${nixos-config}/config"
"${nixos-config}/machine/not522/hardware.nix"
"${nixos-config}/machine/not522/cross-packages.nix"
./disko.nix
];
system.stateVersion = config.system.nixos.version;
environment.etc."install-closure".source = "${closureInfo}/store-paths";
environment.systemPackages = [
(pkgs.writeShellScriptBin "install-nixos-unattended" ''
set -eux
exec ${pkgs.disko}/bin/disko-install --flake "${nixos-config}#not522" --disk main "${nixos-config.nixosConfigurations.not522.config.disko.devices.disk.main.device}"
'')
];
}

View file

@ -0,0 +1,55 @@
{
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/mmcblk1";
content = {
type = "gpt";
partitions = {
ESP = {
priority = 1;
name = "ESP";
start = "1M";
end = "1024M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = ["umask=0077"];
};
};
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = ["-f"]; # Override existing partition
# Subvolumes must set a mountpoint in order to be mounted,
# unless their parent is mounted
subvolumes = {
# Subvolume name is different from mountpoint
"/root" = {
mountOptions = ["compress=zstd"];
mountpoint = "/";
};
# Subvolume name is the same as the mountpoint
"/persistent" = {
mountOptions = ["compress=zstd"];
mountpoint = "/persistent";
};
# Parent is not mounted so the mountpoint must be set
"/nix" = {
mountOptions = ["compress=zstd" "noatime"];
mountpoint = "/nix";
};
};
mountpoint = "/partition-root";
};
};
};
};
};
};
};
}

View file

@ -3,6 +3,7 @@
./riscv.nix
./containers/autoconfig.nix
./nix/lix.nix
./nix/link-inputs.nix
./environment/impermanence.nix
./secrets/sops.nix
disko.nixosModules.default

View file

@ -0,0 +1,23 @@
{
lib,
inputs,
...
}: let
# Taken from https://github.com/gytis-ivaskevicius/flake-utils-plus/blob/master/lib/options.nix
inherit (lib) filterAttrs mapAttrs';
flakes = filterAttrs (name: value: (name != "self") && (value ? outputs)) inputs;
nixRegistry =
builtins.mapAttrs
(name: v: {flake = v;})
flakes;
in {
nix.registry = nixRegistry;
environment.etc =
mapAttrs'
(name: value: {
name = "nix/inputs/${name}";
value = {source = value.outPath;};
})
flakes;
nix.nixPath = ["/etc/nix/inputs"];
}

7
services/openssh.nix Normal file
View file

@ -0,0 +1,7 @@
{...}: {
services.openssh.settings = {
PermitRootLogin = true;
PasswordAuthentication = false;
};
networking.firewall.allowedTCPPorts = [22];
}