nixos/flake.nix

91 lines
3.2 KiB
Nix
Executable file

# reference: https://github.com/kenranunderscore/dotfiles/blob/main/flake.nix
# also good: https://github.com/cab404/home
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
#home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
emacs-overlay.url = "github:nix-community/emacs-overlay";
emacs-overlay.inputs.nixpkgs.follows = "nixpkgs";
emacs-overlay.inputs.nixpkgs-stable.follows = "nixpkgs-stable";
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs-stable";
q-sh.url = "sourcehut:~knazarov/q.sh";
q-sh.inputs.nixpkgs.follows = "nixpkgs";
notes-sh.url = "sourcehut:~knazarov/notes2.sh";
notes-sh.inputs.nixpkgs.follows = "nixpkgs";
knazarovcom.url = "sourcehut:~knazarov/knazarov.com";
knazarovcom.inputs.nixpkgs.follows = "nixpkgs";
vmatveevacom.url = "github:valeriya-matveeva/vmatveeva.com";
vmatveevacom.inputs.nixpkgs.follows = "nixpkgs";
git-plan.url = "sourcehut:~knazarov/git-plan";
git-plan.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, nixpkgs-stable, home-manager, emacs-overlay
, sops-nix, q-sh, notes-sh, knazarovcom, vmatveevacom, git-plan, ...
}@attrs:
let
system = "x86_64-linux";
specialArgs = { inherit attrs; };
buildConfig = modules: system: { inherit modules system specialArgs; };
buildSystem = modules: system:
nixpkgs.lib.nixosSystem (buildConfig modules system);
buildSystemStable = modules: system:
nixpkgs-stable.lib.nixosSystem (buildConfig modules system);
hostAttrs = dir: {
settings = import "${dir}/host-metadata.nix";
config = import "${dir}/configuration.nix";
hw-config = import "${dir}/hardware-configuration.nix";
};
node = dir:
with hostAttrs dir;
buildSystem [
({ config, pkgs, ... }: {
nixpkgs.overlays = [
emacs-overlay.overlay
q-sh.overlays.default
notes-sh.overlays.default
git-plan.overlays.default
];
})
sops-nix.nixosModules.sops
home-manager.nixosModule
config
hw-config
./configuration.nix
] settings.system;
server = dir:
with hostAttrs dir;
buildSystem [
({ config, pkgs, ... }: {
nixpkgs.overlays = [
emacs-overlay.overlay
q-sh.overlays.default
knazarovcom.overlays.default
vmatveevacom.overlays.default
];
})
sops-nix.nixosModules.sops
home-manager.nixosModule
config
hw-config
#(dir + "/configuration.nix")
] settings.system;
in {
nixosConfigurations = {
mira = node ./nodes/mira;
framework = node ./nodes/framework;
knazarovcom = server ./nodes/knazarovcom;
videos = server ./nodes/videos;
};
};
}