Compare commits

...

4 commits

Author SHA1 Message Date
Geoffrey Frogeye dd6f579f74
Booting pindakaas on SD card 2023-11-28 00:34:30 +01:00
Geoffrey Frogeye 7e49ed2e19
Reduce number of channels used
This was a fix attempt before I discovered that the issue was that
nixos-install uses the root user's channels. Doesn't hurt anyways.
2023-11-28 00:33:03 +01:00
Geoffrey Frogeye bae9c4c524
hm: Fix fix 2023-11-28 00:30:52 +01:00
Geoffrey Frogeye b626cb89f4
hm: Various fixes 2023-11-27 18:01:20 +01:00
10 changed files with 193 additions and 15 deletions

View file

@ -3,7 +3,6 @@
# TODO Surely there's more elegant? # TODO Surely there's more elegant?
nix-channel --add https://nixos.org/channels/nixos-23.05 nixpkgs 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://github.com/nix-community/home-manager/archive/release-23.05.tar.gz home-manager
# First commit before 23.05 release date:
nix-channel --add https://github.com/NixOS/nixos-hardware/archive/468a7a108108908c7a35d6549f1e1f0236a9448a.tar.gz nixos-hardware
nix-channel --update nix-channel --update

71
build-pindakaas-disk.sh Executable file
View file

@ -0,0 +1,71 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash
#! nix-shell -p bash nixos-install-tools
set -euo pipefail
# Parse arguments
function help {
echo "Usage: $0 -e"
echo
echo "Options:"
echo " -h: Display this help message."
echo " -e: Erase the disk. This can be used in case the wanted partition scheme doesn't match."
}
disko_mode=mount
while getopts "e" OPTION
do
case "$OPTION" in
h)
help
exit 0
;;
e)
disko_mode=disko
;;
?)
help
exit 2
;;
esac
done
shift "$(($OPTIND -1))"
if [ "$#" -gt 0 ]
then
help
exit 2
fi
set -x
# Add channels to root user, as nixos-install uses those.
# Not great, but fixable with flakes I guess
sudo ./add_channels.sh
# Format or mount disk
sudo nix --extra-experimental-features nix-command --extra-experimental-features flakes run github:nix-community/disko -- --mode $disko_mode ./pindakaas_disko.nix
# Generate hardware-config.nix
sudo nixos-generate-config --no-filesystems --root /mnt
# --no-filesystems because they are imported via disko
# Plug system configuration into this git repo
sudo mkdir -p /mnt/etc/nixos
echo "{ ... }: { imports = [ ./hardware-configuration.nix /home/geoffrey/.config/dotfiles/pindakaas.nix ]; }" | sudo tee /mnt/etc/nixos/configuration.nix > /dev/null
# Everything there should be covered by (and conflicts with) the repo anyways.
# Install NixOS! Or create a new generation.
sudo nixos-install
# Install dotfiles. Actually not needed by nixos-install since it doesn't rewrite global paths to /mnt.
# Without it no nixos-rebuild from the system itself once installed though.
# Should probably be replaced with something like git-sync
# sudo mkdir -p /mnt/home/geoffrey/.config/
# sudo cp -a ../dotfiles /mnt/home/geoffrey/.config/
# sudo chown geoffrey:geoffrey /mnt/home/geoffrey -R
# Signal we're done!
# Although it might ask for passwords beforehand, so not sure it's really useful
echo 

View file

