Initial firmware infra
This commit is contained in:
parent
97cb513fd5
commit
8c9e57f97b
1
firmware/.envrc
Normal file
1
firmware/.envrc
Normal file
@ -0,0 +1 @@
|
||||
use flake ..#firmware --override-input rootdir "file+file://"<(printf %s "$PWD")
|
1
firmware/.gitignore
vendored
Normal file
1
firmware/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/result
|
19
firmware/base.nix
Normal file
19
firmware/base.nix
Normal file
@ -0,0 +1,19 @@
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib) mkOption;
|
||||
in
|
||||
{
|
||||
options.my.build = {
|
||||
image = mkOption {
|
||||
description = "Final output image for distribution.";
|
||||
type = lib.types.unspecified;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
system = {
|
||||
stateVersion = "24.11";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
32
firmware/default.nix
Normal file
32
firmware/default.nix
Normal file
@ -0,0 +1,32 @@
|
||||
{ inputs, ... }:
|
||||
let
|
||||
mkSystem = target: inputs.nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
./base.nix
|
||||
target
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
flake.nixosConfigurations = {
|
||||
qclk-rpi3 = mkSystem target/rpi3.nix;
|
||||
};
|
||||
|
||||
perSystem = { libMy, pkgs, ... }: {
|
||||
devenv.shells.firmware = libMy.withRootdir {
|
||||
packages = with pkgs; [
|
||||
nixos-rebuild
|
||||
nixVersions.latest
|
||||
];
|
||||
|
||||
scripts = {
|
||||
build.exec = ''
|
||||
nix build "..#nixosConfigurations.qclk-$1.config.system.build.toplevel"
|
||||
'';
|
||||
build-image.exec = ''
|
||||
nix build "..#nixosConfigurations.qclk-$1.config.my.build.image"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
8
firmware/target/rpi3.nix
Normal file
8
firmware/target/rpi3.nix
Normal file
@ -0,0 +1,8 @@
|
||||
{ pkgs, modulesPath, config, ... }: {
|
||||
imports = [
|
||||
"${modulesPath}/installer/sd-card/sd-image-aarch64.nix"
|
||||
];
|
||||
|
||||
nixpkgs.system = "aarch64-linux";
|
||||
my.build.image = config.system.build.sdImage;
|
||||
}
|
Loading…
Reference in New Issue
Block a user