Kieran's opinionated (and probably slightly dumb) nix config

chore: Add disko configuration to moonlark

+21
flake.lock
···
"type": "github"
}
},
"hardware": {
"locked": {
"lastModified": 1721413321,
···
},
"root": {
"inputs": {
"hardware": "hardware",
"home-manager": "home-manager",
"hyprland-nix": "hyprland-nix",
···
"type": "github"
}
},
+
"disko": {
+
"inputs": {
+
"nixpkgs": [
+
"nixpkgs"
+
]
+
},
+
"locked": {
+
"lastModified": 1721612107,
+
"narHash": "sha256-1F2N90WqHV14oIn5RpDfzINj4zMi5gBQOt1BAc34gGM=",
+
"owner": "nix-community",
+
"repo": "disko",
+
"rev": "2f5df5dcceb8473dd5715c4ae92f9b0d5f87fff9",
+
"type": "github"
+
},
+
"original": {
+
"owner": "nix-community",
+
"repo": "disko",
+
"type": "github"
+
}
+
},
"hardware": {
"locked": {
"lastModified": 1721413321,
···
},
"root": {
"inputs": {
+
"disko": "disko",
"hardware": "hardware",
"home-manager": "home-manager",
"hyprland-nix": "hyprland-nix",
+9 -1
flake.nix
···
# hyprland nix
hyprland-nix.url = "github:hyprland-community/hyprnix";
};
outputs = {
···
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
moonlark = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
# > Our main nixos configuration file <
-
modules = [./moonlark/configuration.nix];
};
};
};
···
# hyprland nix
hyprland-nix.url = "github:hyprland-community/hyprnix";
+
+
disko.url = "github:nix-community/disko";
+
disko.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
···
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
moonlark = nixpkgs.lib.nixosSystem {
+
system = "x86_64-linux";
specialArgs = {inherit inputs outputs;};
# > Our main nixos configuration file <
+
modules = [
+
inputs.disko.nixosModules.disko
+
{ disko.devices.disk.disk1.device = "/dev/vda"; }
+
./moonlark/configuration.nix
+
];
};
};
};
+18 -2
moonlark/configuration.nix
···
# Import home-manager's configuration
./home-manager.nix
];
nixpkgs = {
···
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
networking = {
hostName = "moonlark";
wireless.enable = true;
···
];
extraGroups = ["wheel" "networkmanager" "audio" "docker"];
};
};
# enable cups
···
};
};
-
# Requires at least 5.16 for working wi-fi and bluetooth.
# https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89
boot = {
kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") (lib.mkDefault pkgs.linuxPackages_latest);
-
loader.grub.device = "/dev/disk/by-uuid/5A0A-6C6E";
};
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
···
# Import home-manager's configuration
./home-manager.nix
+
+
# Import disko's configuration
+
./disk-config.nix
];
nixpkgs = {
···
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
+
environment.systemPackages = map lib.lowPrio [
+
pkgs.curl
+
pkgs.gitMinimal
+
];
+
networking = {
hostName = "moonlark";
wireless.enable = true;
···
];
extraGroups = ["wheel" "networkmanager" "audio" "docker"];
};
+
root.openssh.authorizedKeys.keys = [
+
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCzEEjvbL/ttqmYoDjxYQmDIq36BabROJoXgQKeh9liBxApwp+2PmgxROzTg42UrRc9pyrkq5kVfxG5hvkqCinhL1fMiowCSEs2L2/Cwi40g5ZU+QwdcwI8a4969kkI46PyB19RHkxg54OUORiIiso/WHGmqQsP+5wbV0+4riSnxwn/JXN4pmnE//stnyAyoiEZkPvBtwJjKb3Ni9n3eNLNs6gnaXrCtaygEZdebikr9kS2g9mM696HvIFgM6cdR/wZ7DcLbG3IdTXuHN7PC3xxL+Y4ek5iMreQIPmuvs4qslbthPGYoYbYLUQiRa9XO5s/ksIj5Z14f7anHE6cuTQVpvNWdGDOigyIVS5qU+4ZF7j+rifzOXVL48gmcAvw/uV68m5Wl/p0qsC/d8vI3GYwEsWG/EzpAlc07l8BU2LxWgN+d7uwBFaJV9VtmUDs5dcslsh8IbzmtC9gq3OLGjklxTfIl6qPiL8U33oc/UwqzvZUrI2BlbagvIZYy6rP+q0= kierank@mockingjay"
+
]
};
# enable cups
···
};
};
+
# Requires at least 5.16 for working wi-fi and bluetooth.
# https://community.frame.work/t/using-the-ax210-with-linux-on-the-framework-laptop/1844/89
boot = {
kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.16") (lib.mkDefault pkgs.linuxPackages_latest);
+
loader.grub = {
+
# no need to set devices, disko will add all devices that have a EF02 partition to the list already
+
# devices = [ ];
+
efiSupport = true;
+
efiInstallAsRemovable = true;
+
};
};
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
+34
moonlark/disk-config.nix
···
···
+
# Example to create a bios compatible gpt partition
+
{ lib, ... }:
+
{
+
disko.devices = {
+
disk = {
+
main = {
+
device = "/dev/nvme0n1";
+
type = "disk";
+
content = {
+
type = "gpt";
+
partitions = {
+
ESP = {
+
type = "EF00";
+
size = "500M";
+
content = {
+
type = "filesystem";
+
format = "vfat";
+
mountpoint = "/boot";
+
};
+
};
+
root = {
+
size = "100%";
+
content = {
+
type = "filesystem";
+
format = "ext4";
+
mountpoint = "/";
+
};
+
};
+
};
+
};
+
};
+
};
+
};
+
}
-15
moonlark/hardware-configuration.nix
···
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
-
fileSystems."/" =
-
{ device = "/dev/disk/by-uuid/609fdd27-3c83-462b-aa3a-86924f13a1f1";
-
fsType = "ext4";
-
};
-
-
fileSystems."/boot" =
-
{ device = "/dev/disk/by-uuid/5A0A-6C6E";
-
fsType = "vfat";
-
options = [ "fmask=0077" "dmask=0077" ];
-
};
-
-
swapDevices =
-
[ { device = "/dev/disk/by-uuid/96be258e-0dc9-4dde-97d3-d01ab48c9588"; }
-
];
-
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
···
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction