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 #!/usr/bin/env bash
# TODO Surely there's more elegant? # TODO Flakes
nix-channel --add https://nixos.org/channels/nixos-23.05 nixpkgs nix-channel --add https://nixos.org/channels/nixos-23.11 nixpkgs
# Below probably only needed on non-NixOS nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz home-manager nix-channel --add https://github.com/NixOS/nixos-hardware/archive/8772491ed75f150f02552c60694e1beff9f46013.tar.gz nixos-hardware
nix-channel --update 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, ... }: { lib, ... }:
{ {
imports = [ 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, ... }: { pkgs, config, ... }:
{ {
# This whole folder is DEBUG
imports = [ imports = [
"${builtins.fetchTarball "https://github.com/nix-community/disko/archive/3cb78c93e6a02f494aaf6aeb37481c27a2e2ee22.tar.gz"}/module.nix" ../os
../curacao/options.nix
../curacao/hardware.nix
./disko.nix ./disko.nix
]; ];
nixpkgs.config.allowUnfree = true;
networking.hostName = "curacao_usb"; networking.hostName = "curacao_usb";
boot = { # It's a removable drive, so no touching EFI vars
# nixos-hardware use latest kernel by default. It has been set a while ago, we maybe don't need it anymore? # (quite a lot of stuff to set for that!)
kernelPackages = pkgs.linuxPackages; boot.loader = {
# 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)
efi.canTouchEfiVariables = false; efi.canTouchEfiVariables = false;
# systemd-boot crashes after booting, so GRUB it is
grub = { grub = {
enable = true;
efiSupport = true;
efiInstallAsRemovable = true; efiInstallAsRemovable = true;
device = "nodev"; device = "nodev";
}; };
}; };
};
} }

View file

@ -1,9 +1,10 @@
{ id, name, ... }:
{ {
disko.devices = { disko.devices = {
disk = { disk = {
pindakaas_sd = { "${name}" = {
type = "disk"; type = "disk";
device = "/dev/disk/by-id/usb-Kingston_DataTraveler_3.0_E0D55EA57414F510489F0F1A-0:0"; device = "/dev/disk/by-id/${id}";
content = { content = {
type = "gpt"; type = "gpt";
partitions = { partitions = {
@ -24,8 +25,8 @@
size = "100%"; size = "100%";
content = { content = {
type = "luks"; type = "luks";
name = "pindakaas_sd"; name = "${name}";
#passwordFile = "/tmp/secret.key"; # Commented out so asked interactively passwordFile = "/tmp/secret.key"; # TODO Generate this somehow
settings = { settings = {
# Not having SSDs die fast is more important than crypto # Not having SSDs die fast is more important than crypto
# nerds that could potentially discover which filesystem I # 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; fpga = true;
python = true; python = true;
}; };
# extra = true; # FIXME Should support aarch64 extra = true;
}; };
} }

View file

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

View file

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

View file

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

View file

@ -2,9 +2,9 @@
let let
nixvim = import (builtins.fetchGit { nixvim = import (builtins.fetchGit {
url = "https://github.com/nix-community/nixvim"; 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"; pname = "vim-shot-f";
version = "2016-02-05"; version = "2016-02-05";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
@ -15,7 +15,7 @@ let
}; };
meta.homepage = "https://github.com/deris/vim-shot-f"; meta.homepage = "https://github.com/deris/vim-shot-f";
}; };
quick-scope = pkgs.vimUtils.buildVimPluginFrom2Nix rec { quick-scope = pkgs.vimUtils.buildVimPlugin rec {
pname = "quick-scope"; pname = "quick-scope";
version = "2.6.1"; version = "2.6.1";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
@ -199,8 +199,7 @@ in
# TODO Could add some, could also remove some # 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 rnix-lsp.enable = true; # Nix
# FIXME sqlls # FIXME sqlls
yamlls.enable = true; # YAML yamlls.enable = true; # YAML
@ -226,7 +225,7 @@ in
# indent = true; # Not very working last time I tried apparently # indent = true; # Not very working last time I tried apparently
}; };
# TODO Investigate https://github.com/nvim-treesitter/nvim-treesitter-textobjects # 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 undotree.enable = true; # Navigate edition history
@ -270,7 +269,7 @@ in
# Treesitter # Treesitter
nvim-ts-rainbow # Randomly color parenthesis pairs nvim-ts-rainbow # Randomly color parenthesis pairs
# 23.11: Replace with plugins.rainbow-delimiters # TODO Replace with plugins.rainbow-delimiters
# Snippets # Snippets
vim-vsnip vim-vsnip
@ -355,54 +354,53 @@ in
# TODO Is not working, options is set to nil even though it shouldn't # TODO Is not working, options is set to nil even though it shouldn't
}; };
# 23.11: Use keymaps, seems better keymaps = [
maps = {
# GENERAL # GENERAL
# Allow saving of files as sudo when I forgot to start vim using sudo. # Allow saving of files as sudo when I forgot to start vim using sudo.
# From https://stackoverflow.com/a/7078429 # 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>"; }; { mode = "i"; key = "jk"; action = "<Esc>"; }
visual."<Enter>" = { action = "<Esc>"; }; { mode = "v"; key = "<Enter>"; action = "<Esc>"; }
normal."<Enter>" = { action = "o<Esc>"; }; { key = "<Enter>"; action = "o<Esc>"; }
# normal."<C-H>" = { action = ":bp<CR>"; }; # { key = "<C-H>"; action = ":bp<CR>"; }
# normal."<C-L>" = { action = ":bn<CR>"; }; # { key = "<C-L>"; action = ":bn<CR>"; }
normal."<C-K>" = { action = "kkkkkkkkkkkkkkkkkkkkk"; }; { key = "<C-K>"; action = "kkkkkkkkkkkkkkkkkkkkk"; }
normal."<C-J>" = { action = "jjjjjjjjjjjjjjjjjjjjj"; }; { key = "<C-J>"; action = "jjjjjjjjjjjjjjjjjjjjj"; }
# \s to replace globally the word under the cursor # \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 # PLUGINS
# barbar # barbar
normal."<C-H>" = { action = "<Cmd>BufferPrevious<CR>"; silent = true; }; { key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; options = { silent = true; }; }
normal."<C-L>" = { action = "<Cmd>BufferNext<CR>"; 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/ # 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; }; { key = "<Space><C-H>"; action = "<Cmd>BufferMovePrevious<CR>"; options = { silent = true; }; }
normal."<Space><C-L>" = { action = "<Cmd>BufferMoveNext<CR>"; silent = true; }; { key = "<Space><C-L>"; action = "<Cmd>BufferMoveNext<CR>"; options = { silent = true; }; }
# TODO gotos don't work # TODO gotos don't work
normal."<C-1>" = { action = "<Cmd>BufferGoto 1<CR>"; silent = true; }; { key = "<C-1>"; action = "<Cmd>BufferGoto 1<CR>"; options = { silent = true; }; }
normal."<C-2>" = { action = "<Cmd>BufferGoto 2<CR>"; silent = true; }; { key = "<C-2>"; action = "<Cmd>BufferGoto 2<CR>"; options = { silent = true; }; }
normal."<C-3>" = { action = "<Cmd>BufferGoto 3<CR>"; silent = true; }; { key = "<C-3>"; action = "<Cmd>BufferGoto 3<CR>"; options = { silent = true; }; }
normal."<C-4>" = { action = "<Cmd>BufferGoto 4<CR>"; silent = true; }; { key = "<C-4>"; action = "<Cmd>BufferGoto 4<CR>"; options = { silent = true; }; }
normal."<C-5>" = { action = "<Cmd>BufferGoto 5<CR>"; silent = true; }; { key = "<C-5>"; action = "<Cmd>BufferGoto 5<CR>"; options = { silent = true; }; }
normal."<C-6>" = { action = "<Cmd>BufferGoto 6<CR>"; silent = true; }; { key = "<C-6>"; action = "<Cmd>BufferGoto 6<CR>"; options = { silent = true; }; }
normal."<C-7>" = { action = "<Cmd>BufferGoto 7<CR>"; silent = true; }; { key = "<C-7>"; action = "<Cmd>BufferGoto 7<CR>"; options = { silent = true; }; }
normal."<C-8>" = { action = "<Cmd>BufferGoto 8<CR>"; silent = true; }; { key = "<C-8>"; action = "<Cmd>BufferGoto 8<CR>"; options = { silent = true; }; }
normal."<C-9>" = { action = "<Cmd>BufferGoto 9<CR>"; silent = true; }; { key = "<C-9>"; action = "<Cmd>BufferGoto 9<CR>"; options = { silent = true; }; }
normal."<C-0>" = { action = "<Cmd>BufferLast<CR>"; silent = true; }; { key = "<C-0>"; action = "<Cmd>BufferLast<CR>"; options = { silent = true; }; }
normal."gb" = { action = "<Cmd>BufferPick<CR>"; silent = true; }; { key = "gb"; action = "<Cmd>BufferPick<CR>"; options = { silent = true; }; }
# TODO Other useful options? # TODO Other useful options?
# symbols-outline-nvim # symbols-outline-nvim
normal."<Space>s" = { action = "<Cmd>SymbolsOutline<CR>"; silent = true; }; { key = "<Space>s"; action = "<Cmd>SymbolsOutline<CR>"; options = { silent = true; }; }
# undotree # 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 # Parse arguments
function help { function help {
echo "Usage: $0 [-e] [-h] profile" echo "Usage: $0 [-h|-e] profile"
echo echo
echo "Arguments:" echo "Arguments:"
echo " file: OS/disk profile to use" echo " profile: OS/disk profile to use"
echo echo
echo "Options:" echo "Options:"
echo " -h: Display this help message." echo " -h: Display this help message."
@ -18,7 +18,7 @@ function help {
} }
disko_mode=mount disko_mode=mount
while getopts "e" OPTION while getopts "he" OPTION
do do
case "$OPTION" in case "$OPTION" in
h) h)

View file

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

View file

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

View file

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

View file

@ -1,65 +1 @@
{ import ../dk/single_uefi_btrfs.nix { id = "mmc-SN32G_0xfb19ae99"; name = "pindakaas_sd"; }
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";
# };
};
};
};
};
};
};
};
};
};
}

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