@ -1,10 +1,12 @@
{ ... }: { ... }:
{ {
imports = [ imports = [
<nixos-hardware/dell/g3/3779> "${builtins.fetchTarball "https://github.com/NixOS/nixos-hardware/archive/468a7a108108908c7a35d6549f1e1f0236a9448a.tar.gz"}/dell/g3/3779"
./os/loader.nix ./os/loader.nix
]; ];
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "curacao"; networking.hostName = "curacao";
frogeye.extra = true; frogeye.extra = true;
frogeye.desktop.xorg = true; frogeye.desktop.xorg = true;

View file

@ -26,7 +26,7 @@ in
# Colored ls # Colored ls
# TODO Doesn't allow completion. Check out lsd instead # TODO Doesn't allow completion. Check out lsd instead
_colored_ls() { _colored_ls() {
\ls -lh --color=always $@ | awk ' ${pkgs.coreutils}/bin/ls -lh --color=always $@ | ${pkgs.gawk}/bin/awk '
BEGIN { BEGIN {
FPAT = "([[:space:]]*[^[:space:]]+)"; FPAT = "([[:space:]]*[^[:space:]]+)";
OFS = ""; OFS = "";
@ -475,7 +475,7 @@ in
]; ];
sessionVariables = { sessionVariables = {
# Favourite commands # Favourite commands
PAGER = "${pkgs.coreutils}/bin/less"; PAGER = "${pkgs.less}/bin/less";
EDITOR = "${pkgs.neovim}/bin/nvim"; EDITOR = "${pkgs.neovim}/bin/nvim";
# Extra config # Extra config

View file

@ -16,7 +16,9 @@
dotfiles = { dotfiles = {
path = lib.mkOption { path = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "${config.home.homeDirectory}/.config/dotfiles"; # default = "${config.home.homeDirectory}/.config/dotfiles";
# FIXME Above doesn't work outside home-manager context
default = "/home/geoffrey/.config/dotfiles";
}; };
}; };
}; };

View file

@ -2,10 +2,11 @@
{ {
networking.domain = "geoffrey.frogeye.fr"; networking.domain = "geoffrey.frogeye.fr";
boot.loader.efi.canTouchEfiVariables = true;
time.timeZone = "Europe/Amsterdam"; time.timeZone = "Europe/Amsterdam";
# Might fill emptiness?
boot.consoleLogLevel = 6; # KERN_INFO
# TODO qwerty-fr for console # TODO qwerty-fr for console
# Enable CUPS to print documents # Enable CUPS to print documents

View file

@ -1,7 +1,7 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
{ {
imports = [ imports = [
<home-manager/nixos> "${builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz"}/nixos"
]; ];
users.users.geoffrey = { users.users.geoffrey = {
@ -9,6 +9,7 @@
extraGroups = [ "wheel" ]; # Enable sudo for the user. extraGroups = [ "wheel" ]; # Enable sudo for the user.
shell = pkgs.zsh; shell = pkgs.zsh;
initialHashedPassword = "$y$j9T$e64bjL7iyVlniEKwKbM9g0$cCn74za0r6L9QMO20Fdxz3/SX0yvhz3Xd6.2BhtbRL1"; # Not a real password
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPE41gxrO8oZ5n3saapSwZDViOQphm6RzqgsBUyA88pU geoffrey@frogeye.fr" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPE41gxrO8oZ5n3saapSwZDViOQphm6RzqgsBUyA88pU geoffrey@frogeye.fr"
]; ];

View file

@ -7,5 +7,6 @@
./common.nix ./common.nix
./desktop.nix ./desktop.nix
./wireless.nix ./wireless.nix
"${builtins.fetchTarball "https://github.com/nix-community/disko/archive/3cb78c93e6a02f494aaf6aeb37481c27a2e2ee22.tar.gz"}/module.nix"
]; ];
} }

View file

@ -1,15 +1,38 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
{ {
imports = [ 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"
./os/loader.nix ./os/loader.nix
./pindakaas_disko.nix
]; ];
# nixos-hardware use latest kernel by default. This obviously runs quickly out of sync with zfs packages. boot = {
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; # 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";
};
};
};
networking.hostName = "pindakaas"; networking.hostName = "pindakaas";
frogeye.extra = false; # FIXME Not working yet # DEBUG Barebones is faster
frogeye.desktop.xorg = true; frogeye.dev.ansible = false;
frogeye.dev.docker = true; frogeye.dev.python = false;
# frogeye.extra = false; # FIXME Not working yet
# frogeye.desktop.xorg = true;
# frogeye.dev.docker = true;
} }

78
pindakaas_disko.nix Normal file
View file

@ -0,0 +1,78 @@
{
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"
];
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
# FIXME Hang on Linux boot, for some reason
# luks = {
# size = "100%";
# content = {
# type = "luks";
# name = "pindakaas_sd";
# # disable settings.keyFile if you want to use interactive password entry
# #passwordFile = "/tmp/secret.key"; # Interactive
# 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;
# # keyFile = "/tmp/secret.key";
# fallbackToPassword = true; # TEST
# };
# # additionalKeyFiles = [ "/tmp/additionalSecret.key" ];
# 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";
# # };
# };
# };
# };
# };
};
};
};
};
};
}