Compare commits

..

6 commits

Author SHA1 Message Date
Geoffrey Frogeye 05b1f2d88a
Process 23.11 deprecations and new things 2023-11-30 20:37:25 +01:00
Geoffrey Frogeye 02e03857c2
Update stateVersions to 23.11
No change needed!
2023-11-30 19:07:03 +01:00
Geoffrey Frogeye 5ee5e5fc52
Upgrade to NixOS 23.11 2023-11-30 19:02:32 +01:00
Geoffrey Frogeye bc4676dec0
Fix/reorganize profile variants 2023-11-30 19:01:55 +01:00
Geoffrey Frogeye 224f769324
Do not restrict VMs to a single config
Also "allows" full-system build without install.
2023-11-30 18:59:50 +01:00
Geoffrey Frogeye 3806e023f6
disko: Reorganize a bit 2023-11-30 18:57:58 +01:00
24 changed files with 161 additions and 235 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
*/system
*/vm
*/vmWithBootLoader
*.qcow2

View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
# TODO Surely there's more elegant?
# TODO Flakes
nix-channel --add https://nixos.org/channels/nixos-23.05 nixpkgs
# Below probably only needed on non-NixOS
nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz home-manager
nix-channel --add https://nixos.org/channels/nixos-23.11 nixpkgs
nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
nix-channel --add https://github.com/NixOS/nixos-hardware/archive/8772491ed75f150f02552c60694e1beff9f46013.tar.gz nixos-hardware
nix-channel --update

66
build_os.sh Executable file
View file

@ -0,0 +1,66 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash
#! nix-shell -p bash nix-output-monitor
set -euo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# Parse arguments
function help {
echo "Usage: $0 [-h|-v|-b] profile"
echo
echo "Arguments:"
echo " profile: OS/disk profile to use"
echo
echo "Options:"
echo " -h: Display this help message."
echo " -v: Build a virtual machine."
echo " -b: Build a virtual machine with boot loader."
}
attr=system
while getopts "hvb" OPTION
do
case "$OPTION" in
h)
help
exit 0
;;
v)
attr=vm
;;
b)
attr=vmWithBootLoader
;;
?)
help
exit 2
;;
esac
done
shift "$(($OPTIND -1))"
if [ "$#" -ne 1 ]
then
help
exit 2
fi
profile="$1"
profile_dir="${SCRIPT_DIR}/${profile}"
if [ ! -d "$profile_dir" ]
then
echo "Profile not found."
fi
nixos_config="${profile_dir}/os.nix"
if [ ! -f "$nixos_config" ]
then
echo "NixOS configuration not found."
fi
set -x
nom-build '<nixpkgs/nixos>' -I "nixos-config=${nixos_config}" -A "$attr" -o "${profile_dir}/${attr}"
echo 

View file

@ -1,8 +1,15 @@
{ lib, ... }:
{
imports = [
"${builtins.fetchTarball "https://github.com/NixOS/nixos-hardware/archive/468a7a108108908c7a35d6549f1e1f0236a9448a.tar.gz"}/dell/g3/3779"
<nixos-hardware/dell/g3/3779>
];
boot.loader.efi.canTouchEfiVariables = lib.mkDefault true;
# UEFI works here, and variables can be touched
boot.loader = {
efi.canTouchEfiVariables = lib.mkDefault true;
grub = {
enable = true;
efiSupport = true;
};
};
}

View file

