143 lines
4 KiB
Nix
143 lines
4 KiB
Nix
{
|
|
description = "System config";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
naersk = {
|
|
url = "github:nix-community/naersk";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
sops = {
|
|
url = "github:Mic92/sops-nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
ha-now-playing = {
|
|
url = "git+ssh://git@git.datarift.nl/erwin/ha-now-playing.git?ref=main";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
inputs.utils.follows = "flake-utils";
|
|
inputs.naersk.follows = "naersk";
|
|
};
|
|
|
|
pamedia = {
|
|
url = "git+ssh://git@git.datarift.nl/erwin/pamedia-rs.git?ref=main";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
inputs.utils.follows = "flake-utils";
|
|
inputs.naersk.follows = "naersk";
|
|
};
|
|
};
|
|
|
|
outputs = { self, sops, ha-now-playing, pamedia, ... }@inputs:
|
|
with inputs;
|
|
let
|
|
|
|
defSystem = system: baseConfig:
|
|
nixpkgs.lib.nixosSystem {
|
|
system = "${system}";
|
|
modules = [
|
|
{ _module.args.inputs = inputs; }
|
|
{ _module.args.self-overlay = self.overlay; }
|
|
{ _module.args.pamedia-overlay = pamedia.overlays.${system}; }
|
|
{ _module.args.ha-now-playing-overlay = ha-now-playing.overlays.${system}; }
|
|
({ ... }: {
|
|
imports = builtins.attrValues self.nixosModules ++ [
|
|
{
|
|
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
|
|
nixpkgs.overlays = [
|
|
self.overlay
|
|
ha-now-playing.overlays.${system}
|
|
pamedia.overlays.${system}
|
|
];
|
|
}
|
|
|
|
baseConfig
|
|
home-manager.nixosModules.home-manager
|
|
{ home-manager.useUserPackages = true; }
|
|
];
|
|
|
|
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
|
|
nix.registry.nixpkgs.flake = nixpkgs;
|
|
})
|
|
sops.nixosModules.sops
|
|
];
|
|
};
|
|
|
|
in
|
|
{
|
|
overlay = import ./overlays;
|
|
# overlay = final: prev: {
|
|
# unstable = import nixpkgs {
|
|
# system = "x86_64-linux";
|
|
# config.allowUnfree = true;
|
|
# };
|
|
# };
|
|
|
|
nixosModules = builtins.listToAttrs (map
|
|
(x: {
|
|
name = x;
|
|
value = import (./modules + "/${x}");
|
|
})
|
|
(builtins.attrNames (builtins.readDir ./modules)));
|
|
|
|
nixosConfigurations = {
|
|
vm1 = defSystem "x86_64-linux" {
|
|
imports = [
|
|
(import (./machines/vm1/configuration.nix) { inherit self; })
|
|
];
|
|
};
|
|
vm2 = defSystem "x86_64-linux" {
|
|
imports = [
|
|
(import (./machines/vm2/configuration.nix) { inherit self; })
|
|
];
|
|
};
|
|
|
|
loki = defSystem "x86_64-linux" {
|
|
imports = [
|
|
(import (./machines/loki/configuration.nix) { inherit self; })
|
|
];
|
|
};
|
|
|
|
};
|
|
} //
|
|
(flake-utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ])
|
|
(system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [
|
|
self.overlay
|
|
ha-now-playing.overlays.${system}
|
|
pamedia.overlays.${system}
|
|
];
|
|
config = {
|
|
allowUnsupportedSystem = true;
|
|
allowUnfree = true;
|
|
};
|
|
};
|
|
in
|
|
rec {
|
|
packages = flake-utils.lib.flattenTree {
|
|
rofi-wayland = pkgs.rofi-wayland;
|
|
nix-plugins = pkgs.nix-plugins;
|
|
};
|
|
|
|
apps = {
|
|
rofi-wayland = flake-utils.lib.mkApp { drv = packages.rofi-wayland; };
|
|
nix-plugins = flake-utils.lib.mkApp { drv = packages.nix-plugins; };
|
|
};
|
|
|
|
devShell = with pkgs; mkShell {
|
|
nativeBuildInputs = [ sops ssh-to-pgp ];
|
|
};
|
|
}
|
|
);
|
|
}
|