rework flake, move hydra stuff

This commit is contained in:
Gabriel Fontes
2023-02-01 18:01:58 -03:00
parent c088968c43
commit 08f141e979
3 changed files with 39 additions and 43 deletions
+15 -33
View File
@@ -1,9 +1,14 @@
{
description = "My NixOS configuration";
nixConfig = {
extra-substituters = [ "https://cache.m7.rs" ];
extra-trusted-public-keys = [ "cache.m7.rs:kszZ/NSwE/TjhOcPPQ16IuUiuRSisdiIwhKZCxguaWg=" ];
};
inputs = {
# Nix ecossystem
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-master.url = "github:nixos/nixpkgs/master";
hardware.url = "github:nixos/nixos-hardware";
impermanence.url = "github:nix-community/impermanence";
@@ -36,32 +41,22 @@
outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
inherit (nixpkgs.lib) filterAttrs;
inherit (builtins) mapAttrs elem;
inherit (self) outputs;
notBroken = x: !(x.meta.broken or false);
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
forEachSystem = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
forEachPkgs = f: forEachSystem (sys: f nixpkgs.legacyPackages.${sys});
in
rec {
templates = import ./templates;
{
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
overlays = import ./overlays;
templates = import ./templates;
packages = forAllSystems (system:
import ./pkgs { pkgs = nixpkgs.legacyPackages.${system}; }
);
devShells = forAllSystems (system: {
default = nixpkgs.legacyPackages.${system}.callPackage ./shell.nix { };
});
overlays = import ./overlays { inherit inputs outputs; };
hydraJobs = import ./hydra.nix { inherit inputs outputs; };
hydraJobs = {
packages = mapAttrs (sys: filterAttrs (_: pkg: (elem sys pkg.meta.platforms && notBroken pkg))) packages;
nixos = mapAttrs (_: cfg: cfg.config.system.build.toplevel) nixosConfigurations;
};
packages = forEachPkgs (pkgs: import ./pkgs { inherit pkgs; });
devShells = forEachPkgs (pkgs: import ./shell.nix { inherit pkgs; });
nixosConfigurations = rec {
nixosConfigurations = {
# Desktop
atlas = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
@@ -127,18 +122,5 @@
modules = [ ./home/misterio/generic.nix ];
};
};
nixConfig = {
extra-substituters = [
"https://cache.m7.rs"
"https://hyprland.cachix.org"
"https://nix-community.cachix.org"
];
extra-trusted-public-keys = [
"cache.m7.rs:kszZ/NSwE/TjhOcPPQ16IuUiuRSisdiIwhKZCxguaWg="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
};
}
+12
View File
@@ -0,0 +1,12 @@
{ inputs, outputs }:
let
inherit (inputs.nixpkgs.lib) filterAttrs mapAttrs elem;
notBroken = pkg: !(pkg.meta.broken or false);
hasPlatform = sys: pkg: elem sys pkg.meta.platforms;
filterValidPkgs = sys: pkgs: filterAttrs (_: pkg: hasPlatform sys pkg && notBroken pkg);
getCfg = _: cfg: cfg.config.system.build.build.toplevel;
in {
packages = mapAttrs filterValidPkgs outputs.packages;
nixos = mapAttrs getCfg outputs.nixosConfigurations;
}
+12 -10
View File
@@ -9,15 +9,17 @@
};
in import nixpkgs { overlays = [ ]; }
, ...
}: pkgs.mkShell {
NIX_CONFIG = "extra-experimental-features = nix-command flakes repl-flake";
nativeBuildInputs = with pkgs; [
nix
home-manager
git
}: {
default = pkgs.mkShell {
NIX_CONFIG = "extra-experimental-features = nix-command flakes repl-flake";
nativeBuildInputs = with pkgs; [
nix
home-manager
git
sops
gnupg
age
];
sops
gnupg
age
];
};
}