@ -1,38 +0,0 @@
{
disko.devices = {
disk = {
vdb = {
type = "disk";
device = "/dev/disk/by-id/usb-Kingston_DataTraveler_3.0_E0D55EA57414F510489F0F1A-0:0";
content = {
type = "gpt";
partitions = {
ESP = {
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted";
settings.allowDiscards = true;
passwordFile = "/tmp/secret.key";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
};
}

View file

@ -1,32 +0,0 @@
{
disko.devices = {
disk = {
vdb = {
type = "disk";
device = "/dev/disk/by-id/usb-Kingston_DataTraveler_3.0_E0D55EA57414F510489F0F1A-0:0";
content = {
type = "gpt";
partitions = {
ESP = {
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
}

View file

@ -1 +0,0 @@
disko-hanging.nix

1
curacao_usb/disko.nix Normal file
View file

@ -0,0 +1 @@
import ../dk/single_uefi_btrfs.nix { id = "usb-Kingston_DataTraveler_3.0_E0D55EA57414F510489F0F1A-0:0"; name = "curacao_usb"; }

View file

@ -1,30 +1,22 @@
{ pkgs, config, ... }:
{
# This whole folder is DEBUG
imports = [
"${builtins.fetchTarball "https://github.com/nix-community/disko/archive/3cb78c93e6a02f494aaf6aeb37481c27a2e2ee22.tar.gz"}/module.nix"
../os
../curacao/options.nix
../curacao/hardware.nix
./disko.nix
];
nixpkgs.config.allowUnfree = true;
networking.hostName = "curacao_usb";
boot = {
# nixos-hardware use latest kernel by default. It has been set a while ago, we maybe don't need it anymore?
kernelPackages = pkgs.linuxPackages;
# Pinebook supports UEFI, at least when tow-boot is installed on the SPI
loader = {
# EFI Variables don't work (no generation appears in systemd-boot)
# It's a removable drive, so no touching EFI vars
# (quite a lot of stuff to set for that!)
boot.loader = {
efi.canTouchEfiVariables = false;
# systemd-boot crashes after booting, so GRUB it is
grub = {
enable = true;
efiSupport = true;
efiInstallAsRemovable = true;
device = "nodev";
};
};
};
}

View file

@ -1,9 +1,10 @@
{ id, name, ... }:
{
disko.devices = {
disk = {
pindakaas_sd = {
"${name}" = {
type = "disk";
device = "/dev/disk/by-id/usb-Kingston_DataTraveler_3.0_E0D55EA57414F510489F0F1A-0:0";
device = "/dev/disk/by-id/${id}";
content = {
type = "gpt";
partitions = {
@ -24,8 +25,8 @@
size = "100%";
content = {
type = "luks";
name = "pindakaas_sd";
#passwordFile = "/tmp/secret.key"; # Commented out so asked interactively
name = "${name}";
passwordFile = "/tmp/secret.key"; # TODO Generate this somehow
settings = {
# Not having SSDs die fast is more important than crypto
# nerds that could potentially discover which filesystem I
@ -61,4 +62,5 @@
};
};
};
};
}

6
full/README.md Normal file
View file

@ -0,0 +1,6 @@
# full profile
Fake configuration that contains everything I could ever need,
used for debugging.
Can't build a full system due to not having a filesystem / bootloader configuration,
build as a VM (without bootloader).

View file

@ -9,6 +9,6 @@
fpga = true;
python = true;
};
# extra = true; # FIXME Should support aarch64
extra = true;
};
}

View file

@ -172,8 +172,7 @@ in
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
enableSyntaxHighlighting = true;
# syntaxHighlighting.enable = true; # 23.11 syntax
syntaxHighlighting.enable = true;
historySubstringSearch.enable = true;
initExtra = lib.strings.concatLines [
commonRc
@ -350,6 +349,7 @@ in
];
extraConfig = builtins.readFile ./tmux.conf + "source-file ${themepack}/share/tmux-plugins/tmux-themepack/powerline/default/green.tmuxtheme\n";
};
translate-shell.enable = true; # TODO Cool config?
};
services = {
gpg-agent = {
@ -394,7 +394,7 @@ in
};
};
home = {
stateVersion = "23.05";
stateVersion = "23.11";
language = {
base = "en_US.UTF-8";
# time = "en_DK.UTF-8"; # FIXME Disabled because complaints during nixos-rebuild switch
@ -423,7 +423,6 @@ in
man
# nodePackages.insect # FIXME Don't install on aarch64
# TODO Use whatever replaces insect
translate-shell
unzip
unrar
p7zip

View file

@ -47,7 +47,7 @@
# TODO wine-gecko wine-mono lib32-libpulse (?)
# gaming
steam
# steam # FIXME Requires i686-linux or something. IIRC the package says to use the NixOS config and not it directly.
yuzu-mainline
minecraft
# TODO factorio

View file

@ -2,7 +2,8 @@
let
stylix = builtins.fetchGit {
url = "https://github.com/danth/stylix.git";
ref = "release-23.05";
# No 23.11 branch last I checked
rev = "8b3f61727f3b86c27096c3c014ae602aa40670ba";
};
in
{

View file

@ -2,9 +2,9 @@
let
nixvim = import (builtins.fetchGit {
url = "https://github.com/nix-community/nixvim";
ref = "nixos-23.05";
ref = "nixos-23.11";
});
vim-shot-f = pkgs.vimUtils.buildVimPluginFrom2Nix {
vim-shot-f = pkgs.vimUtils.buildVimPlugin {
pname = "vim-shot-f";
version = "2016-02-05";
src = pkgs.fetchFromGitHub {
@ -15,7 +15,7 @@ let
};
meta.homepage = "https://github.com/deris/vim-shot-f";
};
quick-scope = pkgs.vimUtils.buildVimPluginFrom2Nix rec {
quick-scope = pkgs.vimUtils.buildVimPlugin rec {
pname = "quick-scope";
version = "2.6.1";
src = pkgs.fetchFromGitHub {
@ -199,8 +199,7 @@ in
# TODO Could add some, could also remove some
};
};
# FIXME phpactor. Only from 23.11
# phpactor.enable = true; # PHP
phpactor.enable = true; # PHP
rnix-lsp.enable = true; # Nix
# FIXME sqlls
yamlls.enable = true; # YAML
@ -226,7 +225,7 @@ in
# indent = true; # Not very working last time I tried apparently
};
# TODO Investigate https://github.com/nvim-treesitter/nvim-treesitter-textobjects
indent-blankline.enable = true; # 23.11 integrate with rainbow-delimiters and use more of the options
indent-blankline.enable = true; # TODO integrate with rainbow-delimiters and use more of the options
undotree.enable = true; # Navigate edition history
@ -270,7 +269,7 @@ in
# Treesitter
nvim-ts-rainbow # Randomly color parenthesis pairs
# 23.11: Replace with plugins.rainbow-delimiters
# TODO Replace with plugins.rainbow-delimiters
# Snippets
vim-vsnip
@ -355,54 +354,53 @@ in
# TODO Is not working, options is set to nil even though it shouldn't
};
# 23.11: Use keymaps, seems better
maps = {
keymaps = [
# GENERAL
# Allow saving of files as sudo when I forgot to start vim using sudo.
# From https://stackoverflow.com/a/7078429
command."w!!" = { action = "w !sudo tee > /dev/null %"; };
{ mode = "c"; key = "w!!"; action = "w !sudo tee > /dev/null %"; }
insert."jk" = { action = "<Esc>"; };
visual."<Enter>" = { action = "<Esc>"; };
normal."<Enter>" = { action = "o<Esc>"; };
{ mode = "i"; key = "jk"; action = "<Esc>"; }
{ mode = "v"; key = "<Enter>"; action = "<Esc>"; }
{ key = "<Enter>"; action = "o<Esc>"; }
# normal."<C-H>" = { action = ":bp<CR>"; };
# normal."<C-L>" = { action = ":bn<CR>"; };
normal."<C-K>" = { action = "kkkkkkkkkkkkkkkkkkkkk"; };
normal."<C-J>" = { action = "jjjjjjjjjjjjjjjjjjjjj"; };
# { key = "<C-H>"; action = ":bp<CR>"; }
# { key = "<C-L>"; action = ":bn<CR>"; }
{ key = "<C-K>"; action = "kkkkkkkkkkkkkkkkkkkkk"; }
{ key = "<C-J>"; action = "jjjjjjjjjjjjjjjjjjjjj"; }
# \s to replace globally the word under the cursor
normal."<Leader>s" = { action = ":%s/\\<<C-r><C-w>\\>/"; };
{ key = "<Leader>s"; action = ":%s/\\<<C-r><C-w>\\>/"; }
# PLUGINS
# barbar
normal."<C-H>" = { action = "<Cmd>BufferPrevious<CR>"; silent = true; };
normal."<C-L>" = { action = "<Cmd>BufferNext<CR>"; silent = true; };
{ key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; options = { silent = true; }; }
{ key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; options = { silent = true; }; }
# TODO https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
normal."<Space><C-H>" = { action = "<Cmd>BufferMovePrevious<CR>"; silent = true; };
normal."<Space><C-L>" = { action = "<Cmd>BufferMoveNext<CR>"; silent = true; };
{ key = "<Space><C-H>"; action = "<Cmd>BufferMovePrevious<CR>"; options = { silent = true; }; }
{ key = "<Space><C-L>"; action = "<Cmd>BufferMoveNext<CR>"; options = { silent = true; }; }
# TODO gotos don't work
normal."<C-1>" = { action = "<Cmd>BufferGoto 1<CR>"; silent = true; };
normal."<C-2>" = { action = "<Cmd>BufferGoto 2<CR>"; silent = true; };
normal."<C-3>" = { action = "<Cmd>BufferGoto 3<CR>"; silent = true; };
normal."<C-4>" = { action = "<Cmd>BufferGoto 4<CR>"; silent = true; };
normal."<C-5>" = { action = "<Cmd>BufferGoto 5<CR>"; silent = true; };
normal."<C-6>" = { action = "<Cmd>BufferGoto 6<CR>"; silent = true; };
normal."<C-7>" = { action = "<Cmd>BufferGoto 7<CR>"; silent = true; };
normal."<C-8>" = { action = "<Cmd>BufferGoto 8<CR>"; silent = true; };
normal."<C-9>" = { action = "<Cmd>BufferGoto 9<CR>"; silent = true; };
normal."<C-0>" = { action = "<Cmd>BufferLast<CR>"; silent = true; };
normal."gb" = { action = "<Cmd>BufferPick<CR>"; silent = true; };
{ key = "<C-1>"; action = "<Cmd>BufferGoto 1<CR>"; options = { silent = true; }; }
{ key = "<C-2>"; action = "<Cmd>BufferGoto 2<CR>"; options = { silent = true; }; }
{ key = "<C-3>"; action = "<Cmd>BufferGoto 3<CR>"; options = { silent = true; }; }
{ key = "<C-4>"; action = "<Cmd>BufferGoto 4<CR>"; options = { silent = true; }; }
{ key = "<C-5>"; action = "<Cmd>BufferGoto 5<CR>"; options = { silent = true; }; }
{ key = "<C-6>"; action = "<Cmd>BufferGoto 6<CR>"; options = { silent = true; }; }
{ key = "<C-7>"; action = "<Cmd>BufferGoto 7<CR>"; options = { silent = true; }; }
{ key = "<C-8>"; action = "<Cmd>BufferGoto 8<CR>"; options = { silent = true; }; }
{ key = "<C-9>"; action = "<Cmd>BufferGoto 9<CR>"; options = { silent = true; }; }
{ key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; options = { silent = true; }; }
{ key = "gb"; action = "<Cmd>BufferPick<CR>"; options = { silent = true; }; }
# TODO Other useful options?
# symbols-outline-nvim
normal."<Space>s" = { action = "<Cmd>SymbolsOutline<CR>"; silent = true; };
{ key = "<Space>s"; action = "<Cmd>SymbolsOutline<CR>"; options = { silent = true; }; }
# undotree
normal."<Space>u" = { action = "<Cmd>UndotreeToggle<CR>"; silent = true; };
{ key = "<Space>u"; action = "<Cmd>UndotreeToggle<CR>"; options = { silent = true; }; }
};
];
};
}

View file

@ -7,10 +7,10 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# Parse arguments
function help {
echo "Usage: $0 [-e] [-h] profile"
echo "Usage: $0 [-h|-e] profile"
echo
echo "Arguments:"
echo " file: OS/disk profile to use"
echo " profile: OS/disk profile to use"
echo
echo "Options:"
echo " -h: Display this help message."
@ -18,7 +18,7 @@ function help {
}
disko_mode=mount
while getopts "e" OPTION
while getopts "he" OPTION
do
case "$OPTION" in
h)

View file

@ -55,7 +55,6 @@
chrony = {
enable = true;
servers = map (n: "${toString n}.europe.pool.ntp.org") (lib.lists.range 0 3);
extraConfig = "rtcsync"; # See 23.11 release notes
};
# Prevent power button from shutting down the computer.
@ -74,6 +73,6 @@
system.copySystemConfiguration = true;
# Use defaults from
system.stateVersion = "23.05";
system.stateVersion = "23.11";
}

View file

@ -1,7 +1,7 @@
{ pkgs, config, ... }:
{
imports = [
"${builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz"}/nixos"
<home-manager/nixos>
];
users.users.geoffrey = {

View file

@ -1,8 +1,7 @@
{ pkgs, config, ... }:
{
imports = [
# First commit before 23.05 release date:
"${builtins.fetchTarball "https://github.com/NixOS/nixos-hardware/archive/468a7a108108908c7a35d6549f1e1f0236a9448a.tar.gz"}/pine64/pinebook-pro"
<nixos-hardware/pine64/pinebook-pro>
];
boot = {
@ -10,6 +9,7 @@
kernelPackages = pkgs.linuxPackages;
# Otherwise it will not show stage1 echo and prompt
# UPST
kernelParams = ["console=tty0"];
# Pinebook supports UEFI, at least when tow-boot is installed on the SPI

View file

@ -1,65 +1 @@
{
disko.devices = {
disk = {
pindakaas_sd = {
type = "disk";
device = "/dev/disk/by-id/mmc-SN32G_0xfb19ae99";
content = {
type = "gpt";
partitions = {
ESP = {
# Needs enough to store multiple kernel generations
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"defaults"
];
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "pindakaas_sd";
passwordFile = "/tmp/secret.key"; # TODO Generate this somehow
settings = {
# Not having SSDs die fast is more important than crypto
# nerds that could potentially discover which filesystem I
# use from TRIM patterns
allowDiscards = true;
};
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/nixos" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/home" = {
mountpoint = "/home";
mountOptions = [ "compress=zstd" "relatime" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
};
# Maybe later
# "/swap" = {
# mountpoint = "/.swapvol";
# swap.swapfile.size = "20M";
# };
};
};
};
};
};
};
};
};
};
}
import ../dk/single_uefi_btrfs.nix { id = "mmc-SN32G_0xfb19ae99"; name = "pindakaas_sd"; }

View file

@ -1 +0,0 @@
/nix/store/bz6nqy0ky5l33rfrkb6k66bzkgw18k90-nixos-system-pindakaas_sd-23.05.4981.5b528f99f73c

2
vm/.gitignore vendored
View file

@ -1,2 +0,0 @@
*.qcow2
result

View file

@ -1,11 +0,0 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash
#! nix-shell -p bash nix-output-monitor
# Build a NixOS VM for testing
set -euo pipefail
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
nom-build '<nixpkgs/nixos>' -A vm \
-I nixos-config=./os.nix