Fix the disk detection issue on the installer
This commit is contained in:
parent
f861e50f3e
commit
be288a69c0
15
flake.lock
15
flake.lock
|
@ -238,17 +238,18 @@
|
|||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1711478570,
|
||||
"narHash": "sha256-qjzwq2qj0e9EpN7QYTnTXipHmrWWUG3bEARmzju81OI=",
|
||||
"ref": "refs/heads/v4",
|
||||
"rev": "2d459669cb67e1960579e97e05ccac05c993b70a",
|
||||
"revCount": 1063,
|
||||
"lastModified": 1711499008,
|
||||
"narHash": "sha256-uXUEpBFfa3e3g37XKJKnlns7wF8Jxq/OE2vvVNbYmo8=",
|
||||
"ref": "v4",
|
||||
"rev": "1f4e6f158ef5922c9b7d4214d0ba1de19b7dba63",
|
||||
"revCount": 1065,
|
||||
"type": "git",
|
||||
"url": "file:///home/lxsameer/src/fg42"
|
||||
"url": "https://devheroes.codes/FG42/FG42"
|
||||
},
|
||||
"original": {
|
||||
"ref": "v4",
|
||||
"type": "git",
|
||||
"url": "file:///home/lxsameer/src/fg42"
|
||||
"url": "https://devheroes.codes/FG42/FG42"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
#fg42.url = "git+https://devheroes.codes/FG42/FG42?ref=v4";
|
||||
fg42.url = "/home/lxsameer/src/fg42";
|
||||
fg42.url = "git+https://devheroes.codes/FG42/FG42?ref=v4";
|
||||
#g42.url = "/home/lxsameer/src/fg42";
|
||||
|
||||
flake_utils.url = "github:numtide/flake-utils";
|
||||
|
||||
|
|
|
@ -213,22 +213,26 @@ rec {
|
|||
};
|
||||
};
|
||||
|
||||
disk = diskFile: grubPart: { lib, pkgs, inputs, hostBuilderConfig, ... }: {
|
||||
# imports = if !hostBuilderConfig.inVM
|
||||
# then [
|
||||
# "${inputs.disko}/module.nix"
|
||||
# ]
|
||||
# else [];
|
||||
imports = [
|
||||
"${inputs.disko}/module.nix"
|
||||
];
|
||||
disk-installer = host: diskFile: { lib, pkgs, inputs, hostBuilderConfig, ... }: {
|
||||
imports = [];
|
||||
|
||||
disko = if !hostBuilderConfig.inVM
|
||||
then import diskFile
|
||||
else {};
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.disko
|
||||
(pkgs.writeShellScriptBin "install-universe" ''
|
||||
# if /etc/universe_release
|
||||
export NIX_PATH=/etc/nix/inputs/
|
||||
echo "Partitioning the disk..."
|
||||
echo "${diskFile}"
|
||||
cp "${diskFile}" /etc/sdisk.nix
|
||||
${pkgs.disko}/bin/disko -m disko /etc/disks.nix
|
||||
mkdir -p /mnt/etc/nix
|
||||
ln -s /mnt/etc/nix/inputs/ /etc/nix/inputs/
|
||||
cd /mnt
|
||||
echo "running installer"
|
||||
nixos-install --impure --flake self#${host} --root /mnt -v --show-trace
|
||||
echo "done"
|
||||
'')
|
||||
];
|
||||
|
||||
environment.etc = {
|
||||
|
@ -240,25 +244,20 @@ rec {
|
|||
boot.loader.grub.efiInstallAsRemovable = true;
|
||||
};
|
||||
|
||||
autoInstaller = host: partitioner: { lib, pkgs, ... }: {
|
||||
disk = diskFile: { lib, pkgs, inputs, hostBuilderConfig, ... }: {
|
||||
imports = [
|
||||
partitioner
|
||||
"${inputs.disko}/module.nix"
|
||||
];
|
||||
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeShellScriptBin "install-universe" ''
|
||||
# if /etc/universe_release
|
||||
export NIX_PATH=/etc/nix/inputs/
|
||||
echo "Partitioning the disk..."
|
||||
${pkgs.disko}/bin/disko -m disko /etc/disks.nix
|
||||
mkdir -p /mnt/etc/nix
|
||||
ln -s /mnt/etc/nix/inputs/ /etc/nix/inputs/
|
||||
cd /mnt
|
||||
echo "running installer"
|
||||
nixos-install --impure --flake self#${host} --root /mnt -v --show-trace
|
||||
echo "done"
|
||||
'')
|
||||
];
|
||||
|
||||
disko = lib.optionalAttrs (!hostBuilderConfig.inVM) (import diskFile).disko;
|
||||
environment.etc = {
|
||||
"disks.nix".source = diskFile;
|
||||
};
|
||||
|
||||
boot.loader.grub.device = "nodev";
|
||||
boot.loader.grub.efiSupport = true;
|
||||
boot.loader.grub.efiInstallAsRemovable = true;
|
||||
};
|
||||
|
||||
styles = { lib, pkgs, inputs, ...}: {
|
||||
|
|
|
@ -65,7 +65,7 @@ rec {
|
|||
isNormalUser = true;
|
||||
shell = pkgs.zsh;
|
||||
uid = 9000;
|
||||
group = "lxsameer";
|
||||
group = "mary";
|
||||
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
|
|
|
@ -43,7 +43,7 @@ in nixpkgs.lib.nixosSystem {
|
|||
base
|
||||
installerUser
|
||||
generator
|
||||
(autoInstaller host diskModule)
|
||||
diskModule
|
||||
]);
|
||||
|
||||
# Pass these attributes to all the modules for this
|
||||
|
|
|
@ -58,14 +58,14 @@ let
|
|||
|
||||
fg42 = inputs.fg42.packages.${system}.default;
|
||||
inVM = (utils.sanitizeBuilderConfig hostBuilderConfig).inVM;
|
||||
host = if inVM then "majinVM" else "majin";
|
||||
|
||||
in {
|
||||
|
||||
installer = import ./installer.nix (params // {
|
||||
host = if inVM then "majinVM" else "majin";
|
||||
diskModule = (modules.disk
|
||||
(if inVM then ./majin/vm.disk.nix else ./majin/disks.nix)
|
||||
(if inVM then "/dev/sda" else "/dev/disk/by-partlabel/disk-twoT-root"));
|
||||
diskModule = (modules.disk-installer
|
||||
host
|
||||
(if inVM then ./majin/vm.disk.nix else ./majin/disks.nix));
|
||||
});
|
||||
|
||||
majin = nixpkgs.lib.nixosSystem {
|
||||
|
@ -76,8 +76,7 @@ in {
|
|||
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
|
||||
this
|
||||
(disk
|
||||
(if inVM then ./majin/vm.disk.nix else ./majin/disks.nix)
|
||||
(if inVM then "/dev/sda" else "/dev/disk/by-partlabel/disk-twoT-root"))
|
||||
(if inVM then ./majin/vm.disk.nix else ./majin/disks.nix))
|
||||
bootable
|
||||
base
|
||||
lxsameer.user
|
||||
|
|
|
@ -40,7 +40,7 @@ let
|
|||
|
||||
services.xserver.enable = true;
|
||||
services.xserver.displayManager.sddm.enable = true;
|
||||
services.xserver.desktopManager.plasma6.enable = true;
|
||||
services.xserver.desktopManager.plasma5.enable = true;
|
||||
|
||||
# I want to fully control my users via nix
|
||||
users.mutableUsers = false;
|
||||
|
@ -55,7 +55,7 @@ let
|
|||
openFirewall = true;
|
||||
};
|
||||
|
||||
fileSystems."/home".neededForBoot = true;
|
||||
fileSystems."/".neededForBoot = true;
|
||||
services.gvfs.enable = true;
|
||||
|
||||
networking.firewall = {
|
||||
|
@ -69,13 +69,16 @@ let
|
|||
|
||||
fg42 = inputs.fg42.packages.${system}.default;
|
||||
inVM = (utils.sanitizeBuilderConfig hostBuilderConfig).inVM;
|
||||
|
||||
host = if inVM then "marylandVM" else "maryland";
|
||||
|
||||
in {
|
||||
|
||||
installer = import ./installer.nix (params // {
|
||||
host = if inVM then "marylandVM" else "maryland";
|
||||
diskModule = (modules.disk
|
||||
(if inVM then ./maryland/vm.disk.nix else ./maryland/disks.nix)
|
||||
(if inVM then "/dev/sda" else "/dev/nvme0n1"));
|
||||
inherit host;
|
||||
diskModule = (modules.disk-installer
|
||||
host
|
||||
(if inVM then ./maryland/vm.disk.nix else ./maryland/disks.nix));
|
||||
});
|
||||
|
||||
maryland = nixpkgs.lib.nixosSystem {
|
||||
|
@ -86,8 +89,7 @@ in {
|
|||
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
|
||||
this
|
||||
(disk
|
||||
(if inVM then ./maryland/vm.disk.nix else ./maryland/disks.nix)
|
||||
(if inVM then "/dev/sda" else "/dev/nvme0n1p3"))
|
||||
(if inVM then ./maryland/vm.disk.nix else ./maryland/disks.nix))
|
||||
bootable
|
||||
base
|
||||
mary.user
|
||||
|
@ -100,7 +102,7 @@ in {
|
|||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
|
||||
home-manager.users.lxsameer = mary.desktop;
|
||||
home-manager.users.mary = mary.desktop;
|
||||
home-manager.extraSpecialArgs = {
|
||||
inherit inputs fg42;
|
||||
};
|
||||
|
|
|
@ -1,35 +1,37 @@
|
|||
{
|
||||
devices = {
|
||||
disk = {
|
||||
main = {
|
||||
device = "/dev/nvme0n1";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
disko = {
|
||||
devices = {
|
||||
disk = {
|
||||
main = {
|
||||
device = "/dev/nvme0n1";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
};
|
||||
swap = {
|
||||
size = "64G";
|
||||
content = {
|
||||
type = "swap";
|
||||
resumeDevice = true;
|
||||
swap = {
|
||||
size = "64G";
|
||||
content = {
|
||||
type = "swap";
|
||||
resumeDevice = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue