impermanence-talk/template/flake.nix

70 lines
1.7 KiB
Nix
Raw Normal View History

2024-04-07 17:34:18 +00:00
{
description = "Impermanence Example";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence = {
url = "github:nix-community/impermanence";
};
};
2024-04-07 18:19:32 +00:00
outputs = {self, ...} @ inputs: let
2024-04-07 17:34:18 +00:00
system = "x86_64-linux";
2024-04-07 18:19:32 +00:00
pkgs = inputs.nixpkgs.legacyPackages.${system};
2024-04-07 17:34:18 +00:00
in {
nixosConfigurations = {
2024-04-09 11:27:55 +00:00
nixos = inputs.nixpkgs.lib.nixosSystem {
2024-04-07 17:34:18 +00:00
inherit system;
2024-04-07 18:19:32 +00:00
2024-04-07 17:34:18 +00:00
modules = [
inputs.disko.nixosModules.default
inputs.impermanence.nixosModules.impermanence
./system
2024-04-09 11:27:55 +00:00
./custom
2024-04-07 17:34:18 +00:00
];
};
2024-04-07 18:19:32 +00:00
};
2024-04-07 17:34:18 +00:00
2024-04-07 18:24:03 +00:00
formatter = pkgs.alejandra;
2024-04-15 16:58:06 +00:00
apps.${system} = {
install = {
program = "${pkgs.writeShellScript "install" ''
2024-04-15 17:10:25 +00:00
sudo nixos-generate-config --no-filesystems --force --root /mnt --dir ./system
2024-04-15 17:23:31 +00:00
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/${inputs.disko.rev}#disko-install -- --flake .#nixos --disk main /dev/sda --write-efi-boot-entries
2024-04-15 16:58:06 +00:00
''}";
type = "app";
};
};
2024-04-07 18:19:32 +00:00
devShells.${system} = {
default = pkgs.mkShellNoCC {
packages = [
inputs.disko.packages.${system}.default
];
2024-04-07 17:34:18 +00:00
};
};
2024-04-15 16:58:06 +00:00
templates = {
default = {
path = ./.;
description = "A flake template for a NixOS setup with impermanence.";
welcomeText = ''
To automatically install do a `nix run .#install`
'';
};
};
2024-04-07 17:34:18 +00:00
};
}