From dce47feee03117cb0b9596e2cd30b3d467afddbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sat, 11 Jun 2022 22:36:26 +0200 Subject: Add development to spawn quickly shells --- develop/default.nix | 5 +++++ develop/riscv.nix | 23 +++++++++++++++++++++++ flake.lock | 35 +++++++++++++++++++++++++---------- flake.nix | 4 +++- 4 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 develop/default.nix create mode 100644 develop/riscv.nix diff --git a/develop/default.nix b/develop/default.nix new file mode 100644 index 0000000..5f880dc --- /dev/null +++ b/develop/default.nix @@ -0,0 +1,5 @@ +{ nixpkgs, shellrc, system }: { + + riscv = import ./riscv.nix { inherit nixpkgs; inherit shellrc; inherit system; }; + +} diff --git a/develop/riscv.nix b/develop/riscv.nix new file mode 100644 index 0000000..ded7859 --- /dev/null +++ b/develop/riscv.nix @@ -0,0 +1,23 @@ +{ nixpkgs, shellrc, system }: +let + pkgs = nixpkgs.legacyPackages.${system}; + pkgs-riscv = import nixpkgs.outPath { + localSystem = system; + crossSystem = { + config = "riscv32-none-elf"; + libc = "newlib"; + gcc = { + arch = "rv32i"; + }; + }; + }; + +in pkgs.mkShell { + packages = (with pkgs; [ + qtrvsim + ]) ++ (with pkgs-riscv.buildPackages; [ + gcc pkg-config + ]); + inputsFrom = [ shellrc.packages.${system}.default ]; + meta.platforms = nixpkgs.lib.platforms.linux; +} diff --git a/flake.lock b/flake.lock index 200f214..42db18a 100644 --- a/flake.lock +++ b/flake.lock @@ -28,13 +28,27 @@ "type": "indirect" } }, + "flake-utils_3": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "id": "flake-utils", + "type": "indirect" + } + }, "nixpkgs": { "locked": { - "lastModified": 1654845941, - "narHash": "sha256-uXulXu4BQ9ch1ItV0FlL2Ns8X83m6unT5h/0X//VRLQ=", + "lastModified": 1654931879, + "narHash": "sha256-OyKm0DPMaHdRcZ8c+jaXmecEeSe3Fd1K+yirg7zDsys=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7b3e907a6fef935794b5049c2c57c519853deb90", + "rev": "c0d782e7b7b81174e056f7dbc991e82314488239", "type": "github" }, "original": { @@ -58,11 +72,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1648219316, - "narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=", + "lastModified": 1654875595, + "narHash": "sha256-Vairke3ryPSFpgQdaYicPPhPWMGhtzm6V+1uF2Tefbk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "30d3d79b7d3607d56546dd2a6b49e156ba0ec634", + "rev": "3f909fb574d9b9d7294e544981c62a4a5e4599fc", "type": "github" }, "original": { @@ -131,14 +145,15 @@ }, "shellrc": { "inputs": { + "flake-utils": "flake-utils_3", "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1654863350, - "narHash": "sha256-qpnYgHWtK2FmnXRhn0yooW8cDfr7vC5ZFpG9fvyARaY=", + "lastModified": 1654979392, + "narHash": "sha256-AIuZnVtHRxyWRNmVb+UhFEOsE4vErWPSTrtGgQfTRa0=", "ref": "refs/heads/master", - "rev": "fe900d86a3ade098bad9d99d7c53806df32a9077", - "revCount": 56, + "rev": "f6b661ebf0cbd9ecae64eb1f757dc1b4073b1d73", + "revCount": 57, "type": "git", "url": "https://git.cynerd.cz/shellrc" }, diff --git a/flake.nix b/flake.nix index d39fbff..3de33af 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,7 @@ modules = hostname: [ self.nixosModules.default self.nixosModules."machine-${hostname}" - shellrc.nixosModule + shellrc.nixosModules.default (personal-secret.lib.personalSecrets hostname) { networking.hostName = hostname; @@ -75,6 +75,8 @@ packages = filterPackages system (flattenTree ( import ./pkgs { nixpkgs = nixpkgs.legacyPackages."${system}"; } )); + devShells = filterPackages system + (import ./develop { inherit nixpkgs; inherit shellrc; inherit system; }); }); } -- cgit v1.2.3