Flake: Use flake-utils instead of a self-written solution

This commit is contained in:
Weckyy702
2026-03-06 17:15:12 +01:00
parent ceb9d9fc17
commit 41bf80157b
2 changed files with 58 additions and 52 deletions

27
flake.lock generated
View File

@@ -1,5 +1,23 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1771369470, "lastModified": 1771369470,
@@ -18,8 +36,8 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs", "flake-utils": "flake-utils",
"systems": "systems" "nixpkgs": "nixpkgs"
} }
}, },
"systems": { "systems": {
@@ -32,8 +50,9 @@
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "systems", "owner": "nix-systems",
"type": "indirect" "repo": "default",
"type": "github"
} }
} }
}, },

View File

@@ -1,45 +1,33 @@
{ {
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = outputs =
inputs @ { nixpkgs
, systems
, ...
}:
let
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs (import systems);
pkgsFor = eachSystem (system:
import nixpkgs {
localSystem = system;
});
in
{ {
devShells = nixpkgs,
eachSystem flake-utils,
(system: { ...
default = }: flake-utils.lib.eachDefaultSystem(system:
let let
pkgs = pkgsFor.${system}; pkgs = import nixpkgs { inherit system; };
pico-sdk = pkgs.pico-sdk.override { pico-sdk = pkgs.pico-sdk.override {
withSubmodules = true; withSubmodules = true;
}; };
PICO_SDK_PATH = "${pico-sdk}/lib/pico-sdk"; PICO_SDK_PATH = "${pico-sdk}/lib/pico-sdk";
in in {
pkgs.mkShell { devShell = pkgs.mkShell {
name = "PicoVGA dev shell"; name = "PicoVGA dev shell";
inputsFrom = [ pico-sdk ]; inputsFrom = [ pico-sdk ];
packages = with pkgs; packages = with pkgs; [
[
gcc-arm-embedded gcc-arm-embedded
python3 python3
usbutils usbutils
picotool picotool
picocom pico-sdk
] ];
++ [ pico-sdk ];
shellHook = '' shellHook = ''
ln -sf ${PICO_SDK_PATH}/external/pico_sdk_import.cmake pico_sdk_import.cmake ln -sf ${PICO_SDK_PATH}/external/pico_sdk_import.cmake pico_sdk_import.cmake
''; '';
@@ -47,5 +35,4 @@
inherit PICO_SDK_PATH; inherit PICO_SDK_PATH;
}; };
}); });
};
} }