2021-02-05 16:25:39 +01:00
|
|
|
{
|
2021-03-07 19:30:33 +01:00
|
|
|
description = "NixOS configuration with flakes";
|
2021-02-05 16:25:39 +01:00
|
|
|
inputs = {
|
2021-09-25 13:30:51 +02:00
|
|
|
agenix = {
|
|
|
|
type = "github";
|
|
|
|
owner = "ryantm";
|
|
|
|
repo = "agenix";
|
2021-11-23 17:08:46 +01:00
|
|
|
ref = "main";
|
2021-09-25 13:30:51 +02:00
|
|
|
inputs = {
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-04-25 17:50:57 +02:00
|
|
|
futils = {
|
|
|
|
type = "github";
|
|
|
|
owner = "numtide";
|
|
|
|
repo = "flake-utils";
|
|
|
|
ref = "master";
|
|
|
|
};
|
|
|
|
|
|
|
|
home-manager = {
|
|
|
|
type = "github";
|
|
|
|
owner = "nix-community";
|
|
|
|
repo = "home-manager";
|
|
|
|
ref = "master";
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
2022-06-22 11:19:43 +02:00
|
|
|
utils.follows = "futils";
|
2021-04-25 17:50:57 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
nixpkgs = {
|
|
|
|
type = "github";
|
|
|
|
owner = "NixOS";
|
|
|
|
repo = "nixpkgs";
|
|
|
|
ref = "nixos-unstable";
|
|
|
|
};
|
|
|
|
|
|
|
|
nur = {
|
|
|
|
type = "github";
|
|
|
|
owner = "nix-community";
|
|
|
|
repo = "NUR";
|
|
|
|
ref = "master";
|
|
|
|
};
|
2021-05-31 23:04:08 +02:00
|
|
|
|
|
|
|
pre-commit-hooks = {
|
|
|
|
type = "github";
|
|
|
|
owner = "cachix";
|
|
|
|
repo = "pre-commit-hooks.nix";
|
|
|
|
ref = "master";
|
|
|
|
inputs = {
|
|
|
|
flake-utils.follows = "futils";
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
2022-11-28 10:17:28 +01:00
|
|
|
nixpkgs-stable.follows = "nixpkgs";
|
2021-05-31 23:04:08 +02:00
|
|
|
};
|
|
|
|
};
|
2021-02-05 16:25:39 +01:00
|
|
|
};
|
|
|
|
|
2021-05-31 23:01:21 +02:00
|
|
|
outputs =
|
|
|
|
inputs @
|
|
|
|
{ self
|
2021-09-25 13:30:51 +02:00
|
|
|
, agenix
|
2021-05-31 23:01:21 +02:00
|
|
|
, futils
|
|
|
|
, home-manager
|
|
|
|
, nixpkgs
|
|
|
|
, nur
|
2021-05-31 23:04:08 +02:00
|
|
|
, pre-commit-hooks
|
2021-05-31 23:01:21 +02:00
|
|
|
}:
|
2021-02-18 21:19:11 +01:00
|
|
|
let
|
2022-04-12 10:43:54 +02:00
|
|
|
inherit (futils.lib) eachSystem system;
|
|
|
|
|
|
|
|
mySystems = [
|
|
|
|
system.aarch64-linux
|
|
|
|
system.x86_64-darwin
|
|
|
|
system.x86_64-linux
|
|
|
|
];
|
|
|
|
|
|
|
|
eachMySystem = eachSystem mySystems;
|
2021-03-07 19:26:20 +01:00
|
|
|
|
2021-03-10 19:49:12 +01:00
|
|
|
lib = nixpkgs.lib.extend (self: super: {
|
|
|
|
my = import ./lib { inherit inputs; pkgs = nixpkgs; lib = self; };
|
|
|
|
});
|
|
|
|
|
2021-03-07 19:26:20 +01:00
|
|
|
defaultModules = [
|
2021-03-08 19:59:08 +01:00
|
|
|
({ ... }: {
|
2021-03-07 19:26:20 +01:00
|
|
|
# Let 'nixos-version --json' know about the Git revision
|
2021-04-25 13:40:30 +02:00
|
|
|
system.configurationRevision = self.rev or "dirty";
|
2021-03-07 19:26:20 +01:00
|
|
|
})
|
2021-04-19 19:16:19 +02:00
|
|
|
{
|
|
|
|
nixpkgs.overlays = (lib.attrValues self.overlays) ++ [
|
|
|
|
nur.overlay
|
|
|
|
];
|
|
|
|
}
|
2021-04-02 13:49:07 +02:00
|
|
|
# Include generic settings
|
|
|
|
./modules
|
2021-05-09 11:30:49 +02:00
|
|
|
# Include bundles of settings
|
|
|
|
./profiles
|
2021-03-07 19:26:20 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
buildHost = name: system: lib.nixosSystem {
|
2021-02-18 21:19:11 +01:00
|
|
|
inherit system;
|
2021-03-07 19:26:20 +01:00
|
|
|
modules = defaultModules ++ [
|
2021-04-02 13:49:07 +02:00
|
|
|
(./. + "/machines/${name}")
|
2021-02-05 16:25:39 +01:00
|
|
|
];
|
2021-04-17 13:39:31 +02:00
|
|
|
specialArgs = {
|
|
|
|
# Use my extended lib in NixOS configuration
|
|
|
|
inherit lib;
|
2021-05-15 20:25:02 +02:00
|
|
|
# Inject inputs to use them in global registry
|
|
|
|
inherit inputs;
|
2021-04-17 13:39:31 +02:00
|
|
|
};
|
2021-02-18 21:19:11 +01:00
|
|
|
};
|
|
|
|
in
|
2022-04-12 10:43:54 +02:00
|
|
|
eachMySystem
|
2021-03-07 19:40:54 +01:00
|
|
|
(system:
|
2021-05-31 23:01:21 +02:00
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
in
|
|
|
|
rec {
|
|
|
|
apps = {
|
|
|
|
diff-flake = futils.lib.mkApp { drv = packages.diff-flake; };
|
2022-05-31 13:41:42 +02:00
|
|
|
default = apps.diff-flake;
|
2021-05-31 23:01:21 +02:00
|
|
|
};
|
|
|
|
|
2021-05-31 23:04:08 +02:00
|
|
|
checks = {
|
|
|
|
pre-commit = pre-commit-hooks.lib.${system}.run {
|
|
|
|
src = ./.;
|
|
|
|
|
|
|
|
hooks = {
|
|
|
|
nixpkgs-fmt = {
|
|
|
|
enable = true;
|
|
|
|
};
|
2021-11-12 09:42:39 +01:00
|
|
|
|
|
|
|
shellcheck = {
|
|
|
|
enable = true;
|
|
|
|
};
|
2021-05-31 23:04:08 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-04-18 14:08:57 +02:00
|
|
|
devShells = {
|
|
|
|
default = pkgs.mkShell {
|
|
|
|
name = "NixOS-config";
|
2021-04-25 14:24:03 +02:00
|
|
|
|
2022-04-18 14:08:57 +02:00
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
gitAndTools.pre-commit
|
|
|
|
nixpkgs-fmt
|
|
|
|
];
|
2021-05-31 23:04:08 +02:00
|
|
|
|
2022-04-18 14:08:57 +02:00
|
|
|
inherit (self.checks.${system}.pre-commit) shellHook;
|
|
|
|
};
|
2021-05-31 23:01:21 +02:00
|
|
|
};
|
2021-04-20 18:38:20 +02:00
|
|
|
|
2021-06-12 19:55:54 +02:00
|
|
|
packages =
|
|
|
|
let
|
2021-07-14 21:48:50 +02:00
|
|
|
inherit (futils.lib) filterPackages flattenTree;
|
2021-06-12 19:55:54 +02:00
|
|
|
packages = import ./pkgs { inherit pkgs; };
|
2021-07-14 21:48:50 +02:00
|
|
|
flattenedPackages = flattenTree packages;
|
|
|
|
finalPackages = filterPackages system flattenedPackages;
|
2021-06-12 19:55:54 +02:00
|
|
|
in
|
|
|
|
finalPackages;
|
2021-05-31 23:01:21 +02:00
|
|
|
}) // {
|
2021-05-09 00:06:12 +02:00
|
|
|
overlays = import ./overlays // {
|
2021-03-10 19:49:12 +01:00
|
|
|
lib = final: prev: { inherit lib; };
|
2021-10-08 15:00:44 +02:00
|
|
|
pkgs = final: prev: {
|
|
|
|
ambroisie = prev.recurseIntoAttrs (import ./pkgs { pkgs = prev; });
|
|
|
|
};
|
2021-03-10 19:49:12 +01:00
|
|
|
};
|
|
|
|
|
2021-03-12 19:21:46 +01:00
|
|
|
nixosConfigurations = lib.mapAttrs buildHost {
|
2021-04-02 14:00:21 +02:00
|
|
|
aramis = "x86_64-linux";
|
2021-02-18 21:19:11 +01:00
|
|
|
porthos = "x86_64-linux";
|
|
|
|
};
|
2021-02-05 16:25:39 +01:00
|
|
|
};
|
|
|
|
}
|