nix: basic packaging
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I6a6a6964c848d4871ead297560a06c2e1dd2f14d
This commit is contained in:
parent
3294fff13c
commit
6abac69e75
3 changed files with 199 additions and 0 deletions
96
flake.nix
Normal file
96
flake.nix
Normal file
|
@ -0,0 +1,96 @@
|
|||
{
|
||||
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";
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue