NixOSConfig/flake.nix

93 lines
2.5 KiB
Nix
Raw Normal View History

2023-12-01 11:29:39 +00:00
{
2024-05-01 12:00:39 +00:00
description = "NixOS Machine Configurations by manuth";
2023-12-01 11:29:39 +00:00
2024-05-01 12:00:39 +00:00
inputs = {
nixpkgs.url = "nixpkgs/38c01297e7ec11f7b9e3f2cae7d6fcec6cc767ec";
2024-05-01 16:14:25 +00:00
flake-utils.url = "github:numtide/flake-utils?ref=b1d9ab70662946ef0850d488da1c9019f3a9752a";
2024-05-01 23:08:45 +00:00
sops-nix.url = "github:Mic92/sops-nix?ref=f1b0adc27265274e3b0c9b872a8f476a098679bd";
2024-05-01 12:00:39 +00:00
};
2023-12-01 11:29:39 +00:00
2024-05-01 23:08:45 +00:00
outputs = { self, nixpkgs, flake-utils, sops-nix }: (
2024-05-01 17:13:25 +00:00
flake-utils.lib.eachDefaultSystem (
system:
let
2024-05-01 23:08:45 +00:00
pkgs = import nixpkgs {
inherit system;
config = {};
overlays = [
sops-nix.overlays.default
];
};
2024-05-01 17:13:25 +00:00
in {
devShells.default = pkgs.mkShellNoCC (
with pkgs;
{
2024-05-01 23:08:45 +00:00
sopsPGPKeyDirs = [
"${toString ./.}/keys/hosts"
"${toString ./.}/keys/users"
];
2024-05-01 17:13:25 +00:00
packages = [
nixos-rebuild
2024-05-02 11:17:36 +00:00
sops
2024-05-01 23:08:45 +00:00
sops-import-keys-hook
2024-05-03 09:59:32 +00:00
ssh-to-age
ssh-to-pgp
2024-05-01 23:08:45 +00:00
];
nativeBuildInputs = [
sops-import-keys-hook
2024-05-01 17:13:25 +00:00
];
});
}
) // {
nixosConfigurations =
2024-05-01 16:14:25 +00:00
let
default = { pkgs, ... }: {
2024-05-07 11:57:46 +00:00
dualBoot = false;
timeZone = null;
2024-05-07 12:11:22 +00:00
keyMap = "us";
keyboardLayout = "us";
2024-05-07 12:31:38 +00:00
localeSettings = { };
2024-05-07 20:02:12 +00:00
users = { };
2024-05-07 11:57:46 +00:00
};
systems = {
nixos.config = { ... }: {
};
};
2024-05-01 17:13:25 +00:00
in
builtins.mapAttrs (
name: { system ? "x86_64-linux", config }: nixpkgs.lib.nixosSystem {
inherit system;
2024-05-01 16:58:39 +00:00
modules = [
(
{ pkgs, ... }@args: {
config._module.args = {
machineConfig = (default args) //
(config args) // {
inherit name;
};
};
})
sops-nix.nixosModules.sops
./lib/configuration.nix
(
let
configCandidate = ./lib/machines/${name}.nix;
machineConfigPath =
if builtins.pathExists configCandidate
then
configCandidate
else
./lib/hardware/base.nix;
in
machineConfigPath)
];
})
systems;
2024-05-01 17:13:25 +00:00
});
2023-12-01 11:29:39 +00:00
}