flake: Simplify the flake.nix file and add a devShell

This commit is contained in:
Peter Jones 2022-06-23 13:38:52 -07:00
parent 65e4ed1364
commit a9e0e6869c
No known key found for this signature in database
GPG Key ID: 9DAFAA8D01941E49
2 changed files with 32 additions and 28 deletions

3
.envrc Normal file
View File

@ -0,0 +1,3 @@
# -*- sh -*-
use flake

View File

@ -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
];
};
});
};
}