messed with disko and zfs, removed direnv module as it got upstreamed

This commit is contained in:
Gerg-L 2023-07-16 15:33:43 -04:00
parent 3e0398f799
commit 29fa4dff1d
11 changed files with 109 additions and 297 deletions

View file

@ -1,6 +1,7 @@
_: {
pkgs,
config,
lib,
...
}: {
local = {
@ -15,13 +16,13 @@ _: {
enable = true;
kmscon.enable = true;
};
allowedUnfree = [
"nvidia-x11"
"nvidia-persistenced"
"steam"
"steam-original"
];
};
nixpkgs.allowedUnfree = [
"nvidia-x11"
"nvidia-persistenced"
"steam"
"steam-original"
];
environment = {
systemPackages = builtins.attrValues {
inherit
@ -38,8 +39,8 @@ _: {
;
};
etc = {
"jdks/17".source = "${pkgs.openjdk17}/bin";
"jdks/8".source = "${pkgs.openjdk8}/bin";
"jdks/17".source = lib.getBin pkgs.openjdk17;
"jdks/8".source = lib.getBin pkgs.openjdk8;
};
};
networking = {

View file

@ -1,5 +1,4 @@
{disko, ...}: {disks ? [], ...}: {
dummyvalue = {inherit disks;};
{disko, ...}: {
imports = [disko.nixosModules.disko];
disko.devices = {
disk.nvme0n1 = {

View file

@ -1,6 +1,7 @@
{nvim-flake, ...}: {
pkgs,
config,
lib,
...
}: {
local = {
@ -18,6 +19,11 @@
enable = true;
kmscon.enable = true;
};
allowedUnfree = [
"nvidia-x11"
"steam"
"steam-original"
];
};
boot.binfmt.emulatedSystems = ["aarch64-linux"];
hardware.nvidia = {
@ -31,11 +37,6 @@
videoDrivers = ["nvidia" "amdgpu"];
};
nixpkgs.allowedUnfree = [
"nvidia-x11"
"steam"
"steam-original"
];
programs.direnv = {
enable = true;
loadInNixShell = false;
@ -67,8 +68,8 @@
inherit (nvim-flake.packages.${pkgs.system}) neovim;
};
etc = {
"jdks/17".source = "${pkgs.openjdk17}/bin";
"jdks/8".source = "${pkgs.openjdk8}/bin";
"jdks/17".source = lib.getBin pkgs.openjdk17;
"jdks/8".source = lib.getBin pkgs.openjdk8;
};
shellAliases.lint = "deadnix -e && statix fix && alejandra ./";
};

View file

@ -1,119 +1,70 @@
{disko, ...}: {disks ? [], ...}: {
dummyvalue = {inherit disks;};
{disko, ...}: {lib, ...}: let
disks = [
"nvme-SHPP41-500GM_SSB4N6719101A4N22"
"nvme-SHPP41-500GM_SSB4N6719101A4N0E"
];
in {
imports = [disko.nixosModules.disko];
disko.devices = {
disk = {
nvme0 = {
type = "disk";
device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22";
content = {
type = "table";
format = "gpt";
partitions = [
{
name = "boot";
start = "0";
end = "1M";
part-type = "primary";
flags = ["bios_grub"];
}
{
name = "ESP";
start = "1M";
end = "1G";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N22";
};
}
{
name = "zfsboot";
start = "1G";
end = "5G";
content = {
type = "zfs";
pool = "bpool";
};
}
{
name = "swap";
start = "5G";
end = "21G";
content = {
type = "swap";
randomEncryption = true;
};
}
{
name = "zfsroot";
start = "21G";
end = "100%";
content = {
type = "zfs";
pool = "rpool";
};
}
];
disk = lib.mkMerge (map (x: {
${x} = {
type = "disk";
device = "/dev/disk/by-id/${x}";
content = {
type = "table";
format = "gpt";
partitions = [
{
name = "boot";
start = "0";
end = "1M";
part-type = "primary";
flags = ["bios_grub"];
}
{
name = "ESP";
start = "1M";
end = "1G";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot/efis/${x}";
};
}
{
name = "zfsboot";
start = "1G";
end = "5G";
content = {
type = "zfs";
pool = "bpool";
};
}
{
name = "swap";
start = "5G";
end = "21G";
content = {
type = "swap";
randomEncryption = true;
};
}
{
name = "zfsroot";
start = "21G";
end = "100%";
content = {
type = "zfs";
pool = "rpool";
};
}
];
};
};
};
nvme1 = {
type = "disk";
device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E";
content = {
type = "table";
format = "gpt";
partitions = [
{
name = "BIOS";
start = "0";
end = "1M";
part-type = "primary";
flags = ["bios_grub"];
}
{
name = "ESP";
start = "1M";
end = "1G";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N0E";
};
}
{
name = "zfsboot";
start = "1G";
end = "5G";
content = {
type = "zfs";
pool = "bpool";
};
}
{
name = "swap";
start = "5G";
end = "21G";
content = {
type = "swap";
randomEncryption = true;
};
}
{
name = "zfsroot";
start = "21G";
end = "100%";
content = {
type = "zfs";
pool = "rpool";
};
}
];
};
};
};
})
disks);
zpool = {
rpool = {
type = "zpool";
@ -139,26 +90,31 @@
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/";
postCreateHook = "zfs snapshot root@empty";
};
"nix" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/nix";
postCreateHook = "zfs snapshot nix@empty";
};
"var" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/var";
postCreateHook = "zfs snapshot var@empty";
};
"persist" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/persist";
postCreateHook = "zfs snapshot persist@empty";
};
"home" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/home";
postCreateHook = "zfs snapshot home@empty";
};
};
};
@ -185,6 +141,7 @@
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/boot";
postCreateHook = "zfs snapshot boot@empty";
};
};
};

