difftreelog
ci add flake outputs formatter, schemas
in: trunk
4 files changed
flake.nixdiffbeforeafterboth1{2 description = "NixOS configuration management";34 inputs = {5 nixpkgs.url = "github:nixos/nixpkgs/master";6 nixpkgs-stable-for-tests.url = "github:nixos/nixpkgs/nixos-24.05";7 rust-overlay = {8 url = "github:oxalica/rust-overlay";9 inputs = {10 nixpkgs.follows = "nixpkgs";11 };12 };13 flake-parts.url = "github:hercules-ci/flake-parts";14 crane = {15 url = "github:ipetkov/crane";16 inputs.nixpkgs.follows = "nixpkgs";17 };18 };19 outputs = {20 self,21 rust-overlay,22 flake-parts,23 nixpkgs,24 nixpkgs-stable-for-tests,25 crane,26 }:27 flake-parts.lib.mkFlake {28 # Not passing inputs through inputs for better visibility.29 inputs = {};30 } {31 flake = {32 lib = import ./lib {33 fleetPkgsForPkgs = pkgs:34 import ./pkgs {35 inherit (pkgs) callPackage;36 craneLib = crane.mkLib pkgs;37 };38 };39 };40 # Supported and tested list of deployment targets.41 systems = ["x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux"];42 perSystem = {43 config,44 system,45 ...46 }: let47 # Can also be built for darwin, through it is not usual to deploy nixos systems from macos machines.48 # I have no hardware for such testing, thus only adding machines I actually have and use.49 #50 # It is not possible to deploy any host from armv6/armv7 hardware, and I don't think it even makes sense.51 deployerSystems = ["aarch64-linux" "x86_64-linux"];52 deployerSystem = builtins.elem system deployerSystems;53 pkgs = import nixpkgs {54 inherit system;55 overlays = [(rust-overlay.overlays.default)];56 };57 lib = pkgs.lib;58 rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;59 craneLib = (crane.mkLib pkgs).overrideToolchain rust;60 in {61 # Reference fleet package should be built with nightly rust, specified in rust-toolchain.toml.62 packages = lib.mkIf deployerSystem (let63 packages = import ./pkgs {64 inherit (pkgs) callPackage;65 inherit craneLib;66 };67 in68 packages // {default = packages.fleet;});69 # TODO: It should be possible to move lib.mkIf to default attribute, instead of disabling the whole70 # devShells block, yet nix flake check fails here, due to no default shell found. It is nix or flake-parts bug?71 devShells = lib.mkIf deployerSystem {72 default = craneLib.devShell {73 packages = with pkgs; [74 rust75 alejandra76 cargo-edit77 cargo-udeps78 cargo-fuzz79 cargo-watch80 cargo-outdated8182 pkg-config83 openssl84 bacon85 ];86 };87 };88 # fleet-install-secrets will not be built normally, because they are not ran directly by user most of the time.89 # checks there build packages for default nixpkgs rustPlatform packages.90 checks = let91 packages = import ./pkgs {92 inherit (pkgs) callPackage;93 craneLib = crane.mkLib (import nixpkgs {inherit system;});94 };95 packages-with-nixpkgs-stable = import ./pkgs {96 inherit (pkgs) callPackage;97 craneLib = crane.mkLib (import nixpkgs-stable-for-tests {inherit system;});98 };99 prefixAttrs = prefix: attrs:100 nixpkgs.lib.attrsets.mapAttrs' (name: value: {101 name = "${prefix}${name}";102 value = value.overrideAttrs (prev: {103 pname = "${prefix}${prev.pname}";104 });105 })106 attrs;107 in108 # `fleet` crate wants nightly rust, also little sense of supporting it on stable nixpkgs.109 (prefixAttrs "nixpkgs-" (removeAttrs packages ["fleet"]))110 // (prefixAttrs "nixpkgs-stable-" (removeAttrs packages-with-nixpkgs-stable ["fleet"]));111 };112 };113}lib/default.nixdiffbeforeafterboth--- a/lib/default.nix
+++ b/lib/default.nix
@@ -1,6 +1,4 @@
-{
- fleetPkgsForPkgs,
-}: {
+{fleetPkgsForPkgs}: {
fleetConfiguration = {
# TODO: Provide by fleet, instead of requesting user to provide it.
# This is not good that user needs to provide it, as it becomes a flake data, and fleet arbitrarily rewriting it
modules/fleet/assertions.nixdiffbeforeafterboth--- a/modules/fleet/assertions.nix
+++ b/modules/fleet/assertions.nix
@@ -1,16 +1,16 @@
-{ lib, ... }:
-
-with lib;
-
-{
-
+{lib, ...}:
+with lib; {
options = {
-
assertions = mkOption {
type = types.listOf types.unspecified;
internal = true;
- default = [ ];
- example = [{ assertion = false; message = "you can't enable this for that reason"; }];
+ default = [];
+ example = [
+ {
+ assertion = false;
+ message = "you can't enable this for that reason";
+ }
+ ];
description = ''
This option allows modules to express conditions that must
hold for the evaluation of the system configuration to
@@ -20,15 +20,14 @@
warnings = mkOption {
internal = true;
- default = [ ];
+ default = [];
type = types.listOf types.str;
- example = [ "The `foo' service is deprecated and will go away soon!" ];
+ example = ["The `foo' service is deprecated and will go away soon!"];
description = ''
This option allows modules to show warnings to users during
the evaluation of the system configuration.
'';
};
-
};
# impl of assertions is in <fleet/lib/default.nix>
}
pkgs/generator-helper.nixdiffbeforeafterboth--- a/pkgs/generator-helper.nix
+++ b/pkgs/generator-helper.nix
@@ -1,4 +1,3 @@
-
{craneLib}:
craneLib.buildPackage rec {
pname = "fleet-generator-helper";
@@ -9,6 +8,6 @@
cargoExtraArgs = "--locked -p ${pname}";
postInstall = ''
- mv bin/${pname} bin/genhelper
+ mv bin/${pname} bin/genhelper
'';
}