bootstrap iso: add PubSolarOS naming, drone pipeline

adjustments to include a symlink to the latest iso built
This commit is contained in:
teutat3s 2022-10-02 23:59:08 +02:00
parent 40e327d60b
commit 986680cc26
Signed by untrusted user: teutat3s
GPG key ID: 4FA1D3FA524F22C1
3 changed files with 52 additions and 18 deletions

View file

@ -98,7 +98,14 @@ steps:
- |
nix $$NIX_FLAGS build \
'.#nixosConfigurations.bootstrap.config.system.build.isoImage'
- cp $(readlink -f result)/iso/*.iso /var/nix/iso-cache/
- cp $(readlink -f result)/iso/PubSolarOS*.iso /var/nix/iso-cache/
- nix shell nixpkgs#findutils
- cd /var/nix/iso-cache/
- export ISO_NAME=$(find . -name '*.iso' -printf "%f\n")
- sha256sum $ISO_NAME > $ISO_NAME.sha256
- ln -s $ISO_NAME PubSolarOS-latest.iso
- cp $ISO_NAME.sha256 PubSolarOS-latest.iso.sha256
- nix run nixpkgs#gnused -- --in-place "s/$ISO_NAME/PubSolarOS-latest.iso/" PubSolarOS-latest.iso.sha256
- name: "Publish ISO"
image: appleboy/drone-scp
@ -117,6 +124,8 @@ steps:
target: /srv/os
source:
- /var/nix/iso-cache/*.iso
- /var/nix/iso-cache/*.iso.sha256
overwrite: true
strip_components: 3
depends_on:
@ -134,6 +143,6 @@ volumes:
---
kind: signature
hmac: 2b930bb5fe02006203b7c2fae8af75814749e8cec5f976ec0d6e64eae1b0c5db
hmac: 7b0b56a97294cd563eee2bde56abeea6dd0928e01729980a25f8c165a3f6e0f6
...

View file

@ -1,4 +1,18 @@
{ profiles, ... }:
{ config, lib, pkgs, profiles, ... }:
with lib;
let
# Gets hostname of host to be bundled inside iso
# Copied from https://github.com/divnix/digga/blob/30ffa0b02272dc56c94fd3c7d8a5a0f07ca197bf/modules/bootstrap-iso.nix#L3-L11
getFqdn = config:
let
net = config.networking;
fqdn =
if (net ? domain) && (net.domain != null)
then "${net.hostName}.${net.domain}"
else net.hostName;
in
fqdn;
in
{
# build with: `nix build ".#nixosConfigurations.bootstrap.config.system.build.isoImage"`
imports = [
@ -10,16 +24,28 @@
profiles.pub-solar-iso
];
boot.loader.systemd-boot.enable = true;
config = {
boot.loader.systemd-boot.enable = true;
# will be overridden by the bootstrapIso instrumentation
fileSystems."/" = { device = "/dev/disk/by-label/nixos"; };
# will be overridden by the bootstrapIso instrumentation
fileSystems."/" = { device = "/dev/disk/by-label/nixos"; };
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.05"; # Did you read the comment?
system.nixos.label = "PubSolarOS-" + config.system.nixos.version;
# mkForce because a similar transformation gets double applied otherwise
# https://github.com/divnix/digga/blob/30ffa0b02272dc56c94fd3c7d8a5a0f07ca197bf/modules/bootstrap-iso.nix#L17
# https://github.com/NixOS/nixpkgs/blob/aecd4d8349b94f9bd5718c74a5b789f233f67326/nixos/modules/installer/cd-dvd/installation-cd-base.nix#L21-L22
isoImage = {
isoBaseName = mkForce (getFqdn config);
isoName = mkForce "${config.system.nixos.label}-${config.isoImage.isoBaseName}-${pkgs.stdenv.hostPlatform.system}.iso";
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.05"; # Did you read the comment?
};
}

View file

@ -2,7 +2,6 @@
with lib;
let
psCfg = config.pub-solar;
cfg = config.pub-solar.core;
in
{
@ -29,12 +28,12 @@ in
config = {
pub-solar = {
audio.enable = lib.mkIf (!cfg.lite) (lib.mkDefault true);
crypto.enable = lib.mkIf (!cfg.lite) (lib.mkDefault true);
devops.enable = lib.mkIf (!cfg.lite) (lib.mkDefault true);
audio.enable = mkIf (!cfg.lite) (mkDefault true);
crypto.enable = mkIf (!cfg.lite) (mkDefault true);
devops.enable = mkIf (!cfg.lite) (mkDefault true);
terminal-life = {
enable = lib.mkDefault true;
enable = mkDefault true;
lite = cfg.lite;
};
};