deepcool/flake.nix
NotAShelf 6abac69e75
nix: basic packaging
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a6964c848d4871ead297560a06c2e1dd2f14d
2025-10-06 21:01:43 +03:00

96 lines
2.6 KiB
Nix

{
inputs.nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
outputs = {
self,
nixpkgs,
}: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
lib = nixpkgs.lib;
in {
packages."${system}" = let
inherit (pkgs.linuxPackages_latest) kernel;
kmod = pkgs.callPackage ./nix/kmod.nix {inherit kernel;};
in {
inherit kernel kmod;
};
nixosConfigurations."gamma" = let
inherit (lib) nixosSystem;
inherit (lib.modules) mkDefault;
in
nixosSystem {
system = null;
modules = [
({modulesPath, ...}: {
imports = [(modulesPath + "/profiles/qemu-guest.nix")];
networking.hostName = "gamma";
boot = {
growPartition = false;
kernelParams = ["console=ttyAMA0,115200n8" "console=tty0"];
consoleLogLevel = mkDefault 7; # ground control to kernel
};
# Empty password
# root can login without a password
users.extraUsers.root.initialHashedPassword = "";
# Nixpkgs options
nixpkgs.pkgs = pkgs; # discard everything else, follow flake `pkgs`
# Packages
environment.systemPackages = [pkgs.microfetch];
# Bootable
fileSystems."/boot" = {
device = "/dev/vda1";
fsType = "vfat";
};
fileSystems."/" = {
device = "/dev/vda2";
fsType = "ext4";
};
boot.loader.grub = {
efiSupport = true;
efiInstallAsRemovable = true;
device = "nodev";
};
# Kernel fun
boot = {
# Use kernel package defined in flake.nix
kernelPackages = pkgs.linuxPackagesFor self.packages.${system}.kernel; # exposed kernel
# Get test module from flake outputs
extraModulePackages = [self.packages.${system}.kmod];
# Load module from package.
# Alternatively, `$ modprobe test` would work too
kernelModules = ["deepcool"];
};
# Make it smaller
documentation = {
doc.enable = false;
man.enable = false;
nixos.enable = false;
info.enable = false;
};
# Get out.
programs = {
bash.completion.enable = false;
command-not-found.enable = false;
};
# Shut up.
system.stateVersion = "25.11";
})
];
};
};
}