From 8476bbde1244409eba43581168b55e5b934a5e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Sat, 17 Feb 2024 18:39:09 +0100 Subject: [PATCH] Re-add variants and reorganize things --- {dk => common/disko}/single_uefi_btrfs.nix | 10 +++++---- curacao/default.nix | 12 +++++++++++ curacao/{dk.nix => disko.nix} | 5 +++-- curacao/features.nix | 13 +++++++++++ curacao/hardware.nix | 11 ++++++++++ curacao/options.nix | 22 ------------------- curacao/os.nix | 16 -------------- curacao/usb.nix | 13 +++++++++++ flake.nix | 18 ++++++++++++++-- os/boot/default.nix | 13 +++++++++++ os/default.nix | 1 + pindakaas/default.nix | 11 ++++++++++ pindakaas/dk.nix | 2 -- pindakaas/features.nix | 9 ++++++++ pindakaas/hardware.nix | 25 +++++++++++++--------- pindakaas/options.nix | 15 ------------- pindakaas/os.nix | 10 --------- pindakaas/sd.nix | 13 +++++++++++ 18 files changed, 136 insertions(+), 83 deletions(-) rename {dk => common/disko}/single_uefi_btrfs.nix (90%) create mode 100644 curacao/default.nix rename curacao/{dk.nix => disko.nix} (96%) create mode 100644 curacao/features.nix delete mode 100644 curacao/options.nix delete mode 100644 curacao/os.nix create mode 100644 curacao/usb.nix create mode 100644 os/boot/default.nix create mode 100644 pindakaas/default.nix delete mode 100644 pindakaas/dk.nix create mode 100644 pindakaas/features.nix delete mode 100644 pindakaas/options.nix delete mode 100644 pindakaas/os.nix create mode 100644 pindakaas/sd.nix diff --git a/dk/single_uefi_btrfs.nix b/common/disko/single_uefi_btrfs.nix similarity index 90% rename from dk/single_uefi_btrfs.nix rename to common/disko/single_uefi_btrfs.nix index 965cc5b..8b91602 100644 --- a/dk/single_uefi_btrfs.nix +++ b/common/disko/single_uefi_btrfs.nix @@ -1,10 +1,12 @@ -{ id, name, passwordFile ? "/should_not_be_needed_in_this_context", ... }: +{ pkgs, lib, config, ... }: +let + passwordFile = "/tmp/dotfiles_${config.networking.hostName}_password"; +in { disko.devices = { disk = { - "${name}" = { + "${config.networking.hostName}" = { type = "disk"; - device = "/dev/disk/by-id/${id}"; content = { type = "gpt"; partitions = { @@ -25,7 +27,7 @@ size = "100%"; content = { type = "luks"; - name = "${name}"; + name = "${config.networking.hostName}"; passwordFile = passwordFile; settings = { # Not having SSDs die fast is more important than crypto diff --git a/curacao/default.nix b/curacao/default.nix new file mode 100644 index 0000000..b432912 --- /dev/null +++ b/curacao/default.nix @@ -0,0 +1,12 @@ +{ pkgs, lib, config, ... }: +{ + config = { + networking.hostName = "curacao"; + }; + imports = [ + ./backup + ./disko.nix + ./features.nix + ./hardware.nix + ]; +} diff --git a/curacao/dk.nix b/curacao/disko.nix similarity index 96% rename from curacao/dk.nix rename to curacao/disko.nix index d730d35..6bb96a8 100644 --- a/curacao/dk.nix +++ b/curacao/disko.nix @@ -1,4 +1,4 @@ -{ passwordFile ? "/should_not_be_needed_in_this_context", ... }: +{ pkgs, lib, config, ... }: # TODO Find a way to use keys in filesystem # TODO Not relatime everywhere, thank you # TODO Default options @@ -10,8 +10,10 @@ let "space_cache" ]; btrfs_args_ssd = btrfs_args_hdd ++ [ "ssd" ]; + passwordFile = "/tmp/dotfiles_${config.networking.hostName}_password"; in { + boot.loader.efi.efiSysMountPoint = config.disko.devices.disk.razmo.content.partitions.esp.content.mountpoint; disko.devices = { disk = { razmo = { @@ -32,7 +34,6 @@ in # hibernation image is saved. That's what I'm doing with Arch, # but I'm setting resume=, should test if it actually works? # Untranslated options from /etc/crypttab: swap,cipher=aes-xts-plain64,size=256 - # Untranslated options from /etc/fstab: defaults,pri=100 }; }; nixosboot = { diff --git a/curacao/features.nix b/curacao/features.nix new file mode 100644 index 0000000..2c7daaa --- /dev/null +++ b/curacao/features.nix @@ -0,0 +1,13 @@ +{ ... }: +{ + frogeye = { + desktop = { + xorg = true; + }; + dev = { + docker = true; + }; + extra = true; + gaming = true; + }; +} diff --git a/curacao/hardware.nix b/curacao/hardware.nix index 7655256..9931172 100644 --- a/curacao/hardware.nix +++ b/curacao/hardware.nix @@ -10,4 +10,15 @@ # TODO Maybe we could? In case the HDD doesn't boot anymore? }; }; + frogeye.desktop = { + x11_screens = [ "HDMI-1-0" "eDP-1" ]; + maxVideoHeight = 1440; + numlock = true; + phasesBrightness = { + enable = true; + jour = "40000"; + crepuscule = "10000"; + nuit = "1"; + }; + }; } diff --git a/curacao/options.nix b/curacao/options.nix deleted file mode 100644 index 45ab31a..0000000 --- a/curacao/options.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ ... }: -{ - frogeye = { - desktop = { - xorg = true; - x11_screens = [ "HDMI-1-0" "eDP-1" ]; - maxVideoHeight = 1440; - numlock = true; - phasesBrightness = { - enable = true; - jour = "40000"; - crepuscule = "10000"; - nuit = "1"; - }; - }; - dev = { - docker = true; - }; - extra = true; - gaming = true; - }; -} diff --git a/curacao/os.nix b/curacao/os.nix deleted file mode 100644 index 9b66fd8..0000000 --- a/curacao/os.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs, lib, config, ... }: -{ - imports = [ - ./options.nix - ./hardware.nix - ./dk.nix - ./backup - ]; - - networking.hostName = "curacao"; - boot = { - loader = { - efi.efiSysMountPoint = "/efi"; - }; - }; -} diff --git a/curacao/usb.nix b/curacao/usb.nix new file mode 100644 index 0000000..a3693d6 --- /dev/null +++ b/curacao/usb.nix @@ -0,0 +1,13 @@ +{ pkgs, lib, config, ... }: +{ + config = { + boot.loader.grub.efiInstallAsRemovable = true; + disk."${config.networking.hostName}".device = "/dev/disk/by-id/usb-Kingston_DataTraveler_3.0_E0D55EA57414F510489F0F1A-0:0"; + networking.hostName = "curacao-usb"; + }; + imports = [ + ../common/disko/single_uefi_btrfs.nix + ./features.nix + ./hardware.nix + ]; +} diff --git a/flake.nix b/flake.nix index d0d78dc..22f15fc 100644 --- a/flake.nix +++ b/flake.nix @@ -102,14 +102,28 @@ nixosConfigurations.curacao = lib.nixosSystem { system = "x86_64-linux"; modules = [ - ./curacao/os.nix + ./curacao + nixos-hardware.nixosModules.dell-g3-3779 + ]; + }; + nixosConfigurations.curacao_usb = lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./curacao/usb.nix nixos-hardware.nixosModules.dell-g3-3779 ]; }; nixosConfigurations.pindakaas = lib.nixosSystem { system = "aarch64-linux"; modules = [ - ./pindakaas/os.nix + ./pindakaas + nixos-hardware.nixosModules.pine64-pinebook-pro + ]; + }; + nixosConfigurations.pindakaas-sd = lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + ./pindakaas/sd.nix nixos-hardware.nixosModules.pine64-pinebook-pro ]; }; diff --git a/os/boot/default.nix b/os/boot/default.nix new file mode 100644 index 0000000..678d614 --- /dev/null +++ b/os/boot/default.nix @@ -0,0 +1,13 @@ +{ pkgs, lib, config, ... }: +{ + boot.loader = { + efi.canTouchEfiVariables = true; + grub = { + enable = true; + efiSupport = true; + device = "nodev"; # Don't install on MBR + }; + }; + +} + diff --git a/os/default.nix b/os/default.nix index b0a6e3e..9dd27a5 100644 --- a/os/default.nix +++ b/os/default.nix @@ -4,6 +4,7 @@ ../options.nix ../common/frogarized ./battery.nix + ./boot ./ccc ./common.nix ./desktop.nix diff --git a/pindakaas/default.nix b/pindakaas/default.nix new file mode 100644 index 0000000..7b54d0e --- /dev/null +++ b/pindakaas/default.nix @@ -0,0 +1,11 @@ +{ pkgs, lib, config, ... }: +{ + config = { + disk."${config.networking.hostName}".device = "/dev/disk/by-id/mmc-DA4064_0x931f080f"; + networking.hostName = "pindakaas"; + }; + imports = [ + ./hardware.nix + ./features.nix + ]; +} diff --git a/pindakaas/dk.nix b/pindakaas/dk.nix deleted file mode 100644 index 881675d..0000000 --- a/pindakaas/dk.nix +++ /dev/null @@ -1,2 +0,0 @@ -{ ... } @ args: -import ../dk/single_uefi_btrfs.nix (args // { id = "mmc-DA4064_0x931f080f"; name = "pindakaas"; }) diff --git a/pindakaas/features.nix b/pindakaas/features.nix new file mode 100644 index 0000000..36e930a --- /dev/null +++ b/pindakaas/features.nix @@ -0,0 +1,9 @@ +{ pkgs, lib, config, ... }: +{ + config = { + frogeye = { + desktop.xorg = true; + extra = true; + }; + }; +} diff --git a/pindakaas/hardware.nix b/pindakaas/hardware.nix index f4173ad..4693218 100644 --- a/pindakaas/hardware.nix +++ b/pindakaas/hardware.nix @@ -6,24 +6,29 @@ # 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 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"; - }; + grub.efiInstallAsRemovable = true; }; }; - zramSwap = { # Not capable of building itself otherwise + frogeye.desktop = { + x11_screens = [ "DP-1" "eDP-1" ]; + maxVideoHeight = 720; + phasesBrightness = { + enable = true; + jour = "3500"; + crepuscule = "3000"; + nuit = "700"; + }; + }; + + zramSwap = { + # Not capable of building itself otherwise enable = true; memoryPercent = 150; # Factory settings }; diff --git a/pindakaas/options.nix b/pindakaas/options.nix deleted file mode 100644 index 56b5eba..0000000 --- a/pindakaas/options.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ ... }: -{ - frogeye.extra = true; - frogeye.desktop = { - xorg = true; - x11_screens = [ "DP-1" "eDP-1" ]; - maxVideoHeight = 720; - phasesBrightness = { - enable = true; - jour = "3500"; - crepuscule = "3000"; - nuit = "700"; - }; - }; -} diff --git a/pindakaas/os.nix b/pindakaas/os.nix deleted file mode 100644 index 44e2583..0000000 --- a/pindakaas/os.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: -{ - imports = [ - ./hardware.nix - ./dk.nix - ./options.nix - ]; - - networking.hostName = "pindakaas"; -} diff --git a/pindakaas/sd.nix b/pindakaas/sd.nix new file mode 100644 index 0000000..dff42d7 --- /dev/null +++ b/pindakaas/sd.nix @@ -0,0 +1,13 @@ +{ pkgs, lib, config, ... }: +{ + config = { + boot.loader.grub.efiInstallAsRemovable = true; + disk."${config.networking.hostName}".device = "/dev/disk/by-id/mmc-SN32G_0xfb19ae99"; + networking.hostName = "pindakaas-sd"; + }; + imports = [ + ../common/disko/single_uefi_btrfs.nix + ./features.nix + ./hardware.nix + ]; +}