From a9e0e6869c8ee70b1af767ee486538ee87433da1 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 23 Jun 2022 13:38:52 -0700 Subject: [PATCH] flake: Simplify the flake.nix file and add a devShell --- .envrc | 3 +++ flake.nix | 57 ++++++++++++++++++++++++++++--------------------------- 2 files changed, 32 insertions(+), 28 deletions(-) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..c08a548 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +# -*- sh -*- + +use flake diff --git a/flake.nix b/flake.nix index 465989d..a1a3111 100644 --- a/flake.nix +++ b/flake.nix @@ -10,24 +10,16 @@ outputs = inputs@{ self, ... }: let - # List of systems we run NixOS tests for: + # Systems that can run tests: supportedSystems = [ - "aarch64-darwin" "aarch64-linux" "i686-linux" - "x86_64-darwin" "x86_64-linux" ]; # Function to generate a set based on supported systems: forAllSystems = inputs.nixpkgs.lib.genAttrs supportedSystems; - # Like `forAllSystems` except just those support NixOS tests: - forQemuSystems = inputs.nixpkgs.lib.genAttrs [ - "x86_64-linux" - "aarch64-linux" - ]; - # Attribute set of nixpkgs for each system: nixpkgsFor = forAllSystems (system: import inputs.nixpkgs { inherit system; }); @@ -63,30 +55,39 @@ }; }); - apps = forAllSystems (system: - { - default = self.apps.${system}.rc2nix; + apps = forAllSystems (system: { + default = self.apps.${system}.rc2nix; - demo = { - type = "app"; - program = "${self.packages.${system}.demo}/bin/run-plasma-demo-vm"; - }; - - rc2nix = { - type = "app"; - program = "${self.packages.${system}.rc2nix}/bin/rc2nix"; - }; - }); - - checks = forQemuSystems (system: - let test = path: import path { - pkgs = nixpkgsFor.${system}; - home-manager = inputs.home-manager; - module = self.homeManagerModules.plasma; + demo = { + type = "app"; + program = "${self.packages.${system}.demo}/bin/run-plasma-demo-vm"; }; + + rc2nix = { + type = "app"; + program = "${self.packages.${system}.rc2nix}/bin/rc2nix"; + }; + }); + + checks = forAllSystems (system: + let + test = path: import path { + pkgs = nixpkgsFor.${system}; + home-manager = inputs.home-manager; + module = self.homeManagerModules.plasma; + }; in { default = test ./test/basic.nix; }); + + devShells = forAllSystems (system: { + default = nixpkgsFor.${system}.mkShell { + buildInputs = with nixpkgsFor.${system}; [ + ruby + ruby.devdoc + ]; + }; + }); }; }