2024-10-28 09:51:44 +00:00
|
|
|
|
{
|
|
|
|
|
description = "Lotte’s nix configuration";
|
2022-01-14 09:19:01 +00:00
|
|
|
|
|
2022-03-05 20:39:49 +00:00
|
|
|
|
inputs = {
|
2024-10-29 12:29:05 +00:00
|
|
|
|
disko = {
|
|
|
|
|
url = "github:nix-community/disko";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
2024-10-28 09:56:58 +00:00
|
|
|
|
flake-compat = {
|
|
|
|
|
url = "github:edolstra/flake-compat";
|
|
|
|
|
flake = false;
|
|
|
|
|
};
|
2024-10-29 06:09:45 +00:00
|
|
|
|
flake-utils = {
|
|
|
|
|
url = "github:numtide/flake-utils";
|
|
|
|
|
inputs.systems.follows = "systems";
|
|
|
|
|
};
|
|
|
|
|
flakey-profile = {
|
|
|
|
|
url = "github:lf-/flakey-profile";
|
|
|
|
|
};
|
|
|
|
|
gitignore = {
|
|
|
|
|
url = "github:hercules-ci/gitignore.nix";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
2024-10-29 08:21:03 +00:00
|
|
|
|
impermanence = {
|
|
|
|
|
url = "github:nix-community/impermanence";
|
|
|
|
|
};
|
2024-10-29 06:09:45 +00:00
|
|
|
|
lix = {
|
|
|
|
|
url = "git+https://git.lix.systems/lix-project/lix";
|
|
|
|
|
inputs.flake-compat.follows = "flake-compat";
|
|
|
|
|
inputs.nix2container.follows = "nix2container";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
inputs.pre-commit-hooks.follows = "pre-commit-hooks";
|
|
|
|
|
};
|
|
|
|
|
lix-module = {
|
|
|
|
|
url = "git+https://git.lix.systems/lix-project/nixos-module";
|
|
|
|
|
inputs.flake-utils.follows = "flake-utils";
|
|
|
|
|
inputs.flakey-profile.follows = "flakey-profile";
|
|
|
|
|
inputs.lix.follows = "lix";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
|
|
|
|
nix2container = {
|
|
|
|
|
url = "github:nlewo/nix2container";
|
|
|
|
|
inputs.flake-utils.follows = "flake-utils";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
2024-10-29 12:29:05 +00:00
|
|
|
|
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
2024-10-28 09:51:44 +00:00
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs";
|
2024-10-29 06:09:45 +00:00
|
|
|
|
pre-commit-hooks = {
|
|
|
|
|
url = "github:cachix/git-hooks.nix";
|
|
|
|
|
inputs.flake-compat.follows = "flake-compat";
|
|
|
|
|
inputs.gitignore.follows = "gitignore";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
inputs.nixpkgs-stable.follows = "nixpkgs";
|
|
|
|
|
};
|
2024-10-28 13:58:23 +00:00
|
|
|
|
riscv-overlay = {
|
|
|
|
|
url = "github:DarkKirb/riscv-overlay";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
2024-10-29 09:06:17 +00:00
|
|
|
|
sops-nix = {
|
|
|
|
|
url = "github:Mic92/sops-nix";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
inputs.nixpkgs-stable.follows = "nixpkgs";
|
|
|
|
|
};
|
2024-10-29 06:09:45 +00:00
|
|
|
|
systems.url = "github:nix-systems/default";
|
2022-03-05 20:39:49 +00:00
|
|
|
|
};
|
2022-01-14 09:19:01 +00:00
|
|
|
|
|
2022-06-12 15:39:15 +00:00
|
|
|
|
outputs = {
|
|
|
|
|
self,
|
|
|
|
|
nixpkgs,
|
2024-10-28 10:28:35 +00:00
|
|
|
|
...
|
2024-10-28 09:51:44 +00:00
|
|
|
|
} @ inputs': let
|
|
|
|
|
inputs =
|
|
|
|
|
inputs'
|
|
|
|
|
// {
|
|
|
|
|
nixos-config = self;
|
|
|
|
|
inherit inputs;
|
2024-10-29 06:09:45 +00:00
|
|
|
|
inTester = false;
|
2024-10-30 08:06:52 +00:00
|
|
|
|
pureInputs = inputs';
|
2024-10-28 09:51:44 +00:00
|
|
|
|
};
|
2024-10-28 13:58:23 +00:00
|
|
|
|
pkgsFor = system: let
|
|
|
|
|
inputs' =
|
|
|
|
|
inputs
|
|
|
|
|
// {
|
|
|
|
|
inherit system;
|
2024-10-28 14:44:39 +00:00
|
|
|
|
inputs = inputs';
|
2024-10-28 13:58:23 +00:00
|
|
|
|
};
|
|
|
|
|
in
|
2024-10-28 09:51:44 +00:00
|
|
|
|
import nixpkgs {
|
2024-04-26 09:26:26 +00:00
|
|
|
|
inherit system;
|
2024-10-28 13:58:23 +00:00
|
|
|
|
overlays =
|
|
|
|
|
[
|
|
|
|
|
(_: _:
|
|
|
|
|
inputs'
|
|
|
|
|
// {
|
|
|
|
|
inputs = inputs';
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
++ (
|
|
|
|
|
if system == "riscv64-linux"
|
|
|
|
|
then [
|
|
|
|
|
inputs.riscv-overlay.overlays.default
|
|
|
|
|
]
|
|
|
|
|
else []
|
|
|
|
|
);
|
2024-04-26 09:26:26 +00:00
|
|
|
|
};
|
2024-10-28 09:51:44 +00:00
|
|
|
|
in {
|
|
|
|
|
checks.x86_64-linux = nixpkgs.lib.listToAttrs (map (testName: {
|
|
|
|
|
name = testName;
|
|
|
|
|
value = (pkgsFor "x86_64-linux").callPackage ./tests/${testName}.nix {};
|
|
|
|
|
}) ["containers-default"]);
|
|
|
|
|
nixosModules = {
|
|
|
|
|
containers = import ./modules/containers/default.nix;
|
2024-10-28 13:58:23 +00:00
|
|
|
|
default = import ./modules/default.nix;
|
2024-10-28 09:51:44 +00:00
|
|
|
|
};
|
|
|
|
|
nixosContainers = with nixpkgs.lib; let
|
|
|
|
|
containerNames = [
|
|
|
|
|
"default"
|
|
|
|
|
];
|
2024-10-28 13:58:23 +00:00
|
|
|
|
containerArches = ["x86_64-linux" "aarch64-linux" "riscv64-linux"];
|
2024-10-28 09:51:44 +00:00
|
|
|
|
containers = listToAttrs (flatten (map (system: let
|
|
|
|
|
pkgs = pkgsFor system;
|
|
|
|
|
in
|
|
|
|
|
map (container: {
|
|
|
|
|
name = "container-${container}-${system}";
|
|
|
|
|
value = pkgs.callPackage ./containers/${container}-configuration.nix {};
|
|
|
|
|
})
|
|
|
|
|
containerNames)
|
|
|
|
|
containerArches));
|
2024-06-17 19:11:14 +00:00
|
|
|
|
in
|
2024-10-28 09:51:44 +00:00
|
|
|
|
containers;
|
|
|
|
|
nixosConfigurations = with nixpkgs.lib; let
|
2024-10-28 13:58:23 +00:00
|
|
|
|
mkSystem = args: let
|
|
|
|
|
inputs' = inputs // {inherit (args) system;};
|
|
|
|
|
in
|
2024-10-28 09:51:44 +00:00
|
|
|
|
nixosSystem (args
|
|
|
|
|
// {
|
2022-06-12 15:39:15 +00:00
|
|
|
|
specialArgs =
|
2024-10-28 09:51:44 +00:00
|
|
|
|
args.specialArgs
|
|
|
|
|
or {}
|
2024-10-28 13:58:23 +00:00
|
|
|
|
// inputs';
|
2024-10-28 09:51:44 +00:00
|
|
|
|
});
|
2024-10-29 12:29:05 +00:00
|
|
|
|
systems' = {
|
2024-10-29 14:03:27 +00:00
|
|
|
|
not522 = {
|
|
|
|
|
config = ./machine/not522;
|
2024-10-29 12:29:05 +00:00
|
|
|
|
system = "riscv64-linux";
|
|
|
|
|
};
|
2024-10-30 08:06:52 +00:00
|
|
|
|
not522-installer = {
|
|
|
|
|
config = ./machine/not522/installer;
|
|
|
|
|
system = "riscv64-linux";
|
|
|
|
|
};
|
2024-10-29 12:29:05 +00:00
|
|
|
|
};
|
2024-10-28 09:51:44 +00:00
|
|
|
|
containers = mapAttrs (_: container:
|
|
|
|
|
mkSystem {
|
|
|
|
|
inherit (container) system;
|
|
|
|
|
modules = [
|
|
|
|
|
container.config
|
|
|
|
|
];
|
2022-01-14 09:19:01 +00:00
|
|
|
|
})
|
2024-10-28 09:51:44 +00:00
|
|
|
|
self.nixosContainers;
|
2024-10-29 12:29:05 +00:00
|
|
|
|
systems = mapAttrs (_: system:
|
|
|
|
|
mkSystem {
|
|
|
|
|
inherit (system) system;
|
|
|
|
|
modules = [
|
|
|
|
|
system.config
|
|
|
|
|
];
|
|
|
|
|
})
|
|
|
|
|
systems';
|
2024-10-28 09:51:44 +00:00
|
|
|
|
in
|
2024-10-29 12:29:05 +00:00
|
|
|
|
containers // systems;
|
2024-10-28 09:56:58 +00:00
|
|
|
|
hydraJobs = {
|
2024-10-29 09:06:17 +00:00
|
|
|
|
inherit (self) checks devShells;
|
2024-10-28 13:27:27 +00:00
|
|
|
|
nixosConfigurations = nixpkgs.lib.mapAttrs (_: v: v.config.system.build.toplevel) self.nixosConfigurations;
|
2024-10-28 09:56:58 +00:00
|
|
|
|
};
|
2024-10-29 09:06:17 +00:00
|
|
|
|
devShells.x86_64-linux.default = with pkgsFor "x86_64-linux";
|
|
|
|
|
mkShell {
|
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
|
age
|
|
|
|
|
sops
|
|
|
|
|
ssh-to-age
|
|
|
|
|
];
|
|
|
|
|
};
|
2022-06-12 15:39:15 +00:00
|
|
|
|
};
|
2022-01-14 09:19:01 +00:00
|
|
|
|
}
|