View file

@ -3,7 +3,7 @@
ex = spicePkgs.extensions;
in {
imports = [spicetify-nix.nixosModule];
nixpkgs.allowedUnfree = ["spotify"];
local.allowedUnfree = ["spotify"];
programs.spicetify = {
enable = true;
enabledExtensions = [

View file

@ -10,13 +10,10 @@ _: {
"L /etc/nixos/flake.nix - - - - /home/gerg/Projects/nixos/flake.nix"
];
#create machine-id for spotify
environment.etc = {
"machine-id".text = "b6431c2851094770b614a9cfa78fb6ea";
};
environment.etc."machine-id".text = "b6431c2851094770b614a9cfa78fb6ea";
#make sure the sopskey is found
sops.age.sshKeyPaths = lib.mkForce ["/persist/ssh/ssh_host_ed25519_key"];
fileSystems."/persist".neededForBoot = true;
boot = {
zfs = {
devNodes = "/dev/disk/by-id/";
@ -33,6 +30,13 @@ _: {
availableKernelModules = ["hid_generic"];
#wipe / and /var on boot
postDeviceCommands = lib.mkAfter ''
#destroy last snapshot
zfs destroy rpool/root@lastboot
zfs destroy rpool/var@lastboot
#create new snapshot
zfs snapshot rpool/root@lastboot
zfs snapshot rpool/var@lastboot
#wipe everything
zfs rollback -r rpool/root@empty
zfs rollback -r rpool/var@empty
'';
@ -62,9 +66,6 @@ _: {
}
];
splashImage = null;
extraConfig = ''
GRUB_TIMEOUT_STYLE=hidden
'';
};
};
};

View file

@ -1,5 +1,4 @@
{disko, ...}: {disks ? [], ...}: {
dummyvalue = {inherit disks;};
{disko, ...}: {
imports = [disko.nixosModules.disko];
disko.devices = {
disk.sda = {

View file

@ -1,5 +1,5 @@
_: {pkgs, ...}: {
nixpkgs.allowedUnfree = ["hplip"];
local.allowedUnfree = ["hplip"];
environment.systemPackages = [
pkgs.gimp
(pkgs.xsane.override {gimpSupport = true;})