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-16 16:35:57 +00:00
|
|
|
sudo nix run --experimental-features "nix-command flakes" ${inputs.disko} -- --mode disko ${./system/disko.nix}
|
2024-04-16 16:18:04 +00:00
|
|
|
sudo nixos-generate-config --force --no-filesystems --root /mnt --dir ./system
|
2024-04-16 16:20:07 +00:00
|
|
|
sudo nixos-install --no-root-password --root /mnt --flake ${self}#nixos
|
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
|
|
|
};
|
|
|
|
}
|