From 4281e0daf34310ea3fd3649e69e5822eba1d4b06 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Tue, 16 Apr 2024 16:56:06 +0100 Subject: [PATCH] feat: add flake.nix to assist local development --- .envrc | 1 + .gitignore | 2 ++ flake.lock | 40 ++++++++++++++++++++++++++++++++++++++++ flake.nix | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..8392d15 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake \ No newline at end of file diff --git a/.gitignore b/.gitignore index c1d18e8..f8349c1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ *.img *.iso *.lock +!flake.lock *.log *.markdownlint.jsonc *.markdownlint.yaml @@ -19,3 +20,4 @@ *.sock *.xml *.zs-old +.direnv/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..1a3f14e --- /dev/null +++ b/flake.lock @@ -0,0 +1,40 @@ +{ + "nodes": { + "flake-schemas": { + "locked": { + "lastModified": 1697467827, + "narHash": "sha256-j8SR19V1SRysyJwpOBF4TLuAvAjF5t+gMiboN4gYQDU=", + "rev": "764932025c817d4e500a8d2a4d8c565563923d29", + "revCount": 29, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.2/018b3da8-4cc3-7fbb-8ff7-1588413c53e2/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1712963716, + "narHash": "sha256-WKm9CvgCldeIVvRz87iOMi8CFVB1apJlkUT4GGvA0iM=", + "rev": "cfd6b5fc90b15709b780a5a1619695a88505a176", + "revCount": 611350, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.611350%2Brev-cfd6b5fc90b15709b780a5a1619695a88505a176/018eddfc-e6d9-74bb-a823-20f2ae60079b/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" + } + }, + "root": { + "inputs": { + "flake-schemas": "flake-schemas", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7bd0ea1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,54 @@ +# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.10) +{ + # A helpful description of your flake + description = "Quickemu"; + + # Flake inputs + inputs = { + flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz"; + + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; + }; + + # Flake outputs that other flakes can use + outputs = { self, flake-schemas, nixpkgs }: + let + # Helpers for producing system-specific outputs + supportedSystems = [ "x86_64-linux" "aarch64-linux" ]; + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in { + # Schemas tell Nix about the structure of your flake's outputs + schemas = flake-schemas.schemas; + + # Development environments + devShells = forEachSupportedSystem ({ pkgs }: { + default = pkgs.mkShell { + # Pinned packages available in the environment + packages = with pkgs; [ + cdrtools + curl + lsb-release + git + gnugrep + gnused + jq + nixpkgs-fmt + procps + python3 + qemu + socat + swtpm + unzip + usbutils + util-linux + wget + xdg-user-dirs + xorg.xrandr + zsync + ]; + }; + }); + }; +}