nixos/flake.nix

87 lines
3 KiB
Nix
Raw Normal View History

# reference: https://github.com/kenranunderscore/dotfiles/blob/main/flake.nix
# also good: https://github.com/cab404/home
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
2024-11-23 21:25:31 +00:00
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
2024-09-08 23:38:16 +00:00
#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";
2023-08-14 21:50:06 +00:00
emacs-overlay.inputs.nixpkgs-stable.follows = "nixpkgs-stable";
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
2023-08-14 21:50:06 +00:00
sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs-stable";
q-sh.url = "sourcehut:~knazarov/q.sh";
q-sh.inputs.nixpkgs.follows = "nixpkgs";
2024-11-23 09:51:10 +00:00
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";
2023-08-14 21:50:06 +00:00
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);
2023-09-09 21:17:02 +00:00
hostAttrs = dir: {
settings = import "${dir}/host-metadata.nix";
#config = import "${dir}/configuration.nix";
};
node = dir:
with hostAttrs dir;
2024-09-08 23:38:16 +00:00
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
dir
] 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
dir
] settings.system;
in {
nixosConfigurations = {
mira = node ./nodes/mira;
framework = node ./nodes/framework;
knazarovcom = server ./nodes/knazarovcom;
videos = server ./nodes/videos;
};
};
}