mirror of
https://github.com/nix-community/disko.git
synced 2026-11-30 13:03:28 +01:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3be6dfbaca |
No files matched your search
@@ -1,8 +1,3 @@
|
||||
# This example with the legacy table should not be used. We recommend using the
|
||||
# gpt type instead. More information about this warning may be found in the
|
||||
# documentation.
|
||||
#
|
||||
# https://github.com/nix-community/disko/blob/master/docs/table-to-gpt.md
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
# This example with the legacy table should not be used. We recommend using the
|
||||
# gpt type instead. More information about this warning may be found in the
|
||||
# documentation.
|
||||
#
|
||||
# https://github.com/nix-community/disko/blob/master/docs/table-to-gpt.md
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
# This example with the legacy table should not be used. We recommend using the
|
||||
# gpt type instead. More information about this warning may be found in the
|
||||
# documentation.
|
||||
#
|
||||
# https://github.com/nix-community/disko/blob/master/docs/table-to-gpt.md
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
|
||||
Generated
+3
-3
@@ -2,11 +2,11 @@
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1768661221,
|
||||
"narHash": "sha256-MJwOjrIISfOpdI9x4C+5WFQXvHtOuj5mqLZ4TMEtk1M=",
|
||||
"lastModified": 1763618868,
|
||||
"narHash": "sha256-v5afmLjn/uyD9EQuPBn7nZuaZVV9r+JerayK/4wvdWA=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3327b113f2ef698d380df83fbccefad7e83d7769",
|
||||
"rev": "a8d610af3f1a5fb71e23e08434d8d61a466fc942",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
text = ''treefmt "$@"'';
|
||||
runtimeInputs = [
|
||||
pkgs.deadnix
|
||||
pkgs.nixfmt
|
||||
pkgs.nixfmt-rfc-style
|
||||
pkgs.shellcheck
|
||||
pkgs.treefmt
|
||||
];
|
||||
|
||||
+2
-7
@@ -6,13 +6,8 @@
|
||||
qemu-common ? import <nixpkgs/nixos/lib/qemu-common.nix>,
|
||||
}:
|
||||
let
|
||||
# qemu-common is a function that takes { lib, stdenv } and returns QEMU utilities
|
||||
qemu-common-lib =
|
||||
pkgs:
|
||||
qemu-common {
|
||||
inherit lib;
|
||||
inherit (pkgs) stdenv;
|
||||
};
|
||||
# qemu-common is a function that takes { lib, pkgs } and returns QEMU utilities
|
||||
qemu-common-lib = pkgs: qemu-common { inherit lib pkgs; };
|
||||
|
||||
outputs = import ../default.nix { inherit lib diskoLib; };
|
||||
diskoLib = {
|
||||
|
||||
@@ -144,7 +144,7 @@ let
|
||||
# (nix refuses symlinks in store path hierarchy)
|
||||
rootMountPoint=$(realpath ${lib.escapeShellArg systemToInstall.config.disko.rootMountPoint})
|
||||
# populate nix db, so nixos-install doesn't complain
|
||||
export NIX_STATE_DIR="$rootMountPoint"/nix/var/nix
|
||||
export NIX_STATE_DIR=$rootMountPoint/nix/var/nix
|
||||
nix-store --load-db < "${closureInfo}/registration"
|
||||
|
||||
# We copy files with cp because `nix copy` has a large memory leak.
|
||||
|
||||
+1
-1
@@ -305,7 +305,7 @@ in
|
||||
--align-end ${
|
||||
lib.optionalString (
|
||||
partition.alignment != 0
|
||||
) "--set-alignment=${builtins.toString partition.alignment}"
|
||||
) ''--set-alignment=${builtins.toString partition.alignment}''
|
||||
} \
|
||||
--new=${toString partition._index}:${partition.start}:${partition.end} \
|
||||
'';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
lib,
|
||||
writeShellApplication,
|
||||
bash,
|
||||
coreutils,
|
||||
@@ -13,73 +14,5 @@ writeShellApplication {
|
||||
coreutils
|
||||
nix-fast-build
|
||||
];
|
||||
text = ''
|
||||
version=''${1:-}
|
||||
if [[ -z "$version" ]]; then
|
||||
echo "USAGE: nix run .#create-release -- <version>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if we're running from the root of the repository
|
||||
if [[ ! -f "flake.nix" || ! -f "version.nix" ]]; then
|
||||
echo "This script must be run from the root of the repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the version matches the semver pattern (without suffixes)
|
||||
semver_regex="^([0-9]+)\.([0-9]+)\.([0-9]+)$"
|
||||
if [[ ! "$version" =~ $semver_regex ]]; then
|
||||
echo "Version must match the semver pattern (e.g., 1.0.0, 2.3.4)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$(git symbolic-ref --short HEAD)" != "master" ]]; then
|
||||
echo "must be on master branch" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure there are no uncommitted or unpushed changes
|
||||
uncommited_changes=$(git diff --compact-summary)
|
||||
if [[ -n "$uncommited_changes" ]]; then
|
||||
echo -e "There are uncommited changes, exiting:\n''${uncommited_changes}" >&2
|
||||
exit 1
|
||||
fi
|
||||
git pull git@github.com:nix-community/disko master
|
||||
unpushed_commits=$(git log --format=oneline origin/master..master)
|
||||
if [[ "$unpushed_commits" != "" ]]; then
|
||||
echo -e "\nThere are unpushed changes, exiting:\n$unpushed_commits" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run all tests to ensure we don't release a broken version
|
||||
# Two workers are safe on systems with at least 16GB of RAM
|
||||
nix-fast-build --no-link -j 2 --eval-workers 2 --flake .#checks
|
||||
|
||||
# Update the version file
|
||||
cat > version.nix <<EOF
|
||||
{
|
||||
version = "$version";
|
||||
released = false;
|
||||
}
|
||||
EOF
|
||||
|
||||
# Commit and tag the release
|
||||
git commit -am "release: v$version"
|
||||
git tag -a "v$version" -m "release: v$version"
|
||||
git tag -d "latest"
|
||||
git tag -a "latest" -m "release: v$version"
|
||||
|
||||
# a revsion suffix when run from the tagged release commit
|
||||
echo "{ version = \"$version\"; released = false; }" > version.nix
|
||||
git commit -am "release: reset released flag"
|
||||
|
||||
echo "Release was prepared successfully!"
|
||||
echo "To push the release, run the following command:"
|
||||
echo
|
||||
echo " git push origin master v$version && git push --force origin latest"
|
||||
echo
|
||||
echo "After that, create a release on GitHub:"
|
||||
echo
|
||||
echo " https://github.com/nix-community/disko/releases/new"
|
||||
'';
|
||||
text = lib.readFile ./create-release.sh;
|
||||
}
|
||||
Executable
+72
@@ -0,0 +1,72 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# Don't run directly! Instead, use
|
||||
# nix run .#create-release
|
||||
|
||||
version=${1:-}
|
||||
if [[ -z "$version" ]]; then
|
||||
echo "USAGE: nix run .#create-release -- <version>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if we're running from the root of the repository
|
||||
if [[ ! -f "flake.nix" || ! -f "version.nix" ]]; then
|
||||
echo "This script must be run from the root of the repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the version matches the semver pattern (without suffixes)
|
||||
semver_regex="^([0-9]+)\.([0-9]+)\.([0-9]+)$"
|
||||
if [[ ! "$version" =~ $semver_regex ]]; then
|
||||
echo "Version must match the semver pattern (e.g., 1.0.0, 2.3.4)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$(git symbolic-ref --short HEAD)" != "master" ]]; then
|
||||
echo "must be on master branch" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure there are no uncommitted or unpushed changes
|
||||
uncommited_changes=$(git diff --compact-summary)
|
||||
if [[ -n "$uncommited_changes" ]]; then
|
||||
echo -e "There are uncommited changes, exiting:\n${uncommited_changes}" >&2
|
||||
exit 1
|
||||
fi
|
||||
git pull git@github.com:nix-community/disko master
|
||||
unpushed_commits=$(git log --format=oneline origin/master..master)
|
||||
if [[ "$unpushed_commits" != "" ]]; then
|
||||
echo -e "\nThere are unpushed changes, exiting:\n$unpushed_commits" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run all tests to ensure we don't release a broken version
|
||||
# Two workers are safe on systems with at least 16GB of RAM
|
||||
nix-fast-build --no-link -j 2 --eval-workers 2 --flake .#checks
|
||||
|
||||
# Update the version file
|
||||
cat > version.nix <<EOF
|
||||
{
|
||||
version = "$version";
|
||||
released = false;
|
||||
}
|
||||
EOF
|
||||
|
||||
# Commit and tag the release
|
||||
git commit -am "release: v$version"
|
||||
git tag -a "v$version" -m "release: v$version"
|
||||
git tag -d "latest"
|
||||
git tag -a "latest" -m "release: v$version"
|
||||
|
||||
# a revsion suffix when run from the tagged release commit
|
||||
echo "{ version = \"$version\"; released = false; }" > version.nix
|
||||
git commit -am "release: reset released flag"
|
||||
|
||||
echo "Release was prepared successfully!"
|
||||
echo "To push the release, run the following command:"
|
||||
echo
|
||||
echo " git push origin master v$version && git push --force origin latest"
|
||||
echo
|
||||
echo "After that, create a release on GitHub:"
|
||||
echo
|
||||
echo " https://github.com/nix-community/disko/releases/new"
|
||||
+5
-8
@@ -17,7 +17,7 @@ diskoLib.testLib.makeDiskoTest {
|
||||
'';
|
||||
extraInstallerConfig = {
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
kernelPackages = pkgs.linuxPackages_testing;
|
||||
supportedFilesystems = [ "bcachefs" ];
|
||||
};
|
||||
};
|
||||
@@ -39,9 +39,6 @@ diskoLib.testLib.makeDiskoTest {
|
||||
machine.succeed("lsblk >&2");
|
||||
machine.succeed("lsblk -f >&2");
|
||||
machine.succeed("mount >&2");
|
||||
# We need to manually unlock /dev/vda2 for some reason
|
||||
# even though it should already get unlocked by bootCommands
|
||||
machine.succeed(r'printf "secretsecret" | bcachefs unlock -k session /dev/vda2 >&2');
|
||||
machine.succeed("bcachefs show-super /dev/vda2 >&2");
|
||||
machine.succeed("bcachefs show-super /dev/vdd1 >&2");
|
||||
machine.succeed("findmnt --json >&2");
|
||||
@@ -56,10 +53,10 @@ diskoLib.testLib.makeDiskoTest {
|
||||
# Verify device membership and labels.
|
||||
machine.succeed("bcachefs show-super /dev/vda2 | grep 'Devices:' | grep -q '3'");
|
||||
machine.succeed("bcachefs show-super /dev/vdd1 | grep 'Devices:' | grep -q '1'");
|
||||
machine.succeed(r"bcachefs show-super /dev/vda2 | grep -qE '^[[:space:]]*Label:[[:space:]]+group_a\.vdb2'");
|
||||
machine.succeed(r"bcachefs show-super /dev/vda2 | grep -qE '^[[:space:]]*Label:[[:space:]]+group_a\.vdc1'");
|
||||
machine.succeed(r"bcachefs show-super /dev/vda2 | grep -qE '^[[:space:]]*Label:[[:space:]]+group_b\.vdd1'");
|
||||
machine.succeed(r"bcachefs show-super /dev/vdd1 | grep -qE '^[[:space:]]*Label:[[:space:]]+group_a\.vde1'");
|
||||
machine.succeed("bcachefs show-super /dev/vda2 | grep -qE '^[[:space:]]*Label:[[:space:]]+group_a\.vdb2'");
|
||||
machine.succeed("bcachefs show-super /dev/vda2 | grep -qE '^[[:space:]]*Label:[[:space:]]+group_a\.vdc1'");
|
||||
machine.succeed("bcachefs show-super /dev/vda2 | grep -qE '^[[:space:]]*Label:[[:space:]]+group_b\.vdd1'");
|
||||
machine.succeed("bcachefs show-super /dev/vdd1 | grep -qE '^[[:space:]]*Label:[[:space:]]+group_a\.vde1'");
|
||||
machine.fail("bcachefs show-super /dev/vda2 | grep 'Label:' | grep -q 'non-existent'");
|
||||
|
||||
# Verify format arguments.
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
version = "1.13.0";
|
||||
released = true;
|
||||
version = "1.12.0";
|
||||
released = false;
|
||||
}
|
||||
Reference in new issue
Block a user