Compare commits

..

No commits in common. "05b1f2d88ae592350e086adfb8e1772e5d976a77" and "36608fa9e447cc73dfe60bdf48d96148f7cbd099" have entirely different histories.

24 changed files with 235 additions and 161 deletions

4
.gitignore vendored
View file

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

View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
# TODO Flakes
# TODO Surely there's more elegant?
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 --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 --update

View file

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

View file

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

View file

@ -0,0 +1,38 @@
{
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

@ -0,0 +1,32 @@
{
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 @@
import ../dk/single_uefi_btrfs.nix { id = "usb-Kingston_DataTraveler_3.0_E0D55EA57414F510489F0F1A-0:0"; name = "curacao_usb"; }

1
curacao_usb/disko.nix Symbolic link
View file

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

View file

@ -1,22 +1,30 @@
{ pkgs, config, ... }:
{
# This whole folder is DEBUG
imports = [
../os
../curacao/options.nix
../curacao/hardware.nix
"${builtins.fetchTarball "https://github.com/nix-community/disko/archive/3cb78c93e6a02f494aaf6aeb37481c27a2e2ee22.tar.gz"}/module.nix"
./disko.nix
];
nixpkgs.config.allowUnfree = true;
networking.hostName = "curacao_usb";
# It's a removable drive, so no touching EFI vars
# (quite a lot of stuff to set for that!)
boot.loader = {
efi.canTouchEfiVariables = false;
grub = {
efiInstallAsRemovable = true;
device = "nodev";
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)
efi.canTouchEfiVariables = false;
# systemd-boot crashes after booting, so GRUB it is
grub = {
enable = true;
efiSupport = true;
efiInstallAsRemovable = true;
device = "nodev";
};
};
};
}

View file

@ -1,6 +0,0 @@
# 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

@ -172,7 +172,8 @@ in
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
enableSyntaxHighlighting = true;
# syntaxHighlighting.enable = true; # 23.11 syntax
historySubstringSearch.enable = true;
initExtra = lib.strings.concatLines [
commonRc
@ -349,7 +350,6 @@ 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.11";
stateVersion = "23.05";
language = {
base = "en_US.UTF-8";
# time = "en_DK.UTF-8"; # FIXME Disabled because complaints during nixos-rebuild switch
@ -423,6 +423,7 @@ 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 # FIXME Requires i686-linux or something. IIRC the package says to use the NixOS config and not it directly.
steam
yuzu-mainline
minecraft
# TODO factorio

View file

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

View file

@ -2,9 +2,9 @@
let
nixvim = import (builtins.fetchGit {
url = "https://github.com/nix-community/nixvim";
ref = "nixos-23.11";
ref = "nixos-23.05";
});
vim-shot-f = pkgs.vimUtils.buildVimPlugin {
vim-shot-f = pkgs.vimUtils.buildVimPluginFrom2Nix {
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.buildVimPlugin rec {
quick-scope = pkgs.vimUtils.buildVimPluginFrom2Nix rec {
pname = "quick-scope";
version = "2.6.1";
src = pkgs.fetchFromGitHub {
@ -199,7 +199,8 @@ in
# TODO Could add some, could also remove some
};
};
phpactor.enable = true; # PHP
# FIXME phpactor. Only from 23.11
# phpactor.enable = true; # PHP
rnix-lsp.enable = true; # Nix
# FIXME sqlls
yamlls.enable = true; # YAML
@ -225,7 +226,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; # TODO integrate with rainbow-delimiters and use more of the options
indent-blankline.enable = true; # 23.11 integrate with rainbow-delimiters and use more of the options
undotree.enable = true; # Navigate edition history
@ -269,7 +270,7 @@ in
# Treesitter
nvim-ts-rainbow # Randomly color parenthesis pairs
# TODO Replace with plugins.rainbow-delimiters
# 23.11: Replace with plugins.rainbow-delimiters
# Snippets
vim-vsnip
@ -286,14 +287,14 @@ in
# Language-specific
tcomment_vim # Language-aware (un)commenting
] ++ lib.optionals config.frogeye.extra [
] ++ lib.optionals config.frogeye.extra [
vim-LanguageTool # Check grammar for human languages
] ++ lib.optionals config.programs.pandoc.enable [
] ++ lib.optionals config.programs.pandoc.enable [
vim-pandoc # Pandoc-specific stuff because there's no LSP for it
vim-pandoc-syntax
] ++ lib.optionals config.frogeye.dev.c [
] ++ lib.optionals config.frogeye.dev.c [
nvim-dap # Debug Adapter Protocol client
] ++ lib.optionals config.frogeye.dev.ansible [
] ++ lib.optionals config.frogeye.dev.ansible [
ansible-vim # FIXME See if it doesn't require to do ./UltiSnips/generate.sh
];
extraConfigLua = lib.strings.concatMapStringsSep "\n" (f: builtins.readFile f) [
@ -354,53 +355,54 @@ in
# TODO Is not working, options is set to nil even though it shouldn't
};
keymaps = [
# 23.11: Use keymaps, seems better
maps = {
# GENERAL
# Allow saving of files as sudo when I forgot to start vim using sudo.
# From https://stackoverflow.com/a/7078429
{ mode = "c"; key = "w!!"; action = "w !sudo tee > /dev/null %"; }
command."w!!" = { action = "w !sudo tee > /dev/null %"; };
{ mode = "i"; key = "jk"; action = "<Esc>"; }
{ mode = "v"; key = "<Enter>"; action = "<Esc>"; }
{ key = "<Enter>"; action = "o<Esc>"; }
insert."jk" = { action = "<Esc>"; };
visual."<Enter>" = { action = "<Esc>"; };
normal."<Enter>" = { action = "o<Esc>"; };
# { key = "<C-H>"; action = ":bp<CR>"; }
# { key = "<C-L>"; action = ":bn<CR>"; }
{ key = "<C-K>"; action = "kkkkkkkkkkkkkkkkkkkkk"; }
{ key = "<C-J>"; action = "jjjjjjjjjjjjjjjjjjjjj"; }
# normal."<C-H>" = { action = ":bp<CR>"; };
# normal."<C-L>" = { action = ":bn<CR>"; };
normal."<C-K>" = { action = "kkkkkkkkkkkkkkkkkkkkk"; };
normal."<C-J>" = { action = "jjjjjjjjjjjjjjjjjjjjj"; };
# \s to replace globally the word under the cursor
{ key = "<Leader>s"; action = ":%s/\\<<C-r><C-w>\\>/"; }
normal."<Leader>s" = { action = ":%s/\\<<C-r><C-w>\\>/"; };
# PLUGINS
# barbar
{ key = "<C-H>"; action = "<Cmd>BufferPrevious<CR>"; options = { silent = true; }; }
{ key = "<C-L>"; action = "<Cmd>BufferNext<CR>"; options = { silent = true; }; }
normal."<C-H>" = { action = "<Cmd>BufferPrevious<CR>"; silent = true; };
normal."<C-L>" = { action = "<Cmd>BufferNext<CR>"; silent = true; };
# TODO https://www.reddit.com/r/neovim/comments/mbj8m5/how_to_setup_ctrlshiftkey_mappings_in_neovim_and/
{ key = "<Space><C-H>"; action = "<Cmd>BufferMovePrevious<CR>"; options = { silent = true; }; }
{ key = "<Space><C-L>"; action = "<Cmd>BufferMoveNext<CR>"; options = { silent = true; }; }
normal."<Space><C-H>" = { action = "<Cmd>BufferMovePrevious<CR>"; silent = true; };
normal."<Space><C-L>" = { action = "<Cmd>BufferMoveNext<CR>"; silent = true; };
# TODO gotos don't work
{ 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; }; }
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; };
# TODO Other useful options?
# symbols-outline-nvim
{ key = "<Space>s"; action = "<Cmd>SymbolsOutline<CR>"; options = { silent = true; }; }
normal."<Space>s" = { action = "<Cmd>SymbolsOutline<CR>"; silent = true; };
# undotree
{ key = "<Space>u"; action = "<Cmd>UndotreeToggle<CR>"; options = { silent = true; }; }
normal."<Space>u" = { action = "<Cmd>UndotreeToggle<CR>"; 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 [-h|-e] profile"
echo "Usage: $0 [-e] [-h] profile"
echo
echo "Arguments:"
echo " profile: OS/disk profile to use"
echo " file: 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 "he" OPTION
while getopts "e" OPTION
do
case "$OPTION" in
h)

View file

@ -55,6 +55,7 @@
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.
@ -73,6 +74,6 @@
system.copySystemConfiguration = true;
# Use defaults from
system.stateVersion = "23.11";
system.stateVersion = "23.05";
}

View file

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

View file

@ -1,7 +1,8 @@
{ pkgs, config, ... }:
{
imports = [
<nixos-hardware/pine64/pinebook-pro>
# First commit before 23.05 release date:
"${builtins.fetchTarball "https://github.com/NixOS/nixos-hardware/archive/468a7a108108908c7a35d6549f1e1f0236a9448a.tar.gz"}/pine64/pinebook-pro"
];
boot = {
@ -9,7 +10,6 @@
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 +1,65 @@
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";
# };
};
};
};
};
};
};
};
};
};
}

1
pindakaas_sd/hybrid Symbolic link
View file

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

2
vm/.gitignore vendored Normal file
View file

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

11
vm/build.sh Executable file
View file

@ -0,0 +1,11 @@
#!/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

View file

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