From 848eccb959bdd1fcb2e1f54e3b62ed9e1c1f182d Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Fri, 9 Aug 2024 02:44:54 +0200 Subject: [PATCH] made usbstick work again --- flake.nix | 4 +- machines/usbstick/configuration.nix | 38 +++------------- .../hardware-configuration/default.nix | 19 ++++++++ .../hardware-configuration/disko-config.nix | 44 +++++++++++++++++++ .../hardware-configuration.nix | 2 +- 5 files changed, 73 insertions(+), 34 deletions(-) create mode 100644 machines/usbstick/hardware-configuration/default.nix create mode 100644 machines/usbstick/hardware-configuration/disko-config.nix rename machines/usbstick/{ => hardware-configuration}/hardware-configuration.nix (97%) diff --git a/flake.nix b/flake.nix index 88d6b7f..c3a7003 100644 --- a/flake.nix +++ b/flake.nix @@ -507,8 +507,10 @@ usbstick = clanSetup { name = "usbstick"; - host = "usbstick.bear"; + #host = "usbstick.bear"; + host = "127.0.0.1"; modules = [ + zerotierModules homeManagerModules stylixModules { diff --git a/machines/usbstick/configuration.nix b/machines/usbstick/configuration.nix index ff6fd2a..fd1aed7 100644 --- a/machines/usbstick/configuration.nix +++ b/machines/usbstick/configuration.nix @@ -2,43 +2,20 @@ imports = [ - ./hardware-configuration.nix + ./hardware-configuration #./tinc.nix #./syncthing.nix ]; - #security.wrappers = { - # pmount = { - # source = "${pkgs.pmount}/bin/pmount"; - # setuid = true; - # owner = "root"; - # group = "root"; - # }; - # pumount = { - # source = "${pkgs.pmount}/bin/pumount"; - # setuid = true; - # owner = "root"; - # group = "root"; - # }; - #}; + components.gui.enable = false; - components.gui.enable = true; + components.mainUser.enable = true; + components.network.enable = true; + components.monitor.enable = false; - configuration.desktop = { - width = 1366; - height = 768; - }; + #networking.networkmanager.enable = true; - # grub configuraton - # ----------------- - boot.loader.grub.enable = true; - boot.loader.grub.efiSupport = true; - boot.loader.grub.device = "/dev/sda"; - boot.loader.grub.efiInstallAsRemovable = true; - boot.tmpOnTmpfs = true; - - networking.networkmanager.enable = true; networking.hostName = "usbstick"; # Set your time zone. @@ -58,9 +35,6 @@ EDITOR=vim ''; - boot.supportedFilesystems = [ "zfs" ]; - networking.hostId = "2ed43034"; - services.openssh.enable = true; #users.users.root.openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw== contact@ingolf-wagner.de" ]; diff --git a/machines/usbstick/hardware-configuration/default.nix b/machines/usbstick/hardware-configuration/default.nix new file mode 100644 index 0000000..153d34d --- /dev/null +++ b/machines/usbstick/hardware-configuration/default.nix @@ -0,0 +1,19 @@ +{ + imports = [ + ./hardware-configuration.nix + #./disko-config.nix # todo: not used yet (use a simple installer usb stick for that) + ]; + + + # grub configuraton + # ----------------- + boot.loader.grub.enable = true; + boot.loader.grub.efiSupport = true; + boot.loader.grub.device = "/dev/sda"; + boot.loader.grub.efiInstallAsRemovable = true; + boot.tmpOnTmpfs = true; + + # zfs + boot.supportedFilesystems = [ "zfs" ]; + networking.hostId = "2ed43034"; +} diff --git a/machines/usbstick/hardware-configuration/disko-config.nix b/machines/usbstick/hardware-configuration/disko-config.nix new file mode 100644 index 0000000..f9d82ff --- /dev/null +++ b/machines/usbstick/hardware-configuration/disko-config.nix @@ -0,0 +1,44 @@ +# Example to create a bios compatible gpt partition +{ lib, ... }: +{ + disko.devices = { + disk.disk1 = { + device = lib.mkDefault "/dev/sda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + esp = { + name = "ESP"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + name = "root"; + size = "100%"; + content = { + type = "luks"; + name = "root"; + settings.allowDiscards = true; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/machines/usbstick/hardware-configuration.nix b/machines/usbstick/hardware-configuration/hardware-configuration.nix similarity index 97% rename from machines/usbstick/hardware-configuration.nix rename to machines/usbstick/hardware-configuration/hardware-configuration.nix index 0efa0f3..a6dbcab 100644 --- a/machines/usbstick/hardware-configuration.nix +++ b/machines/usbstick/hardware-configuration/hardware-configuration.nix @@ -27,7 +27,7 @@ fileSystems."/boot" = { #device = "/dev/disk/by-uuid/EBCE-D756"; - device = "/dev/disk/by-uuid/sda2"; + device = "/dev/sda2"; fsType = "vfat"; };