infra/nix/os/devices/steveej-x13s/flake.nix

150 lines
4.3 KiB
Nix

{
inputs = {
nixpkgs.follows = "nixpkgs-stable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
get-flake.url = "github:ursi/get-flake";
disko.inputs.nixpkgs.follows = "nixpkgs";
home-manager = {
# url = "github:nix-community/home-manager/master";
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-x13s.url =
"git+https://forgejo.www.stefanjunker.de/steveej/nixos-x13s.git?ref=bump"
# 6.11.0
# "git+https://forgejo.www.stefanjunker.de/steveej/nixos-x13s.git?branch=remaintain&rev=6b9efe77ca80653354981c720af3c4241ac71490"
# 6.12.0-rc6
# "git+https://forgejo.www.stefanjunker.de/steveej/nixos-x13s.git?branch=remaintain&rev=bd580ee9c35fcb8a720122d5bb2f903f1b7395ee"
# "git+https://forgejo.www.stefanjunker.de/steveej/nixos-x13s.git?branch=remaintain&rev=1286d20be2321a1a2d27f5d09257ebaf54ce0630"
#"/home/steveej/src/others/nixos-x13s"
#
;
# nixos-x13s.url = "git+https://codeberg.org/adamcstephens/nixos-x13s?ref=refs/tags/2024-02-28";
# nixos-x13s.url = "path:/home/steveej/src/others/nixos-x13s";
# nixos-x13s.inputs.nixpkgs.follows = "nixpkgs";
mycelium.url = "github:threefoldtech/mycelium";
mycelium.inputs.nixpkgs.follows = "nixpkgs";
nix-snapshotter = {
url = "github:yu-re-ka/nix-snapshotter";
# url = "github:pdtpartners/nix-snapshotter";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
get-flake,
nixpkgs,
...
}: let
nativeSystem = "aarch64-linux";
nodeName = "steveej-x13s";
repoFlake = get-flake ../../../..;
mkNixosConfiguration = {extraModules ? [], ...} @ attrs:
nixpkgs.lib.nixosSystem (
nixpkgs.lib.attrsets.recursiveUpdate
attrs
{
specialArgs =
(import ./default.nix {
system = nativeSystem;
inherit nodeName;
inherit repoFlake;
repoFlakeWithSystem = repoFlake.lib.withSystem;
nodeFlake = self;
})
.meta
.nodeSpecialArgs
.${nodeName};
modules =
[
./configuration.nix
# flake registry
{
nix.registry.nixpkgs.flake = nixpkgs;
}
]
++ extraModules;
}
);
in {
lib = {
inherit mkNixosConfiguration;
};
overlays.libcamera = final: previous: {
wireplumber = previous.wireplumber.overrideAttrs (_: {
version = "git";
src = previous.fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "pipewire";
repo = "wireplumber";
rev = "71f868233792f10848644319dbdc97a4f147d554";
hash = "sha256-VX3OFsBK9AbISm/XTx8p05ak+z/VcKXfUXhB9aI9ev8=";
};
});
libcamera = previous.libcamera.overrideAttrs (_: {
postFixup = ''
../src/ipa/ipa-sign-install.sh src/ipa-priv-key.pem $out/lib/libcamera/ipa_*.so
'';
});
libcamera-qcam = previous.libcamera-qcam.overrideAttrs (_: {
postFixup = ''
../src/ipa/ipa-sign-install.sh src/ipa-priv-key.pem $out/lib/libcamera/ipa_*.so
'';
});
};
overlays.default = final: previous: let
inherit (previous.stdenv) system;
pkgsUnstable = import self.inputs.nixpkgs-unstable.outPath {
inherit system;
overlays = [self.overlays.libcamera];
};
in {
inherit
(pkgsUnstable)
libcamera
;
webkitgtk = previous.webkitgtk.overrideAttrs (attrs: {
preConfigure =
attrs.preConfigure
+ ''
export NIX_BUILD_CORES="$((NIX_BUILD_CORES > 8 ? 8 : NIX_BUILD_CORES))"
export NUMBER_OF_PROCESSORS="$NIX_BUILD_CORES"
'';
});
};
nixosConfigurations = {
native = mkNixosConfiguration {
system = nativeSystem;
};
cross = mkNixosConfiguration {
extraModules = [
{
nixpkgs.buildPlatform.system = "x86_64-linux";
nixpkgs.hostPlatform.system = nativeSystem;
}
];
};
};
};
}