Skip to content

Instantly share code, notes, and snippets.

@ryantm
Created October 12, 2021 14:12
Show Gist options
  • Save ryantm/3a1e24f848a83e5dbfe75b3a6c0249ba to your computer and use it in GitHub Desktop.
Save ryantm/3a1e24f848a83e5dbfe75b3a6c0249ba to your computer and use it in GitHub Desktop.
{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.agenix.url = "github:ryantm/agenix";
inputs.agenix.inputs.nixpkgs.follows = "nixpkgs";
inputs.deploy-rs.url = "github:serokell/deploy-rs";
inputs.deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
outputs = { self, nixpkgs, agenix, deploy-rs }:
let
pkgsBoot = import nixpkgs {
system = "x86_64-linux";
};
nixpkgsPatched = pkgsBoot.applyPatches {
src = pkgsBoot.path;
patches = [
];
};
pkgs = import nixpkgsPatched {
system = "x86_64-linux";
config = {
allowUnfree = true;
};
};
system = "x86_64-linux";
defaultSystem = systemModule: nixpkgs.lib.nixosSystem {
inherit pkgs system;
modules =
[
({modulesPath, ...}: {
imports = (import ./modules) ++ ["${modulesPath}/installer/scan/not-detected.nix"];
})
systemModule
agenix.nixosModules.age
{
environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ];
}
{
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
}
];
};
in
{
nixosConfigurations = {
laptop1 = defaultSystem ./systems/laptop1.nix; # Mara
laptop3 = defaultSystem ./systems/laptop3.nix;
home1 = defaultSystem ./systems/home1.nix;
home2 = defaultSystem ./systems/home2.nix;
rtmnix = defaultSystem ./systems/rtmnix.nix; # Midas
};
deploy.nodes = {
home1 = {
hostname = "home1";
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.home1;
};
};
home2 = {
hostname = "home2";
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.home2;
};
};
};
# This is highly advised, and will prevent many possible mistakes
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment