Created
February 15, 2024 23:36
-
-
Save heywoodlh/4770ce81d3f4ce2d301e7cfdc020da91 to your computer and use it in GitHub Desktop.
Example NixOS flake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
description = "example nixos/nix-darwin/home-manager/nix-droid flake"; | |
inputs = { | |
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; | |
darwin = { | |
url = "github:LnL7/nix-darwin/master"; | |
inputs.nixpkgs.follows = "nixpkgs"; | |
}; | |
home-manager = { | |
url = "github:nix-community/home-manager"; | |
inputs.nixpkgs.follows = "nixpkgs"; | |
}; | |
nix-on-droid = { | |
url = "github:nix-community/nix-on-droid/release-23.05"; | |
inputs.nixpkgs.follows = "nixpkgs"; | |
}; | |
}; | |
outputs = inputs@{ self, | |
nixpkgs, | |
darwin, | |
home-manager, | |
nix-on-droid, | |
... }: | |
flake-utils.lib.eachDefaultSystem (system: let | |
pkgs = import nixpkgs { | |
inherit system; | |
config.allowUnfree = true; | |
}; | |
in { | |
# nixos targets | |
packages.nixosConfigurations = { | |
nixos-machine-1 = nixpkgs.lib.nixosSystem { | |
system = "x86_64-linux"; | |
specialArgs = inputs; | |
modules = [ | |
./nixos/hosts/macbook/configuration.nix | |
{ | |
# NixOS configuration goes here | |
} | |
]; | |
}; | |
}; | |
# macos targets | |
packages.darwinConfigurations = { | |
"macbook-1" = darwin.lib.darwinSystem { | |
system = "aarch64-darwin"; | |
specialArgs = inputs; | |
modules = [ | |
./path/to/some/configuration.nix | |
{ | |
# Nix-darwin configuration goes here | |
} | |
]; | |
}; | |
}; | |
# home-manager targets (non NixOS/MacOS) | |
packages.homeConfigurations = { | |
heywoodlh = home-manager.lib.homeManagerConfiguration { | |
inherit pkgs; | |
modules = [ | |
./path/to/home.nix | |
{ | |
# Other configuration goes here | |
} | |
]; | |
extraSpecialArgs = inputs; | |
}; | |
}; | |
packages.nixOnDroidConfigurations = { | |
default = nix-on-droid.lib.nixOnDroidConfiguration { | |
extraSpecialArgs = inputs; | |
modules = [ | |
./path/to/droid.nix | |
{ | |
# Nix-droid configuration goes here | |
} | |
]; | |
home-manager-path = home-manager.outPath; | |
}; | |
}; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment